module-menu-vue 0.0.15 → 0.0.17

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.15",
3
+ "version": "0.0.17",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -12,8 +12,7 @@
12
12
  "axios": "^1.4.0",
13
13
  "core-js": "^3.8.3",
14
14
  "element-ui": "^2.15.13",
15
- "vue": "^2.6.14",
16
- "vue-axios": "^3.5.2"
15
+ "vue": "^2.6.14"
17
16
  },
18
17
  "devDependencies": {
19
18
  "@babel/core": "^7.12.16",
@@ -33,6 +33,7 @@
33
33
  // import {logout} from './service.js'
34
34
  import {userMenuIcon} from './constant.js'
35
35
  import { getStore } from '../Util/userInfo.js';
36
+ import axios from 'axios'
36
37
  export default {
37
38
  name: 'UserInfo',
38
39
  data () {
@@ -77,7 +78,7 @@ export default {
77
78
  if (TENANT_ID) {
78
79
  config.headers["TENANT-ID"] = TENANT_ID; // 租户ID
79
80
  }
80
- this.axios({
81
+ axios({
81
82
  method: 'delete',
82
83
  url: '/auth/token/logout',
83
84
  ...config
package/src/main.js CHANGED
@@ -2,14 +2,10 @@ import Vue from 'vue'
2
2
  import App from './App.vue'
3
3
  import ElementUI from 'element-ui';
4
4
  import 'element-ui/lib/theme-chalk/index.css';
5
- import axios from 'axios'
6
- import VueAxios from 'vue-axios'
7
5
 
8
6
 
9
7
  Vue.config.productionTip = false
10
8
  Vue.use(ElementUI);
11
- window.axios = axios
12
- Vue.use(VueAxios, axios)
13
9
 
14
10
 
15
11
  new Vue({
@@ -1,61 +0,0 @@
1
- // import axios from 'axios';
2
- import { getStore } from './userInfo.js';
3
- import { checkToken} from '../User/service.js';
4
- // import qs from "qs";
5
-
6
- let tokenValue='200ad182-7aec-4473-98a4-08d3d8bccf73';
7
-
8
- this.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
- this.axios.interceptors.request.use(config => {
41
- console.log('-----', token, isToken, TENANT_ID)
42
- const TENANT_ID = getStore({ name: "tenantId" }) || '1';
43
- const isToken = (config.headers || {}).isToken === false;
44
- const token = getStore({ name: 'access_token' });
45
- if (token && !isToken) {
46
- config.headers["Authorization"] = `Bearer ${token}`; // token
47
- }
48
- if (TENANT_ID) {
49
- config.headers["TENANT-ID"] = TENANT_ID; // 租户ID
50
- }
51
- // config.headers["Authorization"] = "Bearer " + '9e3f86b0-41e2-436a-9f0d-aeace114cc66'; // token
52
- // config.headers["TENANT-ID"] = 1; // 租户ID
53
- // config.paramsSerializer = function (params) {
54
- // return qs.stringify(params, { arrayFormat: "repeat" });
55
- // };
56
- return config;
57
- },
58
- error => {
59
- return Promise.reject(error);
60
- }
61
- );