yz3456
2024-05-27 fd08342ac7b11db592ed04b2cbc51eac748d7535
ruoyi-ui/src/views/pet/petInfo.vue
@@ -615,21 +615,23 @@
      );
    },
    requestUpload2(params)
    {
      var file = params.file;
      var formData = new FormData();
    // requestUpload2(params)
    // {
    //   var file = params.file;
    //   var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
    //   formData.append('uploadFile', file);
    //   let _this = this
      uploadPic1(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        _this.fileList2.push({name:response.data.fileName, url:response.data.url})
        console("ok")
      })
    },
    //   uploadPic1(formData).then(response => {
    //     let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
    //     _this.fileList2.push({name:response.data.fileName, url:response.data.url})
    //     console("ok")
    //   })
    // },
    submitForm() {
      // let ul = this.fileList1.map(function (elem){
@@ -645,13 +647,25 @@
          if (valid) {
            if (this.petList.id != undefined) {
              if(this.petList.sex=='雄性')
                 this.petList.sex = 1
              else
                 this.petList.sex = 0
              updatePet(this.petList).then(response => {
                this.$modal.msgSuccess("修改成功");
                // this.open = false;
                if(this.petList.sex==1)
                   this.petList.sex = '雄性'
                else
                   this.petList.sex = '雌性'
                this.btn=false
              });
            } else {
              this.$modal.msgSuccess("修改失败");
              if(this.petList.sex==1)
                 this.petList.sex = '雄性'
              else
                 this.petList.sex = '雌性'
            }
          }
@@ -764,18 +778,28 @@
   //   console("ok")
    //  alert(90)
    //  alert(response.data.url)
    if(this.petList.sex=='雄性')
       this.petList.sex = 1
    else
       this.petList.sex = 0
      _this.petList.fullPicture =  response.data.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      updatePet(_this.petList).then(response => {
        _this.$modal.msgSuccess("图像修改成功");
        if(this.petList.sex==1)
           this.petList.sex = '雄性'
        else
           this.petList.sex = '雌性'
        // this.open = false;
        _this.btn=false
      });
     // alert(100)
    })
      //alert(90)
     },
requestUpload1(params)
    {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
@@ -791,14 +815,23 @@
   //   console("ok")
    //  alert(90)
    //  alert(response.data.url)
    if(this.petList.sex=='雄性')
       this.petList.sex = 1
    else
       this.petList.sex = 0
      _this.petList.headPicture =  response.data.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      updatePet(_this.petList).then(response => {
        _this.$modal.msgSuccess("修改成功");
        // this.open = false;
        if(this.petList.sex==1)
           this.petList.sex = '雄性'
        else
           this.petList.sex = '雌性'
        _this.btn=false
      });
     // alert(100)
    })
      //alert(90)
     },