|
@@ -31,7 +31,6 @@ import Upload from "@/components/shared/uploads/Upload";
|
|
|
|
|
|
import { uploadFileByWork } from "@/api";
|
|
import { uploadFileByWork } from "@/api";
|
|
|
|
|
|
-
|
|
|
|
export default {
|
|
export default {
|
|
props: ["show", "data", "editTitle"],
|
|
props: ["show", "data", "editTitle"],
|
|
components: {
|
|
components: {
|
|
@@ -40,8 +39,8 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
param: "pcIcon",
|
|
param: "pcIcon",
|
|
- changeArr:[],
|
|
|
|
- tempTaskList:{}
|
|
|
|
|
|
+ changeArr: [],
|
|
|
|
+ tempTaskList: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -61,14 +60,26 @@ export default {
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
onFileChange(file) {
|
|
onFileChange(file) {
|
|
|
|
+ let flag = this.typeObj.checkSuffix.some((iii) => {
|
|
|
|
+ return file.type.indexOf(iii) > -1;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (!flag) {
|
|
|
|
+ this.$msg({
|
|
|
|
+ message: `“${file.name}”格式错误,${this.typeObj.errMsg}`,
|
|
|
|
+ type: "warning",
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
this.info[this.param] = URL.createObjectURL(file);
|
|
this.info[this.param] = URL.createObjectURL(file);
|
|
- if (this.param == 'bgm') {
|
|
|
|
|
|
+ if (this.param == "bgm") {
|
|
this.info[this.param] = {
|
|
this.info[this.param] = {
|
|
url: URL.createObjectURL(file),
|
|
url: URL.createObjectURL(file),
|
|
- name: file.name
|
|
|
|
|
|
+ name: file.name,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- let p = new Promise(relove => {
|
|
|
|
|
|
+ let p = new Promise((relove) => {
|
|
let fn = () => {
|
|
let fn = () => {
|
|
let pp = new Promise((rel) => {
|
|
let pp = new Promise((rel) => {
|
|
uploadFileByWork(
|
|
uploadFileByWork(
|
|
@@ -77,13 +88,13 @@ export default {
|
|
file: file,
|
|
file: file,
|
|
},
|
|
},
|
|
(data) => {
|
|
(data) => {
|
|
- if (this.param == 'bgm') {
|
|
|
|
|
|
+ if (this.param == "bgm") {
|
|
this.info[this.param].url = this.$cdn + data.data.filePath + `?_=${Math.random()}`;
|
|
this.info[this.param].url = this.$cdn + data.data.filePath + `?_=${Math.random()}`;
|
|
- } else{
|
|
|
|
|
|
+ } else {
|
|
this.info[this.param] = this.$cdn + data.data.filePath + `?_=${Math.random()}`;
|
|
this.info[this.param] = this.$cdn + data.data.filePath + `?_=${Math.random()}`;
|
|
}
|
|
}
|
|
this.$store.commit("SetInfo", this.info);
|
|
this.$store.commit("SetInfo", this.info);
|
|
-
|
|
|
|
|
|
+
|
|
rel();
|
|
rel();
|
|
}
|
|
}
|
|
);
|
|
);
|
|
@@ -102,16 +113,16 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
- this.tempTaskList = {}
|
|
|
|
|
|
+ this.tempTaskList = {};
|
|
this.$store.commit("SetInfo", this.backupInfo);
|
|
this.$store.commit("SetInfo", this.backupInfo);
|
|
this.$emit("close");
|
|
this.$emit("close");
|
|
},
|
|
},
|
|
save() {
|
|
save() {
|
|
- if (this.param == 'bgm') {
|
|
|
|
- this.uploadTaskList['bgm'] = this.tempTaskList['bgm']
|
|
|
|
- } else{
|
|
|
|
- this.uploadTaskList['pcIcon'] = this.tempTaskList['pcIcon']
|
|
|
|
- this.uploadTaskList['appIcon'] = this.tempTaskList['appIcon']
|
|
|
|
|
|
+ if (this.param == "bgm") {
|
|
|
|
+ this.uploadTaskList["bgm"] = this.tempTaskList["bgm"];
|
|
|
|
+ } else {
|
|
|
|
+ this.uploadTaskList["pcIcon"] = this.tempTaskList["pcIcon"];
|
|
|
|
+ this.uploadTaskList["appIcon"] = this.tempTaskList["appIcon"];
|
|
}
|
|
}
|
|
this.$store.commit("SetInfo", this.info);
|
|
this.$store.commit("SetInfo", this.info);
|
|
this.$emit("close");
|
|
this.$emit("close");
|