diff --git a/canteen/pages/purchase/detail.vue b/canteen/pages/purchase/detail.vue index 0779ab3..f3f492f 100644 --- a/canteen/pages/purchase/detail.vue +++ b/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); } }) }, diff --git a/supplier/pages/gonghuo/detail.vue b/supplier/pages/gonghuo/detail.vue index c2edd59..23f9ace 100644 --- a/supplier/pages/gonghuo/detail.vue +++ b/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); } }) },