message-verify 0.0.22-beta.0 → 0.0.24-beta.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.
- package/dist/index.js +14 -8
- package/dist/main.js +1 -1
- package/package.json +2 -1
- package/src/index.tsx +29 -29
- package/src/main.tsx +1 -1
package/dist/index.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useState } from 'react';
|
3
|
-
import Modal from '
|
4
|
-
import
|
5
|
-
import Api from './resource';
|
3
|
+
import { Input, Button, Modal } from 'antd';
|
4
|
+
import Api from './resource.js';
|
6
5
|
const App = ({ data }) => {
|
7
6
|
const { mobile } = data || {};
|
8
7
|
const [countdown, setCountdown] = useState(60);
|
@@ -15,6 +14,13 @@ const App = ({ data }) => {
|
|
15
14
|
console.log('image', image);
|
16
15
|
setCaptchaImage(image);
|
17
16
|
};
|
17
|
+
// const retryModal = async(config, http) =>{
|
18
|
+
// console.log('retryModal=>config', config);
|
19
|
+
// config.headers['sms-code'] = 'new-value';
|
20
|
+
// // 3. 重新发起请求
|
21
|
+
// await http(config);
|
22
|
+
// // console.log('response', response);
|
23
|
+
// };
|
18
24
|
useEffect(() => {
|
19
25
|
setVisible(true);
|
20
26
|
}, []);
|
@@ -33,10 +39,10 @@ const App = ({ data }) => {
|
|
33
39
|
clearInterval(timer);
|
34
40
|
};
|
35
41
|
}, [visible, countdown]);
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return (_jsx(_Fragment, { children: _jsxs(Modal, {
|
42
|
+
const handleResend = async () => {
|
43
|
+
setCountdown(60);
|
44
|
+
// retryModal()
|
45
|
+
};
|
46
|
+
return (_jsx(_Fragment, { children: _jsxs(Modal, { open: visible, onClose: () => setVisible(false), okText: '提交', cancelText: false, children: [_jsxs("div", { children: ["\u5DF2\u53D1\u9001\u77ED\u4FE1\u81F3\u60A8\u7684\u624B\u673A\uFF1A", mobile] }), _jsxs("div", { style: { marginTop: 8, display: 'flex', alignItems: 'center', width: 300 }, children: [_jsx(Input, { disabled: countdown > 0 }), _jsx("img", { src: captchaImage, alt: "\u9A8C\u8BC1\u7801", style: { width: 100, height: 30, marginLeft: 8 }, onClick: getKey })] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }, children: [_jsx(Input.OTP, { length: 6, onChange: (val) => { console.log('change', val); } }), _jsx(Button, { disabled: countdown > 0, onClick: handleResend, style: countdown > 0 ? { marginLeft: 8 } : { marginLeft: 8, backgroundColor: '#1677ff', color: '#fff' }, children: countdown > 0 ? `${countdown}秒` : '重新发送' })] })] }) }));
|
41
47
|
};
|
42
48
|
export default App;
|
package/dist/main.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { createRoot } from 'react-dom/client';
|
3
|
-
import App from './index'; // 或 './index'
|
3
|
+
import App from './index.js'; // 或 './index'
|
4
4
|
createRoot(document.getElementById('root')).render(_jsx(App, { data: {
|
5
5
|
mobile: '185****7760',
|
6
6
|
verifyCodeKey: 'e381c5f9-c7f4-4bf1-a948-744334fb0203',
|
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "message-verify",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.24-beta.0",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"dependencies": {
|
7
7
|
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
8
8
|
"@yqg/resource": "^1.3.8",
|
9
|
+
"antd": "^5.24.8",
|
9
10
|
"react": "^19.0.0",
|
10
11
|
"react-dom": "^19.0.0"
|
11
12
|
},
|
package/src/index.tsx
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
import { useEffect, useState } from 'react'
|
2
|
-
import Modal from '
|
3
|
-
import
|
4
|
-
import Api from './resource'
|
5
|
-
// import { getEnvironmentFingerprint } from './utils'
|
6
|
-
// import Button from './components/button'
|
7
|
-
|
8
|
-
// const buttonStyle: React.CSSProperties = {
|
9
|
-
// padding: '8px 16px',
|
10
|
-
// border: 'none',
|
11
|
-
// borderRadius: 4,
|
12
|
-
// fontSize: 14,
|
13
|
-
// cursor: 'pointer',
|
14
|
-
// };
|
15
|
-
|
2
|
+
import { Input, Button, Modal } from 'antd';
|
3
|
+
import Api from './resource.js'
|
16
4
|
interface Props {
|
17
5
|
data: {
|
18
6
|
mobile: string;
|
@@ -36,6 +24,15 @@ const App: React.FC<Props> = ({ data }) => {
|
|
36
24
|
setCaptchaImage(image);
|
37
25
|
}
|
38
26
|
|
27
|
+
// const retryModal = async(config, http) =>{
|
28
|
+
// console.log('retryModal=>config', config);
|
29
|
+
// config.headers['sms-code'] = 'new-value';
|
30
|
+
|
31
|
+
// // 3. 重新发起请求
|
32
|
+
// await http(config);
|
33
|
+
// // console.log('response', response);
|
34
|
+
// };
|
35
|
+
|
39
36
|
useEffect(() => {
|
40
37
|
setVisible(true);
|
41
38
|
}, [])
|
@@ -55,33 +52,36 @@ const App: React.FC<Props> = ({ data }) => {
|
|
55
52
|
};
|
56
53
|
}, [visible, countdown]);
|
57
54
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
const handleResend = async() => {
|
56
|
+
setCountdown(60);
|
57
|
+
// retryModal()
|
58
|
+
}
|
59
|
+
|
62
60
|
return (
|
63
61
|
<>
|
64
|
-
<Modal
|
65
|
-
|
62
|
+
<Modal
|
63
|
+
open={visible}
|
64
|
+
onClose={() => setVisible(false)}
|
65
|
+
okText={'提交'}
|
66
|
+
cancelText={false}
|
66
67
|
>
|
67
68
|
<div>已发送短信至您的手机:{mobile}</div>
|
68
|
-
|
69
|
-
<Input />
|
69
|
+
<div style={{ marginTop: 8, display: 'flex', alignItems: 'center', width: 300 }}>
|
70
|
+
<Input disabled={countdown > 0} />
|
70
71
|
<img src={captchaImage} alt="验证码" style={{ width: 100, height: 30, marginLeft: 8 }} onClick={getKey} />
|
71
|
-
</div>
|
72
|
+
</div>
|
72
73
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }}>
|
73
|
-
<Input
|
74
|
-
|
74
|
+
<Input.OTP length={6} onChange={(val) => {console.log('change', val)}} />
|
75
|
+
<Button
|
75
76
|
disabled={countdown > 0}
|
76
77
|
onClick={handleResend}
|
77
78
|
style={countdown > 0 ? { marginLeft: 8 } : { marginLeft: 8, backgroundColor: '#1677ff', color: '#fff' }}
|
78
|
-
btnText={countdown > 0 ? `${countdown}秒` : '重新发送'}
|
79
|
-
|
79
|
+
// btnText={countdown > 0 ? `${countdown}秒` : '重新发送'}
|
80
|
+
>{countdown > 0 ? `${countdown}秒` : '重新发送'}</Button>
|
80
81
|
</div>
|
81
82
|
</Modal>
|
82
83
|
</>
|
83
84
|
)
|
84
85
|
}
|
85
86
|
|
86
|
-
export default App;
|
87
|
-
// export { getEnvironmentFingerprint };
|
87
|
+
export default App;
|
package/src/main.tsx
CHANGED