Browse Source

feat: 卷宗照片格式限制

tangning 1 year ago
parent
commit
efa95cd3a6
2 changed files with 6 additions and 2 deletions
  1. 2 0
      src/constant/caseFile.ts
  2. 4 2
      src/view/case/addPhotoFile.vue

+ 2 - 0
src/constant/caseFile.ts

@@ -2,6 +2,7 @@ import { BoardType } from "@/store/caseFile";
 
 export const FileDrawType = 1;
 export const DrawFormats = [".jpg", ".jpeg", ".png", ".raw", ".dcm"];
+export const photoFormats = [".jpg", ".jpeg", ".png"];
 export const OtherFormats = [".pdf", ".jpeg", ".doc", ".docx", ".jpg", ".png"];
 export const BoardTypeDesc = {
   [BoardType.scene]: "现场图",
@@ -9,5 +10,6 @@ export const BoardTypeDesc = {
 };
 export const DrawFormatDesc = "jpg、png、raw、dcm等格式的文件";
 export const OtherFormatDesc = "pdf、word、jpg、png等格式的文件";
+export const photoFormatDesc = "jpg、jpeg、png等格式的文件";
 
 export const maxFileSize = 100 * 1024 * 1024;

+ 4 - 2
src/view/case/addPhotoFile.vue

@@ -15,14 +15,14 @@
         :file-list="fileList"
         :http-request="httpsApi"
         :on-preview="previewFile"
-        :accept="accept"
+        :accept="photoFormats"
         :before-remove="removeFile"
       >
         <el-button type="primary" :disabled="!!file">
           <el-icon><Upload /></el-icon>上传
         </el-button>
         <template v-slot:tip>
-          <div class="el-upload__tip">注:可上传{{ size }}以内的{{ formatDesc }}</div>
+          <div class="el-upload__tip">注:可上传{{ size }}以内的{{ photoFormatDesc }}</div>
         </template>
         <template v-slot:file="{ file }">
           <div class="file" @click.stop="previewFile()">
@@ -50,6 +50,8 @@
 import {
   DrawFormatDesc,
   DrawFormats,
+  photoFormats,
+  photoFormatDesc,
   FileDrawType,
   OtherFormatDesc,
   OtherFormats,