🎈 perf:避免表单值被后续函数修改导致页面异常

pull/499/head
preschool 2024-08-15 10:08:23 +08:00 committed by 李浪
parent d3f38c690e
commit 16c919ce02
2 changed files with 10 additions and 8 deletions

View File

@ -276,10 +276,11 @@ const handleLogin = async (params) => {
const code = route?.query?.code as string const code = route?.query?.code as string
const state = route?.query?.state as string const state = route?.query?.state as string
const loginDataLoginForm = { ...loginData.loginForm }
const res = await LoginApi.login({ const res = await LoginApi.login({
// //
username: loginData.loginForm.username, username: loginDataLoginForm.username,
password: loginData.loginForm.password, password: loginDataLoginForm.password,
captchaVerification: params.captchaVerification, captchaVerification: params.captchaVerification,
// //
socialCode: code, socialCode: code,
@ -294,8 +295,8 @@ const handleLogin = async (params) => {
text: '正在加载系统中...', text: '正在加载系统中...',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
if (loginData.loginForm.rememberMe) { if (loginDataLoginForm.rememberMe) {
authUtil.setLoginForm(loginData.loginForm) authUtil.setLoginForm(loginDataLoginForm)
} else { } else {
authUtil.removeLoginForm() authUtil.removeLoginForm()
} }

View File

@ -249,8 +249,9 @@ const handleLogin = async (params) => {
if (!data) { if (!data) {
return return
} }
loginData.loginForm.captchaVerification = params.captchaVerification const loginDataLoginForm = { ...loginData.loginForm }
const res = await LoginApi.login(loginData.loginForm) loginDataLoginForm.captchaVerification = params.captchaVerification
const res = await LoginApi.login(loginDataLoginForm)
if (!res) { if (!res) {
return return
} }
@ -259,8 +260,8 @@ const handleLogin = async (params) => {
text: '正在加载系统中...', text: '正在加载系统中...',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
if (loginData.loginForm.rememberMe) { if (loginDataLoginForm.rememberMe) {
authUtil.setLoginForm(loginData.loginForm) authUtil.setLoginForm(loginDataLoginForm)
} else { } else {
authUtil.removeLoginForm() authUtil.removeLoginForm()
} }