测试问题修改2

This commit is contained in:
zzyuan 2025-07-09 17:15:23 +08:00
parent 5e529ed911
commit 337498efbc
1 changed files with 7 additions and 2 deletions

View File

@ -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