ebaoferc 0.2.0 → 0.3.0
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.
|
@@ -130,28 +130,37 @@ export default function SliderVerify(props) {
|
|
|
130
130
|
})), [props.getVerifyCode]);
|
|
131
131
|
var validate = /*#__PURE__*/function () {
|
|
132
132
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
133
|
-
var
|
|
133
|
+
var _result, _props$onSuccess, _props$onFail, _props$onFail2;
|
|
134
134
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
135
135
|
while (1) switch (_context2.prev = _context2.next) {
|
|
136
136
|
case 0:
|
|
137
|
-
_context2.
|
|
137
|
+
_context2.prev = 0;
|
|
138
|
+
_context2.next = 3;
|
|
138
139
|
return props.checkVerifyCode(_objectSpread({
|
|
139
140
|
id: id.current
|
|
140
141
|
}, currentCaptchaConfig.current));
|
|
141
|
-
case
|
|
142
|
-
|
|
143
|
-
if (
|
|
142
|
+
case 3:
|
|
143
|
+
_result = _context2.sent;
|
|
144
|
+
if (_result.matching) {
|
|
144
145
|
reset();
|
|
145
|
-
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props,
|
|
146
|
+
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props, _result);
|
|
146
147
|
} else {
|
|
147
148
|
fetchVerify();
|
|
148
149
|
(_props$onFail = props.onFail) === null || _props$onFail === void 0 || _props$onFail.call(props);
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
_context2.next = 12;
|
|
152
|
+
break;
|
|
153
|
+
case 7:
|
|
154
|
+
_context2.prev = 7;
|
|
155
|
+
_context2.t0 = _context2["catch"](0);
|
|
156
|
+
console.error(_context2.t0);
|
|
157
|
+
fetchVerify();
|
|
158
|
+
(_props$onFail2 = props.onFail) === null || _props$onFail2 === void 0 || _props$onFail2.call(props);
|
|
159
|
+
case 12:
|
|
151
160
|
case "end":
|
|
152
161
|
return _context2.stop();
|
|
153
162
|
}
|
|
154
|
-
}, _callee2);
|
|
163
|
+
}, _callee2, null, [[0, 7]]);
|
|
155
164
|
}));
|
|
156
165
|
return function validate() {
|
|
157
166
|
return _ref2.apply(this, arguments);
|
|
@@ -7,6 +7,12 @@ type TSingleValueToArrayRes<T> = T extends (infer _U)[] ? T : T extends null | u
|
|
|
7
7
|
export declare function singleValueToArray<T>(value: T): TSingleValueToArrayRes<T>;
|
|
8
8
|
type TArrayToSingleValueRes<T> = T extends (infer U)[] ? U : T;
|
|
9
9
|
export declare function arrayToSingleValue<T>(value: T): TArrayToSingleValueRes<T>;
|
|
10
|
+
/**
|
|
11
|
+
* 判断数据类型 Number/String/Boolean/Null/Undefined/Array/Object/Symbol/Date/RegExp/FormData
|
|
12
|
+
* @param data
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function typeOfData(data: any): string;
|
|
10
16
|
/**
|
|
11
17
|
* 给对象第一层的字符串属性值做 trim
|
|
12
18
|
*/
|
|
@@ -26,10 +26,20 @@ export function arrayToSingleValue(value) {
|
|
|
26
26
|
return value;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* 判断数据类型 Number/String/Boolean/Null/Undefined/Array/Object/Symbol/Date/RegExp/FormData
|
|
31
|
+
* @param data
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export function typeOfData(data) {
|
|
35
|
+
return Object.prototype.toString.call(data).slice(8, -1);
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
/**
|
|
30
39
|
* 给对象第一层的字符串属性值做 trim
|
|
31
40
|
*/
|
|
32
41
|
export function trimObjectValuesFirstLayer(obj) {
|
|
42
|
+
if (typeOfData(obj) !== 'Object') return obj;
|
|
33
43
|
var result = {};
|
|
34
44
|
for (var _key2 in obj) {
|
|
35
45
|
if (obj.hasOwnProperty(_key2)) {
|