uepay-ops2 4.0.13 → 4.0.15-beta.1

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.
@@ -15,24 +15,20 @@ var _en_US = _interopRequireDefault(require("antd/lib/locale-provider/en_US"));
15
15
 
16
16
  var _zh_TW = _interopRequireDefault(require("antd/lib/locale-provider/zh_TW"));
17
17
 
18
- var _sider = _interopRequireDefault(require("./layout/sider"));
18
+ var _menuAble = _interopRequireDefault(require("./layout/menuAble"));
19
19
 
20
- var _header = _interopRequireDefault(require("./layout/header"));
20
+ var _single = _interopRequireDefault(require("./layout/single"));
21
21
 
22
22
  var _context = require("./locale/context");
23
23
 
24
24
  var _withOptions = _interopRequireDefault(require("./auth/withOptions"));
25
25
 
26
- var _multiPage = _interopRequireDefault(require("./layout/multiPage"));
26
+ var _ctx = require("../data/ctx");
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
30
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
31
 
32
- const {
33
- Footer,
34
- Content
35
- } = _antd.Layout;
36
32
  /**
37
33
  * 布局组件
38
34
  * @param props
@@ -43,25 +39,13 @@ const {
43
39
  * @return {*}
44
40
  * @constructor
45
41
  */
46
-
47
42
  class LayoutExt extends _react.default.Component {
48
43
  constructor() {
49
44
  super(...arguments);
50
45
 
51
46
  _defineProperty(this, "state", {
52
- collapsed: false,
53
47
  locale: 'cn'
54
48
  });
55
-
56
- _defineProperty(this, "els", {});
57
-
58
- _defineProperty(this, "comps", []);
59
-
60
- _defineProperty(this, "handleCollapse", collapsed => {
61
- this.setState((state, props) => ({
62
- collapsed: !state.collapsed
63
- }));
64
- });
65
49
  }
66
50
 
67
51
  render() {
@@ -72,33 +56,19 @@ class LayoutExt extends _react.default.Component {
72
56
  locale,
73
57
  onLogin
74
58
  } = this.props,
75
- {
76
- collapsed
77
- } = this.state,
78
- isCn = 'cn' === locale.value;
59
+ isCn = 'cn' === locale.value,
60
+ PageComp = pageProps && pageProps.opt === _ctx.PageOptType.new && _single.default || _menuAble.default;
79
61
  return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
80
62
  locale: isCn ? _zh_TW.default : _en_US.default
81
63
  }, /*#__PURE__*/_react.default.createElement(_context.LocaleProvider, {
82
64
  value: locale
83
- }, /*#__PURE__*/_react.default.createElement(_antd.Layout, {
84
- className: "uepay-ops-layout",
85
- hasSider: true
86
- }, /*#__PURE__*/_react.default.createElement(_sider.default, {
87
- collapsed: collapsed
88
- }), /*#__PURE__*/_react.default.createElement(_antd.Layout, null, /*#__PURE__*/_react.default.createElement(_header.default, {
89
- collapsed: collapsed,
90
- onCollapse: this.handleCollapse,
65
+ }, /*#__PURE__*/_react.default.createElement(PageComp, {
91
66
  locale: locale,
92
67
  onLocale: onLocale,
93
- onLogin: onLogin
94
- }), /*#__PURE__*/_react.default.createElement(Content, {
95
- className: "ops-content"
96
- }, /*#__PURE__*/_react.default.createElement(_multiPage.default, {
97
68
  Component: Component,
98
- pageProps: pageProps
99
- })), /*#__PURE__*/_react.default.createElement(Footer, {
100
- className: "ops-footer"
101
- }, "Power by Uepay Technology")))));
69
+ pageProps: pageProps,
70
+ onLogin: onLogin
71
+ })));
102
72
  }
103
73
 
104
74
  }
