message-verify 0.0.38-beta.0 → 0.0.39-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.
@@ -11,8 +11,8 @@ const Button = ({ disabled, onClick, children, style }) => {
|
|
11
11
|
padding: '6px 6px',
|
12
12
|
borderRadius: 5,
|
13
13
|
border: '1px solid #d9d9d9',
|
14
|
-
background: disabled ? '#f5f5f5' : '#
|
15
|
-
color: disabled ? '#aaa' : '#
|
14
|
+
background: disabled ? '#f5f5f5' : '#fff',
|
15
|
+
color: disabled ? '#aaa' : '#333',
|
16
16
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
17
17
|
whiteSpace: 'nowrap',
|
18
18
|
...style,
|
package/dist/compoments/input.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
const Input = ({ value, onChange, placeholder, type = 'text' }) => {
|
2
|
+
const Input = ({ value, onChange, placeholder, type = 'text', style }) => {
|
3
3
|
return (_jsx("input", { type: type, value: value, placeholder: placeholder, onChange: e => onChange?.(e.target.value), style: {
|
4
4
|
padding: '6px 12px',
|
5
5
|
border: '1px solid #d9d9d9',
|
@@ -7,7 +7,9 @@ const Input = ({ value, onChange, placeholder, type = 'text' }) => {
|
|
7
7
|
outline: 'none',
|
8
8
|
fontSize: 14,
|
9
9
|
width: '100%',
|
10
|
-
boxSizing: 'border-box'
|
10
|
+
boxSizing: 'border-box',
|
11
|
+
height: 36,
|
12
|
+
...style,
|
11
13
|
} }));
|
12
14
|
};
|
13
15
|
export default Input;
|
package/dist/verify-modal.js
CHANGED
@@ -4,7 +4,7 @@ import { Modal, Input, Button, message } from './compoments/index.js';
|
|
4
4
|
import Api from './resource.js';
|
5
5
|
const ModalDom = ({ config }) => {
|
6
6
|
const [visible, setVisible] = useState(true);
|
7
|
-
const [countdown, setCountdown] = useState(
|
7
|
+
const [countdown, setCountdown] = useState(3);
|
8
8
|
const [captchaImage, setCaptchaImage] = useState('');
|
9
9
|
const [captchCode, setCaptchCode] = useState('');
|
10
10
|
const [captchaKey, setCaptchaKey] = useState('');
|
@@ -38,7 +38,7 @@ const ModalDom = ({ config }) => {
|
|
38
38
|
}, [visible, countdown]);
|
39
39
|
useEffect(() => {
|
40
40
|
console.log('mobile', mobile);
|
41
|
-
}, []);
|
41
|
+
}, [mobile]);
|
42
42
|
const handleResend = async () => {
|
43
43
|
setCountdown(60);
|
44
44
|
const res = await Api.reSendCode({ captchaKey, captcha: captchCode });
|
@@ -48,8 +48,8 @@ const ModalDom = ({ config }) => {
|
|
48
48
|
return (_jsxs(Modal, { visible: visible, onClose: () => {
|
49
49
|
setVisible(false);
|
50
50
|
config.onClose?.();
|
51
|
-
}, children: [_jsxs("div", { children: ["\u5DF2\u53D1\u9001\u77ED\u4FE1\u81F3\u60A8\u7684\u624B\u673A\uFF1A", mobile] }), countdown > 0 ? null : _jsxs("div", { style: {
|
51
|
+
}, children: [_jsxs("div", { style: { fontSize: 14, color: '#666' }, children: ["\u5DF2\u53D1\u9001\u77ED\u4FE1\u81F3\u60A8\u7684\u624B\u673A\uFF1A", mobile] }), countdown > 0 ? null : _jsxs("div", { style: { marginBlock: 8, display: 'flex', alignItems: 'center', width: 300 }, children: [_jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801", onChange: (e) => {
|
52
52
|
setCaptchCode(e);
|
53
|
-
} }), captchaImage && _jsx("img", { src: captchaImage, alt: "\u9A8C\u8BC1\u7801", style: { width: 100, height: 30, marginLeft: 8 }, onClick: getKey })] }), countdown > 0 ? null : _jsx("div", { children: "\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801\u540E\uFF0C\u91CD\u65B0\u53D1\u9001\u9A8C\u8BC1\u7801" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }, children: [_jsx(Input, { onChange: (val) => { console.log('change', val); } }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, children: countdown > 0 ? `${countdown}秒` : '重新发送' })] })] }));
|
53
|
+
} }), captchaImage && _jsx("img", { src: captchaImage, alt: "\u9A8C\u8BC1\u7801", style: { width: 100, height: 30, marginLeft: 8 }, onClick: getKey })] }), (countdown > 0 || captchCode) ? null : _jsx("div", { style: { fontSize: 14, color: 'red' }, children: "\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801\u540E\uFF0C\u91CD\u65B0\u53D1\u9001\u9A8C\u8BC1\u7801" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }, children: [_jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801", onChange: (val) => { console.log('change', val); } }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, children: countdown > 0 ? `${countdown}秒` : '重新发送' })] })] }));
|
54
54
|
};
|
55
55
|
export default ModalDom;
|
package/package.json
CHANGED
@@ -24,8 +24,8 @@ const Button: React.FC<CustomButtonProps> = ({ disabled, onClick, children, styl
|
|
24
24
|
padding: '6px 6px',
|
25
25
|
borderRadius: 5,
|
26
26
|
border: '1px solid #d9d9d9',
|
27
|
-
background: disabled ? '#f5f5f5' : '#
|
28
|
-
color: disabled ? '#aaa' : '#
|
27
|
+
background: disabled ? '#f5f5f5' : '#fff',
|
28
|
+
color: disabled ? '#aaa' : '#333',
|
29
29
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
30
30
|
whiteSpace: 'nowrap',
|
31
31
|
...style,
|
package/src/compoments/input.tsx
CHANGED
@@ -5,9 +5,10 @@ interface CustomInputProps {
|
|
5
5
|
onChange?: (val: string) => void;
|
6
6
|
placeholder?: string;
|
7
7
|
type?: string;
|
8
|
+
style?: React.CSSProperties;
|
8
9
|
}
|
9
10
|
|
10
|
-
const Input: React.FC<CustomInputProps> = ({ value, onChange, placeholder, type = 'text' }) => {
|
11
|
+
const Input: React.FC<CustomInputProps> = ({ value, onChange, placeholder, type = 'text', style }) => {
|
11
12
|
return (
|
12
13
|
<input
|
13
14
|
type={type}
|
@@ -21,7 +22,9 @@ const Input: React.FC<CustomInputProps> = ({ value, onChange, placeholder, type
|
|
21
22
|
outline: 'none',
|
22
23
|
fontSize: 14,
|
23
24
|
width: '100%',
|
24
|
-
boxSizing: 'border-box'
|
25
|
+
boxSizing: 'border-box',
|
26
|
+
height: 36,
|
27
|
+
...style,
|
25
28
|
}}
|
26
29
|
/>
|
27
30
|
);
|
package/src/verify-modal.tsx
CHANGED
@@ -12,7 +12,7 @@ type ModalConfig = {
|
|
12
12
|
}
|
13
13
|
const ModalDom = ({ config }: { config: ModalConfig }) => {
|
14
14
|
const [visible, setVisible] = useState(true);
|
15
|
-
const [countdown, setCountdown] = useState(
|
15
|
+
const [countdown, setCountdown] = useState(3);
|
16
16
|
const [captchaImage, setCaptchaImage] = useState<string>('');
|
17
17
|
const [captchCode, setCaptchCode] = useState<string>('');
|
18
18
|
const [captchaKey, setCaptchaKey] = useState<string>('');
|
@@ -49,7 +49,7 @@ const ModalDom = ({ config }: { config: ModalConfig }) => {
|
|
49
49
|
|
50
50
|
useEffect(() => {
|
51
51
|
console.log('mobile', mobile);
|
52
|
-
}, [])
|
52
|
+
}, [mobile])
|
53
53
|
|
54
54
|
const handleResend = async() => {
|
55
55
|
setCountdown(60);
|
@@ -66,17 +66,21 @@ const ModalDom = ({ config }: { config: ModalConfig }) => {
|
|
66
66
|
config.onClose?.();
|
67
67
|
}}
|
68
68
|
>
|
69
|
-
<div>已发送短信至您的手机:{mobile}</div>
|
70
|
-
{countdown > 0 ? null : <div style={{
|
71
|
-
<Input
|
72
|
-
|
73
|
-
|
69
|
+
<div style={{ fontSize: 14, color: '#666' }}>已发送短信至您的手机:{mobile}</div>
|
70
|
+
{countdown > 0 ? null : <div style={{ marginBlock: 8, display: 'flex', alignItems: 'center', width: 300 }}>
|
71
|
+
<Input
|
72
|
+
placeholder="请输入图形验证码"
|
73
|
+
onChange={(e) => {
|
74
|
+
setCaptchCode(e as string)
|
75
|
+
}}
|
76
|
+
/>
|
74
77
|
|
75
78
|
{captchaImage && <img src={captchaImage} alt="验证码" style={{ width: 100, height: 30, marginLeft: 8 }} onClick={getKey} />}
|
76
79
|
</div>}
|
77
|
-
{countdown > 0 ? null : <div>请输入图形验证码后,重新发送验证码</div>}
|
80
|
+
{(countdown > 0 || captchCode) ? null : <div style={{ fontSize: 14, color: 'red' }}>请输入图形验证码后,重新发送验证码</div>}
|
78
81
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }}>
|
79
82
|
<Input
|
83
|
+
placeholder="请输入验证码"
|
80
84
|
onChange={(val) => {console.log('change', val)}}
|
81
85
|
/>
|
82
86
|
<Button
|