debug
All checks were successful
Deploy to Server / deploy (push) Successful in 25s

This commit is contained in:
jeremygan2021
2026-02-28 13:01:02 +08:00
parent b778fbb923
commit b31e8fff09
7 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
import Taro from '@tarojs/taro'
/**
* 检查用户是否登录
* @returns boolean 是否已登录
*/
export const checkLogin = (): boolean => {
const token = Taro.getStorageSync('token')
if (!token) {
Taro.showModal({
title: '提示',
content: '请先登录小程序',
confirmText: '去登录',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
Taro.switchTab({
url: '/pages/user/index'
})
}
}
})
return false
}
return true
}