@@ -113,41 +83,4 @@ LayoutExt.propTypes = {
113
83
 
114
84
  var _default = (0, _withOptions.default)()(LayoutExt);
115
85
 
116
- exports.default = _default;
117
- const Hide = {
118
- display: 'none'
119
- },
120
- Show = {
121
- display: 'block'
122
- };
123
- /**
124
- *
125
- * @param props.children 要渲染的子组件
126
- * @param props.show 数据显示或关闭
127
- * @return {*}
128
- * @constructor
129
- */
130
-
131
- class CompWrapper extends _react.default.Component {
132
- constructor() {
133
- super(...arguments);
134
-
135
- _defineProperty(this, "show", false);
136
-
137
- this.show = this.props.show;
138
- }
139
-
140
- setIsShow(show) {
141
- this.show = show;
142
- }
143
-
144
- render() {
145
- const {
146
- children
147
- } = this.props;
148
- return /*#__PURE__*/_react.default.createElement("div", {
149
- style: this.show ? Show : Hide
150
- }, children);
151
- }
152
-
153
- }
86
+ exports.default = _default;
@@ -58,6 +58,7 @@ const withLocale = function withLocale() {
58
58
 
59
59
  }
60
60
 
61
+ Wrapper.tabName = Comp.tabName;
61
62
  Wrapper.displayName = "withLocale(".concat((0, _tool.getDisplayName)(Comp), ")");
62
63
  return Wrapper;
63
64
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.logout = exports.login = exports.getSts = exports.getMenus = exports.getLoginConfig = exports.getCollectById = exports.getBpmForm = exports.checkLogin = exports.changePassword = exports.captcha = void 0;
6
+ exports.logout = exports.login = exports.getSts = exports.getMenus = exports.checkLogin = exports.changePassword = exports.captcha = void 0;
7
7
 
8
8
  var _ctx = require("./ctx");
9
9
 
@@ -40,18 +40,6 @@ exports.getSts = getSts;
40
40
  const getMenus = () => {
41
41
  return (0, _net.get)("".concat((0, _ctx.getHost)(), "/api/uepay/assist/authority/runtimeserver/identitymgr/tree/menu/"));
42
42
  };
43
- /**
44
- * 獲取當前登錄配置
45
- * 密码:password;动态码:googleAuth;短信:sms
46
- * @returns {Promise<Response>}
47
- */
48
-
49
-
50
- exports.getMenus = getMenus;
51
-
52
- const getLoginConfig = () => {
53
- return (0, _net.get)("".concat((0, _ctx.getHost)(), "/api/uepay/assist/authority/runtimeserver/identitymgr/token/way"));
54
- };
55
43
  /**
56
44
  * 登陸接口
57
45
  * @param account 用戶名
@@ -61,7 +49,7 @@ const getLoginConfig = () => {
61
49
  */
62
50
 
63
51
 
64
- exports.getLoginConfig = getLoginConfig;
52
+ exports.getMenus = getMenus;
65
53
 
66
54
  const login = (account, password, captcha) => {
67
55
  let params = {
@@ -122,34 +110,5 @@ const changePassword = (oldPasswd, newPasswd, verifyPasswd, captcha) => {
122
110
  };
123
111
  return (0, _net.post)("".concat((0, _ctx.getHost)(), "/api/authority/service/usr/passwd"), params);
124
112
  };
125
- /**
126
- * 获取流程表单
127
- * @param insId 流程实例ID
128
- * @return {Promise<Response>}
129
- *
130
- */
131
-
132
-
133
- exports.changePassword = changePassword;
134
-
135
- const getBpmForm = insId => {
136
- return (0, _net.get)("".concat((0, _ctx.getHost)(), "/api/pbm/execute/usr/form?ins=").concat(insId));
137
- };
138
- /**
139
- *
140
- * @param host
141
- * @param collectId
142
- * @return {Promise<Response>}
143
- */
144
-
145
-
146
- exports.getBpmForm = getBpmForm;
147
-
148
- const getCollectById = _ref => {
149
- let {
150
- collectId
151
- } = _ref;
152
- return (0, _net.get)("".concat((0, _ctx.getHost)(), "/data/mesh/execute/collect?collectId=").concat(collectId));
153
- };
154
113
 
155
- exports.getCollectById = getCollectById;
114
+ exports.changePassword = changePassword;
@@ -0,0 +1,37 @@
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/data/ctx.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getTitleEn = exports.getTitleCn = exports.getServerUrl = exports.getModuleId = exports.getHost = exports.get = exports.default = void 0;
6
+ exports.getTitleEn = exports.getTitleCn = exports.getServerUrl = exports.getHost = exports.getBpmFormPage = exports.get = exports.default = exports.PageOptType = void 0;
7
7
 
8
8
  var _config = _interopRequireDefault(require("next/config"));
9
9
 
@@ -33,15 +33,16 @@ const getServerUrl = () => {
33
33
  return config['module.server.url'];
34
34
  };
35
35
  /**
36
- * 获取当前的模块编号
36
+ * 构建跳转对应流程表单的URL
37
+ * @param insId {string|number} 流程实例Id
37
38
  * @return {*}
38
39
  */
39
40
 
40
41
 
41
42
  exports.getServerUrl = getServerUrl;
42
43
 
43
- const getModuleId = () => {
44
- return config['module.current.id'];
44
+ const getBpmFormPage = insId => {
45
+ return "".concat(config['module.bpm.form_page'], "?insId=").concat(insId);
45
46
  };
46
47
  /**
47
48
  * 获取项目中文名称
@@ -49,7 +50,7 @@ const getModuleId = () => {
49
50
  */
50
51
 
51
52
 
52
- exports.getModuleId = getModuleId;
53
+ exports.getBpmFormPage = getBpmFormPage;
53
54
 
54
55
  const getTitleCn = () => {
55
56
  return config['module.current.title_cn'];
@@ -77,15 +78,27 @@ const get = function get() {
77
78
  let key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
78
79
  return key ? config[key] : config;
79
80
  };
81
+ /**
82
+ * Page的操作頁面
83
+ * @type {{origin: string, new_window: string}}
84
+ */
85
+
80
86
 
81
87
  exports.get = get;
88
+ const PageOptType = {
89
+ origin: 'origin',
90
+ //原窗口控制
91
+ new: 'new' //新窗口
92
+
93
+ };
94
+ exports.PageOptType = PageOptType;
82
95
  const Ctx = {
83
96
  getHost,
84
97
  getServerUrl,
85
- getModuleId,
86
98
  getTitleCn,
87
99
  getTitleEn,
88
- get
100
+ get,
101
+ PageOptType
89
102
  };
90
103
  var _default = Ctx;
91
104
  exports.default = _default;
@@ -0,0 +1,25 @@
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
+
package/lib/util/net.js CHANGED
@@ -15,24 +15,23 @@ 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
+ }
18
21
  /**
19
22
  * get请求,
20
23
  * @param url {String} 访问地址的url
21
24
  * @param headers {Object} 附加頭部參數
22
25
  * @return {Promise<Response>}
23
26
  */
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
- };
27
+
28
+
29
+ const get = (url, headers) => {
29
30
  return fetch(url, {
30
31
  method: 'GET',
31
32
  mode: "cors",
32
33
  headers: buildHeaders(headers)
33
- }).then(res => onRes(res)).catch(function (error) {
34
- console.log('Fetch Error: ', error.message);
35
- });
34
+ }).then(res => onRes(res)).catch(onCatchError);
36
35
  };
