feat:更新朋友圈功能
This commit is contained in:
@@ -91,10 +91,14 @@ const userStore = useUserStore()
|
||||
|
||||
const loginFormRef = ref()
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
const storageLoginForm = getLocalStorage('loginForm')
|
||||
if (storageLoginForm) {
|
||||
authStore.loginForm = JSON.parse(storageLoginForm)
|
||||
|
||||
if (!authStore.isLogout) {
|
||||
await doLogin('common')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -109,15 +113,7 @@ const handleLogin = async (type: ILoginType) => {
|
||||
authStore.loginLoading = true
|
||||
|
||||
try {
|
||||
await authStore.handleLogin(type)
|
||||
userStore.handleSession(authStore.session)
|
||||
|
||||
// 2. 存储账户密码到localStorage中
|
||||
if (authStore.loginForm.isRemember) {
|
||||
setLocalStorage('loginForm', JSON.stringify(authStore.loginForm))
|
||||
}
|
||||
|
||||
await router.push('/record')
|
||||
await doLogin(type)
|
||||
} finally {
|
||||
authStore.loginLoading = false
|
||||
}
|
||||
@@ -127,4 +123,16 @@ const handleLogin = async (type: ILoginType) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const doLogin = async (type: ILoginType) => {
|
||||
await authStore.handleLogin(type)
|
||||
userStore.handleSession(authStore.session)
|
||||
|
||||
// 2. 存储账户密码到localStorage中
|
||||
if (authStore.loginForm.isRemember) {
|
||||
setLocalStorage('loginForm', JSON.stringify(authStore.loginForm))
|
||||
}
|
||||
|
||||
await router.push('/record')
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user