jack 1 месяц назад
Родитель
Сommit
31170b2b6e

+ 1 - 1
src/global.d.ts

@@ -36,7 +36,7 @@ interface Window {
       update: (credentials: { accessKeyId: string; secretAccessKey: string }) => void;
       region: string;
     };
-    S3: new (config: { params: { Bucket: string } }) => S3Instance;
+    S3: new (config: { params: { Bucket: string }, httpOptions: { timeout: number } }) => S3Instance;
   };
 }
 

+ 6 - 2
src/hooks/useImport.ts

@@ -606,7 +606,11 @@ export default () => {
       window.AWS.config.update(credentials)
       window.AWS.config.region = 'cn-northwest-1'
 
-      const bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } })
+      const bucket = new window.AWS.S3({
+        params: { Bucket: 'ccrb' }, httpOptions: {
+          timeout: 600000 // 10分钟超时
+        }
+      })
       const ext = file.name.split('.').pop() || 'bin'
       const key = `${file.name.split('.')[0]}_${Date.now()}.${ext}`
 
@@ -617,7 +621,7 @@ export default () => {
         ACL: 'public-read',
       }
       const options = {
-        partSize: 2048 * 1024 * 1024, // 2GB 分片,可酌情调小
+        partSize: 5 * 1024 * 1024, // 2GB 分片,可酌情调小
         queueSize: 2,
         leavePartsOnError: true,
       }

+ 1 - 1
src/views/Student/components/wangEnduit.vue

@@ -149,7 +149,7 @@ export default {
               ACL: 'public-read',
             } // key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
             const options = {
-              partSize: 2048 * 1024 * 1024,
+              partSize: 5 * 1024 * 1024,
               queueSize: 2,
               leavePartsOnError: true,
             }

+ 1 - 1
src/views/Student/index.vue

@@ -1696,7 +1696,7 @@ const uploadFile = (file: File): Promise<string> => {
         }
 
         const options = {
-          partSize: 2048 * 1024 * 1024, // 2GB分片
+          partSize: 5 * 1024 * 1024, // 2GB分片
           queueSize: 2,
           leavePartsOnError: true
         }

+ 1 - 1
src/views/components/element/FrameElement/jietu.js

@@ -51,7 +51,7 @@ function beforeUpload_shishi(nfile, uid, cid, task, tool, atool, type) {
       ACL: 'public-read',
     } // key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
     const options = {
-      partSize: 2048 * 1024 * 1024,
+      partSize: 5 * 1024 * 1024,
       queueSize: 2,
       leavePartsOnError: true,
     }