module-menu-vue 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -4
- package/package.json +1 -1
- package/src/assets/personalCenter.svg +15 -15
- package/src/assets/systemManage.svg +15 -15
- package/src/components/Menu/ModuleMenu.vue +312 -309
- package/src/components/Menu/constant.js +504 -504
- package/src/components/Menu/menu.css +106 -106
- package/src/components/Menu/service.js +25 -25
- package/src/components/Portal/PortalBtn.vue +30 -30
- package/src/components/Tenant/TenantList.vue +70 -70
- package/src/components/Tenant/service.js +17 -17
- package/src/components/User/UserInfo.vue +213 -213
- package/src/components/User/constant.js +11 -11
- package/src/components/User/service.js +14 -14
- package/src/components/Util/axios.js +89 -89
- package/src/components/Util/config.js +13 -13
- package/src/components/Util/permessionUtils.js +25 -25
- package/src/components/Util/userInfo.js +96 -96
- package/vue.config.js +34 -34
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const address = location.hostname
|
|
2
|
-
const port = location.port
|
|
3
|
-
const baseCof =
|
|
4
|
-
process.env.NODE_ENV === 'production' ?
|
|
5
|
-
{
|
|
6
|
-
baseSever: `https://${address}:${port}`,
|
|
7
|
-
basePath: `/app/cmcc/data`,
|
|
8
|
-
}
|
|
9
|
-
:
|
|
10
|
-
{
|
|
11
|
-
baseSever: location.origin,
|
|
12
|
-
basePath: '/cmcc/data',
|
|
13
|
-
};
|
|
1
|
+
const address = location.hostname
|
|
2
|
+
const port = location.port
|
|
3
|
+
const baseCof =
|
|
4
|
+
process.env.NODE_ENV === 'production' ?
|
|
5
|
+
{
|
|
6
|
+
baseSever: `https://${address}:${port}`,
|
|
7
|
+
basePath: `/app/cmcc/data`,
|
|
8
|
+
}
|
|
9
|
+
:
|
|
10
|
+
{
|
|
11
|
+
baseSever: location.origin,
|
|
12
|
+
basePath: '/cmcc/data',
|
|
13
|
+
};
|
|
14
14
|
export default baseCof;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import Axios from './axios';
|
|
2
|
-
const localStorageToken = localStorage.getItem('ACCESS_TOKEN')
|
|
3
|
-
const stash = sessionStorage.getItem('stash')
|
|
4
|
-
const DEFAULT_LOGOUT_URL = localStorageToken ? '/admin-ui/login' : stash === 'GZW' ? '/data-platform/#/login' : stash === 'PANWEI' ? '/bigdata-portal/#/login' : '/#/login'
|
|
5
|
-
import { integrationLogout } from '../User/service.js'
|
|
6
|
-
// 校验token是否失效
|
|
7
|
-
export const checkToken = async (token) => {
|
|
8
|
-
if (localStorageToken) {
|
|
9
|
-
await integrationLogout()
|
|
10
|
-
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
11
|
-
localStorage.clear();
|
|
12
|
-
sessionStorage.clear();
|
|
13
|
-
location.href = DEFAULT_LOGOUT_URL;
|
|
14
|
-
}});
|
|
15
|
-
} else {
|
|
16
|
-
const url = stash === 'GZW' ? `/data-platform/auth/oauth/check_token?token=${token}` : `/auth/oauth/check_token?token=${token}`
|
|
17
|
-
Axios('get', url, '', {})
|
|
18
|
-
.then().catch(() =>{
|
|
19
|
-
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
20
|
-
localStorage.clear();
|
|
21
|
-
sessionStorage.clear();
|
|
22
|
-
location.href = DEFAULT_LOGOUT_URL;
|
|
23
|
-
}});
|
|
24
|
-
})
|
|
25
|
-
}
|
|
1
|
+
import Axios from './axios';
|
|
2
|
+
const localStorageToken = localStorage.getItem('ACCESS_TOKEN')
|
|
3
|
+
const stash = sessionStorage.getItem('stash')
|
|
4
|
+
const DEFAULT_LOGOUT_URL = localStorageToken ? '/admin-ui/login' : stash === 'GZW' ? '/data-platform/#/login' : stash === 'PANWEI' ? '/bigdata-portal/#/login' : '/#/login'
|
|
5
|
+
import { integrationLogout } from '../User/service.js'
|
|
6
|
+
// 校验token是否失效
|
|
7
|
+
export const checkToken = async (token) => {
|
|
8
|
+
if (localStorageToken) {
|
|
9
|
+
await integrationLogout()
|
|
10
|
+
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
11
|
+
localStorage.clear();
|
|
12
|
+
sessionStorage.clear();
|
|
13
|
+
location.href = DEFAULT_LOGOUT_URL;
|
|
14
|
+
}});
|
|
15
|
+
} else {
|
|
16
|
+
const url = stash === 'GZW' ? `/data-platform/auth/oauth/check_token?token=${token}` : `/auth/oauth/check_token?token=${token}`
|
|
17
|
+
Axios('get', url, '', {})
|
|
18
|
+
.then().catch(() =>{
|
|
19
|
+
this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
|
|
20
|
+
localStorage.clear();
|
|
21
|
+
sessionStorage.clear();
|
|
22
|
+
location.href = DEFAULT_LOGOUT_URL;
|
|
23
|
+
}});
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
26
|
}
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取认证相关的localStorage/SessionStorage
|
|
3
|
-
*/
|
|
4
|
-
function getStore(params) {
|
|
5
|
-
let { name, debug } = params;
|
|
6
|
-
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
7
|
-
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
8
|
-
if (token) {
|
|
9
|
-
let storageStr = '';
|
|
10
|
-
if (name === 'access_token') {
|
|
11
|
-
storageStr = localStorage.getItem('ACCESS_TOKEN');
|
|
12
|
-
} else if (name === 'tenantId') {
|
|
13
|
-
// 暂定当前租户 curTenantId
|
|
14
|
-
storageStr = localStorage.getItem('curTenantId');
|
|
15
|
-
} else if (name === 'userName') {
|
|
16
|
-
// 获取当前登录用户名称
|
|
17
|
-
storageStr = localStorage.getItem('userName');
|
|
18
|
-
} else if (name === 'userId') {
|
|
19
|
-
// 获取当前登录用户Id
|
|
20
|
-
storageStr = localStorage.getItem('userId');
|
|
21
|
-
}
|
|
22
|
-
return storageStr;
|
|
23
|
-
} else {
|
|
24
|
-
const keyName = 'bigdata-';
|
|
25
|
-
name = keyName + name;
|
|
26
|
-
let obj = {};
|
|
27
|
-
let content;
|
|
28
|
-
obj = sessionStorage.getItem(name);
|
|
29
|
-
if (!obj || Object.keys(obj).length === 0) obj = localStorage.getItem(name);
|
|
30
|
-
if (!obj || Object.keys(obj).length === 0) return '';
|
|
31
|
-
try {
|
|
32
|
-
obj = JSON.parse(obj);
|
|
33
|
-
} catch (e) {
|
|
34
|
-
return '';
|
|
35
|
-
}
|
|
36
|
-
if (debug) {
|
|
37
|
-
return '';
|
|
38
|
-
}
|
|
39
|
-
if (obj.dataType === 'string') {
|
|
40
|
-
content = obj.content;
|
|
41
|
-
} else if (obj.dataType === 'number') {
|
|
42
|
-
content = Number(obj.content);
|
|
43
|
-
} else if (obj.dataType === 'boolean') {
|
|
44
|
-
// eslint-disable-next-line no-eval
|
|
45
|
-
content = eval(obj.content);
|
|
46
|
-
} else if (obj.dataType === 'object') {
|
|
47
|
-
content = obj.content;
|
|
48
|
-
}
|
|
49
|
-
return content;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export default getStore;
|
|
53
|
-
|
|
54
|
-
export const getUserName = () => {
|
|
55
|
-
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
56
|
-
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
57
|
-
if (token) {
|
|
58
|
-
const name = getStore({ name: 'userName' });
|
|
59
|
-
if (!name) {
|
|
60
|
-
return '';
|
|
61
|
-
}
|
|
62
|
-
return name;
|
|
63
|
-
} else {
|
|
64
|
-
const userInfo = getStore({ name: 'userInfo' });
|
|
65
|
-
if (userInfo && Object.keys(userInfo).length > 0 && userInfo.username) {
|
|
66
|
-
console.log('username', userInfo.username)
|
|
67
|
-
return userInfo.username;
|
|
68
|
-
}
|
|
69
|
-
return '';
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const getUserId = () => {
|
|
74
|
-
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
75
|
-
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
76
|
-
if (token) {
|
|
77
|
-
const id = getStore({ name: 'userId' });
|
|
78
|
-
if (!id) {
|
|
79
|
-
return '';
|
|
80
|
-
}
|
|
81
|
-
return id;
|
|
82
|
-
} else {
|
|
83
|
-
const userInfo = getStore({ name: 'userInfo' });
|
|
84
|
-
if (userInfo && Object.keys(userInfo).length > 0 && userInfo.id) {
|
|
85
|
-
return userInfo.id;
|
|
86
|
-
}
|
|
87
|
-
return '';
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 获取是否拥有系统管理左侧菜单权限标识
|
|
93
|
-
* @returns
|
|
94
|
-
*/
|
|
95
|
-
export const getIsHaveSystemManagementPermissionFlag = () => {
|
|
96
|
-
return getStore({ name: 'isHaveSystemManagementPermission' });
|
|
1
|
+
/**
|
|
2
|
+
* 获取认证相关的localStorage/SessionStorage
|
|
3
|
+
*/
|
|
4
|
+
function getStore(params) {
|
|
5
|
+
let { name, debug } = params;
|
|
6
|
+
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
7
|
+
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
8
|
+
if (token) {
|
|
9
|
+
let storageStr = '';
|
|
10
|
+
if (name === 'access_token') {
|
|
11
|
+
storageStr = localStorage.getItem('ACCESS_TOKEN');
|
|
12
|
+
} else if (name === 'tenantId') {
|
|
13
|
+
// 暂定当前租户 curTenantId
|
|
14
|
+
storageStr = localStorage.getItem('curTenantId');
|
|
15
|
+
} else if (name === 'userName') {
|
|
16
|
+
// 获取当前登录用户名称
|
|
17
|
+
storageStr = localStorage.getItem('userName');
|
|
18
|
+
} else if (name === 'userId') {
|
|
19
|
+
// 获取当前登录用户Id
|
|
20
|
+
storageStr = localStorage.getItem('userId');
|
|
21
|
+
}
|
|
22
|
+
return storageStr;
|
|
23
|
+
} else {
|
|
24
|
+
const keyName = 'bigdata-';
|
|
25
|
+
name = keyName + name;
|
|
26
|
+
let obj = {};
|
|
27
|
+
let content;
|
|
28
|
+
obj = sessionStorage.getItem(name);
|
|
29
|
+
if (!obj || Object.keys(obj).length === 0) obj = localStorage.getItem(name);
|
|
30
|
+
if (!obj || Object.keys(obj).length === 0) return '';
|
|
31
|
+
try {
|
|
32
|
+
obj = JSON.parse(obj);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
if (debug) {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
if (obj.dataType === 'string') {
|
|
40
|
+
content = obj.content;
|
|
41
|
+
} else if (obj.dataType === 'number') {
|
|
42
|
+
content = Number(obj.content);
|
|
43
|
+
} else if (obj.dataType === 'boolean') {
|
|
44
|
+
// eslint-disable-next-line no-eval
|
|
45
|
+
content = eval(obj.content);
|
|
46
|
+
} else if (obj.dataType === 'object') {
|
|
47
|
+
content = obj.content;
|
|
48
|
+
}
|
|
49
|
+
return content;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export default getStore;
|
|
53
|
+
|
|
54
|
+
export const getUserName = () => {
|
|
55
|
+
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
56
|
+
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
57
|
+
if (token) {
|
|
58
|
+
const name = getStore({ name: 'userName' });
|
|
59
|
+
if (!name) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
return name;
|
|
63
|
+
} else {
|
|
64
|
+
const userInfo = getStore({ name: 'userInfo' });
|
|
65
|
+
if (userInfo && Object.keys(userInfo).length > 0 && userInfo.username) {
|
|
66
|
+
console.log('username', userInfo.username)
|
|
67
|
+
return userInfo.username;
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const getUserId = () => {
|
|
74
|
+
// 使用 ACCESS_TOKEN 判断是否是一体化
|
|
75
|
+
const token = localStorage.getItem('ACCESS_TOKEN')
|
|
76
|
+
if (token) {
|
|
77
|
+
const id = getStore({ name: 'userId' });
|
|
78
|
+
if (!id) {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
return id;
|
|
82
|
+
} else {
|
|
83
|
+
const userInfo = getStore({ name: 'userInfo' });
|
|
84
|
+
if (userInfo && Object.keys(userInfo).length > 0 && userInfo.id) {
|
|
85
|
+
return userInfo.id;
|
|
86
|
+
}
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 获取是否拥有系统管理左侧菜单权限标识
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
export const getIsHaveSystemManagementPermissionFlag = () => {
|
|
96
|
+
return getStore({ name: 'isHaveSystemManagementPermission' });
|
|
97
97
|
}
|
package/vue.config.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const url = 'https://192.168.108.203:31950'
|
|
2
|
-
module.exports = {
|
|
3
|
-
lintOnSave: true,
|
|
4
|
-
productionSourceMap: false,
|
|
5
|
-
css: {
|
|
6
|
-
// 忽略 CSS order 顺序警告
|
|
7
|
-
extract: { ignoreOrder: true },
|
|
8
|
-
// 查看CSS属于哪个css文件
|
|
9
|
-
sourceMap: process.env.NODE_ENV === "development",
|
|
10
|
-
},
|
|
11
|
-
// 配置转发代理
|
|
12
|
-
devServer: {
|
|
13
|
-
// disableHostCheck: true,
|
|
14
|
-
port: 8080,
|
|
15
|
-
proxy: {
|
|
16
|
-
"/": {
|
|
17
|
-
// target:' https://10.136.106.82:30011',
|
|
18
|
-
target: url,
|
|
19
|
-
ws: false, // 需要websocket 开启
|
|
20
|
-
changOrigin: true, //允许跨域
|
|
21
|
-
pathRewrite: {
|
|
22
|
-
"^/": "/",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
'/admin-api': {
|
|
26
|
-
target: url,
|
|
27
|
-
changeOrigin: true,
|
|
28
|
-
pathRewrite: { '^': '' },
|
|
29
|
-
}
|
|
30
|
-
// 3.5 以后不需要再配置
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
1
|
+
const url = 'https://192.168.108.203:31950'
|
|
2
|
+
module.exports = {
|
|
3
|
+
lintOnSave: true,
|
|
4
|
+
productionSourceMap: false,
|
|
5
|
+
css: {
|
|
6
|
+
// 忽略 CSS order 顺序警告
|
|
7
|
+
extract: { ignoreOrder: true },
|
|
8
|
+
// 查看CSS属于哪个css文件
|
|
9
|
+
sourceMap: process.env.NODE_ENV === "development",
|
|
10
|
+
},
|
|
11
|
+
// 配置转发代理
|
|
12
|
+
devServer: {
|
|
13
|
+
// disableHostCheck: true,
|
|
14
|
+
port: 8080,
|
|
15
|
+
proxy: {
|
|
16
|
+
"/": {
|
|
17
|
+
// target:' https://10.136.106.82:30011',
|
|
18
|
+
target: url,
|
|
19
|
+
ws: false, // 需要websocket 开启
|
|
20
|
+
changOrigin: true, //允许跨域
|
|
21
|
+
pathRewrite: {
|
|
22
|
+
"^/": "/",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
'/admin-api': {
|
|
26
|
+
target: url,
|
|
27
|
+
changeOrigin: true,
|
|
28
|
+
pathRewrite: { '^': '' },
|
|
29
|
+
}
|
|
30
|
+
// 3.5 以后不需要再配置
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|