|
|
|
@ -43,6 +43,18 @@ |
|
|
|
|
<el-table-column label="标题" align="center" prop="title" /> |
|
|
|
|
<el-table-column label="副标题" align="center" prop="subtitle" /> |
|
|
|
|
<el-table-column label="跳转链接" align="center" prop="url" /> |
|
|
|
|
<el-table-column label="是否推荐" align="center" prop="recommend"> |
|
|
|
|
<template v-slot="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="scope.row.recommend" |
|
|
|
|
active-color="#13ce66" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
|
@change="handleRecommendChange(scope.row)" |
|
|
|
|
inactive-color="#ff4949"> |
|
|
|
|
</el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
|
|
|
|
<template v-slot="scope"> |
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span> |
|
|
|
@ -109,13 +121,30 @@ export default { |
|
|
|
|
async getList() { |
|
|
|
|
try { |
|
|
|
|
this.loading = true; |
|
|
|
|
const res = await ColumnInfoApi.getColumnInfoPage(this.queryParams); |
|
|
|
|
const res = await ColumnInfoApi.getColumnInfoPage(this.queryParams); |
|
|
|
|
console.log(res); |
|
|
|
|
this.list = res.data.list; |
|
|
|
|
this.total = res.data.total; |
|
|
|
|
} finally { |
|
|
|
|
this.loading = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 推荐切换 |
|
|
|
|
async handleRecommendChange(row) { |
|
|
|
|
try { |
|
|
|
|
let data = { |
|
|
|
|
id: row.id, |
|
|
|
|
type: row.type, |
|
|
|
|
recommend: row.recommend |
|
|
|
|
} |
|
|
|
|
await ColumnInfoApi.updateColumnInfo(data); |
|
|
|
|
this.$modal.msgSuccess("修改成功"); |
|
|
|
|
this.dialogVisible = false; |
|
|
|
|
this.$emit('success'); |
|
|
|
|
} catch (error) { |
|
|
|
|
row.recommend = !row.recommend; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** 搜索按钮操作 */ |
|
|
|
|
handleQuery() { |
|
|
|
|
this.queryParams.pageNo = 1; |
|
|
|
|