|
@@ -45,27 +45,39 @@ router.beforeEach((to, from , next) => {
|
|
|
toLogin()
|
|
|
}
|
|
|
})
|
|
|
-let userInfo = null
|
|
|
+let userInfo = {
|
|
|
+ isAdmin: true
|
|
|
+}
|
|
|
let themeConfig = null
|
|
|
export const initMainRouter = async () => {
|
|
|
if (localStorage.getItem('ss_token')) {
|
|
|
- const loading = ElLoading.service({
|
|
|
- lock: true,
|
|
|
- text: '加载中……',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)',
|
|
|
- })
|
|
|
- await Promise.all([
|
|
|
- mockGetUserInfo(),
|
|
|
- mockGetConfig()
|
|
|
- ]).then(async ([user, config]) => {
|
|
|
- userInfo = user.data
|
|
|
- console.log('管理员:', userInfo?.isAdmin)
|
|
|
- if (userInfo?.isAdmin) {
|
|
|
- router.addRoute(manageRouter)
|
|
|
- }
|
|
|
- loading.close()
|
|
|
- themeConfig = config.data
|
|
|
- initRootVar(config.data)
|
|
|
+ // const loading = ElLoading.service({
|
|
|
+ // lock: true,
|
|
|
+ // text: '加载中……',
|
|
|
+ // background: 'rgba(0, 0, 0, 0.7)',
|
|
|
+ // })
|
|
|
+ // await Promise.all([
|
|
|
+ // mockGetUserInfo(),
|
|
|
+ // mockGetConfig()
|
|
|
+ // ]).then(async ([user, config]) => {
|
|
|
+ // userInfo = user.data
|
|
|
+ // console.log('管理员:', userInfo?.isAdmin)
|
|
|
+ // if (userInfo?.isAdmin) {
|
|
|
+ // router.addRoute(manageRouter)
|
|
|
+ // }
|
|
|
+ // loading.close()
|
|
|
+ // themeConfig = config.data
|
|
|
+ // initRootVar(config.data)
|
|
|
+ // })
|
|
|
+ initRootVar({
|
|
|
+ mainColor: '#f82828',
|
|
|
+ textColor1: 'rgba(48,49,51,1)',
|
|
|
+ textColor2: 'rgba(96,98,102,1)',
|
|
|
+ textColor3: 'rgba(144,147,153,1)',
|
|
|
+ textColor4: 'rgba(192,196,204,1)',
|
|
|
+ logo: 'https://element-plus.org/images/element-plus-logo.svg',
|
|
|
+ title: '海南社管智慧搜索平台',
|
|
|
+ subTitle: 'HAI NAN SHE GUAN ZHI HUI SOU SUO PING TAI'
|
|
|
})
|
|
|
} else if (location.pathname !== '/login') {
|
|
|
toLogin()
|