修复h5下登录问题

This commit is contained in:
Jason 2023-01-17 15:46:07 +08:00
parent 9e5bd06e37
commit 9595769d46
1 changed files with 4 additions and 4 deletions

View File

@ -167,7 +167,6 @@ import { useAppStore } from '@/stores/app'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import cache from '@/utils/cache' import cache from '@/utils/cache'
import { isWeixinClient } from '@/utils/client' import { isWeixinClient } from '@/utils/client'
import { currentPage } from '@/utils/util'
// #ifdef H5 // #ifdef H5
import wechatOa from '@/utils/wechat' import wechatOa from '@/utils/wechat'
// #endif // #endif
@ -285,17 +284,18 @@ const loginHandle = async (data: any) => {
await userStore.getUser() await userStore.getUser()
uni.$u.toast('登录成功') uni.$u.toast('登录成功')
uni.hideLoading() uni.hideLoading()
if (getCurrentPages().length > 1) { const pages = getCurrentPages()
if (pages.length > 1) {
const prevPage = pages.at(-2)
uni.navigateBack({ uni.navigateBack({
success: () => { success: () => {
// @ts-ignore // @ts-ignore
const { onLoad, options } = currentPage() const { onLoad, options } = prevPage
// //
onLoad && onLoad(options) onLoad && onLoad(options)
} }
}) })
} else if (cache.get(BACK_URL)) { } else if (cache.get(BACK_URL)) {
console.log(BACK_URL, cache.get(BACK_URL))
uni.redirectTo({ url: cache.get(BACK_URL) }) uni.redirectTo({ url: cache.get(BACK_URL) })
} else { } else {
uni.reLaunch({ uni.reLaunch({