梁展鹏 3 年 前
コミット
1786f57c71

+ 1 - 0
src/utils/ali-oss.js

@@ -23,5 +23,6 @@ export const getFileNameUUID = () => {
   function rx() {
     return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
   }
+
   return `${+new Date()}_${rx()}${rx()}`
 }

+ 19 - 13
src/views/photographerManagement/photoVerify/modal/ali-oss-multi.vue

@@ -26,7 +26,7 @@
       <el-form-item label="图片" prop="urls" required>
         <el-upload
           action
-          :http-request="Upload"
+          :http-request="upload"
           :before-upload="beforeAvatarUpload"
           :on-preview="handlePreview"
           :before-remove="beforeRemove"
@@ -66,7 +66,7 @@ export default {
   props: {
     limit: {
       type: Number,
-      default: 30
+      default: 50
     }
   },
   data() {
@@ -79,6 +79,12 @@ export default {
         activityId: '',
         urls: []
       },
+      rules: {
+        kindergartenId: [
+          { required: true, message: '请选择关联场景', trigger: 'blur' }
+        ],
+        urls: [{ required: true, message: '请上传图片', trigger: 'change' }]
+      },
 
       fileList: [], // 文件列
       showProgress: false, // 进度条的显示
@@ -87,8 +93,8 @@ export default {
         accessKeyId: 'LTAI5t8FMLXGzU4pTi9GXWb6',
         accessKeySecret: 'Hz6WOXIVNfpdMphYtf3laHbVoasGlT',
         bucket: 'yxl-kindergarten'
-      }, //存签名信息
-      progress: 0 //进度条数据
+      }, // 存签名信息 todo
+      progress: 0 // 进度条数据
     };
   },
   methods: {
@@ -117,23 +123,23 @@ export default {
       //   this.$message.error("请上传正确的视频格式");
       //   return false;
       // }
-      // const isLt100M = file.size / 1024 / 1024 > 10 && file.size / 1024 / 1024 < 1024;
-      // if (!isLt100M) {
-      //   this.$message.error("上传视频大小要在10MB~1GB之间哦!");
-      //   return false;
-      // }
-      if (!this.form.kindergartenId) {
-        this.$error('请先选择幼儿园');
+      const isLt100M = file.size / 1024 / 1024 > 5 && file.size / 1024 / 1024 < 1024;
+      if (!isLt100M) {
+        this.$message.error("上传照片大小要在5MB ~ 1GB之间哦!");
+        return false;
       }
-
       const isLt30 = file.name.length < 30;
       if (!isLt30) {
         this.$message.error('上传视频文件名称长度必须要小于30个文字哦!');
         return false;
       }
+      if (!this.form.kindergartenId) {
+        this.$error('请先选择幼儿园');
+        return false;
+      }
     },
     // http-request属性来覆盖默认的上传行为(即action="url"),自定义上传的实现
-    Upload(file) {
+    upload(file) {
       if (!this.form.kindergartenId) {
         this.$error('请先选择幼儿园');
         return false;