ls-pro-common 1.0.13 → 1.0.16

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.
@@ -0,0 +1,3 @@
1
+ import './common.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
Binary file
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import './common.less';
3
+ export default (function () {
4
+ return /*#__PURE__*/React.createElement("div", {
5
+ className: "page404"
6
+ }, /*#__PURE__*/React.createElement("img", {
7
+ src: "./404.jpg"
8
+ }), " \u60A8\u8BBF\u95EE\u7684\u8D44\u6E90\u4E0D\u5B58\u5728~~");
9
+ });
@@ -0,0 +1,3 @@
1
+ import './common.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import "antd/es/spin/style";
2
+ import _Spin from "antd/es/spin";
3
+ import React from 'react';
4
+ import './common.less';
5
+ export default (function () {
6
+ return /*#__PURE__*/React.createElement("div", {
7
+ className: "loading"
8
+ }, /*#__PURE__*/React.createElement(_Spin, null), "\u52A0\u8F7D\u4E2D... ");
9
+ });
@@ -61,4 +61,25 @@
61
61
  .flex {
62
62
  width: 0;
63
63
  }
64
+ }
65
+
66
+ .page404 {
67
+ width : 100%;
68
+ height : 100%;
69
+ text-align : center;
70
+ padding-top : 20%;
71
+ vertical-align: middle;
72
+
73
+ img {
74
+ vertical-align: middle;
75
+ padding-right : 20px;
76
+ }
77
+ }
78
+
79
+ .loading {
80
+ height : 100%;
81
+ width : 100%;
82
+ text-align : center;
83
+ padding-top: 20%;
84
+ background : #fff;
64
85
  }
@@ -20,10 +20,10 @@ export declare function httpPost(url: string, data?: Record<string, any>, isJson
20
20
  * put 请求
21
21
  * @param url 接口
22
22
  * @param data 参数{key:value}
23
- * @param needGateWay 是否需要网关 默认为true
23
+ * @param needGateWay 是否需要网关 默认为true
24
24
  * @returns Promise<ApiResponse>
25
25
  */
26
- export declare function httpPut(url: string, data?: Record<string, any>): Promise<any>;
26
+ export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean): Promise<any>;
27
27
  /**
28
28
  * delete 请求
29
29
  * @param url 接口
@@ -31,7 +31,7 @@ export declare function httpPut(url: string, data?: Record<string, any>): Promis
31
31
  * @param needGateWay 是否需要网关 默认为true
32
32
  * @returns Promise<ApiResponse>
33
33
  */
34
- export declare function httpDelete(url: string, data: any): Promise<any>;
34
+ export declare function httpDelete(url: string, data: any, needGateWay?: boolean): Promise<any>;
35
35
  /**
36
36
  * 读取数据字典
37
37
  * @param dictCode 字典编码
package/es/http/index.js CHANGED
@@ -137,7 +137,7 @@ export function httpPost(_x4) {
137
137
  * put 请求
138
138
  * @param url 接口
139
139
  * @param data 参数{key:value}
140
- * @param needGateWay 是否需要网关 默认为true
140
+ * @param needGateWay 是否需要网关 默认为true
141
141
  * @returns Promise<ApiResponse>
142
142
  */
143
143
 
