{"remainingRequest":"/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/admin/projects/dms/src/dealer_admin/src/components/Upload/SingleImage.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/components/Upload/SingleImage.vue","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport {put} from '@/utils/alioss.js';\nimport {createUniqueString} from '@/utils/index.js';\n\nexport default {\n  name: 'SingleImageUpload',\n  props: {\n    imageUrl: {\n      type: String,\n      default: ''\n    }\n  },\n  data() {\n    return {\n      photoUploadStatus:false,\n    }\n  },\n  methods: {\n    rmImage() {\n      this.emitInput('');\n    },\n    emitInput(val) {\n      this.$emit('imgChange', val);\n    },\n    handleImageSuccess() {\n      this.emitInput(this.tempUrl)\n    },\n    async photoChange(e){\n      this.$nextTick(async () => {\n        if(this.$refs.photoInput.files.length <= 0 || this.$refs.photoInput.files[0] == null || this.$refs.photoInput.files[0] == undefined){\n          return;\n        }\n        if(this.photoUploadStatus)return;\n        this.photoUploadStatus = true;\n        let file = this.$refs.photoInput.files[0];\n        const random_str = createUniqueString();\n        var sec_name = file.name.lastIndexOf('.') != -1 ? file.name.substring(file.name.lastIndexOf('.')):\"\";\n        let result = await put(random_str + sec_name,file);\n        let imageUrl = result.url;\n         this.$refs.photoInput.value = \"\";\n        this.photoUploadStatus = false;\n        if(imageUrl != ''){\n          this.emitInput(imageUrl);\n        }\n      })\n    },\n    hh(){\n      console.log(\"hhh\");\n    }\n  }\n}\n",null]}