message-verify 1.0.1-beta.24 → 1.0.1-beta.27
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 -19
- package/package.json +1 -1
- package/src/verify-modal.tsx +8 -20
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, apiResolve
|
14
|
+
const { data, http, lang, api = '/admin/sms/send', config, apiResolve } = props || {};
|
15
15
|
const dataObj = JSON.parse(data || '{}');
|
16
16
|
const { mobile, verifyCodeKey } = dataObj || {};
|
17
17
|
const getKey = async () => {
|
@@ -91,31 +91,19 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
91
91
|
});
|
92
92
|
})
|
93
93
|
]);
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
// ...http.defaults.headers.common,
|
98
|
-
// 'sms-code': val,
|
99
|
-
// 'sms-code-key': verifyCodeKey,
|
100
|
-
// 'Content-Type': config.headers['Content-Type'],
|
101
|
-
// }
|
102
|
-
// })
|
103
|
-
console.log('resresresresres');
|
104
|
-
console.log('res', res);
|
105
|
-
if (!res) {
|
106
|
-
message.error('验证失败');
|
107
|
-
// apiReject();
|
94
|
+
if (res?.data?.status?.code === 0) {
|
95
|
+
apiResolve(res);
|
96
|
+
setVisible(false);
|
108
97
|
}
|
109
98
|
else {
|
110
|
-
|
99
|
+
message.error('验证失败');
|
100
|
+
setOtp('');
|
111
101
|
}
|
112
|
-
setVisible(false);
|
113
102
|
}
|
114
103
|
catch (error) {
|
115
104
|
console.warn('catch', error);
|
116
105
|
message.error('验证失败');
|
117
|
-
|
118
|
-
setVisible(false);
|
106
|
+
setOtp('');
|
119
107
|
}
|
120
108
|
}
|
121
109
|
} }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, style: { padding: '8px' }, children: countdown > 0 ? t('countDownSecound', lang, { countdown }) : t('reSend', lang) })] }), countdown > 0 ? null :
|
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, apiResolve
|
15
|
+
const { data, http, lang, api = '/admin/sms/send', config, apiResolve } = props || {};
|
16
16
|
const dataObj = JSON.parse(data || '{}');
|
17
17
|
const { mobile, verifyCodeKey } = dataObj || {};
|
18
18
|
|
@@ -106,30 +106,18 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
106
106
|
reject(err);
|
107
107
|
})
|
108
108
|
})
|
109
|
-
])
|
110
|
-
|
111
|
-
// ...config,
|
112
|
-
// headers: {
|
113
|
-
// ...http.defaults.headers.common,
|
114
|
-
// 'sms-code': val,
|
115
|
-
// 'sms-code-key': verifyCodeKey,
|
116
|
-
// 'Content-Type': config.headers['Content-Type'],
|
117
|
-
// }
|
118
|
-
// })
|
119
|
-
console.log('resresresresres')
|
120
|
-
console.log('res', res);
|
121
|
-
if (!res) {
|
122
|
-
message.error('验证失败');
|
123
|
-
// apiReject();
|
124
|
-
} else {
|
109
|
+
]) as any;
|
110
|
+
if (res?.data?.status?.code === 0) {
|
125
111
|
apiResolve(res);
|
112
|
+
setVisible(false);
|
113
|
+
} else {
|
114
|
+
message.error('验证失败');
|
115
|
+
setOtp('');
|
126
116
|
}
|
127
|
-
setVisible(false);
|
128
117
|
} catch (error) {
|
129
118
|
console.warn('catch', error);
|
130
119
|
message.error('验证失败');
|
131
|
-
|
132
|
-
setVisible(false);
|
120
|
+
setOtp('');
|
133
121
|
}
|
134
122
|
}
|
135
123
|
}} />
|