module-menu-vue 0.0.25 → 0.0.27

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.25",
3
+ "version": "0.0.27",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -41,21 +41,23 @@ axios.interceptors.response.use(
41
41
  /** 全局请求拦截器 */
42
42
  axios.interceptors.request.use(
43
43
  async (params) => {
44
- // 生产环境,对接门户时,需要在请求头中设置token等信息
45
- if (process.env.NODE_ENV === 'production') {
44
+ // 多种环境,对接门户时,需要在请求头中设置token等信息
45
+ const environmentList = ['production', 'development', 'test']
46
+ if (environmentList.includes(process.env.NODE_ENV)) {
46
47
  const TENANT_ID = getStore({ name: 'tenantId' }) || '1';
47
48
  const isToken = (params.headers || {}).isToken === false;
48
49
  const token = getStore({ name: 'access_token' });
49
- if (!(token && !isToken) || !TENANT_ID) {
50
+ if (token && !isToken) {
50
51
  // 如果是调用退出登录接口,则不再执行退出登录逻辑,防止出现重复调用退出登录的循环
51
- return params;
52
+ params.headers['Authorization'] = `Bearer ${token}`;
52
53
  }
53
- params.headers['Authorization'] = `Bearer ${token}`;
54
- params.headers['TENANT-ID'] = TENANT_ID;
55
- return params;
54
+ if (TENANT_ID) {
55
+ params.headers["TENANT-ID"] = TENANT_ID; // 租户ID
56
+ }
57
+ } else {
58
+ params.headers['Authorization'] = `Bearer ${tokenValue}`;
59
+ params.headers['TENANT-ID'] = '1';
56
60
  }
57
- params.headers['Authorization'] = `Bearer ${tokenValue}`;
58
- params.headers['TENANT-ID'] = 1;
59
61
  console.log('params', JSON.stringify(params))
60
62
  return params;
61
63
  },
package/vue.config.js CHANGED
@@ -1,47 +1,47 @@
1
- const { defineConfig } = require('@vue/cli-service')
2
- module.exports = defineConfig({
3
- transpileDependencies: true
4
- })
5
- // const url = 'https://192.168.108.86:30011/'
6
- // module.exports = {
7
- // lintOnSave: true,
8
- // productionSourceMap: false,
9
- // css: {
10
- // // 忽略 CSS order 顺序警告
11
- // extract: { ignoreOrder: true },
12
- // // 查看CSS属于哪个css文件
13
- // sourceMap: process.env.NODE_ENV === "development",
14
- // },
15
- // configureWebpack: () => {
16
- // if (process.env.NODE_ENV === "production") {
17
- // // 仅在生产环境下启用该配置
18
- // return {
19
- // performance: {
20
- // // 打包后最大文件大小限制
21
- // maxAssetSize: 1024000,
22
- // },
23
- // };
24
- // } else if (process.env.NODE_ENV === "development") {
25
- // return {
26
- // devtool: "source-map",
27
- // };
28
- // }
29
- // },
30
- // // 配置转发代理
31
- // devServer: {
32
- // // disableHostCheck: true,
33
- // port: 8080,
34
- // proxy: {
35
- // "/": {
36
- // // target:' https://10.136.106.82:30011',
37
- // target: url,
38
- // ws: false, // 需要websocket 开启
39
- // // changOrigin: true, //允许跨域
40
- // pathRewrite: {
41
- // "^/": "/",
42
- // },
43
- // },
44
- // // 3.5 以后不需要再配置
45
- // },
46
- // },
47
- // };
1
+ // const { defineConfig } = require('@vue/cli-service')
2
+ // module.exports = defineConfig({
3
+ // transpileDependencies: true
4
+ // })
5
+ const url = 'https://192.168.108.86:30011/'
6
+ module.exports = {
7
+ lintOnSave: true,
8
+ productionSourceMap: false,
9
+ css: {
10
+ // 忽略 CSS order 顺序警告
11
+ extract: { ignoreOrder: true },
12
+ // 查看CSS属于哪个css文件
13
+ sourceMap: process.env.NODE_ENV === "development",
14
+ },
15
+ configureWebpack: () => {
16
+ if (process.env.NODE_ENV === "production") {
17
+ // 仅在生产环境下启用该配置
18
+ return {
19
+ performance: {
20
+ // 打包后最大文件大小限制
21
+ maxAssetSize: 1024000,
22
+ },
23
+ };
24
+ } else if (process.env.NODE_ENV === "development") {
25
+ return {
26
+ devtool: "source-map",
27
+ };
28
+ }
29
+ },
30
+ // 配置转发代理
31
+ devServer: {
32
+ // disableHostCheck: true,
33
+ port: 8080,
34
+ proxy: {
35
+ "/": {
36
+ // target:' https://10.136.106.82:30011',
37
+ target: url,
38
+ ws: false, // 需要websocket 开启
39
+ // changOrigin: true, //允许跨域
40
+ pathRewrite: {
41
+ "^/": "/",
42
+ },
43
+ },
44
+ // 3.5 以后不需要再配置
45
+ },
46
+ },
47
+ };