2025-04-23 10:37:50 +08:00
|
|
|
<script setup>
|
2025-04-23 20:53:28 +08:00
|
|
|
import config from './config'
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
import { useConfigStore } from '@/store'
|
|
|
|
import { getCurrentInstance } from "vue"
|
2025-04-23 10:37:50 +08:00
|
|
|
import { onLaunch } from '@dcloudio/uni-app'
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
2025-04-13 09:49:11 +08:00
|
|
|
onLaunch(() => {
|
|
|
|
initApp()
|
2025-04-23 10:37:50 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
// 初始化应用
|
2025-04-23 20:53:28 +08:00
|
|
|
function initApp() {
|
|
|
|
// 初始化应用配置
|
|
|
|
initConfig()
|
2025-04-23 10:37:50 +08:00
|
|
|
// 检查用户登录状态
|
|
|
|
//#ifdef H5
|
|
|
|
checkLogin()
|
|
|
|
//#endif
|
2025-04-23 20:53:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function initConfig() {
|
|
|
|
useConfigStore().setConfig(config)
|
2025-04-23 10:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function checkLogin() {
|
|
|
|
if (!getToken()) {
|
|
|
|
proxy.$tab.reLaunch('/pages/login')
|
|
|
|
}
|
2025-04-23 20:53:28 +08:00
|
|
|
}
|
2022-08-01 08:14:57 +08:00
|
|
|
</script>
|
2025-04-23 10:37:50 +08:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '@/static/scss/index.scss'
|
2022-08-01 08:14:57 +08:00
|
|
|
</style>
|