解决登录显示、首页显示bug
This commit is contained in:
@@ -152,12 +152,22 @@ export function responsiveState() {
|
||||
export function goToLogin(redirectUrl?: string | null) {
|
||||
try {
|
||||
const target = redirectUrl != null && redirectUrl.length > 0 ? redirectUrl : ''
|
||||
if (target.length > 0) {
|
||||
const redirect = encodeURIComponent(target)
|
||||
uni.navigateTo({ url: `/pages/user/login?redirect=${redirect}` })
|
||||
} else {
|
||||
uni.navigateTo({ url: '/pages/user/login' })
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前操作需要登录,是否前往登录页继续?',
|
||||
confirmText: '去登录',
|
||||
cancelText: '先逛逛',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
if (target.length > 0) {
|
||||
const redirect = encodeURIComponent(target)
|
||||
uni.navigateTo({ url: `/pages/user/login?redirect=${redirect}` })
|
||||
} else {
|
||||
uni.navigateTo({ url: '/pages/user/login' })
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
uni.navigateTo({ url: '/pages/user/login' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user