module-menu-vue 0.0.13 → 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.13",
3
+ "version": "0.0.14",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -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
  }