案例详情

This commit is contained in:
zhaofang
2022-06-10 11:30:48 +08:00
parent 155f0fc3fe
commit c35f1e8f79
6 changed files with 62 additions and 11 deletions

View File

@@ -141,6 +141,10 @@ export default {
theme:{
type:Number,
default:1
},
unicom:{
type:Boolean,
default:false
}
},
data(){
@@ -159,7 +163,7 @@ export default {
},
computed:{
...mapGetters(['userInfo']),
...mapGetters(['userInfo','praisesUnicom','favoritesUnicom']),
showAlign(){
if(this.align=='left'){
@@ -170,6 +174,12 @@ export default {
}
},
watch:{
praisesUnicom(newVal){
this.isPraise = newVal;
},
favoritesUnicom(newVal){
this.isFavorite = newVal;
},
data(newVal,oldVal){
// console.log(newVal,'newVal');
// if(newVal && newVal.id!=''){
@@ -178,7 +188,6 @@ export default {
}
},
created(){
},
mounted() {
if(this.data && this.data.id && !this.readonly){
@@ -266,7 +275,6 @@ export default {
this.shareShow=true;
},
addPraise(){
if(this.type==0){
console.log('未设置type值,1表课程,2表文章3表案例4表问答')
return;
@@ -296,6 +304,9 @@ export default {
this.data.praises--;
}
this.isPraise=false;
if(this.unicom) {
this.$store.dispatch("unicomPraises",false)
}
this.$message({message:'取消点赞',type:'success'})
}else{
console.log('取消失败:'+res.message);
@@ -308,6 +319,9 @@ export default {
if(res.result){
this.data.praises++;
}
if(this.unicom) {
this.$store.dispatch("unicomPraises",true)
}
if(this.type!=1&&this.type!=5){
this.messageSave(this.data.id,this.data.title,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'点赞了我的');
}
@@ -356,6 +370,9 @@ export default {
if(res.result){
this.data.favorites--;
}
if(this.unicom) {
this.$store.dispatch("unicomFavorites",false)
}
this.$message({message:'已取消收藏',type:'success'});
//this.$emit('addFavorite',res.result);//添加收藏,如果是true代表添加成功false代表已存在
}else{
@@ -370,6 +387,9 @@ export default {
if(res.result){
this.data.favorites++;
}
if(this.unicom) {
this.$store.dispatch("unicomFavorites",true)
}
if(this.type===2||this.type===4){
this.messageSave(this.data.id,this.data.title,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'收藏了我发布的');
}