diff --git a/src/components/upload/config.js b/src/components/upload/config.js index 04818ef..1216d71 100644 --- a/src/components/upload/config.js +++ b/src/components/upload/config.js @@ -1,32 +1,12 @@ /** * 阿里云oss配置 * */ -import { get } from '@/plugins/requests/index.js' -import api from '@/api' -import CryptoJS from 'crypto-js' -import JSEncrypt from 'jsencrypt' - -const A = (key, encryptedData) => { - const keyHex = CryptoJS.enc.Base64.parse(key) - const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, { - mode: CryptoJS.mode.ECB, - padding: CryptoJS.pad.Pkcs7 - }) - return decrypted.toString(CryptoJS.enc.Utf8) -} - -const R = (encryptedKey, privateKey) => { - const decrypt = new JSEncrypt() - decrypt.setPrivateKey(privateKey) - const decryptedKey = decrypt.decrypt(encryptedKey) - return decryptedKey -} export default async function () { try { - const res = await get(api.encrypt) - const RE = A(R(res.encryptedKey, res.privateKey), res.encryptedData).split('/') - return { + let RE = localStorage.getItem('osc') + if (RE) RE = JSON.parse(RE) + return RE ? { // oss账号信息 config: { region: 'oss-cn-shenzhen', @@ -36,6 +16,6 @@ export default async function () { }, // 上传成功url前置部分(成功回调没有返回url) preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' - } + } : {} } catch (e) { } } \ No newline at end of file diff --git a/src/pages/account/redirect/index.vue b/src/pages/account/redirect/index.vue index 3f19949..b320967 100644 --- a/src/pages/account/redirect/index.vue +++ b/src/pages/account/redirect/index.vue @@ -1,9 +1,11 @@