YaolongHan 3 年之前
父节点
当前提交
29a30a67b6
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/components/editview/rightPropertyBar/BaseImagePro.vue

+ 4 - 4
src/components/editview/rightPropertyBar/BaseImagePro.vue

@@ -197,7 +197,7 @@ export default {
       fileReader.readAsDataURL(file); //读取图片
       const ftype = file.type;
       const fname = file.name;
-      const uploadKey = fname;
+      const uploadKey = file.uid;
       const imgType = ftype.split(".")[ftype.length - 1];
       fileReader.addEventListener("load", function () {
         // 读取完成
@@ -225,14 +225,14 @@ export default {
               /* method */
               "POST",
               /* target url */
-              imgServeUpload + uploadKey
+              imgServeUpload + uploadKey + "." + imgType
             );
             xhr.send(reader.result);
             xhr.onreadystatechange = function () {
               if (xhr.readyState == 4) {
                 if (xhr.status == 200) {
-                  that.url = uploadKey
-                  bus.$emit("updateStyle", "url", uploadKey );
+                  that.url = uploadKey + "." + imgType;
+                  bus.$emit("updateStyle", "url", uploadKey + "." + imgType);
                 }
               }
             };