message-verify 0.0.21-beta.0 → 0.0.23-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 +19 -7
- package/package.json +2 -1
- package/src/index.tsx +34 -17
- package/vite.config.ts +1 -1
package/dist/index.js
CHANGED
@@ -1,8 +1,10 @@
|
|
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 './components/modal'
|
4
|
-
import Input from './components/input'
|
3
|
+
// import Modal from './components/modal'
|
4
|
+
// import Input from './components/input'
|
5
|
+
import { Input, Button, Modal } from 'antd';
|
5
6
|
import Api from './resource';
|
7
|
+
import { getEnvironmentFingerprint } from './utils';
|
6
8
|
const App = ({ data }) => {
|
7
9
|
const { mobile } = data || {};
|
8
10
|
const [countdown, setCountdown] = useState(60);
|
@@ -15,8 +17,16 @@ const App = ({ data }) => {
|
|
15
17
|
console.log('image', image);
|
16
18
|
setCaptchaImage(image);
|
17
19
|
};
|
20
|
+
// const retryModal = async(config, http) =>{
|
21
|
+
// console.log('retryModal=>config', config);
|
22
|
+
// config.headers['sms-code'] = 'new-value';
|
23
|
+
// // 3. 重新发起请求
|
24
|
+
// await http(config);
|
25
|
+
// // console.log('response', response);
|
26
|
+
// };
|
18
27
|
useEffect(() => {
|
19
28
|
setVisible(true);
|
29
|
+
getEnvironmentFingerprint();
|
20
30
|
}, []);
|
21
31
|
useEffect(() => {
|
22
32
|
let timer = null;
|
@@ -33,10 +43,12 @@ const App = ({ data }) => {
|
|
33
43
|
clearInterval(timer);
|
34
44
|
};
|
35
45
|
}, [visible, countdown]);
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return (_jsx(_Fragment, { children: _jsxs(Modal, {
|
46
|
+
const handleResend = async () => {
|
47
|
+
setCountdown(60);
|
48
|
+
// retryModal()
|
49
|
+
};
|
50
|
+
return (_jsx(_Fragment, { children: _jsxs(Modal, { open: visible, onClose: () => setVisible(false),
|
51
|
+
// cancelButtonProps={false}
|
52
|
+
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
53
|
};
|
42
54
|
export default App;
|
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "message-verify",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.23-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,8 +1,9 @@
|
|
1
1
|
import { useEffect, useState } from 'react'
|
2
|
-
import Modal from './components/modal'
|
3
|
-
import Input from './components/input'
|
2
|
+
// import Modal from './components/modal'
|
3
|
+
// import Input from './components/input'
|
4
|
+
import { Input, Button, Modal } from 'antd';
|
4
5
|
import Api from './resource'
|
5
|
-
|
6
|
+
import { getEnvironmentFingerprint } from './utils'
|
6
7
|
// import Button from './components/button'
|
7
8
|
|
8
9
|
// const buttonStyle: React.CSSProperties = {
|
@@ -36,8 +37,18 @@ const App: React.FC<Props> = ({ data }) => {
|
|
36
37
|
setCaptchaImage(image);
|
37
38
|
}
|
38
39
|
|
40
|
+
// const retryModal = async(config, http) =>{
|
41
|
+
// console.log('retryModal=>config', config);
|
42
|
+
// config.headers['sms-code'] = 'new-value';
|
43
|
+
|
44
|
+
// // 3. 重新发起请求
|
45
|
+
// await http(config);
|
46
|
+
// // console.log('response', response);
|
47
|
+
// };
|
48
|
+
|
39
49
|
useEffect(() => {
|
40
50
|
setVisible(true);
|
51
|
+
getEnvironmentFingerprint();
|
41
52
|
}, [])
|
42
53
|
|
43
54
|
useEffect(() => {
|
@@ -55,33 +66,39 @@ const App: React.FC<Props> = ({ data }) => {
|
|
55
66
|
};
|
56
67
|
}, [visible, countdown]);
|
57
68
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
69
|
+
const handleResend = async() => {
|
70
|
+
setCountdown(60);
|
71
|
+
// retryModal()
|
72
|
+
}
|
73
|
+
|
62
74
|
return (
|
63
75
|
<>
|
64
|
-
<Modal
|
76
|
+
<Modal
|
77
|
+
open={visible}
|
78
|
+
onClose={() => setVisible(false)}
|
79
|
+
// cancelButtonProps={false}
|
80
|
+
okText={'提交'}
|
81
|
+
cancelText={false}
|
65
82
|
// onOk={() => refresh()}
|
66
83
|
>
|
67
84
|
<div>已发送短信至您的手机:{mobile}</div>
|
68
|
-
|
69
|
-
<Input />
|
85
|
+
<div style={{ marginTop: 8, display: 'flex', alignItems: 'center', width: 300 }}>
|
86
|
+
<Input disabled={countdown > 0} />
|
70
87
|
<img src={captchaImage} alt="验证码" style={{ width: 100, height: 30, marginLeft: 8 }} onClick={getKey} />
|
71
|
-
</div>
|
88
|
+
</div>
|
72
89
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }}>
|
73
|
-
<Input placeholder="请输入验证码" />
|
74
|
-
{
|
90
|
+
{/* <Input placeholder="请输入验证码" onChange={(val) => {console.log('change', val)}} /> */}
|
91
|
+
<Input.OTP length={6} onChange={(val) => {console.log('change', val)}} />
|
92
|
+
<Button
|
75
93
|
disabled={countdown > 0}
|
76
94
|
onClick={handleResend}
|
77
95
|
style={countdown > 0 ? { marginLeft: 8 } : { marginLeft: 8, backgroundColor: '#1677ff', color: '#fff' }}
|
78
|
-
btnText={countdown > 0 ? `${countdown}秒` : '重新发送'}
|
79
|
-
|
96
|
+
// btnText={countdown > 0 ? `${countdown}秒` : '重新发送'}
|
97
|
+
>{countdown > 0 ? `${countdown}秒` : '重新发送'}</Button>
|
80
98
|
</div>
|
81
99
|
</Modal>
|
82
100
|
</>
|
83
101
|
)
|
84
102
|
}
|
85
103
|
|
86
|
-
export default App;
|
87
|
-
// export { getEnvironmentFingerprint };
|
104
|
+
export default App;
|
package/vite.config.ts
CHANGED