37
36
  /**
38
37
  * post请求,表示新增数据
@@ -45,21 +44,8 @@ const get = function get(url) {
45
44
 
46
45
  exports.get = get;
47
46
 
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
- }
47
+ const post = (url, params, headers) => {
48
+ return request('POST', url, params, headers);
63
49
  };
64
50
  /**
65
51
  * put请求,表示修改数据
@@ -72,21 +58,8 @@ const post = function post(url, params) {
72
58
 
73
59
  exports.post = post;
74
60
 
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
- }
61
+ const put = (url, params, headers) => {
62
+ return request('PUT', url, params, headers);
90
63
  };
91
64
  /**
92
65
  * patch请求,表示修改数据
@@ -99,25 +72,13 @@ const put = function put(url, params) {
99
72
 
100
73
  exports.put = put;
101
74
 
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
- }
75
+ const patch = (url, params, headers) => {
76
+ return request('PATCH', url, params, headers);
117
77
  };
118
78
  /**
119
79
  * delete请求,表示修改数据
120
80
  * @param url {String} 访问地址的url
81
+ * @param params {Object} 附加頭部參數
121
82
  * @param headers {Object} 附加頭部參數
122
83
  * @return {Promise<Response>}
123
84
  */
@@ -125,16 +86,35 @@ const patch = function patch(url, params) {
125
86
 
126
87
  exports.patch = patch;
127
88
 
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
- });
89
+ const remove = (url, params, headers) => {
90
+ return request('DELETE', url, params, headers);
137
91
  };
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
+ }
138
118
  /**
139
119
  * 处理返回数据
140
120
  * @param res
@@ -142,8 +122,6 @@ const remove = function remove(url) {
142
122
  */
143
123
 
144
124
 
