1
lzhe
2024-05-12 f00e6c3b881c67ef3651d4f812230188af01faca
src/components/scUpload/index.vue
@@ -78,7 +78,7 @@
         disabled: { type: Boolean, default: false },
         round: { type: Boolean, default: false },
         onSuccess: { type: Function, default: () => { return true } },
         host: {type: String, default: ''},
         cropper: { type: Boolean, default: false },
         compress: {type: Number, default: 1},
         aspectRatio:  {type: Number, default: NaN}
@@ -95,7 +95,8 @@
               height: this.height + "px"
            },
            cropperDialogVisible: false,
            cropperFile: null
            cropperFile: null,
            hostNew: ''
         }
      },
      watch:{
@@ -108,15 +109,23 @@
         }
      },
      mounted() {
         this.value = this.modelValue
         this.newFile(this.modelValue)
         this.getHost().then(res => {
            this.value = this.modelValue
            this.newFile(this.modelValue)
         })
      },
      methods: {
         getHost () {
            if (this.host) return this.hostNew = this.host
            return this.$API.setting.component.getImgHost.get().then(res => {
               this.hostNew = res.data + '/visual/'
            })
         },
         newFile(url){
            if(url){
               this.file = {
                  status: "success",
                  url: url
                  url: `${this.hostNew}${url}`
               }
            }else{
               this.file = null
@@ -198,7 +207,11 @@
         success(res, file){
            //释放内存删除blob
            URL.revokeObjectURL(file.tempFile)
            delete file.tempFile
            try {
               delete file.tempFile
            } catch (error) {
            }
            var os = this.onSuccess(res, file)
            if(os!=undefined && os==false){
               this.$nextTick(() => {