message-verify 1.0.1-beta.14 → 1.0.1-beta.16
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 -10
- package/package.json +1 -1
- package/src/verify-modal.tsx +21 -10
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);
|
@@ -77,18 +79,27 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
77
79
|
}
|
78
80
|
});
|
79
81
|
console.log('组件打印res', res);
|
80
|
-
const {
|
81
|
-
if (
|
82
|
-
|
83
|
-
console.log('detailObj', detailObj);
|
84
|
-
message.error(detailObj?.message || t('sendFailed', lang));
|
85
|
-
return;
|
82
|
+
// const {data: {status: {code, detail}}} = res || {} as any;
|
83
|
+
if (!res) {
|
84
|
+
message.error('验证失败');
|
86
85
|
}
|
87
86
|
else {
|
88
|
-
|
89
|
-
setVisible(false);
|
90
|
-
// return Promise.resolve(response);
|
87
|
+
message.success('验证成功');
|
91
88
|
}
|
89
|
+
// if (code !== 0) {
|
90
|
+
// console.log('失败了')
|
91
|
+
// const detailObj = JSON.parse(detail || '{}');
|
92
|
+
// console.log('detailObj', detailObj);
|
93
|
+
// message.error(detailObj?.message || t('sendFailed', lang));
|
94
|
+
// setVisible(false);
|
95
|
+
// return;
|
96
|
+
// } else {
|
97
|
+
// console.log('成功了')
|
98
|
+
// // message.success(t('verifySuccess', lang));
|
99
|
+
// setVisible(false);
|
100
|
+
// // return Promise.resolve(response);
|
101
|
+
// }
|
102
|
+
setVisible(false);
|
92
103
|
}
|
93
104
|
catch (error) {
|
94
105
|
message.error(error?.message || t('sendFailed', lang));
|
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 (
|
@@ -92,17 +94,26 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
92
94
|
}
|
93
95
|
});
|
94
96
|
console.log('组件打印res', res);
|
95
|
-
const {data: {status: {code, detail}}} = res || {} as any;
|
96
|
-
if
|
97
|
-
|
98
|
-
console.log('detailObj', detailObj);
|
99
|
-
message.error(detailObj?.message || t('sendFailed', lang));
|
100
|
-
return;
|
97
|
+
// const {data: {status: {code, detail}}} = res || {} as any;
|
98
|
+
if(!res) {
|
99
|
+
message.error('验证失败');
|
101
100
|
} else {
|
102
|
-
|
103
|
-
setVisible(false);
|
104
|
-
// return Promise.resolve(response);
|
101
|
+
message.success('验证成功');
|
105
102
|
}
|
103
|
+
// if (code !== 0) {
|
104
|
+
// console.log('失败了')
|
105
|
+
// const detailObj = JSON.parse(detail || '{}');
|
106
|
+
// console.log('detailObj', detailObj);
|
107
|
+
// message.error(detailObj?.message || t('sendFailed', lang));
|
108
|
+
// setVisible(false);
|
109
|
+
// return;
|
110
|
+
// } else {
|
111
|
+
// console.log('成功了')
|
112
|
+
// // message.success(t('verifySuccess', lang));
|
113
|
+
// setVisible(false);
|
114
|
+
// // return Promise.resolve(response);
|
115
|
+
// }
|
116
|
+
setVisible(false);
|
106
117
|
} catch (error: any) {
|
107
118
|
message.error(error?.message || t('sendFailed', lang));
|
108
119
|
}
|