增加文章删除事件的处理

This commit is contained in:
daihh
2022-10-12 19:45:31 +08:00
parent a8566f9129
commit e12aefb61b
2 changed files with 31 additions and 25 deletions

View File

@@ -1,16 +1,8 @@
<template> <template>
<div> <div>
<Remark :fixed="false">
<ul>
<li>class名为problem的dom(即时间)无法直接垂直居中</li>
<li>状态有草稿待审核未通过已通过已发布</li>
<li>状态为已发布时才显示点赞收藏图标</li>
<li>点击编辑时没有跳转到新页面</li>
</ul>
</Remark>
<div class="article-list" v-for="(item, idx) in items" :key="idx" @click="jumpDetail(item)"> <div class="article-list" v-for="(item, idx) in items" :key="idx" @click="jumpDetail(item)">
<div class="article-info"> <div class="article-info">
<div class="article-info-title one-line-ellipsis" <div class="article-info-title one-line-ellipsis"
> >
<!-- <span v-if="item.enabled" :class="classFilter(item.status).className">{{classFilter(item.status).text}}</span> --> <!-- <span v-if="item.enabled" :class="classFilter(item.status).className">{{classFilter(item.status).text}}</span> -->
<!-- <span v-else class="article-status8">已下架</span> --> <!-- <span v-else class="article-status8">已下架</span> -->
@@ -53,6 +45,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex";
import interactBar from '@/components/Portal/interactBar.vue'; import interactBar from '@/components/Portal/interactBar.vue';
import apiArticle from '@/api/modules/article.js'; import apiArticle from '@/api/modules/article.js';
import editItems from '@/components/Article/editItems.vue'; import editItems from '@/components/Article/editItems.vue';
@@ -60,6 +53,9 @@ export default {
components: { components: {
interactBar,editItems interactBar,editItems
}, },
computed: {
...mapGetters(["userInfo"]),
},
name: 'articleItems', name: 'articleItems',
props: { props: {
items: { items: {
@@ -78,7 +74,7 @@ export default {
} }
}; };
}, },
filters:{ filters:{
sysCreateTimeFilter(item){ sysCreateTimeFilter(item){
return item.split(' ')[0] return item.split(' ')[0]
@@ -146,26 +142,35 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) }).then(() => {
apiArticle.del(item.id).then(res => {
.then(() => {
apiArticle
.del(item.id)
.then(res => {
if (res.status == 200) { if (res.status == 200) {
this.$emit('update',true) this.$emit('update',true)
this.$message.success('删除成功'); this.$message.success('删除成功');
console.log('shanchushanchu') //发送删除事件
let event = {
key: "DeleteArticle",//后台的事件key 发布文章且审核通过
title: "删除文章",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "删除文章",//事件的内容
source:'page',
objId: item.id,//关联的id
objType: "2",//关联的类型
objInfo: item.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
this.$store.dispatch("userTrigger", event);
}else{ }else{
this.$message.error('删除失败'); this.$message.error('删除失败:'+res.message);
} }
}) }).catch(err => {
.catch(err => {
this.$message.error('删除失败'); this.$message.error('删除失败');
}); });
}) }).catch(() => {});
.catch(() => {});
} }
} }
}; };
@@ -275,7 +280,7 @@ export default {
width: 100%; width: 100%;
font-size: 18px; font-size: 18px;
// font-weight: 400; // font-weight: 400;
// height: 40px; // height: 40px;
margin-top: 7px; margin-top: 7px;
// line-height: 40px; // line-height: 40px;

View File

@@ -41,7 +41,7 @@
<!-- </div> --> <!-- </div> -->
<div> <div>
<el-badge :value="userMsg" :hidden="userMsg==0" class="message-count"> <el-badge :value="userMsg" :hidden="userMsg==0" class="message-count">
<el-link type="primary" :href="`${webBaseUrl}/message/center/index`" target="_blank" :underline="false"> <el-link type="primary" :href="`${webBaseUrl}/message/center/index`" :underline="false">
<svg-icon style="margin-right: 0;font-size:26px;" icon-class="messfff"></svg-icon> <svg-icon style="margin-right: 0;font-size:26px;" icon-class="messfff"></svg-icon>
</el-link> </el-link>
</el-badge> </el-badge>
@@ -126,6 +126,7 @@ export default {
components:{InterestCollection,GuideBox}, components:{InterestCollection,GuideBox},
data() { data() {
return { return {
isTiao:false,
interestShow:false, interestShow:false,
checked:true, checked:true,
signInShow: false, signInShow: false,
@@ -430,7 +431,7 @@ export default {
color:#409EFF; color:#409EFF;
} }
} }
.el-button{ .el-button{
margin-top: 1px; margin-top: 1px;
// margin-left: 20px; // margin-left: 20px;