内容发布

This commit is contained in:
yanran200730
2022-03-18 13:47:30 +08:00
parent a93b78de4f
commit af65ba44ab
5 changed files with 294 additions and 32 deletions

View File

@@ -1,15 +1,26 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :moduleName="moduleName" :moduleId="moduleId" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title :title="moduleName" :isShowBottomBorder="false" :isShowArea="currIndex === '0'" v-model="areaId" :instance="instance" @change="onAreaChange"></ai-title>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :areaId="areaId" :moduleName="moduleName" :moduleId="moduleId" :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Add v-else-if="component === 'Add'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
<Detail v-else-if="component === 'Detail'" :moduleName="moduleName" :moduleId="moduleId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Detail>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
import Audit from './components/Audit'
import { mapState } from 'vuex'
export default {
name: 'AppContentInfo',
@@ -17,31 +28,48 @@
props: {
instance: Function,
dict: Object
dict: Object,
permissions: Function
},
data () {
return {
areaId: '',
component: 'List',
params: {},
moduleId: '',
include: [],
moduleName: ''
moduleName: '',
tabs: [],
currIndex: '0',
isShowDetail: false
}
},
components: {
Add,
List,
Audit,
Detail
},
computed: {
...mapState(['user'])
},
created () {
this.moduleId = this.$route.query.moduleId
this.areaId = this.user.info.areaId
this.instance.post('/app/appcontentmoduleinfo/queryDetailById?id=' + this.$route.query.moduleId).then(res => {
if (res.code === 0) {
this.moduleName = res.data.moduleName
this.tabs = [
{label: this.moduleName, name: 'List', comp: List, permission: ''},
{label: `${this.moduleName}审核`, name: 'Audit', comp: Audit, permission: ''}
].filter(item => {
return true
})
}
})
},
@@ -51,23 +79,32 @@
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
this.isShowDetail = true
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
this.isShowDetail = true
}
if (data.type === 'list') {
if (data.type === 'Audit') {
this.component = 'Audit'
this.params = data.params
this.isShowDetail = false
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
this.isShowDetail = false
}
},
onAreaChange () {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
}
}
}

View File

@@ -100,6 +100,7 @@
instance: Function,
dict: Object,
params: Object,
areaId: String,
moduleName: String
},
data () {
@@ -145,7 +146,7 @@
created () {
this.getModuleInfo()
this.getCateList()
this.form.areaId = this.user.info.areaId
this.form.areaId = this.areaId
this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) {
this.id = this.params.id
@@ -269,7 +270,7 @@
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
type: 'List',
isRefresh: !!isRefresh
})
}

View File

@@ -0,0 +1,188 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
@keyup.enter.native="search.current = 1, search.title, getList()"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="audit(row.id)">审核</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog
:visible.sync="isShow"
width="800px"
@close="onClose"
title="审核"
@onConfirm="onConfirm">
<el-form class="ai-form" label-width="120px" :model="form" ref="form">
<el-form-item label="是否通过审核" prop="pass" style="width: 100%;" :rules="[{ required: true, message: '请选择是否通过审核' }]">
<el-radio-group v-model="form.pass" @change="onStatusChange">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核意见" prop="opinion" style="width: 100%;" :rules="[{ required: form.pass === '0', message: '请输入审核意见' }]">
<el-input type="textarea" :rows="5" :maxlength="200" v-model="form.opinion" clearable placeholder="请输入审核意见" show-word-limit></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Audit',
props: {
instance: Function,
dict: Object,
moduleName: String,
areaId: String
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
form: {
opinion: '',
pass: ''
},
id: '',
isShow: false,
total: 0,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'left' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
created() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcontentinfo/list`, null, {
params: {
moduleId: this.$route.query.moduleId,
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onStatusChange () {
this.$refs.form.clearValidate()
},
onClose () {
this.form.opinion = ''
this.form.pass = ''
},
onConfirm () {
this.$refs.form.validate(v => {
if (v) {
this.instance.post('/app/appcontentinfo/examine', null, {
params: {
...this.form,
id: this.id
}
}).then(res => {
if (res?.code == 0) {
this.isShow = false
this.getList()
this.$message.success('审核成功!')
}
})
}
})
},
audit (id) {
this.id = id
this.isShow = true
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -7,6 +7,35 @@
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布地区" isLine :value="info.areaName"></ai-info-item>
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '文章' : '视频'"></ai-info-item>
<ai-info-item label="分类" isLine :value="info.categoryName"></ai-info-item>
<ai-info-item label="正文" v-if="info.contentType === '0'" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item v-if="info.contentType === '0'" isLine label="封面图片">
<ai-uploader
:instance="instance"
disabled
v-model="info.files"
:limit="9">
</ai-uploader>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="封面图片">
<video style="width:100%; height:100%; object-fit: fill;" :src="info.files[0].url" controls></video>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="视频封面">
<ai-uploader
:instance="instance"
disabled
v-model="info.pictureUrl"
:limit="1">
</ai-uploader>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
@@ -40,19 +69,19 @@
methods: {
getInfo (id) {
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.codeUrl = [{
url: res.data.codeUrl
}]
this.info = res.data
this.info.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
type: 'List',
isRefresh: !!isRefresh
})
}

View File

@@ -1,8 +1,5 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title :title="moduleName" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
@@ -36,10 +33,11 @@
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
@@ -57,7 +55,8 @@
props: {
instance: Function,
dict: Object,
moduleName: String
moduleName: String,
areaId: String
},
data() {
@@ -65,8 +64,7 @@
search: {
current: 1,
size: 10,
title: '',
areaId: ''
title: ''
},
currIndex: -1,
areaList: [],
@@ -90,7 +88,6 @@
},
created() {
this.search.areaId = this.user.info.areaId
this.getList()
},
@@ -99,7 +96,8 @@
this.instance.post(`/app/appcontentinfo/list`, null, {
params: {
moduleId: this.$route.query.moduleId,
...this.search
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {
@@ -127,6 +125,15 @@
id: id || ''
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}