uepay-ops2 4.0.15 → 4.0.16-beta

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.
Files changed (41) hide show
  1. package/bin/uepay.js +0 -3
  2. package/index.d.ts +3 -1
  3. package/index.js +8 -5
  4. package/lib/components/application/optionsLoader.js +9 -22
  5. package/lib/components/application.js +41 -63
  6. package/lib/components/applicationLight.js +13 -40
  7. package/lib/components/auth/withOptions.js +4 -12
  8. package/lib/components/client.js +42 -34
  9. package/lib/components/home/home.js +13 -17
  10. package/lib/components/icon/captcha.js +13 -29
  11. package/lib/components/layout/menuAble/header.js +35 -38
  12. package/lib/components/layout/menuAble/multiPage.js +13 -43
  13. package/lib/components/layout/menuAble/sider.js +13 -26
  14. package/lib/components/layout/menuAble.js +8 -21
  15. package/lib/components/layout/mobileAble.d.ts +4 -0
  16. package/lib/components/layout/mobileAble.js +23 -0
  17. package/lib/components/layout/single.js +3 -10
  18. package/lib/components/layout.js +14 -31
  19. package/lib/components/locale/context.js +4 -11
  20. package/lib/components/locale/withLocale.js +2 -17
  21. package/lib/components/setting/userSetting.js +7 -27
  22. package/lib/components/spin/loading.js +2 -10
  23. package/lib/components/spinner/spinner.js +2 -14
  24. package/lib/components/userMgr/login.js +12 -35
  25. package/lib/components/userMgr/userInfo.js +5 -13
  26. package/lib/components/userMgr/userMgrLayout.js +8 -19
  27. package/lib/data/appUrl.js +7 -22
  28. package/lib/data/ctx.js +14 -32
  29. package/lib/data/localDefined.js +1 -3
  30. package/lib/util/apolloConfig.js +7 -17
  31. package/lib/util/authRoute.js +21 -47
  32. package/lib/util/establish.js +0 -3
  33. package/lib/util/express.js +12 -12
  34. package/lib/util/net.js +13 -37
  35. package/lib/util/state.js +2 -4
  36. package/lib/util/token.js +1 -7
  37. package/lib/util/tool.js +3 -21
  38. package/lib/util/uepayConfig.js +1 -7
  39. package/net.js +5 -12
  40. package/package.json +1 -1
  41. package/styles.css +1 -0
package/lib/util/net.js CHANGED
@@ -4,28 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.remove = exports.put = exports.post = exports.patch = exports.get = void 0;
7
-
7
+ require("core-js/modules/es7.array.includes.js");
8
8
  require("core-js/modules/es6.regexp.replace.js");
9
-
10
9
  var _token2 = require("./token");
11
-
12
10
  var _authRoute = require("./authRoute");
