测试问题修改2
This commit is contained in:
parent
5e529ed911
commit
337498efbc
|
|
@ -1,6 +1,6 @@
|
||||||
import { login, logout, getInfo, refreshToken, getPhoneCode, isLogin,isAdmin} from '@/api/login'
|
import { login, logout, getInfo, refreshToken, getPhoneCode, isLogin,isAdmin} from '@/api/login'
|
||||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||||
|
import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm';
|
||||||
// 更严格的手机号和邮箱正则表达式
|
// 更严格的手机号和邮箱正则表达式
|
||||||
const phonePattern = /^(\+86)?1[3-9]\d{9}$/ // 支持前缀 +86
|
const phonePattern = /^(\+86)?1[3-9]\d{9}$/ // 支持前缀 +86
|
||||||
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
||||||
|
|
@ -90,7 +90,12 @@ const user = {
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
Login({ commit }, userInfo) {
|
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)
|
return login(payload)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const { access_token, expires_in } = res.data
|
const { access_token, expires_in } = res.data
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue