From 337498efbc7ac9a5a8b4f47333871f2f06eb4130 Mon Sep 17 00:00:00 2001 From: zzyuan <781948537@qq.com> Date: Wed, 9 Jul 2025 17:15:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 5d83b5a2..a0517bc4 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,6 +1,6 @@ import { login, logout, getInfo, refreshToken, getPhoneCode, isLogin,isAdmin} from '@/api/login' import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth' - + import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm'; // 更严格的手机号和邮箱正则表达式 const phonePattern = /^(\+86)?1[3-9]\d{9}$/ // 支持前缀 +86 const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ @@ -90,7 +90,12 @@ const user = { // 登录 Login({ commit }, userInfo) { - const payload = buildPayload(userInfo) + let param = { + ...userInfo + } + param.username = encryptWithSM4(userInfo.username) + param.password = encryptWithSM4(userInfo.password) + const payload = buildPayload(param) return login(payload) .then(res => { const { access_token, expires_in } = res.data