Commit 7230ef08 by LJM

异常

parent 07c68452
Showing with 51 additions and 0 deletions
...@@ -191,6 +191,7 @@ ...@@ -191,6 +191,7 @@
chooseImageChange() { chooseImageChange() {
var self = this; var self = this;
var time = parseInt(new Date().getTime() / 1000); var time = parseInt(new Date().getTime() / 1000);
// #ifdef MP-WEIXIN
uni.chooseMedia({ uni.chooseMedia({
count: 10, count: 10,
mediaType: ['image'], mediaType: ['image'],
...@@ -240,6 +241,56 @@ ...@@ -240,6 +241,56 @@
} }
} }
}); });
// #endif
// #ifdef APP-PLUS
uni.chooseImage({
count: 10,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
let maxNum = tempFilePaths.length * 1 + self.form.info_pic.length * 1;
if (maxNum > 10) {
uni.hideLoading();
uni.showToast({
title: '图片不超过10张'
});
return false;
}
for (let i = 0; i < tempFilePaths.length; i++) {
uni.uploadFile({
url: API.upload,
filePath: tempFilePaths[i],
name: 'upload',
formData: {
source: '1',
k1: time,
k2: w_md5.hex_md5_32(w_md5.hex_md5_32(String(time)) + 'fh6y5t4rr351d2c3bryi')
},
success: uploadFileRes => {
uni.hideLoading();
var data = JSON.parse(uploadFileRes.data);
if (data.code === 200) {
self.form.info_pic.push(data.data[0]);
} else {
uni.showToast({
title: data.message,
icon: 'error'
});
}
},
fail: error => {
uni.hideLoading();
}
});
}
}
});
// #endif
}, },
submit() { submit() {
if (this.delivery_method_index == 0) { if (this.delivery_method_index == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment