|
@@ -109,7 +109,6 @@
|
|
|
:color="$colors.prim"
|
|
:color="$colors.prim"
|
|
|
block
|
|
block
|
|
|
round
|
|
round
|
|
|
- :disabled="!canSubmit"
|
|
|
|
|
>提交</van-button
|
|
>提交</van-button
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
@@ -211,25 +210,20 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- afterRead(file, fileList, detail) {
|
|
|
|
|
|
|
+ uploadImg(file, detail) {
|
|
|
console.log(file);
|
|
console.log(file);
|
|
|
- console.log(fileList);
|
|
|
|
|
- this.$toast.loading({
|
|
|
|
|
- message: "加载中...",
|
|
|
|
|
- forbidClick: true
|
|
|
|
|
- });
|
|
|
|
|
this.$http
|
|
this.$http
|
|
|
.post("/upload/base64", {
|
|
.post("/upload/base64", {
|
|
|
base64: file.content
|
|
base64: file.content
|
|
|
})
|
|
})
|
|
|
.then(res => {
|
|
.then(res => {
|
|
|
|
|
+ console.log(res);
|
|
|
this.$toast.clear();
|
|
this.$toast.clear();
|
|
|
let imgs =
|
|
let imgs =
|
|
|
detail.name === "big"
|
|
detail.name === "big"
|
|
|
? [...this.form.img]
|
|
? [...this.form.img]
|
|
|
: [...this.submitList[detail.name].img];
|
|
: [...this.submitList[detail.name].img];
|
|
|
imgs.push(res);
|
|
imgs.push(res);
|
|
|
- console.log(detail);
|
|
|
|
|
if (detail.name === "big") {
|
|
if (detail.name === "big") {
|
|
|
this.form.img = imgs;
|
|
this.form.img = imgs;
|
|
|
} else {
|
|
} else {
|
|
@@ -237,6 +231,20 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ afterRead(file, fileList, detail) {
|
|
|
|
|
+ this.$toast.loading({
|
|
|
|
|
+ message: "加载中...",
|
|
|
|
|
+ forbidClick: true
|
|
|
|
|
+ });
|
|
|
|
|
+ if (file instanceof Array) {
|
|
|
|
|
+ file.map(v => {
|
|
|
|
|
+ // console.log(v);
|
|
|
|
|
+ this.uploadImg(v);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.uploadImg(file);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
beforeDelete(file, detail) {
|
|
beforeDelete(file, detail) {
|
|
|
let submitForm = {};
|
|
let submitForm = {};
|
|
|
if (detail.name === "big") {
|
|
if (detail.name === "big") {
|
|
@@ -257,18 +265,29 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
beforeRead(file) {
|
|
beforeRead(file) {
|
|
|
- console.log(file);
|
|
|
|
|
- return new Promise(resolve => {
|
|
|
|
|
- // compressorjs 默认开启 checkOrientation 选项
|
|
|
|
|
- // 会将图片修正为正确方向
|
|
|
|
|
- new Compressor(file, {
|
|
|
|
|
- success: resolve,
|
|
|
|
|
- error(err) {
|
|
|
|
|
- console.log(err.message);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (file instanceof Array) {
|
|
|
|
|
+ //判断是否是数组
|
|
|
|
|
+ file.forEach(v => {
|
|
|
|
|
+ console.log(v);
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("单个图片");
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
},
|
|
},
|
|
|
|
|
+ // beforeRead(file) {
|
|
|
|
|
+ // console.log(file);
|
|
|
|
|
+ // return new Promise(resolve => {
|
|
|
|
|
+ // // compressorjs 默认开启 checkOrientation 选项
|
|
|
|
|
+ // // 会将图片修正为正确方向
|
|
|
|
|
+ // new Compressor(file, {
|
|
|
|
|
+ // success: resolve,
|
|
|
|
|
+ // error(err) {
|
|
|
|
|
+ // console.log(err.message);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // });
|
|
|
|
|
+ // },
|
|
|
save() {
|
|
save() {
|
|
|
let form = { ...this.form };
|
|
let form = { ...this.form };
|
|
|
this.$toast.loading({
|
|
this.$toast.loading({
|