|
@@ -3,6 +3,7 @@ import { useUserStore } from '@/store/modules/users';
|
|
|
import { storage } from '@/utils/storage';
|
|
|
import { PageEnum } from '@/enums/pageEnum';
|
|
|
import { ACCESS_TOKEN, ACCESS_TOKEN_ADMIN } from '@/store/mutation-types';
|
|
|
+import { getAuthForAdmin } from '../utils';
|
|
|
|
|
|
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
|
|
|
|
@@ -63,10 +64,15 @@ export function createRouterGuards(router: Router) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- let token = storage.get(ACCESS_TOKEN);
|
|
|
- const authSource = sessionStorage.getItem('authSource');
|
|
|
- if (authSource === 'admin' && storage.get(ACCESS_TOKEN_ADMIN)) {
|
|
|
- token = storage.get(ACCESS_TOKEN_ADMIN);
|
|
|
+
|
|
|
+ // 为了处理课堂乐器后台预览课件的功能
|
|
|
+ // const authSource = sessionStorage.getItem('authSource');
|
|
|
+ const userAuth = getAuthForAdmin()
|
|
|
+ let token = "";
|
|
|
+ if (userAuth.authSource === 'admin') {
|
|
|
+ token = userAuth.Authorization;
|
|
|
+ } else {
|
|
|
+ token = storage.get(ACCESS_TOKEN)
|
|
|
}
|
|
|
// console.log(token, 'access token');
|
|
|
if (!token) {
|