Ver Fonte

上传文件地址

yuhongqi há 1 semana atrás
pai
commit
9e465bbf5c

+ 1 - 1
.env.development

@@ -12,7 +12,7 @@ VUE_APP_COS_BUCKET = fs-1319721001
 # 存储桶配置
 VUE_APP_COS_REGION = ap-chongqing
 # 线路一地址
-VUE_APP_VIDEO_LINE_1 = https://fs-1319721001.cos.ap-chongqing.myqcloud.com
+VUE_APP_VIDEO_LINE_1 = https://cos.his.cdwjyyh.com
 # 线路二地址
 VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
 

+ 1 - 1
.env.production

@@ -9,7 +9,7 @@ VUE_APP_COS_BUCKET = fs-1319721001
 # 存储桶配置
 VUE_APP_COS_REGION = ap-chongqing
 # 线路一地址
-VUE_APP_VIDEO_LINE_1 = https://fs-1319721001.cos.ap-chongqing.myqcloud.com
+VUE_APP_VIDEO_LINE_1 = https://cos.his.cdwjyyh.com
 # 线路二地址
 VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
 

+ 18 - 1
src/components/LiveVideoUpload/index.vue

@@ -40,7 +40,7 @@
 <!--              status="success">-->
 <!--            </el-progress>-->
 <!--          </div>-->
-          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过500M</div>
+          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过800M</div>
         </el-upload>
       </div>
     </el-form-item>
@@ -163,6 +163,14 @@ export default {
       // 重置其他状态...
     },
     handleChange(file, fileList) {
+      const MAX_SIZE = 800 * 1024 * 1024;
+      if (file.raw && file.raw.size > MAX_SIZE) {
+        this.$message.error("文件大小不能超过800M");
+        this.$refs.upload.clearFiles();
+        this.fileList = [];
+        this.$emit("update:fileSize", null);
+        return;
+      }
       this.fileList = fileList;
       this.getVideoDuration(file.raw);
     },
@@ -183,6 +191,10 @@ export default {
       if (this.fileList.length < 1) {
         return this.$message.error("请先选取视频,再进行上传");
       }
+      const MAX_SIZE = 800 * 1024 * 1024;
+      if (this.fileList[0].raw && this.fileList[0].raw.size > MAX_SIZE) {
+        return this.$message.error("文件大小不能超过800M");
+      }
       //同时上传个线路
       await this.uploadVideoToTxPcdn();
       // await this.uploadVideoToHwObs();
@@ -200,6 +212,11 @@ export default {
     async uploadVideoToTxPcdn() {
       try {
         const file = this.fileList[0].raw;
+        const MAX_SIZE = 800 * 1024 * 1024;
+        if (file && file.size > MAX_SIZE) {
+          this.$message.error("文件大小不能超过800M");
+          return;
+        }
         const data = await uploadObject(file, this.updateTxProgress,this.type);
         console.log("腾讯COS返回========>",data);
         console.log("isPrivate=======>",this.isPrivate)

+ 18 - 1
src/components/VideoUpload/index.vue

@@ -44,7 +44,7 @@
 <!--              status="success">-->
 <!--            </el-progress>-->
 <!--          </div>-->
-          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过500M</div>
+          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过800M</div>
 <!--        </el-upload>-->
       </div>
     </el-form-item>
@@ -277,6 +277,14 @@ export default {
       this.getList();
     },
     handleChange(file, fileList) {
+      const MAX_SIZE = 800 * 1024 * 1024;
+      if (file.raw && file.raw.size > MAX_SIZE) {
+        this.$message.error("文件大小不能超过800M");
+        this.$refs.upload?.clearFiles();
+        this.fileList = [];
+        this.$emit("update:fileSize", null);
+        return;
+      }
       this.fileList = fileList;
       this.getVideoDuration(file.raw);
     },
@@ -297,6 +305,10 @@ export default {
       if (this.fileList.length < 1) {
         return this.$message.error("请先选取视频,再进行上传");
       }
+      const MAX_SIZE = 800 * 1024 * 1024;
+      if (this.fileList[0].raw && this.fileList[0].raw.size > MAX_SIZE) {
+        return this.$message.error("文件大小不能超过800M");
+      }
       //同时上传个线路
       await this.uploadVideoToTxPcdn();
       this.$emit("update:fileName", this.fileList[0].name);
@@ -321,6 +333,11 @@ export default {
     async uploadVideoToTxPcdn() {
       try {
         const file = this.fileList[0].raw;
+        const MAX_SIZE = 800 * 1024 * 1024;
+        if (file && file.size > MAX_SIZE) {
+          this.$message.error("文件大小不能超过800M");
+          return;
+        }
         const data = await uploadObject(file, this.updateTxProgress,this.type);
         console.log("腾讯COS返回========>",data);
         console.log("isPrivate=======>",this.isPrivate)