ls-pro-common 3.0.77 → 3.0.79

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.
@@ -1,6 +1,7 @@
1
1
  declare const request: import("umi-request").RequestMethod<false>;
2
2
  /**
3
- * get请求
3
+ * Get请求
4
+ *
4
5
  * @param url 接口
5
6
  * @param params 参数{key:value}
6
7
  * @param needGateWay 是否需要网关 默认为true
@@ -8,16 +9,18 @@ declare const request: import("umi-request").RequestMethod<false>;
8
9
  */
9
10
  export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
10
11
  /**
11
- * post请求
12
+ * Post请求
13
+ *
12
14
  * @param url 接口
13
15
  * @param data 参数{key:value}
14
- * @param isJson json请求还是form请求,默认为json请求
16
+ * @param isJson Json请求还是form请求,默认为json请求
15
17
  * @param needGateWay 是否需要网关 默认为true
16
18
  * @returns Promise<ApiResponse>
17
19
  */
18
20
  export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
19
21
  /**
20
- * put 请求
22
+ * Put 请求
23
+ *
21
24
  * @param url 接口
22
25
  * @param data 参数{key:value}
23
26
  * @param needGateWay 是否需要网关 默认为true
@@ -25,7 +28,8 @@ export declare function httpPost(url: string, data?: Record<string, any>, isJson
25
28
  */
26
29
  export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
27
30
  /**
28
- * delete 请求
31
+ * Delete 请求
32
+ *
29
33
  * @param url 接口
30
34
  * @param data 参数[]
31
35
  * @param needGateWay 是否需要网关 默认为true
@@ -34,6 +38,7 @@ export declare function httpPut(url: string, data?: Record<string, any>, needGat
34
38
  export declare function httpDelete(url: string, data: any, needGateWay?: boolean, timeout?: number): Promise<any>;
35
39
  /**
36
40
  * 读取数据字典
41
+ *
37
42
  * @param dictCode 字典编码
38
43
  * @param needGateWay 是否需要网关 默认为true
39
44
  * @returns Promise<Record<string,string>>
@@ -41,6 +46,7 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
41
46
  export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
42
47
  /**
43
48
  * 加载下拉框的数据源
49
+ *
44
50
  * @param url 后端接口
45
51
  * @param param 请求参数
46
52
  * @param valueField 值字段
package/lib/http/index.js CHANGED
@@ -15,31 +15,37 @@ var httpStatus = {
15
15
  };
16
16
  /** 请求拦截器,统一添加token */
