Commit 84b9343c by 姜雷

添加上传文件大小限制

parent 22f6a439
......@@ -137,11 +137,11 @@ class ReprtRepair extends Component {
Toast.fail('请选择报修人身份!');
return;
}
if (!applyForm.areaId) {
if (!applyForm.area) {
Toast.fail('请选择报修区域!');
return;
}
if (!applyForm.termId) {
if (!applyForm.term) {
Toast.fail('请选择报修项目!');
return;
}
......@@ -149,6 +149,17 @@ class ReprtRepair extends Component {
Toast.fail('请输入报修地址!');
return;
}
let imgList = applyForm.uploadImg.filter(i => i !== null);
if (imgList.length) {
let size = imgList.reduce((totle, item) => {
let fileSize = item.filesList[0].size;
return totle + fileSize;
}, 0);
if (size > 10485760) {
Toast.fail('上传图片过大!');
return;
}
}
return true;
};
startApply = () => {
......
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 to comment