{"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/SinglePdf.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/components/Upload/SinglePdf.vue","mtime":1713161556000},{"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/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\nimport {put} from '@/utils/alioss.js';\nimport {createUniqueString} from '@/utils/index.js';\n\nexport default {\n  name: 'SinglePdfUpload',\n  props: {\n    pdfUrl: {\n      type: String,\n      default: ''\n    }\n  },\n  data() {\n    return {\n      pdfUploadStatus:false,\n    }\n  },\n  methods: {\n    check(){\n      if(this.pdfUrl && this.pdfUrl != undefined) window.open(this.pdfUrl);\n    },\n    rmPdf() {\n      this.emitInput('')\n    },\n    emitInput(val) {\n      this.$emit('pdfChange', val)\n    },\n    handleImageSuccess() {\n      this.emitInput(this.tempUrl)\n    },\n    async pdfChange(e){\n      this.$nextTick(async () => {\n        if(this.$refs.pdfInput.files.length <= 0 || this.$refs.pdfInput.files[0] == null || this.$refs.pdfInput.files[0] == undefined){\n          return;\n        }\n        if(this.pdfUploadStatus)return;\n        this.pdfUploadStatus = true;\n        let file = this.$refs.pdfInput.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('pdf/' + random_str + sec_name,file);\n        let result = await put('pdf/' + file.name,file);\n        let pdfUrl = decodeURI(result.url);\n        console.log(pdfUrl);\n        this.pdfUploadStatus = false;\n        this.$refs.pdfInput.value = \"\";\n        if(pdfUrl != ''){\n          this.emitInput(pdfUrl);\n        }\n      })\n    }\n  }\n}\n",null]}