@yuku123/z-frontend-common 0.1.4 → 0.2.1
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/z-frontend-common.es.js +1935 -1839
- package/dist/z-frontend-common.umd.js +11 -11
- package/package.json +1 -1
- package/src/components/Ctc/uc/UCLogin.tsx +31 -0
- package/src/components/Ctc/uc/UCPhoneLogin.tsx +62 -0
- package/src/components/Ctc/uc/UCRegister.tsx +37 -0
- package/src/components/Ctc/uc/UCResetPassword.tsx +69 -0
- package/src/components/Ctc/uc/index.tsx +15 -0
- package/src/index.js +7 -0
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Card, Form, Input, Button, message, Tabs} from 'antd';
|
|
3
|
+
import {UserOutlined, LockOutlined} from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 账号密码登录 (FEATURE011)
|
|
7
|
+
*/
|
|
8
|
+
const UCLogin = () => {
|
|
9
|
+
const [form] = Form.useForm();
|
|
10
|
+
const onFinish = (values: any) => {
|
|
11
|
+
console.log('UC login:', values);
|
|
12
|
+
message.info('UC 账号密码登录占位组件 — 实际登录逻辑接 z-ctc-ac');
|
|
13
|
+
};
|
|
14
|
+
return (
|
|
15
|
+
<Card title="账号密码登录" style={{maxWidth: 420, margin: '40px auto'}}>
|
|
16
|
+
<Form form={form} onFinish={onFinish} layout="vertical">
|
|
17
|
+
<Form.Item name="username" label="账号" rules={[{required: true}]}>
|
|
18
|
+
<Input prefix={<UserOutlined/>} placeholder="请输入账号"/>
|
|
19
|
+
</Form.Item>
|
|
20
|
+
<Form.Item name="password" label="密码" rules={[{required: true}]}>
|
|
21
|
+
<Input.Password prefix={<LockOutlined/>} placeholder="请输入密码"/>
|
|
22
|
+
</Form.Item>
|
|
23
|
+
<Form.Item>
|
|
24
|
+
<Button type="primary" htmlType="submit" block>登录</Button>
|
|
25
|
+
</Form.Item>
|
|
26
|
+
</Form>
|
|
27
|
+
</Card>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default UCLogin;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Card, Form, Input, Button, message} from 'antd';
|
|
3
|
+
import {MobileOutlined, SafetyOutlined} from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 手机验证码登录 (FEATURE011)
|
|
7
|
+
* 验证码默认 123456(mock 通道,见 z-msg 配置)
|
|
8
|
+
*/
|
|
9
|
+
const UCPhoneLogin = () => {
|
|
10
|
+
const [form] = Form.useForm();
|
|
11
|
+
const [sending, setSending] = React.useState(false);
|
|
12
|
+
const [count, setCount] = React.useState(0);
|
|
13
|
+
|
|
14
|
+
const sendCode = async () => {
|
|
15
|
+
try {
|
|
16
|
+
const phone = form.getFieldValue('phone');
|
|
17
|
+
if (!phone || !/^1\d{10}$/.test(phone)) {
|
|
18
|
+
message.warning('请输入正确的手机号');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setSending(true);
|
|
22
|
+
setCount(60);
|
|
23
|
+
const t = setInterval(() => setCount(c => (c > 0 ? c - 1 : (clearInterval(t), 0))), 1000);
|
|
24
|
+
message.success('验证码已发送 (mock 通道: 123456)');
|
|
25
|
+
} catch (e) {
|
|
26
|
+
message.error('发送失败');
|
|
27
|
+
} finally {
|
|
28
|
+
setSending(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onFinish = (values: any) => {
|
|
33
|
+
if (values.code !== '123456') {
|
|
34
|
+
message.error('验证码错误,固定码 123456');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
message.success('手机登录成功 (占位)');
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Card title="手机验证码登录" style={{maxWidth: 420, margin: '40px auto'}}>
|
|
42
|
+
<Form form={form} onFinish={onFinish} layout="vertical">
|
|
43
|
+
<Form.Item name="phone" label="手机号" rules={[{required: true, pattern: /^1\d{10}$/}]}>
|
|
44
|
+
<Input prefix={<MobileOutlined/>} placeholder="11 位手机号" maxLength={11}/>
|
|
45
|
+
</Form.Item>
|
|
46
|
+
<Form.Item name="code" label="验证码" rules={[{required: true}]}>
|
|
47
|
+
<Input prefix={<SafetyOutlined/>} placeholder="固定码 123456" maxLength={6}
|
|
48
|
+
addonAfter={
|
|
49
|
+
<Button type="link" disabled={sending || count > 0} onClick={sendCode}>
|
|
50
|
+
{count > 0 ? `${count}s` : '获取验证码'}
|
|
51
|
+
</Button>
|
|
52
|
+
}/>
|
|
53
|
+
</Form.Item>
|
|
54
|
+
<Form.Item>
|
|
55
|
+
<Button type="primary" htmlType="submit" block>登录</Button>
|
|
56
|
+
</Form.Item>
|
|
57
|
+
</Form>
|
|
58
|
+
</Card>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default UCPhoneLogin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Card, Form, Input, Button, message} from 'antd';
|
|
3
|
+
import {UserOutlined, LockOutlined, SafetyOutlined, MobileOutlined} from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 用户注册 (FEATURE011)
|
|
7
|
+
*/
|
|
8
|
+
const UCRegister = () => {
|
|
9
|
+
const [form] = Form.useForm();
|
|
10
|
+
const onFinish = (values: any) => {
|
|
11
|
+
console.log('UC register:', values);
|
|
12
|
+
message.success('注册成功 (占位)');
|
|
13
|
+
};
|
|
14
|
+
return (
|
|
15
|
+
<Card title="新用户注册" style={{maxWidth: 420, margin: '40px auto'}}>
|
|
16
|
+
<Form form={form} onFinish={onFinish} layout="vertical">
|
|
17
|
+
<Form.Item name="username" label="账号" rules={[{required: true, min: 3}]}>
|
|
18
|
+
<Input prefix={<UserOutlined/>} placeholder="3 位以上"/>
|
|
19
|
+
</Form.Item>
|
|
20
|
+
<Form.Item name="phone" label="手机号" rules={[{required: true, pattern: /^1\d{10}$/}]}>
|
|
21
|
+
<Input prefix={<MobileOutlined/>} placeholder="11 位手机号" maxLength={11}/>
|
|
22
|
+
</Form.Item>
|
|
23
|
+
<Form.Item name="code" label="验证码" rules={[{required: true}]}>
|
|
24
|
+
<Input prefix={<SafetyOutlined/>} placeholder="固定码 123456" maxLength={6}/>
|
|
25
|
+
</Form.Item>
|
|
26
|
+
<Form.Item name="password" label="密码" rules={[{required: true, min: 6}]}>
|
|
27
|
+
<Input.Password prefix={<LockOutlined/>} placeholder="6 位以上"/>
|
|
28
|
+
</Form.Item>
|
|
29
|
+
<Form.Item>
|
|
30
|
+
<Button type="primary" htmlType="submit" block>注册</Button>
|
|
31
|
+
</Form.Item>
|
|
32
|
+
</Form>
|
|
33
|
+
</Card>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default UCRegister;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Card, Form, Input, Button, message, Steps} from 'antd';
|
|
3
|
+
import {MobileOutlined, SafetyOutlined, LockOutlined} from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 找回密码 (FEATURE011) - 3 步流程
|
|
7
|
+
* Step 1: 输入手机号
|
|
8
|
+
* Step 2: 输入验证码
|
|
9
|
+
* Step 3: 重置密码
|
|
10
|
+
*/
|
|
11
|
+
const UCResetPassword = () => {
|
|
12
|
+
const [step, setStep] = React.useState(0);
|
|
13
|
+
const [form] = Form.useForm();
|
|
14
|
+
const onNext = async () => {
|
|
15
|
+
try {
|
|
16
|
+
await form.validateFields();
|
|
17
|
+
if (step < 2) setStep(step + 1);
|
|
18
|
+
else message.success('密码重置成功 (占位)');
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// antd 会显示字段错误
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return (
|
|
24
|
+
<Card title="找回密码" style={{maxWidth: 480, margin: '40px auto'}}>
|
|
25
|
+
<Steps current={step} items={[
|
|
26
|
+
{title: '验证手机号'},
|
|
27
|
+
{title: '输入验证码'},
|
|
28
|
+
{title: '重置密码'},
|
|
29
|
+
]} style={{marginBottom: 24}}/>
|
|
30
|
+
<Form form={form} layout="vertical">
|
|
31
|
+
{step === 0 && (
|
|
32
|
+
<Form.Item name="phone" label="手机号" rules={[{required: true, pattern: /^1\d{10}$/}]}>
|
|
33
|
+
<Input prefix={<MobileOutlined/>} placeholder="注册时的手机号" maxLength={11}/>
|
|
34
|
+
</Form.Item>
|
|
35
|
+
)}
|
|
36
|
+
{step === 1 && (
|
|
37
|
+
<Form.Item name="code" label="验证码" rules={[{required: true}]}>
|
|
38
|
+
<Input prefix={<SafetyOutlined/>} placeholder="固定码 123456" maxLength={6}/>
|
|
39
|
+
</Form.Item>
|
|
40
|
+
)}
|
|
41
|
+
{step === 2 && (
|
|
42
|
+
<>
|
|
43
|
+
<Form.Item name="password" label="新密码" rules={[{required: true, min: 6}]}>
|
|
44
|
+
<Input.Password prefix={<LockOutlined/>} placeholder="6 位以上"/>
|
|
45
|
+
</Form.Item>
|
|
46
|
+
<Form.Item name="confirm" label="确认密码"
|
|
47
|
+
rules={[{required: true}, ({getFieldValue}) => ({
|
|
48
|
+
validator(_, value) {
|
|
49
|
+
if (!value || getFieldValue('password') === value) {
|
|
50
|
+
return Promise.resolve()
|
|
51
|
+
}
|
|
52
|
+
return Promise.reject(new Error('两次输入不一致'))
|
|
53
|
+
},
|
|
54
|
+
})]}>
|
|
55
|
+
<Input.Password prefix={<LockOutlined/>} placeholder="再输一次"/>
|
|
56
|
+
</Form.Item>
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
59
|
+
<Form.Item>
|
|
60
|
+
<Button type="primary" onClick={onNext} block>
|
|
61
|
+
{step < 2 ? '下一步' : '提交'}
|
|
62
|
+
</Button>
|
|
63
|
+
</Form.Item>
|
|
64
|
+
</Form>
|
|
65
|
+
</Card>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default UCResetPassword;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* User Center 登录 - FEATURE011
|
|
6
|
+
* - /uc/login-account 账号密码登录 (默认)
|
|
7
|
+
* - /uc/login-phone 手机验证码登录
|
|
8
|
+
* - /uc/register 注册
|
|
9
|
+
* - /uc/reset-password 找回密码
|
|
10
|
+
*/
|
|
11
|
+
const UCLayout = () => {
|
|
12
|
+
return <Outlet/>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default UCLayout;
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,13 @@ export {default as AgentTeamIM} from './components/Ctc/agentTeam'
|
|
|
15
15
|
export {default as UserPanel} from './components/Ctc/userPanel'
|
|
16
16
|
export {default as Webide} from './components/Ctc/webide'
|
|
17
17
|
|
|
18
|
+
// UC 用户中心 (FEATURE011)
|
|
19
|
+
export {default as UCLayout} from './components/Ctc/uc'
|
|
20
|
+
export {default as UCLogin} from './components/Ctc/uc/UCLogin'
|
|
21
|
+
export {default as UCPhoneLogin} from './components/Ctc/uc/UCPhoneLogin'
|
|
22
|
+
export {default as UCRegister} from './components/Ctc/uc/UCRegister'
|
|
23
|
+
export {default as UCResetPassword} from './components/Ctc/uc/UCResetPassword'
|
|
24
|
+
|
|
18
25
|
// 低代码建模
|
|
19
26
|
export {default as LowCodePage} from './components/LowCode/LowCodePage'
|
|
20
27
|
export {default as LowCodeRuntime} from './components/LowCode/LowCodeRuntime'
|