发表于: 2020-03-06 22:02:34
1 1513
今天完成的事情:
1.推进任务
明天计划的事情:
1.推进任务
遇到的问题和收获:
完善一下按钮
<el-button type="primary" @click="handleClick(scope.row)" size="small">
{{scope.row.status===1?'上线':'下线'}}
</el-button>
//修改article的上架/下架(status)
handleClick(row) {
console.log(row);
this.$confirm(row.status === 1 ? '是否执行上线操作' : '是否执行下线操作' + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
method: 'put',
url: '/api/a/u/article/status',
data: this.$qs.stringify({
id: row.id,
status: row.status === 1 ? 2 : 1
})
}).then(res => {
console.log(res);
if (res.data.code === 0) {
console.log(res);
this.$message.success('操作成功')
//请求刷新列表
this.getArticleList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
执行请求上下线的接口
评论