特别关心

/*
      *特别关心
      */ 
      handleislike() {
        if(this.isCare) {
          //取消关注
          const h = this.$createElement;
          this.$msgbox({
            title: '消息',
            message: h('div', {
              style:'text-align:center'
            }, [
            h('img', { 
                attrs: {src: '../../static/images/animal.png'},
                style:' 60px;height:52px;margin:0 auto;'
              },null),
              h('p', null, '确定取消关心吗?'),
            ]),
            showCancelButton: true,
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            customClass: 'careMsgBox',
            cancelButtonClass: 'cancelButtonStyle',
            confirmButtonClass: 'confirmButtonStyle',
            beforeClose: (action, instance, done) => {
              done();
              this.patientInfo.GzTag = ''
              // this.list(1)
            }
          }).then(action => {
            //取消关注
            API.common.updateGz({
              'adminId': this.userId, //医生ID
              'patientId': this.patientId,//患者的id (必填)
              'operateType': 0,//(操作类型 1:关注 0:取消关注) (必填)
              'operateTag':'' //关注的标签
            }).then((res)=>{
              if(res.code == 0) {
                this.isCare = false
              }
            }).catch((error)=>{
              console.log(error)
            })
          }).catch(()=>{

          });
        }else {
          //增加关注
          this.$prompt('标签', '添加', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            inputPlaceholder: '请输入标签',
            customClass: 'careMsgBoxAdd',
            cancelButtonClass: 'cancelButtonStyle',
            confirmButtonClass: 'confirmButtonStyle',
          }).then(({ value }) => {
            if(!value) {
              this.$message.error('标签不能为空!');
            }else if(value.toString().length<6){
              this.addTag = value
              API.common.updateGz({
                'adminId': this.userId, //医生ID
                'patientId': this.patientId,//患者的id (必填)
                'operateType': 1,//(操作类型 1:关注 0:取消关注) (必填)
                'operateTag': value //关注的标签
              }).then((res)=>{
                if(res.code == 0) {
                  this.isCare = true
                  this.$message({
                    type: 'success',
                    message: '关注成功!'
                  });
                  this.patientInfo.GzTag = value
                }
              }).catch((error)=>{
                console.log(error)
              })
            }else{
              this.$message.error('标签长度不能大于5!')
            }
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '取消输入'
            });       
          });
        }
      },
原文地址:https://www.cnblogs.com/xuyan1/p/8321078.html