update:授权委托书改为PDF件上传

This commit is contained in:
2021-02-18 14:45:36 +08:00
parent c5746051df
commit 2989b130ed

View File

@@ -103,11 +103,10 @@
<FormItem label="授权委托书" v-bind="validateInfos.loaPicId">
<input v-model="modelRef.loaPicId" hidden />
<Upload
accept="image/*"
accept="application/pdf"
action="/api2/upload/uploadfile"
v-model:fileList="loaPicFileList"
:beforeUpload="beforeUpload"
list-type="picture"
:beforeUpload="file => beforeUpload(file, true)"
@change="info => handleChange(info, 'loaPicId')"
:disabled="disabledUpload"
>
@@ -182,7 +181,7 @@
<FormItem>
<Popover title="说明">
<template #content>
<p>请将两页纸一起拍照或扫描上传</p>
<p>上传的文件pdf大小不得超过2Mb</p>
</template>
<Button type="link"
><a
@@ -510,17 +509,20 @@ export default {
}
}
};
const beforeUpload = file => {
const isJpgOrPng =
file.type === "image/jpeg" || file.type === "image/png";
if (!isJpgOrPng) {
message.error("只能上传jpeg/png格式的图片文件");
const beforeUpload = (file, isPdf) => {
console.log(file, isPdf);
const isValid =
isPdf === true
? file.type === "application/pdf"
: file.type === "image/jpeg" || file.type === "image/png";
if (!isValid) {
message.error("只能上传受支持格式的文件");
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error("文件大小超过2MB!");
}
return isJpgOrPng && isLt2M;
return isValid && isLt2M;
};
const handleChange = (info, name) => {
console.log(info.file.status, info.file, info.fileList);