17
17
  request.interceptors.request.use(function (url, options) {
18
- var token = getCookie("token");
18
+ var token = getCookie('token');
19
19
  options.headers = options.headers || {};
20
20
  // 处理 token
21
21
  if (token && url.indexOf('noToken=1') === -1) {
22
+ // @ts-ignore
22
23
  options.headers['token'] = token;
23
24
  }
24
25
  // 处理门店
25
26
  var shopNo = getCache('shopNo', true) || getCache('shopNo');
26
27
  if (shopNo) {
27
- options.headers["shopNo"] = shopNo;
28
+ // @ts-ignore
29
+ options.headers['shopNo'] = shopNo;
28
30
  }
29
31
  // 处理门店
30
32
  var shopCode = getCache('shopCode', true) || getCache('shopCode');
31
33
  if (shopCode) {
32
- options.headers["shopCode"] = shopCode;
34
+ // @ts-ignore
35
+ options.headers['shopCode'] = shopCode;
33
36
  }
34
37
  // 处理仓库
35
38
  var storeNo = getCache('storeNo', true) || getCache('storeNo');
36
39
  if (storeNo) {
37
- options.headers["storeNo"] = storeNo;
40
+ // @ts-ignore
41
+ options.headers['storeNo'] = storeNo;
38
42
  }
39
43
  var tag = getCookie('x-asm-prefer-tag');
40
44
  if (tag) {
41
- options.headers['x-asm-prefer-tag'] = tag;
45
+ // @ts-ignore
46
+ options.headers['x-asm-prefer-tag'] = tag; //灰度发版标识
42
47
  }
48
+
43
49
  url = url.replace('&noToken=1', '').replace('noToken=1', '');
44
50
  var param = {
45
51
  resCode: getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
@@ -78,7 +84,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
78
84
  retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
79
85
  faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
80
86
  if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
81
- if (!getCookie("token")) {
87
+ if (!getCookie('token')) {
82
88
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
83
89
  } else {
84
90
  reLogin();
@@ -127,7 +133,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
127
133
  _faultCode = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.faultCode;
128
134
  if (_retCode && !status.includes(_retCode)) {
129
135
  if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
130
- if (!getCookie("token")) {
136
+ if (!getCookie('token')) {
131
137
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
132
138
  } else {
133
139
  reLogin();
@@ -200,7 +206,8 @@ function ajax(url) {
200
206
  }
201
207
  }
202
208
  /**
203
- * get请求
209
+ * Get请求
210
+ *
204
211
  * @param url 接口
205
212
  * @param params 参数{key:value}
206
213
  * @param needGateWay 是否需要网关 默认为true
@@ -213,10 +220,11 @@ export function httpGet(url) {
213
220
  return ajax(url, params, 'get', needGateWay, true, timeout);
214
221
  }
215
222
  /**
216
- * post请求
223
+ * Post请求
224
+ *
217
225
  * @param url 接口
218
226
  * @param data 参数{key:value}
219
- * @param isJson json请求还是form请求,默认为json请求
227
+ * @param isJson Json请求还是form请求,默认为json请求
220
228
  * @param needGateWay 是否需要网关 默认为true
221
229
  * @returns Promise<ApiResponse>
222
230
  */
@@ -228,7 +236,8 @@ export function httpPost(url) {
228
236
  return ajax(url, data, 'post', needGateWay, isJson, timeout);
229
237
  }
230
238
  /**
231
- * put 请求
239
+ * Put 请求
240
+ *
232
241
  * @param url 接口
233
242
  * @param data 参数{key:value}
234
243
  * @param needGateWay 是否需要网关 默认为true
@@ -241,7 +250,8 @@ export function httpPut(url) {
241
250
  return ajax(url, data, 'put', needGateWay, true, timeout);
242
251
  }
243
252
  /**
244
- * delete 请求
253
+ * Delete 请求
254
+ *
245
255
  * @param url 接口
246
256
  * @param data 参数[]
247
257
  * @param needGateWay 是否需要网关 默认为true
@@ -254,6 +264,7 @@ export function httpDelete(url, data) {
254
264
  }
255
265
  /**
256
266
  * 读取数据字典
267
+ *
257
268
  * @param dictCode 字典编码
258
269
  * @param needGateWay 是否需要网关 默认为true
259
270
  * @returns Promise<Record<string,string>>
@@ -270,6 +281,7 @@ export function getDict(dictCode) {
270
281
  }
271
282
  /**
272
283
  * 加载下拉框的数据源
284
+ *
273
285
  * @param url 后端接口
274
286
  * @param param 请求参数
275
287
  * @param valueField 值字段
package/lib/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
18
  import TagCheck from './components/TagCheck';
19
+ import ViewOffice from './components/ViewOffice';
19
20
  import BaseService from './service/BaseService';
20
21
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
21
22
  import * as utils from './utils';
@@ -32,4 +33,4 @@ import type { DtlLyaoutProps } from './components/DtlLayout';
32
33
  import type { DescritionCardProps } from './components/DescritionCard';
33
34
  import type { PermissionProps } from './components/Permission';
34
35
  export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps, };
35
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, };
36
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, };
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
18
  import TagCheck from './components/TagCheck';
19
+ import ViewOffice from './components/ViewOffice';
19
20
  import BaseService from './service/BaseService';
20
21
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
21
22
  import * as utils from './utils';
@@ -26,4 +27,4 @@ import usePermission from './hooks/usePermission';
26
27
  import useGetState from './hooks/useGetState';
27
28
  import { useFilterLocal } from './hooks/useFilterBack';
28
29
  import useQueue from './hooks/useQueue';
29
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue };
30
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue };
package/lib/typing.d.ts CHANGED
@@ -25,29 +25,29 @@ export declare type TableToolbar = {
25
25
  };
26
26
  /** 基础模块接口类型 */
27
27
  export declare type BaseApiType = {
28
- /**加载数据api */
28
+ /** 加载数据api */
29
29
  load?: string;
30
- /**新增数据api */
30
+ /** 新增数据api */
31
31
  add?: string;
32
- /**更改数据api,如果跟新增接口一样,可不指定 */
32
+ /** 更改数据api,如果跟新增接口一样,可不指定 */
33
33
  edit?: string;
34
- /**删除数据api */
34
+ /** 删除数据api */
35
35
  delete?: string;
36
- /**主从一起保存方法,新增,现改,删除共用一个接口 */
36
+ /** 主从一起保存方法,新增,现改,删除共用一个接口 */
37
37
  mstDtl?: string;
38
- /**导入数据api */
38
+ /** 导入数据api */
39
39
  import?: string;
40
- /**导出数据api,如果跟加载数据api一致,可不指定 */
40
+ /** 导出数据api,如果跟加载数据api一致,可不指定 */
41
41
  export?: string;
42
42
  /** 审核接口 */
43
43
  audit?: string;
44
44
  };
45
- /**请求后端接口方法 */
45
+ /** 请求后端接口方法 */
46
46
  export declare type MethodType = {
47
- /**加载数据对应的方法,默认为get, 如果请求参数太长时,后端可能会改为post */
48
- get: 'get' | 'post';
47
+ /** 加载数据对应的方法,默认为get, 如果请求参数太长时,后端可能会改为post */
48
+ get?: 'get' | 'post';
49
49
  /** 更改数据的请求方法,默认为 put, 也可以是post,根据后端接口而定 */
50
- edit: 'put' | 'post';
50
+ edit?: 'put' | 'post';
51
51
  /** 删除数据的请求方法,默认为delete, 也可以是post,根据后端接口而定 */
52
- delete: 'delete' | 'post';
52
+ delete?: 'delete' | 'post';
53
53
  };
@@ -461,16 +461,11 @@ export var showAlert = function showAlert(text) {
461
461
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
462
462
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
463
463
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
464
- var win = top || window;
465
- //@ts-ignore
466
- if (!win.lsAppList || !!document.fullscreenElement) {
467
- win = window;
468
- }
469
464
  return new Promise(function (resolve, reject) {
470
465
  _Modal[type](_objectSpread({
471
466
  content: text,
472
467
  title: title,
473
- getContainer: getFullScreenElement() || win.document.body,
468
+ getContainer: getFullScreenElement() || document.body,
474
469
  onOk: function onOk() {
475
470
  resolve(true);
476
471
  },
@@ -492,11 +487,6 @@ export var exitAlert = function exitAlert() {
492
487
  export var showConfirm = function showConfirm(text) {
493
488
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
494
489
  return new Promise(function (resolve, reject) {
495
- var win = top || window;
496
- //@ts-ignore
497
- if (!win.lsAppList || !!document.fullscreenElement) {
498
- win = window;
499
- }
500
490
  _Modal.confirm({
501
491
  title: title,
502
492
  content: text,
@@ -506,7 +496,7 @@ export var showConfirm = function showConfirm(text) {
506
496
  cancelButtonProps: {
507
497
  className: 'ant-btn-gray'
508
498
  },
509
- getContainer: getFullScreenElement() || win.document.body,
499
+ getContainer: getFullScreenElement() || document.body,
510
500
  onOk: function onOk() {
511
501
  resolve(true);
512
502
  },
@@ -525,16 +515,11 @@ var timeout = false;
525
515
  export var reLogin = function reLogin() {
526
516
  if (timeout) return;
527
517
  timeout = true;
528
- var win = top || window;
529
- //@ts-ignore
530
- if (!win.lsAppList || !!document.fullscreenElement) {
531
- win = window;
532
- }
533
518
  _Modal.warning({
534
519
  title: '登录状态已过期,请重新登录',
535
520
  okText: '重新登录',
536
521
  maskClosable: false,
537
- getContainer: getFullScreenElement() || win.document.body,
522
+ getContainer: getFullScreenElement() || document.body,
538
523
  afterClose: function afterClose() {
539
524
  timeout = false;
540
525
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.77",
3
+ "version": "3.0.79",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [