module-menu-vue 0.0.12 → 0.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "module-menu-vue",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -95,38 +95,6 @@ export default {
95
95
  }
96
96
  return logoAndTitle;
97
97
  },
98
- /**
99
- * 判断第三方服务是否有对应服务的菜单权限
100
- * @param {*} authMenus
101
- * @param {*} rootMenuPath
102
- */
103
- judgeThirdPartyServiceIsHaveMenus (authMenus, rootMenuPath) {
104
- let dsMenus = [];
105
- if (
106
- typeof authMenus !== "undefined" &&
107
- authMenus !== null &&
108
- authMenus.length > 0
109
- ) {
110
- const rootMenus = authMenus.filter((item) => {
111
- const { parentId, type, path } = item;
112
- if (parentId === -1 && type === "3" && path === rootMenuPath) {
113
- return true;
114
- }
115
- return false;
116
- });
117
- if (
118
- rootMenus &&
119
- Object.keys(rootMenus).length > 0 &&
120
- rootMenus[0].children
121
- ) {
122
- dsMenus = rootMenus[0].children;
123
- }
124
- }
125
- if (!dsMenus || dsMenus.length === 0) {
126
- return false;
127
- }
128
- return true;
129
- },
130
98
  // 跳转各个模块
131
99
  toModulePage (nameStr) {
132
100
  console.log('nameStr', nameStr)
@@ -30,7 +30,8 @@
30
30
  </template>
31
31
 
32
32
  <script >
33
- import Axios from '../Util/axios.js';
33
+ // import Axios from '../Util/axios.js';
34
+ import {logout} from '../Util/permessionUtils'
34
35
  import {userMenuIcon} from './constant.js'
35
36
  export default {
36
37
  name: 'UserInfo',
@@ -59,7 +60,7 @@ export default {
59
60
  } else if (flag === 'systerm') {
60
61
  url = '/#/admin/user/index'
61
62
  } else if (flag === 'logout') {
62
- this.logout()
63
+ logout()
63
64
  }
64
65
  window.location.href = url;
65
66
  },
@@ -70,18 +71,6 @@ export default {
70
71
  }
71
72
  return '';
72
73
  },
73
- // 退出登录
74
- logout () {
75
- Axios('delete','/auth/token/logout', '', {}).then(() => {
76
- console.log('退出登录接口调用成功')
77
- localStorage.clear();
78
- sessionStorage.clear();
79
- window.location.href = "/#/login";
80
- }).catch((error) => {
81
- console.error('Error while logging out, error:', error);
82
- this.$message.error('服务器错误,请稍后重试');
83
- });
84
- }
85
74
  }
86
75
  }
87
76
  </script>
@@ -40,22 +40,23 @@ axios.interceptors.response.use(
40
40
  /** 全局请求拦截器 */
41
41
  axios.interceptors.request.use(
42
42
  async (params) => {
43
+ console.log('process.env', process.env)
43
44
  // 生产环境,对接门户时,需要在请求头中设置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;
45
+ // if (process.env.NODE_ENV === 'production') {
46
+ const TENANT_ID = getStore({ name: 'tenantId' }) || '1';
47
+ const isToken = (params.headers || {}).isToken === false;
48
+ const token = getStore({ name: 'access_token' });
49
+ if (!(token && !isToken) || !TENANT_ID) {
50
+ // 如果是调用退出登录接口,则不再执行退出登录逻辑,防止出现重复调用退出登录的循环
54
51
  return params;
55
52
  }
56
- params.headers.common['Authorization'] = `Bearer ${tokenValue}`;
57
- params.headers.common['TENANT-ID'] = '1';
53
+ params.headers.common['Authorization'] = `Bearer ${token}`;
54
+ params.headers.common['TENANT-ID'] = TENANT_ID;
58
55
  return params;
56
+ // }
57
+ // params.headers.common['Authorization'] = `Bearer ${tokenValue}`;
58
+ // params.headers.common['TENANT-ID'] = '1';
59
+ // return params;
59
60
  },
60
61
  function (error) {
61
62
  // 对请求错误做些什么
@@ -3,7 +3,7 @@ import Axios from './axios.js';
3
3
  const DEFAULT_LOGOUT_URL = '/#/login'
4
4
  // 退出登录
5
5
  export const logout = () => {
6
- Axios('delete','/auth/token/logout', '', {} )
6
+ Axios('delete','/auth/token/logout', '', {})
7
7
  .then(() => {
8
8
  localStorage.clear();
9
9
  sessionStorage.clear();
@@ -16,12 +16,11 @@ export const logout = () => {
16
16
  }
17
17
  // 校验token是否失效
18
18
  export const checkToken = (token) => {
19
- Axios('get',`/auth/oauth/check_token?token=${token}`, '', {} ).then(
20
- ).catch(() => {
21
- this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
22
- localStorage.clear();
23
- sessionStorage.clear();
24
- window.location.href = DEFAULT_LOGOUT_URL;
25
- }});
26
- })
19
+ Axios('get',`/auth/oauth/check_token?token=${token}`, '', {} ).then().catch(() => {
20
+ this.$message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
21
+ localStorage.clear();
22
+ sessionStorage.clear();
23
+ window.location.href = DEFAULT_LOGOUT_URL;
24
+ }});
25
+ })
27
26
  }