管理案例页面增加取消推荐案例和推荐案例

This commit is contained in:
lmj
2022-12-06 12:02:28 +08:00
parent 5e198e60b0
commit 3140d04b7c
3 changed files with 61 additions and 4 deletions

View File

@@ -38,9 +38,8 @@
<!-- <el-button type="text" @click="shareItem(scope.row)" icon="el-icon-share" style="margin:0 5px">推荐</el-button> -->
<el-button style="margin:0 5px" v-if="!scope.row.isTop" type="text" @click="setTop(scope.row)" icon="el-icon-top">置顶</el-button>
<el-button style="margin:0 5px" v-if="scope.row.isTop" type="text" @click="setTop(scope.row)" icon="el-icon-bottom">取消置顶</el-button>
<el-button type="text" icon="el-icon-medal" ><span @click="cancal(scope.row)" v-if="scope.row.excellent">取消案例</span><span @click="open(scope.row)" v-else>优秀案例</span></el-button>
<el-button style="margin:0 5px" type="text" @click="delItem(scope.row)" icon="el-icon-delete">删除</el-button>
<el-button type="text" icon="el-icon-finished">推荐优秀案例</el-button>
</el-button-group>
</template>
</el-table-column>
@@ -118,6 +117,7 @@ export default {
name: 'articleItems',
data() {
return {
excellent:false,
queryObj: {
pageIndex:1,
pageSize:10,
@@ -138,7 +138,6 @@ export default {
shareShow: false,
shareUsers:[],
shareItemData:{},
timeout: null,
params: { name: '', type: '' },
typeList: [],
@@ -160,6 +159,62 @@ export default {
this.getData();
},
methods: {
cancal(item){
this.$confirm('是否取消该案例为优秀案例?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.excellent = false;
let data = {
id:item.id,
excellent:this.excellent
}
console.log(data)
apiCase.excellent(data).then(res => {
if(res.status == 200){
this.$message({
type: 'success',
message: '取消成功!'
});
this.getData()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已撤回取消推荐'
});
});
},
open(item) {
this.$confirm('是否推荐该案例为优秀案例?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.excellent = true;
let data = {
id:item.id,
excellent:this.excellent
}
console.log(data)
apiCase.excellent(data).then(res => {
if(res.status == 200){
this.$message({
type: 'success',
message: '推荐成功!'
});
this.getData()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消推荐'
});
});
},
inputOn() {
this.$forceUpdate();
},