diff --git a/sgzb-ui/.env.production b/sgzb-ui/.env.production index bae011af..0f4b7e2d 100644 --- a/sgzb-ui/.env.production +++ b/sgzb-ui/.env.production @@ -5,4 +5,7 @@ VUE_APP_TITLE = 施工装备管理系统 ENV = 'production' # 若依管理系统/生产环境 -VUE_APP_BASE_API = '/gl/dev-api' # 南网需加上/gl +VUE_APP_BASE_API=dev-api + +# 南网需加上/gl +# VUE_APP_BASE_API = '/gl/dev-api' diff --git a/sgzb-ui/src/store/modules/user.js b/sgzb-ui/src/store/modules/user.js index 5cf92bb9..230569b0 100644 --- a/sgzb-ui/src/store/modules/user.js +++ b/sgzb-ui/src/store/modules/user.js @@ -5,27 +5,31 @@ import { Notification, MessageBox, Message, Loading } from 'element-ui' const secretKey = 'CCNWrpassWordKey' async function encryptData(data, keyStr) { - const keyUint8 = new TextEncoder().encode(keyStr); - const key = await crypto.subtle.importKey( + try { + const keyUint8 = new TextEncoder().encode(keyStr); + const key = await crypto.subtle.importKey( 'raw', keyUint8, { name: 'AES-CBC', length: 256 }, false, ['encrypt'] - ); + ); - const iv = crypto.getRandomValues(new Uint8Array(16)); - const cipherTextBuffer = await crypto.subtle.encrypt( + const iv = crypto.getRandomValues(new Uint8Array(16)); + const cipherTextBuffer = await crypto.subtle.encrypt( { name: 'AES-CBC', iv }, key, new TextEncoder().encode(data) - ); + ); - const combined = new Uint8Array(iv.length + cipherTextBuffer.byteLength); - combined.set(iv, 0); - combined.set(new Uint8Array(cipherTextBuffer), iv.length); + const combined = new Uint8Array(iv.length + cipherTextBuffer.byteLength); + combined.set(iv, 0); + combined.set(new Uint8Array(cipherTextBuffer), iv.length); - return btoa(String.fromCharCode.apply(null, combined)); + return btoa(String.fromCharCode.apply(null, combined)); + } catch (error) { + console.log('🚀 ~ encryptData ~ error:', error); + } } const user = {