YaolongHan 3 years ago
parent
commit
29a30a67b6
1 changed files with 4 additions and 4 deletions
  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);
                 }
               }
             };