|
@@ -1,6 +1,11 @@
|
|
|
import { defineStore } from 'pinia';
|
|
|
import { store } from '@/store';
|
|
|
-import { ACCESS_TOKEN, CURRENT_USER, IM_TOKEN } from '@/store/mutation-types';
|
|
|
+import {
|
|
|
+ ACCESS_TOKEN,
|
|
|
+ ACCESS_TOKEN_ADMIN,
|
|
|
+ CURRENT_USER,
|
|
|
+ IM_TOKEN
|
|
|
+} from '@/store/mutation-types';
|
|
|
import { storage } from '@/utils/storage';
|
|
|
import { userLogin, getUserInfo } from '@/api/user';
|
|
|
|
|
@@ -31,7 +36,13 @@ export const useUserStore = defineStore('user-store', {
|
|
|
return this.noReadCount;
|
|
|
},
|
|
|
getToken(): string {
|
|
|
- return this.token;
|
|
|
+ // 为了处理课堂乐器后台预览课件的功能
|
|
|
+ let Authorization = this.token;
|
|
|
+ const authSource = sessionStorage.getItem('authSource');
|
|
|
+ if (authSource === 'admin' && storage.get(ACCESS_TOKEN_ADMIN)) {
|
|
|
+ Authorization = storage.get(ACCESS_TOKEN_ADMIN);
|
|
|
+ }
|
|
|
+ return Authorization;
|
|
|
},
|
|
|
getImToken(): string {
|
|
|
return this.imToken;
|