This commit is contained in:
liuye
2023-11-17 10:22:53 +08:00
parent 843476a24b
commit 688437a068
3 changed files with 318 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>