13
-
14
11
  var _cookie = _interopRequireDefault(require("cookie"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
13
  function onCatchError(e) {
19
14
  console.error(e);
20
15
  }
16
+
21
17
  /**
22
18
  * get请求,
23
19
  * @param url {String} 访问地址的url
24
20
  * @param headers {Object} 附加頭部參數
25
21
  * @return {Promise<Response>}
26
22
  */
27
-
28
-
29
23
  const get = (url, headers) => {
30
24
  return fetch(url, {
31
25
  method: 'GET',
@@ -33,6 +27,7 @@ const get = (url, headers) => {
33
27
  headers: buildHeaders(headers)
34
28
  }).then(res => onRes(res)).catch(onCatchError);
35
29
  };
30
+
36
31
  /**
37
32
  * post请求,表示新增数据
38
33
  * @param url {String} 访问地址的url
@@ -40,13 +35,11 @@ const get = (url, headers) => {
40
35
  * @param headers {Object} 附加頭部參數
41
36
  * @return {Promise<Response>}
42
37
  */
43
-
44
-
45
38
  exports.get = get;
46
-
47
39
  const post = (url, params, headers) => {
48
40
  return request('POST', url, params, headers);
49
41
  };
42
+
50
43
  /**
51
44
  * put请求,表示修改数据
52
45
  * @param url {String} 访问地址的url
@@ -54,13 +47,11 @@ const post = (url, params, headers) => {
54
47
  * @param headers {Object} 附加頭部參數
55
48
  * @return {Promise<Response>}
56
49
  */
57
-
58
-
59
50
  exports.post = post;
60
-
61
51
  const put = (url, params, headers) => {
62
52
  return request('PUT', url, params, headers);
63
53
  };
54
+
64
55
  /**
65
56
  * patch请求,表示修改数据
66
57
  * @param url {String} 访问地址的url
@@ -68,13 +59,11 @@ const put = (url, params, headers) => {
68
59
  * @param headers {Object} 附加頭部參數
69
60
  * @return {Promise<Response>}
70
61
  */
71
-
72
-
73
62
  exports.put = put;
74
-
75
63
  const patch = (url, params, headers) => {
76
64
  return request('PATCH', url, params, headers);
77
65
  };
66
+
78
67
  /**
79
68
  * delete请求,表示修改数据
80
69
  * @param url {String} 访问地址的url
@@ -82,13 +71,11 @@ const patch = (url, params, headers) => {
82
71
  * @param headers {Object} 附加頭部參數
83
72
  * @return {Promise<Response>}
84
73
  */
85
-
86
-
87
74
  exports.patch = patch;
88
-
89
75
  const remove = (url, params, headers) => {
90
76
  return request('DELETE', url, params, headers);
91
77
  };
78
+
92
79
  /**
93
80
  * fetch请求方式
94
81
  * @param method {String} 请求方法
@@ -97,10 +84,7 @@ const remove = (url, params, headers) => {
97
84
  * @param headers {Object} 附加頭部參數
98
85
  * @returns {Promise<Response>}
99
86
  */
100
-
101
-
102
87
  exports.remove = remove;
103
-
104
88
  function request(method, url, params, headers) {
105
89
  if (!url) {
106
90
  return new Promise((suc, err) => {
@@ -115,22 +99,19 @@ function request(method, url, params, headers) {
115
99
  }).then(res => onRes(res)).catch(onCatchError);
116
100
  }
117
101
  }
102
+
118
103
  /**
119
104
  * 处理返回数据
120
105
  * @param res
121
106
  * @returns {{msg: string, code: number}|any | Promise<any>}
122
107
  */
123
-
124
-
125
108
  const onRes = res => {
126
109
  if (res && res.ok) {
127
110
  const _token = res.headers.get('Token'),
128
- contentType = res.headers.get('Content-Type');
129
-
111
+ contentType = res.headers.get('Content-Type');
130
112
  if (_token) {
131
113
  _token2.token.set(_token);
132
114
  }
133
-
134
115
  if (contentType.includes('application/json')) {
135
116
  return res.json();
136
117
  } else if (contentType.includes('text/html')) {
@@ -143,19 +124,16 @@ const onRes = res => {
143
124
  };
144
125
  }
145
126
  };
127
+
146
128
  /**
147
129
  *
148
130
  * @param headers {Object}
149
131
  * @returns {Object}
150
132
  */
151
-
152
-
153
133
  const buildHeaders = function buildHeaders() {
154
134
  let headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
155
-
156
135
  const _c = _cookie.default.parse(document.cookie),
157
- menu = (0, _authRoute.getCurMenu)();
158
-
136
+ menu = (0, _authRoute.getCurMenu)();
159
137
  return Object.assign({
160
138
  Authorization: parsePath(menu.path),
161
139
  'Content-Type': 'application/json',
@@ -163,16 +141,14 @@ const buildHeaders = function buildHeaders() {
163
141
  STS: _c.sts
164
142
  }, headers);
165
143
  };
144
+
166
145
  /**
167
146
  * 解析提取相关的URL信息,如果没有指向当前菜单则获取浏览器Path
168
147
  * @param path {String}
169
148
  */
170
-
171
-
172
149
  const parsePath = path => {
173
150
  if (path) {
174
151
  let pos = -1;
175
-
176
152
  if (-1 < (pos = path.indexOf('mesh'))) {
177
153
  let str = path.substr(pos);
178
154
  return str && str.replace('mesh=', '');
package/lib/util/state.js CHANGED
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StateConfig = void 0;
7
-
8
7
  /**
9
8
  * state 状态管理,表示数据服务请求状态
10
9
  */
11
- const StateConfig = {
10
+ const StateConfig = exports.StateConfig = {
12
11
  //成功
13
12
  succeed: 1,
14
13
  //失败
@@ -23,5 +22,4 @@ const StateConfig = {
23
22
  userAndPass: -4,
24
23
  //其他
25
24
  other: -1
26
- };
27
- exports.StateConfig = StateConfig;
25
+ };
package/lib/util/token.js CHANGED
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.token = void 0;
7
-
8
7
  class Token {
9
8
  set(newToken) {
10
9
  localStorage.setItem('token', newToken);
11
10
  }
12
-
13
11
  get() {
14
12
  return localStorage.getItem('token');
15
13
  }
16
-
17
14
  del() {
18
15
  localStorage.removeItem('token');
19
16
  }
20
-
21
17
  }
22
-
23
- const token = new Token();
24
- exports.token = token;
18
+ const token = exports.token = new Token();
package/lib/util/tool.js CHANGED
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.setStyle = exports.setCookie = exports.getDisplayName = exports.getCookie = exports.encodeMeshPath = exports.decodeMeshPath = void 0;
7
-
8
7
  require("core-js/modules/es6.regexp.split.js");
9
-
10
8
  require("core-js/modules/web.dom.iterable.js");
11
-
12
9
  /**
13
10
  * 获取React组件的名称。
14
11
  * @param WrappedComponent
@@ -17,30 +14,26 @@ require("core-js/modules/web.dom.iterable.js");
17
14
  const getDisplayName = WrappedComponent => {
18
15
  return WrappedComponent.displayName || WrappedComponent.name || 'Component';
19
16
  };
17
+
20
18
  /**
21
19
  * 批量添加style样式
22
20
  * @param obj
23
21
  * @param css
24
22
  * @returns {*|string}
25
23
  */
26
-
27
-
28
24
  exports.getDisplayName = getDisplayName;
29
-
30
25
  const setStyle = (obj, css) => {
31
26
  for (var atr in css) {
32
27
  obj.style[atr] = css[atr];
33
28
  }
34
29
  };
30
+
35
31
  /**
36
32
  * 编码菜单查询参数
37
33
  * @param menu
38
34
  * @return {menu}
39
35
  */
40
-
41
-
42
36
  exports.setStyle = setStyle;
43
-
44
37
  const encodeMeshPath = menu => {
45
38
  if (menu.menuType === 'MESH') {
46
39
  menu.path += "?mesh=".concat(btoa(JSON.stringify({
@@ -49,46 +42,35 @@ const encodeMeshPath = menu => {
49
42
  flag: menu.optionFlag
50
43
  })));
51
44
  }
52
-
53
45
  return menu;
54
46
  };
47
+
55
48
  /**
56
49
  * 解码菜单查询样式
57
50
  * @param base64
58
51
  * @return {Object} {id, type, flag}
59
52
  */
60
-
61
-
62
53
  exports.encodeMeshPath = encodeMeshPath;
63
-
64
54
  const decodeMeshPath = base64 => {
65
55
  return JSON.parse(atob(base64));
66
56
  };
67
-
68
57
  exports.decodeMeshPath = decodeMeshPath;
69
-
70
58
  const setCookie = (key, value, exdays) => {
71
59
  const d = new Date();
72
60
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
73
61
  const expires = "expires=" + d.toGMTString();
74
62
  document.cookie = "".concat(key, "=").concat(value, ";").concat(expires);
75
63
  };
76
-
77
64
  exports.setCookie = setCookie;
78
-
79
65
  const getCookie = key => {
80
66
  key = key + "=";
81
67
  const spilt = document.cookie.split(';');
82
-
83
68
  for (let one of spilt) {
84
69
  one = one.trim();
85
-
86
70
  if (0 === one.indexOf(key)) {
87
71
  return one.substring(key.length, one.length);
88
72
  }
89
73
  }
90
-
91
74
  return "";
92
75
  };
93
-
94
76
  exports.getCookie = getCookie;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  const path = require('path'),
4
- fs = require('fs');
5
-
4
+ fs = require('fs');
6
5
  function UepayConfig() {
7
6
  this.config = {};
8
7
  }
9
-
10
8
  UepayConfig.prototype.init = async function () {
11
9
  /**
12
10
  *
@@ -17,7 +15,6 @@ UepayConfig.prototype.init = async function () {
17
15
  */
18
16
  this.config = await this.readConfig();
19
17
  };
20
-
21
18
  UepayConfig.prototype.readConfig = function () {
22
19
  return new Promise((success, error) => {
23
20
  const filePath = path.join(process.cwd(), 'uepay.config.js');
@@ -27,15 +24,12 @@ UepayConfig.prototype.readConfig = function () {
27
24
  } else {
28
25
  const Module = module.constructor;
29
26
  const m = new Module();
30
-
31
27
  m._compile(code, 'next.config.js');
32
-
33
28
  const a = m.exports;
34
29
  success(a);
35
30
  }
36
31
  });
37
32
  });
38
33
  };
39
-
40
34
  module.exports = new UepayConfig();
41
35
  const u = new UepayConfig();
package/net.js CHANGED
@@ -4,16 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.remove = exports.put = exports.post = exports.patch = exports.get = void 0;
7
-
8
7
  var _net = require("./lib/util/net");
9
-
10
- const get = _net.get;
11
- exports.get = get;
12
- const post = _net.post;
13
- exports.post = post;
14
- const put = _net.put;
15
- exports.put = put;
16
- const patch = _net.patch;
17
- exports.patch = patch;
18
- const remove = _net.remove;
19
- exports.remove = remove;
8
+ const get = exports.get = _net.get;
9
+ const post = exports.post = _net.post;
10
+ const put = exports.put = _net.put;
11
+ const patch = exports.patch = _net.patch;
12
+ const remove = exports.remove = _net.remove;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uepay-ops2",
3
- "version": "4.0.15",
3
+ "version": "4.0.16-beta",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
package/styles.css CHANGED
@@ -106,6 +106,7 @@ html {
106
106
 
107
107
  .uepay-ops-header .ops-collapse {
108
108
  color: #cccccc;
109
+ margin-right: 0.6rem;
109
110
  }
110
111
 
111
112
  .uepay-ops-header-oper-name {