|
|
@@ -542,7 +542,7 @@
|
|
|
<el-form-item label="场景截图" prop="scene_image" required>
|
|
|
<el-upload ref="uploadRef" :http-request="handleOnboardUpload" :file-list="onboardFiles"
|
|
|
:limit="5" list-type="picture-card" accept=".jpg,.jpeg,.png,.pdf"
|
|
|
- :before-upload="handleBeforeUpload" :on-remove="handleOnboardFileRemove">
|
|
|
+ :before-upload="handleSceneBeforeUpload" :on-remove="handleOnboardFileRemove">
|
|
|
<el-icon><Plus /></el-icon>
|
|
|
</el-upload>
|
|
|
<div class="upload-tip">支持 jpg / png / pdf,最多 5 个文件</div>
|
|
|
@@ -556,7 +556,7 @@
|
|
|
</template>
|
|
|
<el-upload ref="qualUploadRef" :http-request="handleQualUpload" :file-list="onboardQualFiles"
|
|
|
:limit="5" list-type="picture-card" accept=".jpg,.jpeg,.png,.pdf"
|
|
|
- :before-upload="handleBeforeUpload" :on-remove="handleQualFileRemove">
|
|
|
+ :before-upload="handleQualBeforeUpload" :on-remove="handleQualFileRemove">
|
|
|
<el-icon><Plus /></el-icon>
|
|
|
</el-upload>
|
|
|
<div class="upload-tip">按场景要求上传行业资质,最多 5 个文件<br>受其他公司委托为他人代发时,无论属于什么场景,请上传合作协议(含甲方行业、委托代发原因、代发对象身份等)</div>
|
|
|
@@ -942,7 +942,7 @@ const onboardRules: FormRules = {
|
|
|
|
|
|
const ALLOWED_EXTENSIONS = [".jpg", ".jpeg", ".png", ".pdf"];
|
|
|
|
|
|
-function handleBeforeUpload(file: File) {
|
|
|
+function validateFileFormat(file: File) {
|
|
|
const ext = "." + file.name.split(".").pop()?.toLowerCase();
|
|
|
if (!ALLOWED_EXTENSIONS.includes(ext)) {
|
|
|
ElMessage.error("仅支持 jpg / png / pdf 格式");
|
|
|
@@ -952,8 +952,22 @@ function handleBeforeUpload(file: File) {
|
|
|
ElMessage.error("文件大小不能超过 5MB");
|
|
|
return false;
|
|
|
}
|
|
|
- if (onboardImageIds.value.length + onboardQualImageIds.value.length >= 5) {
|
|
|
- ElMessage.error("场景截图和资质文件合计最多 5 个文件");
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+function handleSceneBeforeUpload(file: File) {
|
|
|
+ if (!validateFileFormat(file)) return false;
|
|
|
+ if (onboardImageIds.value.length >= 5) {
|
|
|
+ ElMessage.error("场景截图最多 5 个文件");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+function handleQualBeforeUpload(file: File) {
|
|
|
+ if (!validateFileFormat(file)) return false;
|
|
|
+ if (onboardQualImageIds.value.length >= 5) {
|
|
|
+ ElMessage.error("资质文件最多 5 个文件");
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|