@@ -188,17 +188,24 @@ export function httpPut(_x5) {
188
188
  function _httpPut() {
189
189
  _httpPut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(url) {
190
190
  var data,
191
+ needGateWay,
191
192
  _args4 = arguments;
192
193
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
193
194
  while (1) {
194
195
  switch (_context4.prev = _context4.next) {
195
196
  case 0:
196
197
  data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
198
+ needGateWay = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
199
+
200
+ if (needGateWay) {
201
+ url = toGatewayUrl(url);
202
+ }
203
+
197
204
  return _context4.abrupt("return", request.put(url, {
198
205
  data: data
199
206
  }));
200
207
 
201
- case 2:
208
+ case 4:
202
209
  case "end":
203
210
  return _context4.stop();
204
211
  }
@@ -220,15 +227,23 @@ export function httpDelete(_x6, _x7) {
220
227
 
221
228
  function _httpDelete() {
222
229
  _httpDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(url, data) {
230
+ var needGateWay,
231
+ _args5 = arguments;
223
232
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
224
233
  while (1) {
225
234
  switch (_context5.prev = _context5.next) {
226
235
  case 0:
236
+ needGateWay = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
237
+
238
+ if (needGateWay) {
239
+ url = toGatewayUrl(url);
240
+ }
241
+
227
242
  return _context5.abrupt("return", request.delete(url, {
228
243
  data: data
229
244
  }));
230
245
 
231
- case 1:
246
+ case 3:
232
247
  case "end":
233
248
  return _context5.stop();
234
249
  }
@@ -27,11 +27,13 @@ export declare const isLogin: () => boolean;
27
27
  * 设置本地缓存
28
28
  * @param { String } key 关键字
29
29
  * @param { Object } data 值
30
+ * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
30
31
  */
31
- export declare const setCache: (key: string, data: any) => void;
32
+ export declare const setCache: (key: string, data: any, session?: boolean) => void;
32
33
  /**
33
34
  * 读取本地缓存
34
35
  * @param { String } key 关键字
36
+ * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
35
37
  * @returns 关键字对应的值
36
38
  */
37
39
  export declare const getCache: any;
package/es/utils/index.js CHANGED
@@ -58,23 +58,28 @@ export var isLogin = function isLogin() {
58
58
  * 设置本地缓存
59
59
  * @param { String } key 关键字
60
60
  * @param { Object } data 值
61
+ * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
61
62
  */
62
63
 
63
64
  export var setCache = function setCache(key, data) {
65
+ var session = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66
+
64
67
  if (_typeof(data) === 'object') {
65
68
  data = JSON.stringify(data);
66
69
  }
67
70
 
68
- localStorage.setItem(key, data);
71
+ session ? sessionStorage.setItem(key, data) : localStorage.setItem(key, data);
69
72
  };
70
73
  /**
71
74
  * 读取本地缓存
72
75
  * @param { String } key 关键字
76
+ * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
73
77
  * @returns 关键字对应的值
74
78
  */
75
79
 
76
80
  export var getCache = function getCache(key) {
77
- var data = localStorage.getItem(key);
81
+ var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
82
+ var data = session ? sessionStorage.getItem(key) : localStorage.getItem(key);
78
83
 
79
84
  if (data && (data.startsWith('{') || data.startsWith('['))) {
80
85
  data = JSON.parse(data);
@@ -0,0 +1,3 @@
1
+ import './common.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
Binary file
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ require("./common.less");
13
+
14
+ var _default = function _default() {
15
+ return /*#__PURE__*/_react.default.createElement("div", {
16
+ className: "page404"
17
+ }, /*#__PURE__*/_react.default.createElement("img", {
18
+ src: "./404.jpg"
19
+ }), " \u60A8\u8BBF\u95EE\u7684\u8D44\u6E90\u4E0D\u5B58\u5728~~");
20
+ };
21
+
22
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ import './common.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ require("antd/es/spin/style");
11
+
12
+ var _spin = _interopRequireDefault(require("antd/es/spin"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ require("./common.less");
17
+
18
+ var _default = function _default() {
19
+ return /*#__PURE__*/_react.default.createElement("div", {
20
+ className: "loading"
21
+ }, /*#__PURE__*/_react.default.createElement(_spin.default, null), "\u52A0\u8F7D\u4E2D... ");
22
+ };
23
+
24
+ exports.default = _default;
@@ -61,4 +61,25 @@
61
61
  .flex {
62
62
  width: 0;
63
63
  }
64
+ }
65
+
66
+ .page404 {
67
+ width : 100%;
68
+ height : 100%;
69
+ text-align : center;
70
+ padding-top : 20%;
71
+ vertical-align: middle;
72
+
73
+ img {
74
+ vertical-align: middle;
75
+ padding-right : 20px;
76
+ }
77
+ }
78
+
79
+ .loading {
80
+ height : 100%;
81
+ width : 100%;
82
+ text-align : center;
83
+ padding-top: 20%;
84
+ background : #fff;
64
85
  }
@@ -20,10 +20,10 @@ export declare function httpPost(url: string, data?: Record<string, any>, isJson
20
20
  * put 请求
21
21
  * @param url 接口
22
22
  * @param data 参数{key:value}
23
- * @param needGateWay 是否需要网关 默认为true
23
+ * @param needGateWay 是否需要网关 默认为true
24
24
  * @returns Promise<ApiResponse>
25
25
  */
26
- export declare function httpPut(url: string, data?: Record<string, any>): Promise<any>;
26
+ export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean): Promise<any>;
27
27
  /**
28
28
  * delete 请求
29
29
  * @param url 接口
@@ -31,7 +31,7 @@ export declare function httpPut(url: string, data?: Record<string, any>): Promis
31
31
  * @param needGateWay 是否需要网关 默认为true
32
32
  * @returns Promise<ApiResponse>
33
33
  */
34
- export declare function httpDelete(url: string, data: any): Promise<any>;
34
+ export declare function httpDelete(url: string, data: any, needGateWay?: boolean): Promise<any>;
35
35
  /**
36
36
  * 读取数据字典
37
37
  * @param dictCode 字典编码
package/lib/http/index.js CHANGED
@@ -157,7 +157,7 @@ function httpPost(_x4) {
157
157
  * put 请求
158
158
  * @param url 接口
159
159
  * @param data 参数{key:value}
160
- * @param needGateWay 是否需要网关 默认为true
160
+ * @param needGateWay 是否需要网关 默认为true
161
161
  * @returns Promise<ApiResponse>
162
162
  */
163
163
 
@@ -210,17 +210,24 @@ function httpPut(_x5) {
210
210
  function _httpPut() {
211
211
  _httpPut = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(url) {
212
212
  var data,
213
+ needGateWay,
213
214
  _args4 = arguments;
214
215
  return _regenerator.default.wrap(function _callee4$(_context4) {
215
216
  while (1) {
216
217
  switch (_context4.prev = _context4.next) {
217
218
  case 0:
218
219
  data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
220
+ needGateWay = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
221
+
222
+ if (needGateWay) {
223
+ url = (0, _utils.toGatewayUrl)(url);
224
+ }
225
+
219
226
  return _context4.abrupt("return", request.put(url, {
220
227
  data: data
221
228
  }));
222
229
 
223
- case 2:
230
+ case 4:
224
231
  case "end":
225
232
  return _context4.stop();
226
233
  }
@@ -243,15 +250,23 @@ function httpDelete(_x6, _x7) {
243
250
 
244
251
  function _httpDelete() {
245
252
  _httpDelete = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(url, data) {
253
+ var needGateWay,
254
+ _args5 = arguments;
246
255
  return _regenerator.default.wrap(function _callee5$(_context5) {
247
256
  while (1) {
248
257
  switch (_context5.prev = _context5.next) {
249
258
  case 0:
259
+ needGateWay = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
260
+
261
+ if (needGateWay) {
262
+ url = (0, _utils.toGatewayUrl)(url);
263
+ }
264
+
250
265
  return _context5.abrupt("return", request.delete(url, {
251
266
  data: data
252
267
  }));
253
268
 
254
- case 1:
269
+ case 3:
255
270
  case "end":
256
271
  return _context5.stop();
257
272
  }
@@ -27,11 +27,13 @@ export declare const isLogin: () => boolean;
27
27
  * 设置本地缓存
28
28
  * @param { String } key 关键字
29
29
  * @param { Object } data 值
30
+ * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
30
31
  */
31
- export declare const setCache: (key: string, data: any) => void;
32
+ export declare const setCache: (key: string, data: any, session?: boolean) => void;
32
33
  /**
33
34
  * 读取本地缓存
34
35
  * @param { String } key 关键字
36
+ * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
35
37
  * @returns 关键字对应的值
36
38
  */
37
39
  export declare const getCache: any;
@@ -117,21 +117,25 @@ var isLogin = function isLogin() {
117
117
  * 设置本地缓存
118
118
  * @param { String } key 关键字
119
119
  * @param { Object } data 值
120
+ * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
120
121
  */
121
122
 
122
123
 
123
124
  exports.isLogin = isLogin;
124
125
 
125
126
  var setCache = function setCache(key, data) {
127
+ var session = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
128
+
126
129
  if ((0, _typeof2.default)(data) === 'object') {
127
130
  data = JSON.stringify(data);
128
131
  }
129
132
 
130
- localStorage.setItem(key, data);
133
+ session ? sessionStorage.setItem(key, data) : localStorage.setItem(key, data);
131
134
  };
132
135
  /**
133
136
  * 读取本地缓存
134
137
  * @param { String } key 关键字
138
+ * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
135
139
  * @returns 关键字对应的值
136
140
  */
137
141
 
@@ -139,7 +143,8 @@ var setCache = function setCache(key, data) {
139
143
  exports.setCache = setCache;
140
144
 
141
145
  var getCache = function getCache(key) {
142
- var data = localStorage.getItem(key);
146
+ var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
147
+ var data = session ? sessionStorage.getItem(key) : localStorage.getItem(key);
143
148
 
144
149
  if (data && (data.startsWith('{') || data.startsWith('['))) {
145
150
  data = JSON.parse(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.13",
3
+ "version": "1.0.16",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@ant-design/icons": "^4.3.0",
31
- "ls-pro-table": "2.62.19",
31
+ "ls-pro-table": "2.62.20",
32
32
  "ls-pro-form": "1.52.20",
33
33
  "@babel/runtime": "^7.16.3",
34
34
  "classnames": "^2.2.6",