uepay-ops2 4.0.12 → 4.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/lib/util/net.js CHANGED
@@ -15,23 +15,24 @@ var _cookie = _interopRequireDefault(require("cookie"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- function onCatchError(e) {
19
- console.error(e);
20
- }
21
18
  /**
22
19
  * get请求,
23
20
  * @param url {String} 访问地址的url
24
21
  * @param headers {Object} 附加頭部參數
25
22
  * @return {Promise<Response>}
26
23
  */
27
-
28
-
29
- const get = (url, headers) => {
24
+ const get = function get(url) {
25
+ let headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
+ const innerHeaders = {
27
+ 'Content-Type': 'application/json'
28
+ };
30
29
  return fetch(url, {
31
30
  method: 'GET',
32
31
  mode: "cors",
33
32
  headers: buildHeaders(headers)
34
- }).then(res => onRes(res)).catch(onCatchError);
33
+ }).then(res => onRes(res)).catch(function (error) {
34
+ console.log('Fetch Error: ', error.message);
35
+ });
35
36
  };
36
37
  /**
37
38
  * post请求,表示新增数据
@@ -44,8 +45,21 @@ const get = (url, headers) => {
44
45
 
45
46
  exports.get = get;
46
47
 
47
- const post = (url, params, headers) => {
48
- return request('POST', url, params, headers);
48
+ const post = function post(url, params) {
49
+ let headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50
+
51
+ if (params) {
52
+ return fetch(url, {
53
+ method: 'POST',
54
+ mode: "cors",
55
+ body: JSON.stringify(params),
56
+ headers: buildHeaders(headers)
57
+ }).then(res => onRes(res)).catch(function (error) {
58
+ console.log('Fetch Error: ', error.message);
59
+ });
60
+ } else {
61
+ throw "必须设置Post传递参数的值";
62
+ }
49
63
  };
50
64
  /**
51
65
  * put请求,表示修改数据
@@ -58,8 +72,21 @@ const post = (url, params, headers) => {
58
72
 
59
73
  exports.post = post;
60
74
 
61
- const put = (url, params, headers) => {
62
- return request('PUT', url, params, headers);
75
+ const put = function put(url, params) {
76
+ let headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
77
+
78
+ if (params) {
79
+ return fetch(url, {
80
+ method: 'PUT',
81
+ mode: "cors",
82
+ body: JSON.stringify(params),
83
+ headers: buildHeaders(headers)
84
+ }).then(res => onRes(res)).catch(function (error) {
85
+ console.log('Fetch Error: ', error.message);
86
+ });
87
+ } else {
88
+ throw "必须设置Put传递参数的值";
89
+ }
63
90
  };
64
91
  /**
65
92
  * patch请求,表示修改数据
@@ -72,13 +99,25 @@ const put = (url, params, headers) => {
72
99
 
73
100
  exports.put = put;
74
101
 
75
- const patch = (url, params, headers) => {
76
- return request('PATCH', url, params, headers);
102
+ const patch = function patch(url, params) {
103
+ let headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
104
+
105
+ if (params) {
106
+ return fetch(url, {
107
+ method: 'PATCH',
108
+ mode: "cors",
109
+ body: JSON.stringify(params),
110
+ headers: buildHeaders(headers)
111
+ }).then(res => onRes(res)).catch(function (error) {
112
+ console.log('Fetch Error: ', error.message);
113
+ });
114
+ } else {
115
+ throw "必须设置Patch传递参数的值";
116
+ }
77
117
  };
78
118
  /**
79
119
  * delete请求,表示修改数据
80
120
  * @param url {String} 访问地址的url
81
- * @param params {Object} 附加頭部參數
82
121
  * @param headers {Object} 附加頭部參數
83
122
  * @return {Promise<Response>}
84
123
  */
@@ -86,35 +125,16 @@ const patch = (url, params, headers) => {
86
125
 
87
126
  exports.patch = patch;
88
127
 
89
- const remove = (url, params, headers) => {
90
- return request('DELETE', url, params, headers);
128
+ const remove = function remove(url) {
129
+ let headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
130
+ return fetch(url, {
131
+ method: 'DELETE',
132
+ mode: "cors",
133
+ headers: buildHeaders(headers)
134
+ }).then(res => onRes(res)).catch(function (error) {
135
+ console.log('Fetch Error: ', error.message);
136
+ });
91
137
  };
92
- /**
93
- * fetch请求方式
94
- * @param method {String} 请求方法
95
- * @param url {String} 访问地址的url
96
- * @param params {Object} 附加頭部參數
97
- * @param headers {Object} 附加頭部參數
98
- * @returns {Promise<Response>}
99
- */
100
-
101
-
102
- exports.remove = remove;
103
-
104
- function request(method, url, params, headers) {
105
- if (!url) {
106
- return new Promise((suc, err) => {
107
- err("".concat(method, " Method Must Support url"));
108
- });
109
- } else {
110
- return fetch(url, {
111
- method: method,
112
- mode: "cors",
113
- body: JSON.stringify(params),
114
- headers: buildHeaders(headers)
115
- }).then(res => onRes(res)).catch(onCatchError);
116
- }
117
- }
118
138
  /**
119
139
  * 处理返回数据
120
140
  * @param res
@@ -122,6 +142,8 @@ function request(method, url, params, headers) {
122
142
  */
123
143
 
124
144
 
145
+ exports.remove = remove;
146
+
125
147
  const onRes = res => {
126
148
  if (res && res.ok) {
127
149
  const _token = res.headers.get('Token'),
@@ -157,19 +179,19 @@ const buildHeaders = function buildHeaders() {
157
179
  menu = (0, _authRoute.getCurMenu)();
158
180
 
159
181
  return Object.assign({
160
- Authorization: parsePath(menu.path),
182
+ Authorization: parseMesh(menu.path) || 'UePay',
161
183
  'Content-Type': 'application/json',
162
184
  Token: _token2.token.get() || 'UePay',
163
185
  STS: _c.sts
164
186
  }, headers);
165
187
  };
166
188
  /**
167
- * 解析提取相关的URL信息,如果没有指向当前菜单则获取浏览器Path
189
+ * 解析提取mesh字符塊
168
190
  * @param path {String}
169
191
  */
170
192
 
171
193
 
172
- const parsePath = path => {
194
+ const parseMesh = path => {
173
195
  if (path) {
174
196
  let pos = -1;
175
197
 
@@ -179,7 +201,5 @@ const parsePath = path => {
179
201
  } else {
180
202
  return btoa(path);
181
203
  }
182
- } else {
183
- return btoa(window.location.pathname);
184
204
  }
185
205
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uepay-ops2",
3
- "version": "4.0.12",
3
+ "version": "4.0.14",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -30,7 +30,6 @@
30
30
  "moment": "^2.24.0"
31
31
  },
32
32
  "devDependencies": {
33
- "antd": "^4.5.1",
34
33
  "core-js": "^2.6.11",
35
34
  "@zeit/next-css": "^1.0.1",
36
35
  "@zeit/next-sass": "^1.0.1",
@@ -46,6 +45,7 @@
46
45
  "react": "^16.12.0",
47
46
  "react-dom": "^16.12.0",
48
47
  "@ant-design/icons": "^4.2.1",
49
- "uepay-mesh": "^4.0.1"
48
+ "antd": "^4.5.1",
49
+ "uepay-mesh": "^4.0.19"
50
50
  }
51
51
  }
package/styles.css CHANGED
@@ -19,10 +19,8 @@ html {
19
19
  }
20
20
 
21
21
  .ant-tabs-tabpane {
22
- position: relative;
23
- display: flex;
24
22
  height: 100%;
25
- flex-direction: column;
23
+ overflow-y: auto;
26
24
  }
27
25
 
28
26
  /*frame*/
@@ -54,7 +52,7 @@ html {
54
52
  align-items: center;
55
53
  }
56
54
 
57
- .uepay-ops-header .usr-setting {
55
+ .uepay-ops-header .usr-setting{
58
56
  width: 100%;
59
57
  height: 100%;
60
58
  background-color: rgba(0, 0, 0, 0.5);
@@ -74,14 +72,14 @@ html {
74
72
  }
75
73
 
76
74
  .uepay-ops-header .usr-setting-title {
77
- padding: 15px 0;
75
+ padding: 15px 0 ;
78
76
  margin: 0 20px;
79
77
  font-size: 18px;
80
78
  border-bottom: 1px solid #ccc;
81
79
  }
82
80
 
83
81
  .uepay-ops-header .usr-setting-form {
84
- padding: 40px 20px 10px 20px;
82
+ padding:40px 20px 10px 20px;
85
83
  }
86
84
 
87
85
  .uepay-ops-header #uepay-frame-avatar {
@@ -169,13 +167,6 @@ html {
169
167
  padding: 4px;
170
168
  }
171
169
 
172
- .uepay-ops-layout-single {
173
- height: 100%;
174
- width: 100%;
175
- overflow-y: auto;
176
- padding: .5rem 1rem;
177
- }
178
-
179
170
  /*login*/
180
171
  .uepay-ops-user-global {
181
172
  cursor: pointer;
@@ -193,7 +184,7 @@ html {
193
184
  height: 100%;
194
185
  }
195
186
 
196
- .uepay-ops-login {
187
+ .uepay-ops-login{
197
188
  display: flex;
198
189
  justify-content: center;
199
190
  align-items: center;
@@ -201,38 +192,38 @@ html {
201
192
  background: #f3f3f3;
202
193
  }
203
194
 
204
- .uepay-ops-login .login-form {
195
+ .uepay-ops-login .login-form{
205
196
  width: 320px;
206
197
  padding: 36px;
207
198
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.08);
208
199
  background: #fff;
209
200
  }
210
201
 
211
- .uepay-ops-login .login-logo {
202
+ .uepay-ops-login .login-logo{
212
203
  width: 100%;
213
204
  height: 40px;
214
205
  }
215
206
 
216
- .uepay-ops-login .login-name {
207
+ .uepay-ops-login .login-name{
217
208
  line-height: 40px;
218
209
  text-align: center;
219
210
  padding-left: 15px;
220
211
  font-size: 20px;
221
212
  }
222
213
 
223
- .uepay-ops-login .login-btn {
214
+ .uepay-ops-login .login-btn{
224
215
  width: 100%;
225
216
  }
226
217
 
227
218
  /*captcha*/
228
- .uepay-ops-captcha {
219
+ .uepay-ops-captcha{
229
220
  position: relative;
230
221
  width: 60px;
231
222
  height: 20px;
232
223
  cursor: pointer;
233
224
  }
234
225
 
235
- .uepay-ops-captcha .ops-spin {
226
+ .uepay-ops-captcha .ops-spin{
236
227
  position: absolute;
237
228
  padding-top: 2px;
238
229
  padding-left: 22px;
@@ -241,7 +232,7 @@ html {
241
232
  background-color: #fff;
242
233
  }
243
234
 
244
- .uepay-ops-captcha img {
235
+ .uepay-ops-captcha img{
245
236
  display: block;
246
237
  width: 100%;
247
238
  height: 100%;
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- require("core-js/modules/web.dom.iterable.js");
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _userMgrLayout = _interopRequireDefault(require("./userMgr/userMgrLayout"));
13
-
14
- var _loading = _interopRequireDefault(require("./spin/loading"));
15
-
16
- var _appUrl = require("../data/appUrl");
17
-
18
- var _userInfo = require("./userMgr/userInfo");
19
-
20
- var _token = require("../util/token");
21
-
22
- var _antd = require("antd");
23
-
24
- var _localDefined = _interopRequireDefault(require("../data/localDefined"));
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
-
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
-
32
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
33
-
34
- const DefaultLocal = typeof window !== 'undefined' ? localStorage.getItem("uepey_locale") : false,
35
- LoginState = {
36
- Check: 1,
37
- Login: 2,
38
- LogOut: 3
39
- };
40
-
41
- function ApplicationLight(_ref) {
42
- let {
43
- Component,
44
- pageProps
45
- } = _ref;
46
- const [login, setLongin] = (0, _react.useState)(LoginState.Check),
47
- [local, setLocal] = (0, _react.useState)(DefaultLocal ? JSON.parse(DefaultLocal) : _localDefined.default[0]);
48
- (0, _react.useEffect)(() => {
49
- (0, _appUrl.checkLogin)().then(res => {
50
- let data;
51
-
52
- if (res && 0 < res.code && (data = res.data)) {
53
- _userInfo.user.set(data.code, data.name);
54
-
55
- setLongin(LoginState.Login);
56
- } else {
57
- setLongin(LoginState.LogOut);
58
- }
59
- });
60
- }, []); //登陸狀態控制
61
-
62
- function handleLogin(login) {
63
- setLongin(login ? LoginState.Login : LoginState.LogOut);
64
- }
65
-
66
- ;
67
-
68
- function handleLocale(local) {}
69
-
70
- ;
71
-
72
- function handLoginOut() {
73
- (0, _appUrl.logout)().then(res => {
74
- if (res && 0 < res.code) {
75
- _token.token.del();
76
-
77
- setLongin(LoginState.LogOut);
78
- } else {
79
- _antd.message.error(res && res.msg || '网络故障,请稍后再试!');
80
- }
81
- }).catch(err => {
82
- _antd.message.error('网络故障,请稍后再试!');
83
-
84
- console.log(err);
85
- });
86
- }
87
-
88
- switch (login) {
89
- case LoginState.Login:
90
- return /*#__PURE__*/_react.default.createElement(Component, _extends({}, pageProps, {
91
- onLoginOut: handLoginOut
92
- }));
93
-
94
- case LoginState.LogOut:
95
- return /*#__PURE__*/_react.default.createElement(_userMgrLayout.default, {
96
- waySignList: [],
97
- onLogin: handleLogin,
98
- onLocale: handleLocale,
99
- locale: local
100
- });
101
-
102
- case LoginState.Check:
103
- default:
104
- return /*#__PURE__*/_react.default.createElement(_loading.default, null);
105
- }
106
- }
107
-
108
- var _default = ApplicationLight;
109
- exports.default = _default;
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
-
3
- interface Props {}
4
-
5
- declare class Client extends React.Component<Props> {}
6
- export default Client
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
-
3
- interface Props {}
4
-
5
- declare class Home extends React.Component<Props> {}
6
- export default Home
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
-
14
- /**
15
- *
16
- * @param locale
17
- * @param onLocale
18
- * @param onLogin
19
- * @param Component
20
- * @param pageProps
21
- * @return {*}
22
- * @constructor
23
- */
24
- function Single(_ref) {
25
- let {
26
- locale,
27
- onLocale,
28
- onLogin,
29
- Component,
30
- pageProps
31
- } = _ref;
32
- return /*#__PURE__*/_react.default.createElement("div", {
33
- className: "uepay-ops-layout-single"
34
- }, /*#__PURE__*/_react.default.createElement(Component, _extends({}, pageProps, {
35
- pageId: "single",
36
- onPageClose: handleClose
37
- })));
38
- }
39
-
40
- var _default = Single;
41
- exports.default = _default;
42
-
43
- function handleClose() {
44
- if (navigator.userAgent.indexOf("MSIE") > 0) {
45
- if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
46
- window.opener = null;
47
- window.close();
48
- } else {
49
- window.open('', '_top');
50
- window.top.close();
51
- }
52
- } else if (navigator.userAgent.indexOf("Firefox") > 0) {
53
- window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的
54
- //window.history.go(-2);
55
- } else {
56
- window.opener = null;
57
- window.open('', '_self', '');
58
- window.close();
59
- }
60
- }
package/lib/data/ctx.d.ts DELETED
@@ -1,37 +0,0 @@
1
- /**
2
- * 获取服务后台地址
3
- */
4
- export function getHost(): string;
5
-
6
- /**
7
- * 获取鉴权中心的地址
8
- */
9
- export function getServerUrl(): string;
10
-
11
- /**
12
- * 获取流程表单页面地址
13
- */
14
- export function getBpmFormPage(insId: string | number): string;
15
-
16
- /**
17
- * 获取项目中文名称
18
- */
19
- export function getTitleCn(): string;
20
-
21
- /**
22
- * 获取项目英文名
23
- */
24
- export function getTitleEn(): string;
25
-
26
- /**
27
- * 获取项目中的配置
28
- * @param key 配置项的key
29
- */
30
- export function get(key?: string | boolean): any;
31
-
32
- /**
33
- * 用于网页打开的的指向参数。
34
- * origin表示在原页面上打开多窗口
35
- * new表示打开一个新的窗口
36
- */
37
- export const PageOptType: { origin: "origin", new: "new" };
package/lib/util/net.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * get請求方法
3
- */
4
- export function get(url: string, headers?: object): Promise<Response>;
5
-
6
- /**
7
- * post請求方法
8
- */
9
- export function post(url: string, params: object, headers?: object): Promise<Response>;
10
-
11
- /**
12
- * put請求方法
13
- */
14
- export function put(url: string, params: object, headers?: object): Promise<Response>;
15
-
16
- /**
17
- * patch請求方法
18
- */
19
- export function patch(url: string, params: object, headers?: object): Promise<Response>;
20
-
21
- /**
22
- * remove請求方法
23
- */
24
- export function remove(url: string, params?: object, headers?: object): Promise<Response>;
25
-