message-verify 1.0.0-beta.17 → 1.0.0-beta.18
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/dist/verify-modal.js +21 -23
- package/package.json +1 -1
- package/src/verify-modal.tsx +20 -26
package/dist/verify-modal.js
CHANGED
@@ -63,32 +63,30 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
63
63
|
return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
|
64
64
|
setVisible(false);
|
65
65
|
props.onClose?.();
|
66
|
-
}, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: (val) => {
|
66
|
+
}, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: async (val) => {
|
67
67
|
setOtp(val);
|
68
68
|
if (val.length === 6) {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
try {
|
70
|
+
const res = await http({
|
71
|
+
...config,
|
72
|
+
headers: {
|
73
|
+
...http.defaults.headers.common,
|
74
|
+
'sms-code': val,
|
75
|
+
'sms-code-key': verifyCodeKey,
|
76
|
+
'Content-Type': config.headers['Content-Type'],
|
77
|
+
}
|
78
|
+
});
|
79
|
+
// 健壮性判断
|
80
|
+
if (!res || !res.data || !res.data.status) {
|
81
|
+
console.log('response结构异常', res);
|
82
|
+
return;
|
76
83
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
const { code, detail } = response.data.status;
|
85
|
-
const responseType = response.config?.responseType;
|
86
|
-
console.log('打印', detail, code, responseType);
|
87
|
-
return response;
|
88
|
-
}, (error) => {
|
89
|
-
console.log('打印', error);
|
90
|
-
return Promise.reject(error);
|
91
|
-
});
|
84
|
+
const { code, detail } = res.data.status;
|
85
|
+
console.log('打印', detail, code);
|
86
|
+
}
|
87
|
+
catch (error) {
|
88
|
+
console.log('请求异常', error);
|
89
|
+
}
|
92
90
|
}
|
93
91
|
} }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, style: { padding: '8px' }, children: countdown > 0 ? t('countDownSecound', lang, { countdown }) : t('reSend', lang) })] }), countdown > 0 ? null :
|
94
92
|
_jsxs("div", { style: { marginTop: 12, display: 'flex', alignItems: 'center' }, children: [_jsx(Input, { placeholder: t('pleaseEnterPicVerifyCode', lang), onChange: (e) => {
|
package/package.json
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -78,35 +78,29 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
78
78
|
<Input.OTP
|
79
79
|
length={6}
|
80
80
|
value={otp}
|
81
|
-
onChange={(val) => {
|
81
|
+
onChange={async (val) => {
|
82
82
|
setOtp(val);
|
83
83
|
if (val.length === 6) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
});
|
93
|
-
(http as any).interceptors.response.use(
|
94
|
-
(response: any) => {
|
95
|
-
// 先做健壮性判断
|
96
|
-
if (!response || !response.data || !response.data.status) {
|
97
|
-
console.log('response结构异常', response);
|
98
|
-
return response;
|
84
|
+
try {
|
85
|
+
const res = await http({
|
86
|
+
...config,
|
87
|
+
headers: {
|
88
|
+
...http.defaults.headers.common,
|
89
|
+
'sms-code': val,
|
90
|
+
'sms-code-key': verifyCodeKey,
|
91
|
+
'Content-Type': config.headers['Content-Type'],
|
99
92
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
93
|
+
}) as any;
|
94
|
+
// 健壮性判断
|
95
|
+
if (!res || !res.data || !res.data.status) {
|
96
|
+
console.log('response结构异常', res);
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
const { code, detail } = res.data.status;
|
100
|
+
console.log('打印', detail, code);
|
101
|
+
} catch (error) {
|
102
|
+
console.log('请求异常', error);
|
103
|
+
}
|
110
104
|
}
|
111
105
|
}} />
|
112
106
|
<Button
|