|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
};
|