mooho-base-admin-plus 0.1.38 → 0.1.41

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,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "0.1.38",
4
+ "version": "0.1.41",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "dotnetVersion": "1.3.97",
7
7
  "license": "MIT",
@@ -25,7 +25,7 @@ function errorLog(err) {
25
25
  }
26
26
  });
27
27
  // 打印到控制台
28
- if (import.meta.env.MODE === 'development') {
28
+ if (window.$mode === 'development') {
29
29
  util.log.error('>>>>>> Error >>>>>>');
30
30
  console.log(err);
31
31
  }
@@ -39,11 +39,9 @@ function errorLog(err) {
39
39
  });
40
40
  }
41
41
 
42
- //axios.defaults.baseURL = 'aaa';
43
-
44
42
  // 创建一个 axios 实例
45
43
  const service = axios.create({
46
- baseURL: Setting.apiBaseURL
44
+ //baseURL: import.meta.env.MODE === 'development' ? Setting.apiBaseURL.dev : Setting.apiBaseURL.prd
47
45
  // timeout: 5000 // 请求超时时间
48
46
  });
49
47
 
@@ -52,6 +50,9 @@ service.interceptors.request.use(
52
50
  config => {
53
51
  store.commit('admin/loader/start');
54
52
 
53
+ let baseURL = window.$mode === 'development' ? Setting.apiBaseURL.dev : Setting.apiBaseURL.prd;
54
+ config.url = baseURL + config.url;
55
+
55
56
  // 在请求发送之前做一些处理
56
57
  const token = util.cookies.get('token');
57
58
  // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
@@ -82,10 +82,10 @@ export default {
82
82
  return Setting.layout;
83
83
  },
84
84
  apiBaseURL() {
85
- return Setting.apiBaseURL;
85
+ return window.$env.MODE === 'development' ? Setting.apiBaseURL.dev : Setting.apiBaseURL.prd;
86
86
  },
87
87
  uploadURL() {
88
- return Setting.apiBaseURL + 'api/Attachment/add';
88
+ return this.apiBaseURL + 'api/Attachment/add';
89
89
  },
90
90
  uploadHeaders() {
91
91
  const token = util.cookies.get('token');
@@ -16,7 +16,7 @@ export default {
16
16
  }
17
17
  });
18
18
  // 只在开发模式下打印 log
19
- if (import.meta.env.MODE === 'development') {
19
+ if (window.$mode === 'development') {
20
20
  util.log.capsule('Admin Plus', 'ErrorHandler', 'error');
21
21
  util.log.error('>>>>>> 错误信息 >>>>>>');
22
22
  console.log(info);
@@ -6,7 +6,7 @@ import store from '../store/index';
6
6
  import dynamic from './dynamic';
7
7
 
8
8
  // 根目录
9
- let base = import.meta.env.VUE_APP_BASE_PATH;
9
+ let base = import.meta.env.VITE_APP_BASE_PATH;
10
10
  if (!base) {
11
11
  base = '';
12
12
  }
package/src/setting.js CHANGED
@@ -2,7 +2,6 @@
2
2
  * Admin Plus 业务配置
3
3
  * */
4
4
 
5
- const env = import.meta.env.MODE;
6
5
  const basePath = import.meta.env.VITE_APP_BASE_PATH;
7
6
 
8
7
  const Setting = {
@@ -109,11 +108,11 @@ const Setting = {
109
108
  // 全局面包屑是否显示图标,开启 showBreadcrumb 时有效
110
109
  showBreadcrumbIcon: false,
111
110
  // 是否显示日志入口,开启与否,不影响日志记录,如不希望用户看到可关闭
112
- showLog: env === 'development',
111
+ showLog: false,
113
112
  // 是否显示多语言
114
113
  showI18n: false,
115
114
  // 是否支持动态修改布局配置,移动端下会自动强制关闭
116
- enableSetting: env === 'development',
115
+ enableSetting: false,
117
116
  // 退出登录时,是否二次确认
118
117
  logoutConfirm: true,
119
118
  // 是否根据操作系统缩放比例,自动调整比例
@@ -196,11 +195,4 @@ if (localSetting) {
196
195
  copyTo(localSetting, Setting);
197
196
  }
198
197
 
199
- console.log('import.meta.env', import.meta.env);
200
-
201
- // API地址
202
- Setting.apiBaseURL = import.meta.env.MODE === 'development' ? Setting.apiBaseURL.dev : Setting.apiBaseURL.prd;
203
-
204
- console.log('Setting.apiBaseURL', Setting.apiBaseURL, import.meta.env.MODE);
205
-
206
198
  export default Setting;
package/test/main.js CHANGED
@@ -12,7 +12,8 @@ import routes from './router/routes';
12
12
  // 自定义css
13
13
  import './styles/css/custom.css';
14
14
 
15
- window.$env = import.meta.env;
15
+ // 环境模式
16
+ window.$mode = import.meta.env.MODE;
16
17
 
17
18
  // 页面
18
19
  const files = import.meta.globEager('./pages/**/*.vue');