auth.js
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import qianKunStart from './index';
import store from '@/store';
import BaseService from '@/services/Base';
import { getStorageToken } from '@/utils/storage/user';
const microAppStart = () => {
const token = getStorageToken();
/**
* @name 已登录状态获取服务端微应用注册表
*/
if (token) {
// 处理token状态共享
store.dispatch('app/setToken', token);
}
const getBaseService = new BaseService();
getBaseService.getMockConfig().then(res => {
let menuPathArr = [];
let resData = res.axios,
resBaseURL = resData.baseURL,
resSubApps = resData.subAppRegisterConfig;
// 测试用的
//resBaseURL = 'https://eshield.test.glsx.com.cn';
// 全局接口url配置
store.dispatch('app/updateBaseURL', resBaseURL);
localStorage.setItem('BASE_URL', resBaseURL);
// 获取子系统路径结合
resSubApps['apps'].forEach(item => {
menuPathArr.push(item.activeRule);
});
store.dispatch('app/updateMenuPathArr', menuPathArr);
// 子应用注册配置
qianKunStart(resSubApps, resBaseURL);
}, err => {
})
}
export default microAppStart