You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
4.1 KiB
117 lines
4.1 KiB
<template>
|
|
<div class="main-content">
|
|
<div class="area-form">
|
|
<el-form :inline="true" size="default">
|
|
<el-form-item label="标题">
|
|
<el-input v-model:value="form.title" placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="confirm">查 询</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
<div class="button-tab">
|
|
<el-button size="default" type="primary" @click="goRelease">发布动态</el-button>
|
|
</div>
|
|
<div class="area-table">
|
|
<el-table :data="tableData.data" size="default" border :header-cell-style="{background: '#EEE'}">
|
|
<el-table-column prop="title" label="标题" width="360"></el-table-column>
|
|
<el-table-column prop="type" label="动态类型" :formatter="statusFormatter" width="100"></el-table-column>
|
|
<el-table-column prop="cover" label="封面" >
|
|
<template #default="scope">
|
|
<img style="width: 200px;height: 100px" :src="$ImgUrl(scope.row.cover)" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="action" label="操作" fixed="right" width="240">
|
|
<template #default="scope">
|
|
<el-link type="primary" style="margin-right: 8px">查看</el-link>
|
|
<el-link type="primary" style="margin-right: 8px" @click="goEdit(scope.row.id)">编辑</el-link>
|
|
<el-link type="danger" style="margin-right: 8px" @click="singleDel(scope.row.id)">删除</el-link>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
v-model:currentPage="pagination.current"
|
|
v-model:page-size="pagination.pageSize"
|
|
:page-sizes="[10, 20, 30, 40]"
|
|
background
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="pagination.total"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {defineComponent, reactive, watch, getCurrentInstance} from 'vue'
|
|
import {statusFormatter} from './config.js'
|
|
export default defineComponent({
|
|
name: 'v-questList',
|
|
setup() {
|
|
const form = reactive({
|
|
title: '',
|
|
});
|
|
const tableData = reactive({
|
|
data: [],
|
|
});
|
|
const { proxy } = getCurrentInstance();
|
|
const pagination = reactive({
|
|
total: 0,
|
|
current: 1,
|
|
pageSize: 10
|
|
})
|
|
return {
|
|
form,proxy,
|
|
tableData,pagination,
|
|
statusFormatter
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getData()
|
|
watch(() => (this.pagination.pageSize), () => {
|
|
this.getData()
|
|
});
|
|
watch(() => (this.pagination.current), () => {
|
|
this.getData()
|
|
})
|
|
},
|
|
methods: {
|
|
getData() {
|
|
let obj = Object.assign({pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
|
|
this.proxy.$post("/topicActivity/list", obj).then(res => {
|
|
const data = res.data
|
|
this.tableData.data = data.records;
|
|
this.pagination.total = data.total
|
|
}).catch(() => {});
|
|
},
|
|
confirm() {
|
|
this.getData()
|
|
},
|
|
goRelease() {
|
|
this.$router.push({ name: "ActRelease" })
|
|
},
|
|
goEdit(value) {
|
|
this.$router.push({ name: "ActRelease",params:{id:value}})
|
|
},
|
|
//删除
|
|
singleDel(id) {
|
|
this.$alert(
|
|
'是否删除'+id+'?', //文字
|
|
'删除', //标题
|
|
{type: 'warning'}
|
|
).then(() => {
|
|
this.proxy.$post("/topicActivity/del", {id: id}).then(res => {
|
|
this.getData()
|
|
this.$message.success(res.data)
|
|
}).catch(() => {});
|
|
}).catch(() => {})
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.area-table {
|
|
margin-top: 16px
|
|
}
|
|
</style> |