145
- exports.remove = remove;
146
-
147
125
  const onRes = res => {
148
126
  if (res && res.ok) {
149
127
  const _token = res.headers.get('Token'),
@@ -179,19 +157,19 @@ const buildHeaders = function buildHeaders() {
179
157
  menu = (0, _authRoute.getCurMenu)();
180
158
 
181
159
  return Object.assign({
182
- Authorization: parseMesh(menu.path) || 'UePay',
160
+ Authorization: parsePath(menu.path),
183
161
  'Content-Type': 'application/json',
184
162
  Token: _token2.token.get() || 'UePay',
185
163
  STS: _c.sts
186
164
  }, headers);
187
165
  };
188
166
  /**
189
- * 解析提取mesh字符塊
167
+ * 解析提取相关的URL信息,如果没有指向当前菜单则获取浏览器Path
190
168
  * @param path {String}
191
169
  */
192
170
 
193
171
 
194
- const parseMesh = path => {
172
+ const parsePath = path => {
195
173
  if (path) {
196
174
  let pos = -1;
197
175
 
@@ -201,5 +179,7 @@ const parseMesh = path => {
201
179
  } else {
202
180
  return btoa(path);
203
181
  }
182
+ } else {
183
+ return btoa(window.location.pathname);
204
184
  }
205
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uepay-ops2",
3
- "version": "4.0.13",
3
+ "version": "4.0.15-beta.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -30,6 +30,7 @@
30
30
  "moment": "^2.24.0"
31
31
  },
32
32
  "devDependencies": {
33
+ "antd": "^4.5.1",
33
34
  "core-js": "^2.6.11",
34
35
  "@zeit/next-css": "^1.0.1",
35
36
  "@zeit/next-sass": "^1.0.1",
@@ -45,7 +46,6 @@
45
46
  "react": "^16.12.0",
46
47
  "react-dom": "^16.12.0",
47
48
  "@ant-design/icons": "^4.2.1",
48
- "antd": "^4.5.1",
49
- "uepay-mesh": "^4.0.19"
49
+ "uepay-mesh": "^4.0.1"
50
50
  }
51
51
  }
package/styles.css CHANGED
@@ -19,8 +19,10 @@ html {
19
19
  }
20
20
 
21
21
  .ant-tabs-tabpane {
22
+ position: relative;
23
+ display: flex;
22
24
  height: 100%;
23
- overflow-y: auto;
25
+ flex-direction: column;
24
26
  }
25
27
 
26
28
  /*frame*/
@@ -52,7 +54,7 @@ html {
52
54
  align-items: center;
53
55
  }
54
56
 
55
- .uepay-ops-header .usr-setting{
57
+ .uepay-ops-header .usr-setting {
56
58
  width: 100%;
57
59
  height: 100%;
58
60
  background-color: rgba(0, 0, 0, 0.5);
@@ -72,14 +74,14 @@ html {
72
74
  }
73
75
 
74
76
  .uepay-ops-header .usr-setting-title {
75
- padding: 15px 0 ;
77
+ padding: 15px 0;
76
78
  margin: 0 20px;
77
79
  font-size: 18px;
78
80
  border-bottom: 1px solid #ccc;
79
81
  }
80
82
 
81
83
  .uepay-ops-header .usr-setting-form {
82
- padding:40px 20px 10px 20px;
84
+ padding: 40px 20px 10px 20px;
83
85
  }
84
86
 
85
87
  .uepay-ops-header #uepay-frame-avatar {
@@ -167,6 +169,13 @@ html {
167
169
  padding: 4px;
168
170
  }
169
171
 
172
+ .uepay-ops-layout-single {
173
+ height: 100%;
174
+ width: 100%;
175
+ overflow-y: auto;
176
+ padding: .5rem 1rem;
177
+ }
178
+
170
179
  /*login*/
171
180
  .uepay-ops-user-global {
172
181
  cursor: pointer;
@@ -184,7 +193,7 @@ html {
184
193
  height: 100%;
185
194
  }
186
195
 
187
- .uepay-ops-login{
196
+ .uepay-ops-login {
188
197
  display: flex;
189
198
  justify-content: center;
190
199
  align-items: center;
@@ -192,38 +201,38 @@ html {
192
201
  background: #f3f3f3;
193
202
  }
194
203
 
195
- .uepay-ops-login .login-form{
204
+ .uepay-ops-login .login-form {
196
205
  width: 320px;
197
206
  padding: 36px;
198
207
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.08);
199
208
  background: #fff;
200
209
  }
201
210
 
202
- .uepay-ops-login .login-logo{
211
+ .uepay-ops-login .login-logo {
203
212
  width: 100%;
204
213
  height: 40px;
205
214
  }
206
215
 
207
- .uepay-ops-login .login-name{
216
+ .uepay-ops-login .login-name {
208
217
  line-height: 40px;
209
218
  text-align: center;
210
219
  padding-left: 15px;
211
220
  font-size: 20px;
212
221
  }
213
222
 
214
- .uepay-ops-login .login-btn{
223
+ .uepay-ops-login .login-btn {
215
224
  width: 100%;
216
225
  }
217
226
 
218
227
  /*captcha*/
219
- .uepay-ops-captcha{
228
+ .uepay-ops-captcha {
220
229
  position: relative;
221
230
  width: 60px;
222
231
  height: 20px;
223
232
  cursor: pointer;
224
233
  }
225
234
 
226
- .uepay-ops-captcha .ops-spin{
235
+ .uepay-ops-captcha .ops-spin {
227
236
  position: absolute;
228
237
  padding-top: 2px;
229
238
  padding-left: 22px;
@@ -232,7 +241,7 @@ html {
232
241
  background-color: #fff;
233
242
  }
234
243
 
235
- .uepay-ops-captcha img{
244
+ .uepay-ops-captcha img {
236
245
  display: block;
237
246
  width: 100%;
238
247
  height: 100%;