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