Browse Source

feat: oss 上传

liming 5 months ago
parent
commit
0973403f0d
2 changed files with 6 additions and 7 deletions
  1. 4 7
      src/store/modules/systemStore.js
  2. 2 0
      src/views/system/menu/index.vue

+ 4 - 7
src/store/modules/systemStore.js

@@ -67,14 +67,13 @@ export const useSystemStore = defineStore({
 
           const info = res.data
           const systemStore = useSystemStore()
-          console.log(info)
           const getInfoData = info => {
             const infoData = {
               endpoint: 'https://cardiot.oss-cn-beijing.aliyuncs.com',
               region: 'oss-cn-beijing',
-              accessKeyId: info.accessKeyId,
-              accessKeySecret: info.accessKeySecret,
-              stsToken: info.securityToken,
+              accessKeyId: info.AccessKeyId,
+              accessKeySecret: info.AccessKeySecret,
+              stsToken: info.SecurityToken,
               bucket: 'cardiot',
               cname: true
             }
@@ -83,14 +82,12 @@ export const useSystemStore = defineStore({
             return infoData
           }
           getInfoData(info)
-          console.log(this.stsClientInfo)
+        
           const client = new windowVar.OSS({
             ...this.stsClientInfo,
             refreshSTSToken: async () => {
               const res = await getSTSInfo({})
-
               getInfoData(res.data)
-
               return {
                 accessKeyId: info.AccessKeyId,
                 accessKeySecret: info.AccessKeySecret,

+ 2 - 0
src/views/system/menu/index.vue

@@ -421,8 +421,10 @@ const customRequest = async (option) => {
     key: key,
     body: file
   })
+  
   if (resClient.statusCode === 200) {
     console.log('上传成功')
+    console.log("resClient=",resClient)
   }
 
 };