话题设置,精选动态

This commit is contained in:
liuye
2023-10-17 13:57:46 +08:00
parent e49b4840e3
commit 522b197279
6 changed files with 660 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<template>
<div class="AppActivitiesManagement">
<keep-alive :include="['List']">
<component ref="component" :is="component" :permissions="permissions " @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Detail from './components/Detail'
export default {
name: 'AppDynamic',
label: '精选动态',
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
List,
Detail
},
methods: {
onChange (data) {
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">
.AppActivitiesManagement {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,110 @@
<template>
<ai-detail class="AppDynamicDetail">
<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.girdName"></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 label="附件" isLine>
<div class="files">
<div class="file-item" v-for="(item, index) in info.files" :key="index">
<video controls :src="item.url" v-if="['.mp4', '.mov'].includes(item.postfix)"></video>
<img :src="item.url" v-else v-viewer="{movable: true}">
</div>
</div>
</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
this.info = {
...res.data,
pictureUrl: res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : [],
files: res.data.files.map(v => {
return {
...v,
postfix: v.postfix.toLowerCase()
}
})
}
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
.AppDynamicDetail {
.files {
display: flex;
align-items: center;
flex-wrap: wrap;
.file-item {
width: 240px;
height: 240px;
margin: 0 20px 20px 0;
img, video {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
}
</style>

View File

@@ -0,0 +1,144 @@
<template>
<ai-list class="notice">
<ai-title slot="title" title="精选动态" v-model="search.areaId" isShowBottomBorder isShowArea :hideLevel="hideLevel - 1" @change="search.current = 1, getList()"></ai-title>
<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"
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="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="remove(row.id)">下架</el-button>
<el-button type="text" @click="toDetail(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
},
data() {
return {
search: {
current: 1,
size: 10,
title: '',
areaId: ''
},
total: 0,
colConfigs: [
{ prop: 'title', label: '类型', align: 'left', width: '200px' },
{ prop: 'createUserName', label: '姓名', align: 'center' },
{ prop: 'girdName', label: '所属网格', align: 'center' },
{ prop: 'examineUserName', label: '推送人', align: 'center' },
{ prop: 'createTime', label: '推送时间', align: 'center' }
],
tableData: [],
moduleId: ''
}
},
computed: {
...mapState(['user']),
hideLevel () {
return this.user.info.areaList.length || 0
},
params () {
return {
...this.search
}
}
},
created() {
this.search.areaId = this.user.info.areaId
this.getInfo()
},
methods: {
getInfo () {
this.instance.post(`/app/appintegraluserapply/queryModuleByName`).then(res => {
if (res.code == 0) {
this.moduleId = res.data
this.$nextTick(() => {
this.getList()
})
}
})
},
getList () {
this.instance.post(`/app/appcontentinfo/list-web`, null, {
params: {
moduleId: this.moduleId,
...this.search,
areaId: this.search.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/deleteIntegralApply?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>
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="AppSubjectSet">
<keep-alive :include="['List']">
<component
ref="component"
:is="component"
@change="onChange"
:params="params"
:instance="instance"
:dict="dict"
></component>
</keep-alive>
</div>
</template>
<script>
import List from "./components/List";
import Add from "./components/Add";
export default {
name: "AppSubjectSet",
label: "话题设置",
props: {
instance: Function,
dict: Object,
},
data() {
return {
component: "List",
params: {},
include: [],
};
},
components: {
Add,
List,
},
methods: {
onChange(data) {
if (data.type === "Add") {
this.component = "Add";
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">
.AppSubjectSet {
height: 100%;
background: #f3f6f9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,128 @@
<template>
<ai-detail class="content-add">
<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 prop="title" style="width: 100%;" label="话题名称" :rules="[{required: true, message: '请输入话题名称', trigger: 'change'}]">
<el-input size="small" placeholder='如“社会保障”仅限4个字' v-model="form.title" maxlength="4" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item prop="showIndex" style="width: 100%;" label="排序" :rules="[{required: true, message: '请输入排序', trigger: 'change'}]">
<el-input-number v-model="form.showIndex" :min="1" :max="100" size="small"></el-input-number>
<span class="tips">请输入数字数字越小排序越前</span>
</el-form-item>
<el-form-item label="话题描述" prop="description" style="width: 100%;" :rules="[{required: true, message: '请输入发布内容', trigger: 'change'}]">
<el-input type="textarea" placeholder="限500字" v-model="form.description" rows="8" maxlength="500" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item label="话题图标" prop="files" style="width: 100%;" :rules="[{required: true, message: '请上传话题图标', trigger: 'change'}]">
<ai-uploader
:instance="instance"
v-model="form.files"
isShowTip
:limit="1">
</ai-uploader>
</el-form-item>
<el-form-item prop="status" style="width: 100%;" label="是否启用" :rules="[{required: true}]">
<el-radio-group v-model="form.status">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
</ai-card>
</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 {
form: {
title: '',
showIndex: '',
description: '',
files: [],
picUrl: '',
status: '1',
},
isFlag: false
}
},
computed: {
...mapState(['user'])
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appneighborhoodassistancetheme/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.files = [{url: res.data.picUrl}]
}
})
},
confirm () {
if(this.isFlag) return
this.$refs.form.validate((valid) => {
if (valid) {
this.isFlag = true
this.instance.post(`/app/appneighborhoodassistancetheme/addOrUpdate`, {
...this.form,
picUrl: this.form.files[0].url
}).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">
.tips {
display: inline-block;
margin-left: 8px;
color: #999;
font-size: 12px;
}
</style>

View File

@@ -0,0 +1,144 @@
<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>
<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="status" width="120px" label="是否启用" align="center">
<template slot-scope="{ row }">
<el-switch v-model="row.status" @change="changeStatus(row)" active-value="1" inactive-value="0"></el-switch>
</template>
</el-table-column>
<el-table-column slot="options" width="180px" 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="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
title: '',
status: ''
},
total: 10,
colConfigs: [
{ prop: 'title', label: '话题名称', align: 'left', width: '200' },
{ prop: 'description', label: '话题描述', align: 'left', 'show-overflow-tooltip': true},
{ prop: 'partakeCount', label: '参与话题数', align: 'center', width: '120' },
{ prop: 'showIndex', label: '排序', align: 'center', width: '120' },
{ prop: 'createUserName', label: '创建人', align: 'center', width: '120' },
{ prop: 'createTime', label: '创建时间', align: 'center', width: '180' },
{ slot: 'status'},
{ slot: 'options'},
],
tableData: [],
}
},
created() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
params: {
...this.search
}
}).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/appneighborhoodassistancetheme/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
},
changeStatus(row) {
this.$confirm(`确定${row.status == 1 ? '启用' : '关闭'}该话题?`).then(() => {
this.instance.post(`/app/appneighborhoodassistancetheme/enable?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功!')
this.getList()
}
})
}).catch(() => {
this.getList()
})
// this.instance.post(`/app/appneighborhoodassistancetheme/enable?id=${row.id}`).then(res => {
// if (res.code == 0) {
// this.$message.success('操作成功!')
// this.getList()
// }
// })
}
}
}
</script>
<style lang="scss" scoped>
</style>