52 lines
1.2 KiB
Vue
52 lines
1.2 KiB
Vue
<template>
|
||
<view class="start-page">
|
||
<text class="app-name">绥时录</text>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { onLoad } from '@dcloudio/uni-app'
|
||
import store from '@/store'
|
||
import { checkPermission } from '@/services/auth'
|
||
import { loadConfig } from '@/services/api'
|
||
|
||
onLoad(async () => {
|
||
// 先加载运行时配置(BASE_URL 等),再发任何请求
|
||
await loadConfig()
|
||
|
||
if (store.token) {
|
||
checkPermission().then((res) => {
|
||
if (res.code === 200) {
|
||
store.isPermission = true
|
||
uni.reLaunch({ url: '/pages/portal/index' })
|
||
} else if (res.code === 403) {
|
||
store.isPermission = false
|
||
uni.reLaunch({ url: '/pages/portal/index' })
|
||
} else if (res.code === 401) {
|
||
uni.reLaunch({ url: '/pages/login/index' })
|
||
}
|
||
}).catch(() => {
|
||
uni.reLaunch({ url: '/pages/login/index' })
|
||
})
|
||
} else {
|
||
uni.reLaunch({ url: '/pages/login/index' })
|
||
}
|
||
})
|
||
</script>
|
||
|
||
<style scoped>
|
||
.start-page {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 100vh;
|
||
background-color: transparent;
|
||
}
|
||
|
||
.app-name {
|
||
font-size: 48rpx;
|
||
font-weight: bold;
|
||
color: #1A73EC;
|
||
}
|
||
</style>
|