ll
liukangdong
2024-10-14 283cb693086791acca0c10ab428d155d9757f393
admin/src/components/common/UploadFaceImg.vue
@@ -24,8 +24,9 @@
      <ImageCropper ref="iconShot" v-if="updateImg" :imgSrc="img" >
      </ImageCropper>
      <span slot="footer" class="dialog-footer">
            <el-button @click="updateImg = false">取 消</el-button>
            <el-button type="primary" @click="uploadIcon">确 定</el-button>
            <el-button v-if="loading">取 消</el-button>
            <el-button v-else @click="updateImg = false">取 消</el-button>
            <el-button :loading="loading" type="primary" @click="uploadIcon">确 定</el-button>
          </span>
    </el-dialog>
  </div>
@@ -50,6 +51,7 @@
  },
  data () {
    return {
      loading: false,
      fileInfo:{},
      img: null,
      updateImg: false,
@@ -75,7 +77,9 @@
                { type: this.fileInfo.type } // 设置File类型的文件类型
            )
        )
        this.loading = true
        upload(formData).then(res => {
          this.loading = false
          console.log(res)
          this.file.imgurl = res.imgaddr
          this.file.imgurlfull = res.url
@@ -84,6 +88,8 @@
          this.updateImg = false
          this.$emit('uploadSuccess', { imgurl: res.imgaddr, imgurlfull: res.url, name: res.originname })
          this.$emit('uploadEnd')
        }, () => {
          this.loading = false
        })
      })
    },