message-verify 1.0.1-beta.14 → 1.0.1-beta.15
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 +7 -2
- package/package.json +1 -1
- package/src/verify-modal.tsx +7 -2
package/dist/verify-modal.js
CHANGED
@@ -11,7 +11,7 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
11
11
|
const [captchaImage, setCaptchaImage] = useState('');
|
12
12
|
const [captchCode, setCaptchCode] = useState('');
|
13
13
|
const [captchaKey, setCaptchaKey] = useState('');
|
14
|
-
const { data, http, lang, api = '/admin/sms/send', config } = props || {};
|
14
|
+
const { data, http, lang, api = '/admin/sms/send', config, response } = props || {};
|
15
15
|
const dataObj = JSON.parse(data || '{}');
|
16
16
|
const { mobile, verifyCodeKey } = dataObj || {};
|
17
17
|
const getKey = async () => {
|
@@ -58,7 +58,9 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
58
58
|
return;
|
59
59
|
}
|
60
60
|
message.success(t('sendSuccess', lang));
|
61
|
+
// 重置倒计时、验证码
|
61
62
|
setCountdown(60);
|
63
|
+
setOtp('');
|
62
64
|
};
|
63
65
|
return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
|
64
66
|
setVisible(false);
|
@@ -79,15 +81,18 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
79
81
|
console.log('组件打印res', res);
|
80
82
|
const { data: { status: { code, detail } } } = res || {};
|
81
83
|
if (code !== 0) {
|
84
|
+
console.log('失败了');
|
82
85
|
const detailObj = JSON.parse(detail || '{}');
|
83
86
|
console.log('detailObj', detailObj);
|
84
87
|
message.error(detailObj?.message || t('sendFailed', lang));
|
88
|
+
setVisible(false);
|
85
89
|
return;
|
86
90
|
}
|
87
91
|
else {
|
92
|
+
console.log('成功了');
|
88
93
|
// message.success(t('verifySuccess', lang));
|
89
94
|
setVisible(false);
|
90
|
-
|
95
|
+
return Promise.resolve(response);
|
91
96
|
}
|
92
97
|
}
|
93
98
|
catch (error) {
|
package/package.json
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -12,7 +12,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
12
12
|
const [captchaImage, setCaptchaImage] = useState<string>('');
|
13
13
|
const [captchCode, setCaptchCode] = useState<string>('');
|
14
14
|
const [captchaKey, setCaptchaKey] = useState<string>('');
|
15
|
-
const { data, http, lang, api='/admin/sms/send', config } = props || {};
|
15
|
+
const { data, http, lang, api='/admin/sms/send', config, response } = props || {};
|
16
16
|
const dataObj = JSON.parse(data || '{}');
|
17
17
|
const { mobile, verifyCodeKey } = dataObj || {};
|
18
18
|
|
@@ -60,7 +60,9 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
60
60
|
return;
|
61
61
|
}
|
62
62
|
message.success(t('sendSuccess', lang));
|
63
|
+
// 重置倒计时、验证码
|
63
64
|
setCountdown(60);
|
65
|
+
setOtp('');
|
64
66
|
}
|
65
67
|
|
66
68
|
return (
|
@@ -94,14 +96,17 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
94
96
|
console.log('组件打印res', res);
|
95
97
|
const {data: {status: {code, detail}}} = res || {} as any;
|
96
98
|
if (code !== 0) {
|
99
|
+
console.log('失败了')
|
97
100
|
const detailObj = JSON.parse(detail || '{}');
|
98
101
|
console.log('detailObj', detailObj);
|
99
102
|
message.error(detailObj?.message || t('sendFailed', lang));
|
103
|
+
setVisible(false);
|
100
104
|
return;
|
101
105
|
} else {
|
106
|
+
console.log('成功了')
|
102
107
|
// message.success(t('verifySuccess', lang));
|
103
108
|
setVisible(false);
|
104
|
-
|
109
|
+
return Promise.resolve(response);
|
105
110
|
}
|
106
111
|
} catch (error: any) {
|
107
112
|
message.error(error?.message || t('sendFailed', lang));
|