| | |
| | | }); |
| | | //登录 |
| | | const onSubmit = async () => { |
| | | let res; |
| | | if (state.activeLoginName === 'accountUser') { |
| | | //账户密码登录 |
| | | const isValid = await loginFormRef.value.validate().catch(() => {}); |
| | | if (!isValid) return; |
| | | const res = await PostLogin({ |
| | | res = await PostLogin({ |
| | | user: state.loginForm.account, |
| | | pass: state.loginForm.pwd, |
| | | client: LOGIN_CLIENT, |
| | |
| | | if (!res.json_ok) { |
| | | return ElMessage.error(res.json_msg); |
| | | } |
| | | userInfo.set(res); |
| | | Local.set(userInfoKey, { |
| | | id: res.id, |
| | | realName: res.real_name, |
| | |
| | | //手机登录 |
| | | const isValid = await formPhoneRef.value.validate().catch(() => {}); |
| | | if (!isValid) return; |
| | | const res = await loginMessageUser({ |
| | | res = await loginMessageUser({ |
| | | phone: state.loginPhoneForm.phoneUser, |
| | | code: state.loginPhoneForm.verifyCode, |
| | | client: LOGIN_CLIENT, |
| | |
| | | email: res.email, |
| | | } as any); |
| | | LoginInfo.set(res.hswatersession, state.loginPhoneForm.phoneUser); |
| | | userInfo.set(res); |
| | | } |
| | | Local.set('isNewUser', !res?.web_login); |
| | | isShowLogin.value = false; |
| | | isLoginStatus.value = true; |
| | | window.location.reload(); |