Files
ss-tiku-manage-h5/src/App.vue
2026-01-30 19:26:21 +08:00

42 lines
846 B
Vue

<script setup>
import config from './config'
import { getToken } from '@/utils/auth'
import { useConfigStore } from '@/store'
import { useUserStore } from '@/store'
import { getCurrentInstance } from "vue"
import { onLaunch } from '@dcloudio/uni-app'
const { proxy } = getCurrentInstance()
onLaunch(() => {
initApp()
})
// 初始化应用
function initApp() {
// 初始化应用配置
initConfig()
// 检查用户登录状态
//#ifdef H5
checkLogin()
//#endif
}
function initConfig() {
useConfigStore().setConfig(config)
}
function checkLogin() {
if (!getToken()) {
proxy.$tab.reLaunch('/pages/login')
} else {
// 重新获取用户权限
useUserStore().getInfo()
}
}
</script>
<style lang="scss">
@import '@/static/scss/index.scss';
</style>