<template>
|
</template>
|
|
<script setup>
|
import { onShow } from '@dcloudio/uni-app'
|
import { getToken } from '@/utils/request.js'
|
import config from '@/config/index.js'
|
|
/**
|
* 校验登录态:本地无 token 时重定向至登录页
|
*/
|
const _checkLoginStatus = () => {
|
if (getToken()) return
|
uni.reLaunch({ url: config.loginPage })
|
}
|
|
// 每次页面显示均校验登录态,避免退出登录后仍停留在首页
|
onShow(() => {
|
_checkLoginStatus()
|
})
|
</script>
|
|
<style scoped lang="scss">
|
</style>
|