Files
2026-10-08 18:19:39 +08:00

65 lines
2.0 KiB
Vue

<template>
<el-dialog title="新闻动态" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="title" label="标题"/>
<el-table-column label="是否显示">
<template #default="{ row }">
<el-switch v-model="row.isShow" size="mini"
@change="changeShow($event, row._id)" :active-value="1"
:inactive-value="0"/>
</template>
</el-table-column>
<el-table-column prop="_add_time_str" label="发布时间"/>
<el-table-column label="详情">
<template #default="{ row }">
<el-button type="primary" size="mini" @click.native="doShowDetail(row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="新闻动态" :visible.sync="showDetail" width="60%" append-to-body="">
<div v-html="content"></div>
</el-dialog>
</el-dialog>
</template>
<script>
export default {
name: "ArticleList",
data() {
return {
dialogVisible: false,
showDetail: false,
list: [],
content: ''
}
},
methods: {
open(userId) {
this.getList(userId)
},
async getList(userId) {
const {rows} = await vk.callFunction({
url: 'admin/userArticle/list/sys/list',
data: {
userId
}
})
this.dialogVisible = true
this.list = rows
},
async changeShow(isShow, id) {
await vk.callFunction({
url: 'admin/userArticle/list/sys/changeShow',
data: {
id, isShow
}
})
},
doShowDetail(row) {
this.showDetail = true
this.content = row.content
}
}
}
</script>