更新
This commit is contained in:
@@ -92,10 +92,24 @@ export function checkLogin() {
|
||||
|
||||
// 未登录,跳转到登录页
|
||||
if (currentRoute !== '/pages/ucenter/login/index') {
|
||||
// 保存当前页面路径,登录后可以返回
|
||||
const pages = getCurrentPages()
|
||||
if (pages && pages.length > 0) {
|
||||
const currentPage = pages[pages.length - 1]
|
||||
try {
|
||||
uni.setStorageSync('beforLoginUrl', {
|
||||
route: currentPage.route,
|
||||
options: currentPage.options
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('保存登录前页面失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user