Browse Source

[优化] 限制上传凭证图片的大小

master
邓平艺 5 years ago
parent
commit
bdbbe6f642
  1. 21
      canteen/pages/purchase/detail.vue
  2. 20
      supplier/pages/gonghuo/detail.vue

21
canteen/pages/purchase/detail.vue

@ -268,8 +268,25 @@
uni.chooseImage({
count: current_count,
complete: result => {
this.voucher_list.push(...result.tempFilePaths);
console.log(this.voucher_list)
let tempFiles = result.tempFiles;
let voucher_list = [];
let overstep = false;
tempFiles.map(item => {
// 10MB
if(item.size < 10464788){
voucher_list.push(item.path);
}else{
overstep = true;
}
})
if(overstep){
uni.showModal({
title: '温馨提示',
content: '您上传的图片含有超出10M大小的限制,请优化大小后再上传!',
showCancel: false
})
}
this.voucher_list.push(...voucher_list);
}
})
},

20
supplier/pages/gonghuo/detail.vue

@ -276,7 +276,25 @@
uni.chooseImage({
count: current_count,
complete: result => {
this.voucher_list.push(...result.tempFilePaths);
let tempFiles = result.tempFiles;
let voucher_list = [];
let overstep = false;
tempFiles.map(item => {
// 10MB
if(item.size < 10464788){
voucher_list.push(item.path);
}else{
overstep = true;
}
})
if(overstep){
uni.showModal({
title: '温馨提示',
content: '您上传的图片含有超出10M大小的限制,请优化大小后再上传!',
showCancel: false
})
}
this.voucher_list.push(...voucher_list);
}
})
},

Loading…
Cancel
Save