置顶提示

main
王宇航 2024-06-26 19:14:40 +08:00
parent 9f40061534
commit 134525de69
1 changed files with 12 additions and 6 deletions

View File

@ -71,10 +71,11 @@
<template slot-scope="scope">
<el-switch
v-model="scope.row.isTop"
active-color="#13ce66"
inactive-color="#ff4949"
active-color="#ff4949"
inactive-color="#13ce66"
active-text="非置顶"
inactive-text="置顶"
inactive-text="置顶"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
@ -332,13 +333,18 @@ export default {
);
},
handleStatusChange(row) {
let text = row.isTop === "0" ? "置顶" : "取消";
this.$modal.confirm('确认要"' + text + '""' + row.username + '"的动态吗?').then(function() {
let text = row.isTop ? "取消" : "置顶";
this.$modal.confirm('确认要"' + text + '""' + row.username + '"的动态置顶吗?').then(function() {
return changeDynamicStatus(row.id, row.isTop);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.isTop = row.isTop === "0" ? "1" : "0";
if (row.isTop) {
row.isTop = row.isTop ? !row.isTop : row.isTop;
}else {
row.isTop = row.isTop ? row.isTop : !row.isTop;
}
});
},
},