71 lines
1.4 KiB
Vue
71 lines
1.4 KiB
Vue
<template>
|
|
<div id="app">
|
|
<router-view />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onMounted } from 'vue'
|
|
import { useAuthStore } from '@/stores/auth'
|
|
import { usePermissionStore } from '@/stores/permission'
|
|
|
|
const authStore = useAuthStore()
|
|
const permissionStore = usePermissionStore()
|
|
|
|
onMounted(async () => {
|
|
// 应用初始化时检查用户登录状态
|
|
const isLoggedIn = await authStore.checkAuthStatus()
|
|
|
|
// 如果用户已登录,初始化权限
|
|
if (isLoggedIn && authStore.userInfo) {
|
|
// 初始化用户权限
|
|
await permissionStore.initPermissions(authStore.userInfo)
|
|
|
|
// 获取菜单列表
|
|
await permissionStore.fetchMenuList()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
#app {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
}
|
|
|
|
// 全局样式重置
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
html, body {
|
|
height: 100%;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
font-size: 14px;
|
|
line-height: 1.5715;
|
|
color: rgba(0, 0, 0, 0.85);
|
|
background-color: #f0f2f5;
|
|
}
|
|
|
|
// 滚动条样式
|
|
::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
}
|
|
|
|
::-webkit-scrollbar-track {
|
|
background: #f1f1f1;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
background: #c1c1c1;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb:hover {
|
|
background: #a8a8a8;
|
|
}
|
|
</style> |