更新:登录功能

This commit is contained in:
2025-11-04 12:37:04 +08:00
commit a21fb92916
897 changed files with 51500 additions and 0 deletions

16
hooks/usePageAuth.ts Normal file
View File

@@ -0,0 +1,16 @@
// hooks/usePageAuth.ts
import { onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/stores/user'
export function usePageAuth(redirect = '/pages/login/login') {
const store = useUserStore()
onShow(() => {
if (!store.token) {
uni.showToast({ title: '请先登录', icon: 'none' })
setTimeout(() => {
uni.reLaunch({ url: redirect })
}, 800)
}
})
}