运营平台

This commit is contained in:
yanran200730
2023-06-05 14:48:25 +08:00
parent 3e440cfad9
commit e78a89a112
11 changed files with 1633 additions and 0 deletions

View File

@@ -0,0 +1,128 @@
<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title :title="moduleName" :isShowBottomBorder="false" :isShowArea="true" 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>
<Comment v-else-if="component === 'Comment'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Comment>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Comment from './components/Comment'
import Detail from './components/Detail'
import Audit from './components/Audit'
import { mapState } from 'vuex'
export default {
name: 'AppContentInfo',
label: '内容发布',
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
areaId: '',
component: 'List',
params: {},
moduleId: '',
include: [],
moduleName: '',
tabs: [],
currIndex: '0',
isShowDetail: false
}
},
components: {
Add,
List,
Audit,
Comment,
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: 'app_appcontentinfo_examine'}
].filter(item => {
return item.name !== 'Audit' || (res.data.needExamine === '1' && item.name === 'Audit' && this.permissions(item.permission))
})
}
})
},
methods: {
onChange (data) {
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 = Comment
}
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.isShowDetail = false
}
if (data.type === 'Comment') {
this.component = 'Comment'
this.params = data.params
this.isShowDetail = true
}
},
onAreaChange () {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,340 @@
<template>
<ai-detail class="content-add" v-loading="isLoading">
<template slot="title">
<ai-title :title="params.id ? '编辑' + moduleName : '添加' + moduleName" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="标题" style="width: 100%;" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
<el-input size="small" v-model="form.title" clearable placeholder="请输入..." :maxlength="50" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item prop="areaId" style="width: 100%;" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
<ai-area-select clearable @fullname="v => form.areaName = v" always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select>
</el-form-item>
<el-form-item prop="contentType" label="文章类型" :rules="[{required: true, message: '请选择文章类型', trigger: 'change'}]">
<el-select style="width: 100%;" @change="onChange" v-model="form.contentType" size="small" placeholder="请选择文章类型">
<el-option
v-for="item in contentTypeList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="categoryId" label="分类" v-if="cateList.length" :rules="[{required: true, message: '请选择分类', trigger: 'change'}]">
<el-select style="width: 100%;" v-model="form.categoryId" size="small" placeholder="请选择分类">
<el-option
v-for="item in cateList"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="form.contentType === '0'" label="正文" prop="content" style="width: 100%;" :rules="[{required: true, message: '请输入内容', trigger: 'change'}]">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item v-if="form.contentType === '0' && !isHideCoverimg" label="封面图片" prop="files" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
key="file"
:limit="9">
<template slot="tips">
<p>最多上传9张图片,单个文件最大10MB支持jpgjpegpng格式</p>
</template>
</ai-uploader>
</el-form-item>
<el-form-item v-if="form.contentType === '1'" label="视频" prop="files" style="width: 100%;" :rules="[{required: true, message: '请上传视频', trigger: 'change'}]">
<el-upload :show-file-list="false" ref="upload1" action :http-request="submitUpload" :accept="accept" :limit="1">
<div class="video" v-if="!form.files.length">
<div class="icon">
<ai-icon type="svg" icon="iconVideo"/>
<span>上传视频</span>
</div>
<span class="tips">支持mp4格式单个文件最大100MB</span>
</div>
</el-upload>
<video class="video-com" style="width:100%; height:100%; object-fit: fill;" muted
:src="form.files[0].url" controls="controls" v-if="form.files.length"></video>
<el-upload :show-file-list="false" ref="upload2" action :http-request="submitUpload" :accept="accept"
:limit="1" v-if="form.files.length">
<el-button style="margin-top: 10px;">重新选择</el-button>
</el-upload>
</el-form-item>
<el-form-item label="视频封面" prop="pictureUrl" style="width: 100%;" v-if="form.contentType === '1'" :rules="[{required: true, message: '请上传视频封面', trigger: 'change'}]">
<ai-uploader
:instance="instance"
isShowTip
v-model="form.pictureUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">
<p>最多上传1张图片,单个文件最大10MB支持jpgjpegpng格式</p>
<p>图片比例1.61</p>
</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" :loading="isLoading" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import mp4box from 'mp4box'
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object,
areaId: String,
moduleName: String
},
data () {
return {
info: {},
accept: '.mp4',
form: {
title: '',
content: '',
areaId: '',
files: [],
categoryId: '',
pictureUrl: [],
contentType: '0',
areaName: '',
thumbUrl: []
},
isLoading: false,
cropOps: {
width: "336px",
height: "210px"
},
id: '',
contentTypeList: [
{
name: '文章',
value: '0'
},
{
name: '视频',
value: '1'
}
],
isHideCoverimg: false,
cateList: [],
needExamine: '0'
}
},
computed: {
...mapState(['user'])
},
created () {
this.getModuleInfo()
this.getCateList()
this.form.areaId = this.areaId
this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
getModuleInfo () {
this.instance.post(`/app/appcontentmoduleinfo/queryDetailById?id=${this.$route.query.moduleId}`).then(res => {
if (res.code === 0) {
this.isHideCoverimg = res.data.styleType === '0'
this.needExamine = res.data.needExamine
}
})
},
onChange () {
this.form.files = []
},
submitUpload(file) {
this.$refs['upload1']?.clearFiles();
this.$refs['upload2']?.clearFiles();
this.$refs['ruleForm']?.clearValidate('videoFile');
const fileType = file.file.name.split(".")[1];
const size = file.file.size / 1024 / 1024 > 100;
let mp4boxfile = mp4box.createFile();
const reader = new FileReader();
reader.readAsArrayBuffer(file.file);
reader.onload = (e) => {
const arrayBuffer = e.target.result;
arrayBuffer.fileStart = 0;
mp4boxfile.appendBuffer(arrayBuffer);
};
mp4boxfile.onReady = (info) => {
let codec = info.mime.match(/codecs="(\S*),/)[1]
if (!/(avc|hevc)/.test(codec)) {
return this.$message.error("视频编码格式不支持")
}
if (size) {
return this.$message.error("视频大小不能超过100M");
}
if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) {
let formData = new FormData()
formData.append('file', file.file);
this.isLoading = true
this.instance.post(`/admin/file/add-unlimited`, formData).then(res => {
if (res && res.data) {
let videoList = res.data[0].split(";");
this.form.files = [{
id: videoList[1],
url: videoList[0]
}]
}
this.isLoading = false
}).catch(() => {
this.isLoading = false
})
} else {
return this.$message.error("视频格式错误")
}
}
},
getCateList () {
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {
...this.cateSearch,
moduleId: this.$route.query.moduleId,
size: 100
}
}).then(res => {
if (res.code == 0) {
this.cateList = res.data.records
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
let categoryName = ''
if (this.cateList.length && this.form.categoryId) {
categoryName = this.cateList.filter(v => v.id === this.form.categoryId)[0].categoryName
}
this.isLoading = true
this.instance.post(`/app/appcontentinfo/addOrUpdate`, {
...this.form,
moduleId: this.$route.query.moduleId,
createUserName: this.user.info.name,
createUserId: this.user.info.id,
categoryName: categoryName,
pictureUrl: this.form.pictureUrl.length ? this.form.pictureUrl[0].url : ''
}).then(res => {
if (res.code == 0) {
if (this.needExamine === '1') {
this.$message.success('提交成功,等待管理员审核')
} else {
this.$message.success('提交成功')
}
setTimeout(() => {
this.cancel(true)
}, 600)
} else {
this.isLoading = false
}
}).catch(() => {
this.isLoading = false
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
.content-add {
.video {
width: 640px;
height: 360px;
border-radius: 4px;
border: 1px dashed #D0D4DC;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
span:nth-child(2) {
display: inline-block;
font-size: 16px;
color: #333333;
line-height: 30px;
}
.iconfont {
display: inline-block;
font-size: 40px;
color: #2266FF;
}
}
.tips {
display: inline-block;
font-size: 12px;
color: #999999;
line-height: 26px;
}
}
.video-com {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
margin-top: -40px;
}
}
</style>

View File

@@ -0,0 +1,201 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-select
v-model="search.examineStatus"
@change="search.current = 1, getList()"
placeholder="审核状态"
:selectList="dict.getDict('auditStatus')">
</ai-select>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current=1,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 v-if="form.pass === '0'" 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: '',
examineStatus: ''
},
form: {
opinion: '',
pass: ''
},
id: '',
isShow: false,
total: 0,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'left' },
{ prop: 'examineStatus', label: '状态', align: 'center', format: v => this.dict.getLabel('auditStatus', v) },
{ prop: 'examineOpinion', label: '审核意见', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
created () {
this.dict.load('auditStatus').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appcontentinfo/list-web`, null, {
params: {
moduleId: this.$route.query.moduleId,
...this.search,
areaId: this.areaId,
queryType: 1
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onStatusChange () {
this.form.opinion = ''
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

@@ -0,0 +1,118 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="评论管理" isShowBottomBorder isShowBack @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
</template>
<template #right>
</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="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="show(row.id, row.isShow)">{{ row.isShow === '1' ? '隐藏' : '显示' }}</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'Comment',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
search: {
current: 1,
size: 10,
title: '',
status: ''
},
total: 10,
colConfigs: [
{ prop: 'name', label: '微信昵称', align: 'left' },
{ prop: 'content', label: '评论', align: 'center' },
{ prop: 'commentTime', label: '评论时间', align: 'center' }
],
tableData: []
}
},
created () {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcontentcomment/list?contentId=${this.params.id}`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
show (id, isShow) {
this.$confirm(isShow === '1' ? '确定隐藏该评论?' : '确定隐藏该评论').then(() => {
this.instance.post(`/app/appcontentcomment/show?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,93 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<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="分类" v-if="info.categoryName" 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>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object,
moduleId: String
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,175 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<ai-download
v-if="permissions('app_appcontentinfo_export')"
:instance="instance"
url="/app/appcontentinfo/export"
:params="params"
fileName="数据列表"
:disabled="tableData.length == 0">
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
</ai-download>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, 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="comment" label="评论数" align="center" v-if="permissions('app_appcontentcomment_detail')">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toComment(row.id)">{{ row.msgCount }}</el-button>
</div>
</template>
</el-table-column>
<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>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object,
moduleName: String,
areaId: String,
permissions: Function
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'left' },
{ prop: 'examineStatus', label: '状态', align: 'center', format: v => this.dict.getLabel('auditStatus', v) },
{ prop: 'examineOpinion', label: '审核意见', align: 'center' },
{ prop: 'viewCount', label: '浏览次数', align: 'center' },
{ slot: 'comment', label: '评论次数', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user']),
params () {
return {
...this.search,
moduleId: this.$route.query.moduleId
}
}
},
created() {
this.dict.load('auditStatus').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appcontentinfo/list-web`, 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
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toComment(id) {
this.$emit('change', {
type: 'Comment',
params: {
id
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -0,0 +1,72 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"/>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppContentManage',
label: '内容管理',
props: {
instance: Function,
dict: Object
},
data() {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
created() {
this.dict.load("yesOrNo")
},
methods: {
onChange(data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,190 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑模块' : '添加模块'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="模块名称" style="width: 100%;" prop="moduleName" :rules="[{required: true, message: '请输入模块名称', trigger: 'blur'}]">
<el-input type="input" style="width: 300px" size="small" v-model="form.moduleName" clearable placeholder="请输入模块名称" maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="menuName" label="菜单名称" :rules="[{required: true, message: '请选择菜单', trigger: 'change'}]">
<el-input type="input" style="width: 300px" disabled size="small" v-model="form.menuName" clearable placeholder="请选择菜单">
<template slot="append">
<el-button size="small" @click="showAdd">选择</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="是否审核" style="width: 100%;" prop="needExamine" :rules="[{required: true, message: '请选择是否审核', trigger: 'change'}]">
<el-radio-group v-model="form.needExamine">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否可评论" style="width: 100%;" prop="isComment" :rules="[{required: true, message: '请选择是否可评论'}]">
<el-radio-group v-model="form.isComment">
<el-radio v-for="op in dict.getDict('yesOrNo')" :key="op.dictValue" :label="op.dictValue">{{ op.dictName }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
</ai-card>
<ai-dialog
:visible.sync="isShowAdd"
width="880px"
height="580px"
title="选择菜单"
@close="onClose"
@onConfirm="onConfirm">
<el-tree
:data="treeData"
node-key="id"
ref="tree"
@node-click="onChange"
highlight-current
:default-expanded-keys="defaultExpandedKeys"
:default-checked-keys="defaulCheckedKeys"
:props="defaultProps">
</el-tree>
</ai-dialog>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data() {
return {
info: {},
form: {
moduleName: '',
menuId: '',
menuName: '',
needExamine: '0'
},
isShowAdd: false,
treeData: [],
id: '',
chooseNode: {},
defaultExpandedKeys: [],
defaulCheckedKeys: [],
defaultProps: {
children: 'subSet',
label: 'name',
disabled: e => {
return e.type !== '1'
}
}
}
},
computed: {
...mapState(['user'])
},
created() {
this.getMenuList()
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo(id) {
this.instance.post(`/app/appcontentmoduleinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
}
})
},
showAdd() {
this.isShowAdd = true
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.form.menuId)
this.defaultExpandedKeys = [this.form.menuId]
this.chooseNode = {
menuId: this.form.menuId,
menuName: this.form.menuName,
type: '1'
}
})
},
onClose() {
},
onConfirm() {
if (this.chooseNode.type === '1') {
this.form.menuId = this.chooseNode.id
this.form.menuName = this.chooseNode.name
this.isShowAdd = false
} else {
this.$message.error('无法选择')
}
},
onChange(e) {
this.chooseNode = e
},
getMenuList() {
this.instance.post(`/admin/menu/menuTree?containPermission=0`).then(res => {
if (res.code === 0) {
this.treeData = res.data
}
})
},
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcontentmoduleinfo/addOrUpdate`, {
...this.form,
id: this.params.id || ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel(isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,75 @@
<template>
<section class="AiEditInput" :class="{[align]:true,error}">
<el-input v-if="edit" size="small" v-model="content" @change="handleChange" @blur="cancel" clearable autofocus/>
<div class="valueText" v-if="!edit && value" v-text="value" @click="edit=true"/>
<i v-if="!edit && !value" class="el-icon-edit" @click="edit = true"></i>
</section>
</template>
<script>
export default {
name: "AiEditInput",
model: {
prop: "value",
event: "change"
},
props: {
value: {default: ""},
align: {default: ""},
error: Boolean
},
data() {
return {
edit: false,
content: ""
}
},
methods: {
cancel() {
this.edit = false
},
handleChange(v) {
this.$emit('change', v)
this.$emit('update:error', false)
}
},
watch: {
edit(v) {
v && (this.content = this.$copy(this.value))
}
}
}
</script>
<style lang="scss" scoped>
:deep(.AiEditInput ){
&.error {
background: rgba(#f46, .2);
}
input {
text-align: center;
}
.valueText {
width: 100%;
height: 100%;
min-width: 43px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
}
&.left {
input {
text-align: left
}
.valueText {
justify-content: flex-start;
}
}
}
</style>

View File

@@ -0,0 +1,63 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.codeUrl = [{
url: res.data.codeUrl
}]
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,178 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="内容管理" isShowBottomBorder></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd()">添加模块</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total" :dict="dict"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<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="getCateList(row.id),isShowAdd = true">分类</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog :visible.sync="isShowAdd" width="880px" height="580px" title="文章分类" @close="onClose" @onConfirm="submitCategory">
<el-button icon="iconfont iconAdd" type="text" @click="cateList.push({error:false,categoryName:null})">添加分类</el-button>
<ai-table v-if="moduleId" :tableData="cateList" :col-configs="cateColConfigs" :isShowPagination="false" @getList="getCateList">
<el-table-column slot="category" label="分类名称" align="center">
<template slot-scope="{row}">
<ai-edit-input v-model="row.categoryName" :key="row.id" :error.sync="row.error"/>
</template>
</el-table-column>
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row,$index }">
<el-button type="text" @click="handleMove(row,$index,-1)" :disabled="$index==0">上移</el-button>
<el-button type="text" @click="handleMove(row,$index,1)" :disabled="$index==(cateList.length-1)">下移</el-button>
<el-button type="text" @click="removeCate($index)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
import AiEditInput from "./AiEditInput";
export default {
name: 'List',
components: {AiEditInput},
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
moduleId: '',
total: 10,
cateList: [],
colConfigs: [
{prop: 'moduleName', label: '模块名称', align: 'left', width: '200px'},
{prop: 'menuName', label: '关联菜单', align: 'center'},
{prop: 'categoryStr', label: '文章分类', align: 'center'},
{prop: 'needExamine', label: '是否审核', align: 'center', dict: 'yesOrNo'},
{prop: 'isComment', label: '是否可以评论', align: 'center', dict: 'yesOrNo'}
],
cateColConfigs: [
{type: 'index', label: "排序", align: 'center'},
{slot: 'category'}
],
isShowAdd: false,
tableData: []
}
},
mounted() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcontentmoduleinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getCateList(moduleId) {
this.moduleId = moduleId
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {size: 99999, moduleId}
}).then(res => {
if (res?.data) {
this.cateList = res.data.records.map(e => ({...e, error: false}))
}
})
},
removeCate(i) {
this.$confirm('确定删除该数据?').then(() => {
this.cateList.splice(i, 1)
})
},
handleMove(row, i, forward) {
const tmp = this.$copy(row), target = i + forward
this.cateList.splice(i, 1, this.cateList[target])
this.cateList.splice(target, 1, tmp)
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmoduleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
submitCategory() {
if (!this.cateList.some((e, i, arr) => {
arr[i].error = !e.categoryName
if (!e.categoryName) {
this.$message.error(`${i + 1}行未填写分类名称!`)
return true
}
})) {
let {cateList: categorys, moduleId} = this
categorys = categorys.map((e, i) => ({...e, showIndex: i * 1 + 1}))
this.instance.post(`/app/appcontentmodulecategory/addOrUpdate2`, {
categorys, moduleId
}).then(res => {
if (res?.code == 0) {
this.$message.success('提交成功')
this.isShowAdd = false
this.getList()
}
})
}
},
onClose() {
this.moduleId = ''
this.cateList = []
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {id}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
.catewrapper {
display: flex;
align-items: center;
}
}
</style>