module-menu-vue 0.0.1 → 0.0.2
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 +3 -2
- package/package.json +3 -1
- package/public/index.html +1 -1
- package/src/App.vue +11 -16
- package/src/assets/admin_logo.svg +48 -0
- package/src/assets/admin_slogo.svg +48 -0
- package/src/assets/alert_logo.svg +26 -0
- package/src/assets/alert_slogo.svg +26 -0
- package/src/assets/childIcon.svg +10 -0
- package/src/assets/dataManager_logo.svg +42 -0
- package/src/assets/dataanalytic_logo.svg +44 -0
- package/src/assets/dataanalytic_slogo.svg +47 -0
- package/src/assets/dataasset_logo.svg +52 -0
- package/src/assets/dataasset_slogo.svg +52 -0
- package/src/assets/datacollection_logo.svg +70 -0
- package/src/assets/datacollection_slogo.svg +70 -0
- package/src/assets/datadev_logo.svg +26 -0
- package/src/assets/datadev_slogo.svg +26 -0
- package/src/assets/datalabel_logo.svg +26 -0
- package/src/assets/datalabel_slogo.svg +26 -0
- package/src/assets/datamanager_slogo.svg +42 -0
- package/src/assets/dataservice_logo.svg +209 -0
- package/src/assets/dataservice_slogo.svg +209 -0
- package/src/assets/datasharing_logo.svg +28 -0
- package/src/assets/datasharing_slogo.svg +28 -0
- package/src/assets/home.svg +12 -0
- package/src/assets/ic_gonggongmokuai_m.svg +5 -0
- package/src/assets/ic_shujuhuiju_m.svg +5 -0
- package/src/assets/ic_shujukaifa_m.svg +15 -0
- package/src/assets/ic_shujukaifang_m.svg +5 -0
- package/src/assets/ic_shujuyingyong_m.svg +5 -0
- package/src/assets/ic_shujuzhili_m.svg +5 -0
- package/src/assets/logout.png +0 -0
- package/src/assets/menuIcon.svg +1 -0
- package/src/assets/messageCenter.svg +1 -0
- package/src/assets/metadata_logo.svg +25 -0
- package/src/assets/metadata_slogo.svg +25 -0
- package/src/assets/module.svg +12 -0
- package/src/assets/operate_logo.svg +63 -0
- package/src/assets/operate_slogo.svg +63 -0
- package/src/assets/personalCenter.svg +16 -0
- package/src/assets/quality_logo.svg +26 -0
- package/src/assets/quality_slogo.svg +26 -0
- package/src/assets/systemManage.svg +16 -0
- package/src/assets/userLogo.svg +1 -0
- package/src/assets/wordorder_logo.svg +57 -0
- package/src/assets/workorder_slogo.svg +54 -0
- package/src/components/Menu/ModuleMenu.vue +189 -0
- package/src/components/Menu/constant.js +172 -0
- package/src/components/Menu/menu.css +94 -0
- package/src/components/User/UserInfo.vue +107 -0
- package/src/components/User/constant.js +11 -0
- package/src/components/Util/axios.js +128 -0
- package/src/components/Util/config.js +10 -0
- package/src/components/Util/permessionUtils.js +27 -0
- package/src/components/Util/userInfo.js +50 -0
- package/src/main.js +3 -2
- package/src/components/ModuleMenu.vue +0 -13
- package/webpack.config.js +0 -25
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class='menuPopupAndTitle'>
|
|
4
|
+
<div class='menuIcon' @click="showMenuList = !showMenuList">
|
|
5
|
+
<img class="menuIcon_img" :src="menuIconSrc" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="menu_title_content">
|
|
8
|
+
<img class="menu_title_content_img" :src="getLogoAndTitle().logoSrc" alt="logo" />
|
|
9
|
+
<span class="menu_title">{{getLogoAndTitle().title}}</span>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class='menu_list_content' :style="{ display: showMenuList ? 'block' : 'none' }">
|
|
13
|
+
<div v-for="(item, index) in menuList" :key="item.path">
|
|
14
|
+
<div :key="item.name" class="cardLine" :style="{height: item.children.length > 3 ? '90px' : ''}">
|
|
15
|
+
<div class='leftMenu'
|
|
16
|
+
:style="{
|
|
17
|
+
height: item.children.length > 3 ? '96px' : '70px',
|
|
18
|
+
lineHeight: item.children.length > 3 ? '45px' : '70px',
|
|
19
|
+
}">
|
|
20
|
+
<img :src="item.url" class="middle" />
|
|
21
|
+
<span class="middle textPad" @click="toHomePage(index)">{{item.name}}</span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class='rightMenu'
|
|
24
|
+
:style="{
|
|
25
|
+
height: item.children.length > 3 ? '96px' : '70px',
|
|
26
|
+
lineHeight: item.children.length > 3 ? '45px' : '70px',
|
|
27
|
+
borderBottom: index === menuList.length - 1 ? '0px' : '1px solid #E9E9E9',
|
|
28
|
+
}">
|
|
29
|
+
<span v-for="child in item.children" :key="child.url">
|
|
30
|
+
<span :key="child.childName">
|
|
31
|
+
<img :src="child.url" class="middle iconPad" />
|
|
32
|
+
<span class='childMenu textPad middle' @click="toModulePage(child.childName)">{{child.childName}}</span>
|
|
33
|
+
</span>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div >
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { menuList as menuListInit, menuIconSrc, sysNameMap } from './constant.js'
|
|
44
|
+
import './menu.css'
|
|
45
|
+
export default {
|
|
46
|
+
name: 'ModuleMenu',
|
|
47
|
+
props: {
|
|
48
|
+
sysName: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'admin'
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
data () {
|
|
54
|
+
return {
|
|
55
|
+
showMenuList: false,
|
|
56
|
+
menuIconSrc: menuIconSrc,
|
|
57
|
+
menuList: [],
|
|
58
|
+
sessionMenu: [],
|
|
59
|
+
menuListInit: menuListInit,
|
|
60
|
+
sysNameMap: sysNameMap
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
created () {
|
|
64
|
+
this.getSessionMenu();
|
|
65
|
+
this.getNewMenuList();
|
|
66
|
+
},
|
|
67
|
+
methods: {
|
|
68
|
+
getSessionMenu () {
|
|
69
|
+
const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
|
|
70
|
+
if (menuObj) {
|
|
71
|
+
this.sessionMenu = [...menuObj.content]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// 获取系统logo及title
|
|
75
|
+
getLogoAndTitle () {
|
|
76
|
+
let sysInfo = this.sysNameMap.find(item => item.sysName === this.sysName);
|
|
77
|
+
let logoAndTitle = { logoSrc: "", title: "" };
|
|
78
|
+
if (sysInfo) {
|
|
79
|
+
logoAndTitle.logoSrc = sysInfo.logoSrc;
|
|
80
|
+
logoAndTitle.title = sysInfo.title;
|
|
81
|
+
}
|
|
82
|
+
return logoAndTitle;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* 判断第三方服务是否有对应服务的菜单权限
|
|
86
|
+
* @param {*} authMenus
|
|
87
|
+
* @param {*} rootMenuPath
|
|
88
|
+
*/
|
|
89
|
+
judgeThirdPartyServiceIsHaveMenus (authMenus, rootMenuPath) {
|
|
90
|
+
let dsMenus = [];
|
|
91
|
+
if (
|
|
92
|
+
typeof authMenus !== "undefined" &&
|
|
93
|
+
authMenus !== null &&
|
|
94
|
+
authMenus.length > 0
|
|
95
|
+
) {
|
|
96
|
+
const rootMenus = authMenus.filter((item) => {
|
|
97
|
+
const { parentId, type, path } = item;
|
|
98
|
+
if (parentId === -1 && type === "3" && path === rootMenuPath) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
});
|
|
103
|
+
if (
|
|
104
|
+
rootMenus &&
|
|
105
|
+
Object.keys(rootMenus).length > 0 &&
|
|
106
|
+
rootMenus[0].children
|
|
107
|
+
) {
|
|
108
|
+
dsMenus = rootMenus[0].children;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!dsMenus || dsMenus.length === 0) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
},
|
|
116
|
+
// 跳转各个模块
|
|
117
|
+
toModulePage (nameStr) {
|
|
118
|
+
console.log('nameStr', nameStr)
|
|
119
|
+
let thirdPartyServiceJumpPath = ""; // 第三方服务跳转路径
|
|
120
|
+
switch (nameStr) {
|
|
121
|
+
case "数据集成":
|
|
122
|
+
thirdPartyServiceJumpPath = "/datacollect/";
|
|
123
|
+
break;
|
|
124
|
+
case "数据治理":
|
|
125
|
+
thirdPartyServiceJumpPath = "/datamanage/";
|
|
126
|
+
break;
|
|
127
|
+
case "元数据管理":
|
|
128
|
+
thirdPartyServiceJumpPath = "/metadata/";
|
|
129
|
+
break;
|
|
130
|
+
case "数据质量":
|
|
131
|
+
thirdPartyServiceJumpPath = "/quality/";
|
|
132
|
+
break;
|
|
133
|
+
case "离线开发":
|
|
134
|
+
thirdPartyServiceJumpPath = "/datadev/";
|
|
135
|
+
break;
|
|
136
|
+
case "实时开发":
|
|
137
|
+
thirdPartyServiceJumpPath = "/dataanalytic/";
|
|
138
|
+
break;
|
|
139
|
+
case "数据服务":
|
|
140
|
+
thirdPartyServiceJumpPath = "/dataservice/";
|
|
141
|
+
break;
|
|
142
|
+
case "数据资产":
|
|
143
|
+
thirdPartyServiceJumpPath = "/dataasset/";
|
|
144
|
+
break;
|
|
145
|
+
case "数据共享":
|
|
146
|
+
thirdPartyServiceJumpPath = "/datasharing/";
|
|
147
|
+
break;
|
|
148
|
+
case "运维中心":
|
|
149
|
+
thirdPartyServiceJumpPath = "/operate/";
|
|
150
|
+
break;
|
|
151
|
+
case "消息中心":
|
|
152
|
+
thirdPartyServiceJumpPath = "/alert/";
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
window.location.href = thirdPartyServiceJumpPath
|
|
158
|
+
},
|
|
159
|
+
// 跳转首页
|
|
160
|
+
toHomePage (index) {
|
|
161
|
+
if (index === 0) {
|
|
162
|
+
window.location.href = '/#/index'
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
getNewMenuList () {
|
|
166
|
+
let newMenuList = [...this.menuListInit];
|
|
167
|
+
if (this.sessionMenu) {
|
|
168
|
+
const pathList = this.sessionMenu.map(item => item.path)
|
|
169
|
+
// 过滤掉没有权限的子菜单(PS:如果模块下面子菜单都没有,则不显示该模块)
|
|
170
|
+
for (let index = newMenuList.length - 1; index >= 0; index--) {
|
|
171
|
+
const menuItem = newMenuList[index]
|
|
172
|
+
for (let index_ch = menuItem.children.length - 1; index_ch >= 0; index_ch--) {
|
|
173
|
+
const child = menuItem.children[index_ch]
|
|
174
|
+
if (!pathList.includes(child.path)) {
|
|
175
|
+
newMenuList[index].children.splice(index_ch, 1)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (menuItem.children.length === 0 && menuItem.name !== '首页') {
|
|
179
|
+
newMenuList.splice(index, 1)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.menuList = [...newMenuList];
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
<style scoped>
|
|
189
|
+
</style>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export const menuList = [{
|
|
2
|
+
name: '首页',
|
|
3
|
+
url: require('../../assets/home.svg'),
|
|
4
|
+
children: [],
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
name: '数据汇聚',
|
|
8
|
+
url: require('../../assets/ic_shujuhuiju_m.svg'),
|
|
9
|
+
children: [{
|
|
10
|
+
childName: '数据集成',
|
|
11
|
+
path: '/datacollection',
|
|
12
|
+
url:require('../../assets/datacollection_slogo.svg'),
|
|
13
|
+
}]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: '数据治理',
|
|
17
|
+
url: require('../../assets/ic_shujuzhili_m.svg'),
|
|
18
|
+
children: [{
|
|
19
|
+
childName: '数据治理',
|
|
20
|
+
path: '/dataManager',
|
|
21
|
+
url:require('../../assets/datamanager_slogo.svg'),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
childName: '元数据管理',
|
|
25
|
+
path: '/metadata',
|
|
26
|
+
url:require('../../assets/metadata_slogo.svg'),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
childName: '数据质量',
|
|
30
|
+
path: '/quality/',
|
|
31
|
+
url:require('../../assets/quality_slogo.svg'),
|
|
32
|
+
}]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: '数据开发',
|
|
36
|
+
url: require('../../assets/ic_shujukaifa_m.svg'),
|
|
37
|
+
children: [{
|
|
38
|
+
childName: '离线开发',
|
|
39
|
+
path: '/datadev/',
|
|
40
|
+
url:require('../../assets/datadev_slogo.svg'),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
childName: '实时开发',
|
|
44
|
+
path: '/dataanalytic',
|
|
45
|
+
url:require('../../assets/dataanalytic_slogo.svg'),
|
|
46
|
+
}]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: '数据开放',
|
|
50
|
+
url: require('../../assets/ic_shujukaifang_m.svg'),
|
|
51
|
+
children: [{
|
|
52
|
+
childName: '数据服务',
|
|
53
|
+
path: '/dataservice',
|
|
54
|
+
url:require('../../assets/dataservice_slogo.svg'),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
childName: '数据资产',
|
|
58
|
+
path: '/dataasset',
|
|
59
|
+
url:require('../../assets/dataasset_slogo.svg'),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
childName: '数据共享',
|
|
63
|
+
path: '/datasharing',
|
|
64
|
+
url:require('../../assets/datasharing_slogo.svg'),
|
|
65
|
+
}]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: '数据应用',
|
|
69
|
+
url: require('../../assets/ic_shujuyingyong_m.svg'),
|
|
70
|
+
children: [{
|
|
71
|
+
childName: '数据标签',
|
|
72
|
+
path: '',
|
|
73
|
+
url:require('../../assets/datalabel_slogo.svg'),
|
|
74
|
+
}]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: '公共模块',
|
|
78
|
+
url: require('../../assets/ic_gonggongmokuai_m.svg'),
|
|
79
|
+
children: [{
|
|
80
|
+
childName: '运维中心',
|
|
81
|
+
path: '/operate',
|
|
82
|
+
url:require('../../assets/operate_slogo.svg'),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
childName: '系统管理',
|
|
86
|
+
path: '/',
|
|
87
|
+
url:require('../../assets/admin_slogo.svg'),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
childName: '工单管理',
|
|
91
|
+
url:require('../../assets/workorder_slogo.svg'),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
childName: '消息中心',
|
|
95
|
+
path: '/alert',
|
|
96
|
+
url:require('../../assets/alert_slogo.svg'),
|
|
97
|
+
}]
|
|
98
|
+
}];
|
|
99
|
+
export const menuIconSrc = require('../../assets/menuIcon.svg');
|
|
100
|
+
export const sysNameMap = [
|
|
101
|
+
{
|
|
102
|
+
sysName: 'datacollection',
|
|
103
|
+
title: '数据集成',
|
|
104
|
+
logoSrc: require('../../assets/datacollection_logo.svg'),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
sysName: 'dataManager',
|
|
108
|
+
title: '数据治理',
|
|
109
|
+
logoSrc: require('../../assets/dataManager_logo.svg'),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
sysName: 'metadata',
|
|
113
|
+
title: '元数据管理',
|
|
114
|
+
logoSrc: require('../../assets/metadata_logo.svg'),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
sysName: 'quality',
|
|
118
|
+
title: '数据质量',
|
|
119
|
+
logoSrc: require('../../assets/quality_logo.svg'),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
sysName: 'datadev',
|
|
123
|
+
title: '离线开发',
|
|
124
|
+
logoSrc: require('../../assets/datadev_logo.svg'),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
sysName: 'dataanalytic',
|
|
128
|
+
title: '实时开发',
|
|
129
|
+
logoSrc: require('../../assets/dataanalytic_logo.svg'),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
sysName: 'dataservice',
|
|
133
|
+
title: '数据服务',
|
|
134
|
+
logoSrc: require('../../assets/dataservice_logo.svg'),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
sysName: 'dataasset',
|
|
138
|
+
title: '数据资产',
|
|
139
|
+
logoSrc: require('../../assets/dataasset_logo.svg'),
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
sysName: 'datasharing',
|
|
143
|
+
title: '数据共享',
|
|
144
|
+
logoSrc: require('../../assets/datasharing_logo.svg'),
|
|
145
|
+
},
|
|
146
|
+
// {
|
|
147
|
+
// sysName: 'dataManager',
|
|
148
|
+
// title: '数据标签',
|
|
149
|
+
// logoSrc: require('../../assets/datalabel_logo.svg'),
|
|
150
|
+
// },
|
|
151
|
+
{
|
|
152
|
+
sysName: 'operate',
|
|
153
|
+
title: '运维中心',
|
|
154
|
+
logoSrc: require('../../assets/operate_logo.svg'),
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
sysName: 'admin',
|
|
158
|
+
title: '系统管理',
|
|
159
|
+
logoSrc: require('../../assets/admin_logo.svg'),
|
|
160
|
+
},
|
|
161
|
+
// {
|
|
162
|
+
// sysName: 'dataManager',
|
|
163
|
+
// title: '工单管理',
|
|
164
|
+
// logoSrc: require('../../assets/wordorder_logo.svg'),
|
|
165
|
+
// },
|
|
166
|
+
{
|
|
167
|
+
sysName: 'alert',
|
|
168
|
+
title: '消息中心',
|
|
169
|
+
logoSrc: require('../../assets/alert_logo.svg'),
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.menu_list_content {
|
|
2
|
+
border: 1px solid #e9e9e9;
|
|
3
|
+
z-index: 2;
|
|
4
|
+
float: left;
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 50px;
|
|
7
|
+
left: 0;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
box-shadow: rgba(0, 0, 0, 0.2) 1px 2px 10px;
|
|
10
|
+
padding-left: 35px;
|
|
11
|
+
padding-bottom: 35px;
|
|
12
|
+
}
|
|
13
|
+
.cardLine {
|
|
14
|
+
padding: 5px 0px;
|
|
15
|
+
}
|
|
16
|
+
.textPad {
|
|
17
|
+
padding-left: 10px;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
}
|
|
20
|
+
.leftMenu {
|
|
21
|
+
width: 100px;
|
|
22
|
+
float: left;
|
|
23
|
+
color: rgba(0, 0, 0, 0.85);
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
text-align: left;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
}
|
|
29
|
+
.rightMenu {
|
|
30
|
+
width: 460px;
|
|
31
|
+
float: left;
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
color: rgba(0, 0, 0, 0.65);
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
margin-left: 15px;
|
|
37
|
+
}
|
|
38
|
+
.childMenu:hover {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
color: #4091f7;
|
|
41
|
+
}
|
|
42
|
+
.childMenu {
|
|
43
|
+
width: 25%;
|
|
44
|
+
display: inline-block;
|
|
45
|
+
font-size: 13px;
|
|
46
|
+
}
|
|
47
|
+
.middle {
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
}
|
|
50
|
+
.middle:hover {
|
|
51
|
+
color: #4091f7;
|
|
52
|
+
}
|
|
53
|
+
.menuPopupAndTitle {
|
|
54
|
+
display: flex;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
}
|
|
57
|
+
.menuIcon {
|
|
58
|
+
text-align: center;
|
|
59
|
+
line-height: 49px;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
width: 60px;
|
|
63
|
+
height: 49px;
|
|
64
|
+
background-color: #4091f7;
|
|
65
|
+
}
|
|
66
|
+
.menuIcon_img {
|
|
67
|
+
height: 25px;
|
|
68
|
+
width: 25px;
|
|
69
|
+
vertical-align: middle;
|
|
70
|
+
}
|
|
71
|
+
.menu_title_content {
|
|
72
|
+
height: 32px;
|
|
73
|
+
margin: 0 0 0 12px;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
font-size: 18px;
|
|
76
|
+
line-height: 49px;
|
|
77
|
+
vertical-align: middle;
|
|
78
|
+
animation: pro-layout-title-hide 0.3s;
|
|
79
|
+
}
|
|
80
|
+
.menu_title_content_img {
|
|
81
|
+
height: 32px;
|
|
82
|
+
width: 32px;
|
|
83
|
+
vertical-align: middle;
|
|
84
|
+
}
|
|
85
|
+
.menu_title {
|
|
86
|
+
color: #1890ff;
|
|
87
|
+
height: 32px;
|
|
88
|
+
margin: 0 0 0 12px;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
font-size: 18px;
|
|
91
|
+
line-height: 32px;
|
|
92
|
+
vertical-align: middle;
|
|
93
|
+
animation: pro-layout-title-hide 0.3s;
|
|
94
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div className="right">
|
|
3
|
+
<el-dropdown v-if="getUserName()" @command="handleClickmenu">
|
|
4
|
+
<span class="el-dropdown-link">
|
|
5
|
+
<img src="../../assets/userLogo.svg" style="vertical-align:middle;padding-right:5px"/>
|
|
6
|
+
{{getUserName()}}
|
|
7
|
+
<i class="el-icon-arrow-down el-icon--right"></i>
|
|
8
|
+
</span>
|
|
9
|
+
<el-dropdown-menu slot="dropdown">
|
|
10
|
+
<el-dropdown-item command="single">
|
|
11
|
+
<img :src="PersonalCenterSrc" alt="" class="menuItem" />
|
|
12
|
+
<span>个人中心</span>
|
|
13
|
+
</el-dropdown-item>
|
|
14
|
+
<el-dropdown-item command="message">
|
|
15
|
+
<img :src="MessageCenterSrc" alt="" class="menuItem" />
|
|
16
|
+
<span>消息中心</span>
|
|
17
|
+
</el-dropdown-item>
|
|
18
|
+
<el-dropdown-item v-show="sysName !== 'admin' && isHaveSystemManagementPermission" command="systerm">
|
|
19
|
+
<img :src="SystemManageSrc" alt="" class="menuItem" />
|
|
20
|
+
<span>系统管理</span>
|
|
21
|
+
</el-dropdown-item>
|
|
22
|
+
<el-dropdown-item command="logout">
|
|
23
|
+
<img :src="LogoutSrc" alt="" class="menuItem" />
|
|
24
|
+
<span>退出登录</span>
|
|
25
|
+
</el-dropdown-item>
|
|
26
|
+
</el-dropdown-menu>
|
|
27
|
+
</el-dropdown>
|
|
28
|
+
<v-loading v-else size="small" :style="{ marginLeft: '8px', marginRight: '8px', lineHeight: '57px', textAlign: 'center' }" />
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script >
|
|
33
|
+
import Axios from '../Util/axios.js';
|
|
34
|
+
import {userMenuIcon} from './constant.js'
|
|
35
|
+
export default {
|
|
36
|
+
name: 'UserInfo',
|
|
37
|
+
data () {
|
|
38
|
+
return {
|
|
39
|
+
isHaveSystemManagementPermission: sessionStorage.getItem('bigdata-isHaveSystemManagementPermission'),
|
|
40
|
+
PersonalCenterSrc: userMenuIcon.PersonalCenterSrc,
|
|
41
|
+
MessageCenterSrc: userMenuIcon.MessageCenterSrc,
|
|
42
|
+
SystemManageSrc: userMenuIcon.SystemManageSrc,
|
|
43
|
+
LogoutSrc: userMenuIcon.LogoutSrc,
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
sysName: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
handleClickmenu (flag){
|
|
53
|
+
let url = ''
|
|
54
|
+
if (flag === 'single') {
|
|
55
|
+
url = '/#/info/index'
|
|
56
|
+
} else if (flag === 'message') {
|
|
57
|
+
url = '/#/alert'
|
|
58
|
+
} else if (flag === 'systerm') {
|
|
59
|
+
url = '/#/admin/user/index'
|
|
60
|
+
} else if (flag === 'logout') {
|
|
61
|
+
this.logout()
|
|
62
|
+
}
|
|
63
|
+
window.location.href = url;
|
|
64
|
+
},
|
|
65
|
+
getUserName () {
|
|
66
|
+
const userInfo = JSON.parse(sessionStorage.getItem('bigdata-userInfo')||"{}");
|
|
67
|
+
if (userInfo && userInfo.content && Object.keys(userInfo.content).length > 0 && userInfo.content.username) {
|
|
68
|
+
return userInfo.content.username;
|
|
69
|
+
}
|
|
70
|
+
return '';
|
|
71
|
+
},
|
|
72
|
+
// 退出登录
|
|
73
|
+
logout () {
|
|
74
|
+
Axios('delete','/auth/token/logout', '', {}).then(() => {
|
|
75
|
+
console.log('退出登录接口调用成功')
|
|
76
|
+
localStorage.clear();
|
|
77
|
+
sessionStorage.clear();
|
|
78
|
+
window.location.href = "/#/login";
|
|
79
|
+
}).catch((error) => {
|
|
80
|
+
console.error('Error while logging out, error:', error);
|
|
81
|
+
this.$message.error('服务器错误,请稍后重试');
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<style scoped>
|
|
89
|
+
.menuItem {
|
|
90
|
+
margin-right: 10px;
|
|
91
|
+
margin-top: -3px;
|
|
92
|
+
}
|
|
93
|
+
.el-dropdown-menu{
|
|
94
|
+
width: 135px;
|
|
95
|
+
height: auto;
|
|
96
|
+
padding: 3px 0;
|
|
97
|
+
}
|
|
98
|
+
.el-dropdown-menu__item, .el-menu-item {
|
|
99
|
+
font-size: 13px;
|
|
100
|
+
}
|
|
101
|
+
.el-dropdown-menu__item img {
|
|
102
|
+
width: 13px;
|
|
103
|
+
}
|
|
104
|
+
.el-dropdown-link{
|
|
105
|
+
font-weight: 600;
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// 图标位置
|
|
2
|
+
export const userMenuIcon = {
|
|
3
|
+
PersonalCenterSrc:require('../../assets/personalCenter.svg'),
|
|
4
|
+
MessageCenterSrc:require('../../assets/messageCenter.svg'),
|
|
5
|
+
SystemManageSrc:require('../../assets/systemManage.svg'),
|
|
6
|
+
LogoutSrc:require('../../assets/logout.png'),
|
|
7
|
+
}
|
|
8
|
+
export const PersonalCenterSrc = require('../../assets/personalCenter.svg');
|
|
9
|
+
export const MessageCenterSrc = require('../../assets/messageCenter.svg');
|
|
10
|
+
export const SystemManageSrc = require('../../assets/systemManage.svg');
|
|
11
|
+
export const LogoutSrc = require('../../assets/logout.png');
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import baseCof from './config';
|
|
3
|
+
import getStore from './userInfo';
|
|
4
|
+
import { checkToken} from './permessionUtils';
|
|
5
|
+
|
|
6
|
+
let tokenValue='7f288e2a-deb0-44fe-af72-7345ac8a6784';
|
|
7
|
+
|
|
8
|
+
axios.interceptors.response.use(
|
|
9
|
+
(response) => {
|
|
10
|
+
if (response.status === 200) {
|
|
11
|
+
return response;
|
|
12
|
+
} else if (response.status === 401 || response.status === 302 || response.status === 403) {
|
|
13
|
+
if (process.env.NODE_ENV === 'production') {
|
|
14
|
+
tokenValue = getStore({ name: 'access_token' });
|
|
15
|
+
}
|
|
16
|
+
checkToken(tokenValue);
|
|
17
|
+
} else {
|
|
18
|
+
console.log('接口异常 response');
|
|
19
|
+
return Promise.reject('error');
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
(error) => {
|
|
23
|
+
console.log('error', error)
|
|
24
|
+
if (error.response) {
|
|
25
|
+
if (error.response.status === 401) {
|
|
26
|
+
if (process.env.NODE_ENV === 'production') {
|
|
27
|
+
tokenValue = getStore({ name: 'access_token' });
|
|
28
|
+
}
|
|
29
|
+
checkToken(tokenValue);
|
|
30
|
+
} else if (error.response.status === 403) {
|
|
31
|
+
// 提示无权限等
|
|
32
|
+
} else {
|
|
33
|
+
// 其他错误处理
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return Promise.reject(error.response.data);
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/** 全局请求拦截器 */
|
|
41
|
+
axios.interceptors.request.use(
|
|
42
|
+
async (params) => {
|
|
43
|
+
// 生产环境,对接门户时,需要在请求头中设置token等信息
|
|
44
|
+
if (process.env.NODE_ENV === 'production') {
|
|
45
|
+
const TENANT_ID = getStore({ name: 'tenantId' }) || '1';
|
|
46
|
+
const isToken = (params.headers || {}).isToken === false;
|
|
47
|
+
const token = getStore({ name: 'access_token' });
|
|
48
|
+
if (!(token && !isToken) || !TENANT_ID) {
|
|
49
|
+
// 如果是调用退出登录接口,则不再执行退出登录逻辑,防止出现重复调用退出登录的循环
|
|
50
|
+
return params;
|
|
51
|
+
}
|
|
52
|
+
params.headers.common['Authorization'] = `Bearer ${token}`;
|
|
53
|
+
params.headers.common['TENANT-ID'] = TENANT_ID;
|
|
54
|
+
return params;
|
|
55
|
+
}
|
|
56
|
+
params.headers.common['Authorization'] = `Bearer ${tokenValue}`;
|
|
57
|
+
params.headers.common['TENANT-ID'] = '1';
|
|
58
|
+
return params;
|
|
59
|
+
},
|
|
60
|
+
function (error) {
|
|
61
|
+
// 对请求错误做些什么
|
|
62
|
+
return Promise.reject(error);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
function Axios(method, api, params, map) {
|
|
67
|
+
// console.log(params)
|
|
68
|
+
|
|
69
|
+
let httpDefult;
|
|
70
|
+
// 几个外部特殊接口
|
|
71
|
+
// 退出登录
|
|
72
|
+
if(api === '/auth/token/logout'){
|
|
73
|
+
httpDefult = {
|
|
74
|
+
method: method,
|
|
75
|
+
url: `${baseCof.baseSever}${api}`,
|
|
76
|
+
params: params,
|
|
77
|
+
...map,
|
|
78
|
+
};
|
|
79
|
+
console.log('httpDefult', httpDefult)
|
|
80
|
+
} else if (api === '/admin/social/logoutUri') {
|
|
81
|
+
httpDefult = {
|
|
82
|
+
method: method,
|
|
83
|
+
url: api,
|
|
84
|
+
params: params,
|
|
85
|
+
...map,
|
|
86
|
+
};
|
|
87
|
+
}else if(api.search("check_token") !== -1){
|
|
88
|
+
httpDefult = {
|
|
89
|
+
method: method,
|
|
90
|
+
url: `${baseCof.baseSever}${api}`,
|
|
91
|
+
params: params,
|
|
92
|
+
...map,
|
|
93
|
+
};
|
|
94
|
+
}else if (method === 'get') {
|
|
95
|
+
httpDefult = {
|
|
96
|
+
method: method,
|
|
97
|
+
url: `${baseCof.baseSever}${baseCof.basePath}${api}`,
|
|
98
|
+
params: params,
|
|
99
|
+
...map,
|
|
100
|
+
};
|
|
101
|
+
} else if (method === 'post') {
|
|
102
|
+
httpDefult = {
|
|
103
|
+
method: method,
|
|
104
|
+
url: `${baseCof.baseSever}${baseCof.basePath}${api}`,
|
|
105
|
+
params: params,
|
|
106
|
+
...map,
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
httpDefult = {
|
|
110
|
+
method: method,
|
|
111
|
+
url: `${baseCof.baseSever}${baseCof.basePath}${api}`,
|
|
112
|
+
params: params,
|
|
113
|
+
...map,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
axios(httpDefult)
|
|
119
|
+
.then((res) => {
|
|
120
|
+
resolve(res);
|
|
121
|
+
})
|
|
122
|
+
.catch((err) => {
|
|
123
|
+
reject(err);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default Axios;
|