@zgfe/business-lib 1.1.52 → 1.1.53
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/es/utils/ajax.js +7 -7
- package/package.json +2 -2
package/es/utils/ajax.js
CHANGED
|
@@ -3,7 +3,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
5
|
import Request, { extend } from 'umi-request';
|
|
6
|
-
import { notification } from 'antd';
|
|
6
|
+
import { notification, message } from 'antd';
|
|
7
7
|
import { globalConfig } from '../config';
|
|
8
8
|
import { ResponseStatus } from './type';
|
|
9
9
|
var codeMessage = {
|
|
@@ -58,21 +58,21 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
58
58
|
throw new Error('接口响应结构异常,缺少code');
|
|
59
59
|
}
|
|
60
60
|
var flag = false;
|
|
61
|
-
var
|
|
61
|
+
var msg = '接口请求失败';
|
|
62
62
|
if (new RegExp("".concat(ResponseStatus.success, "$")).test(apiResult.code)) {
|
|
63
63
|
flag = true;
|
|
64
64
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
65
|
-
|
|
65
|
+
msg = '账户未登录或登录已失效';
|
|
66
66
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
67
|
-
|
|
67
|
+
msg = '账户没有权限';
|
|
68
68
|
}
|
|
69
69
|
if (!flag) {
|
|
70
|
-
|
|
70
|
+
msg = apiResult.msg || msg;
|
|
71
71
|
notification[notifyType || 'error']({
|
|
72
72
|
message: errorTitle || "\u8BF7\u6C42\u9519\u8BEF",
|
|
73
|
-
description:
|
|
73
|
+
description: msg
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
message.error(msg);
|
|
76
76
|
}
|
|
77
77
|
return apiResult;
|
|
78
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.53",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "8b0de5490014d6a853e82ec29c55543533f881d1"
|
|
64
64
|
}
|