|
@@ -1,6 +1,17 @@
|
|
|
import { login, logout, getInfo } from '@/api/login'
|
|
|
import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
|
import defAva from '@/assets/images/profile.jpg'
|
|
|
+import CryptoJS from 'crypto-js';
|
|
|
+
|
|
|
+const SECRET_KEY = 'qwertasdfg159753'
|
|
|
+function AES_ECB_ENCRYPT(text) {
|
|
|
+ var keyHex = CryptoJS.enc.Utf8.parse(SECRET_KEY);
|
|
|
+ var messageHex = CryptoJS.enc.Utf8.parse(text);
|
|
|
+ var encrypted = CryptoJS.AES.encrypt(messageHex, keyHex, {
|
|
|
+ "mode": CryptoJS.mode.ECB
|
|
|
+ });
|
|
|
+ return encrypted.toString();
|
|
|
+}
|
|
|
|
|
|
const useUserStore = defineStore(
|
|
|
'user',
|
|
@@ -17,7 +28,7 @@ const useUserStore = defineStore(
|
|
|
// 登录
|
|
|
login(userInfo) {
|
|
|
const username = userInfo.username.trim()
|
|
|
- const password = userInfo.password
|
|
|
+ const password = AES_ECB_ENCRYPT(userInfo.password)
|
|
|
const code = userInfo.code
|
|
|
const uuid = userInfo.uuid
|
|
|
return new Promise((resolve, reject) => {
|