@yuku123/z-frontend-common 0.2.8 → 1.0.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/LICENSE +25 -0
- package/README.md +55 -42
- package/dist/index.js +1 -0
- package/package.json +49 -44
- package/src/components/ErrorBoundary/index.jsx +24 -77
- package/src/components/Layout/index.jsx +141 -38
- package/src/components/LoginPage/index.jsx +47 -21
- package/src/components/StatusTag/index.jsx +14 -12
- package/src/index.js +32 -38
- package/src/services/request.js +74 -4
- package/dist/z-frontend-common.css +0 -1
- package/dist/z-frontend-common.es.js +0 -51275
- package/dist/z-frontend-common.umd.js +0 -459
- package/src/components/Ctc/Layout.jsx +0 -330
- package/src/components/Ctc/Layout.module.css +0 -145
- package/src/components/Ctc/agentTeam/index.tsx +0 -308
- package/src/components/Ctc/login/AuthPage.module.css +0 -26
- package/src/components/Ctc/login/AuthPage.tsx +0 -235
- package/src/components/Ctc/login/index.less +0 -49
- package/src/components/Ctc/login/index.tsx +0 -142
- package/src/components/Ctc/uc/UCLogin.tsx +0 -31
- package/src/components/Ctc/uc/UCPhoneLogin.tsx +0 -62
- package/src/components/Ctc/uc/UCRegister.tsx +0 -37
- package/src/components/Ctc/uc/UCResetPassword.tsx +0 -69
- package/src/components/Ctc/uc/index.tsx +0 -15
- package/src/components/Ctc/userPanel/index.tsx +0 -999
- package/src/components/Ctc/webide/index.tsx +0 -272
- package/src/components/LowCode/LowCodeModel.jsx +0 -962
- package/src/components/LowCode/LowCodePage.jsx +0 -31
- package/src/components/LowCode/LowCodeRuntime.jsx +0 -335
- package/src/components/LowCode/MaterializePage.jsx +0 -235
- package/src/components/LowCode/index.js +0 -1
- package/src/components/MockPlatform/CurlImportModal.jsx +0 -362
- package/src/components/MockPlatform/EndpointsTab.jsx +0 -509
- package/src/components/MockPlatform/EnvironmentsTab.jsx +0 -212
- package/src/components/MockPlatform/MockTemplateHelper.jsx +0 -200
- package/src/components/MockPlatform/OpenApiImportModal.jsx +0 -305
- package/src/components/MockPlatform/RecordingsTab.jsx +0 -397
- package/src/components/MockPlatform/RequestLogsTab.jsx +0 -239
- package/src/components/MockPlatform/ScenariosTab.jsx +0 -236
- package/src/components/MockPlatform/TestCasesTab.jsx +0 -462
- package/src/components/MockPlatform/index.jsx +0 -127
- package/src/components/Overview.jsx +0 -74
- package/src/dev.jsx +0 -28
- package/src/services/agentTeam.js +0 -7
- package/src/services/api.js +0 -84
- package/src/services/ctcAc.js +0 -7
- package/src/services/ctcAcDomain.js +0 -7
- package/src/services/ctcAuthorization.js +0 -7
- package/src/services/ctcSurl.js +0 -7
- package/src/services/ctcUser.js +0 -7
- package/src/services/job.js +0 -7
- package/src/services/metaApp.js +0 -7
- package/src/services/privateConfig.js +0 -7
- package/src/services/webide.js +0 -6
- package/src/services/workspace.js +0 -21
- package/src/utils/request.ts +0 -102
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import {useNavigate, Link} from 'react-router-dom';
|
|
3
|
-
import {Alert, Button, Checkbox, Form, Input, message, Tabs} from 'antd';
|
|
4
|
-
import {LockOutlined, UserOutlined} from '@ant-design/icons';
|
|
5
|
-
import {login} from '@/services/api';
|
|
6
|
-
|
|
7
|
-
const containerStyle: React.CSSProperties = {
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'column',
|
|
10
|
-
height: '100vh',
|
|
11
|
-
overflow: 'auto',
|
|
12
|
-
background: '#f0f2f5',
|
|
13
|
-
backgroundImage: "url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg')",
|
|
14
|
-
backgroundRepeat: 'no-repeat',
|
|
15
|
-
backgroundPosition: 'center 110px',
|
|
16
|
-
backgroundSize: '100%',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const contentStyle: React.CSSProperties = {
|
|
20
|
-
flex: 1,
|
|
21
|
-
padding: '32px 0',
|
|
22
|
-
maxWidth: 400,
|
|
23
|
-
margin: '0 auto',
|
|
24
|
-
width: '100%',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const Login: React.FC = () => {
|
|
28
|
-
const [userLoginState, setUserLoginState] = useState<any>({});
|
|
29
|
-
const [type] = useState<string>('account');
|
|
30
|
-
const [loading, setLoading] = useState(false);
|
|
31
|
-
const navigate = useNavigate();
|
|
32
|
-
|
|
33
|
-
const handleSubmit = async (values: { userName: string; password: string }) => {
|
|
34
|
-
setLoading(true);
|
|
35
|
-
try {
|
|
36
|
-
// api.login() 后端 LoginRequest: {identifier, password}
|
|
37
|
-
const response: any = await login({identifier: values.userName, password: values.password});
|
|
38
|
-
if (response && response.token) {
|
|
39
|
-
localStorage.setItem('token', response.token);
|
|
40
|
-
const acct = response.account || {}
|
|
41
|
-
localStorage.setItem('userInfo', JSON.stringify({
|
|
42
|
-
userId: acct.id,
|
|
43
|
-
userName: acct.username,
|
|
44
|
-
nickname: acct.nickname,
|
|
45
|
-
tenantCode: acct.tenantCode,
|
|
46
|
-
}));
|
|
47
|
-
message.success('登录成功!');
|
|
48
|
-
navigate('/');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
setUserLoginState(response);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
message.error('登录失败,请重试!');
|
|
54
|
-
} finally {
|
|
55
|
-
setLoading(false);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const {status} = userLoginState;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div style={containerStyle}>
|
|
63
|
-
<div style={contentStyle}>
|
|
64
|
-
{/* 品牌标识 — 内联 SVG(不再依赖外部 /logo.svg 文件) */}
|
|
65
|
-
<div style={{textAlign: 'center', marginBottom: 24}}>
|
|
66
|
-
<svg width="56" height="56" viewBox="0 0 56 56" fill="none" aria-label="logo">
|
|
67
|
-
<defs>
|
|
68
|
-
<linearGradient id="brandGrad" x1="0" y1="0" x2="56" y2="56" gradientUnits="userSpaceOnUse">
|
|
69
|
-
<stop offset="0%" stopColor="#1677ff"/>
|
|
70
|
-
<stop offset="100%" stopColor="#0958d9"/>
|
|
71
|
-
</linearGradient>
|
|
72
|
-
</defs>
|
|
73
|
-
<rect x="2" y="2" width="52" height="52" rx="14" fill="url(#brandGrad)"/>
|
|
74
|
-
<path
|
|
75
|
-
d="M18 18 H40 L18 38 H40"
|
|
76
|
-
stroke="#ffffff"
|
|
77
|
-
strokeWidth="3.5"
|
|
78
|
-
strokeLinecap="round"
|
|
79
|
-
strokeLinejoin="round"
|
|
80
|
-
fill="none"
|
|
81
|
-
/>
|
|
82
|
-
</svg>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<Tabs activeKey={type} centered items={[{key: 'account', label: '账户密码登录'}]}/>
|
|
86
|
-
|
|
87
|
-
{status === 'error' && (
|
|
88
|
-
<Alert title="账户或密码错误" type="error" showIcon style={{marginBottom: 16}}/>
|
|
89
|
-
)}
|
|
90
|
-
|
|
91
|
-
<Form
|
|
92
|
-
onFinish={handleSubmit}
|
|
93
|
-
initialValues={{autoLogin: true}}
|
|
94
|
-
layout="vertical"
|
|
95
|
-
>
|
|
96
|
-
<Form.Item
|
|
97
|
-
name="userName"
|
|
98
|
-
rules={[{required: true, message: '请输入用户名!'}]}
|
|
99
|
-
>
|
|
100
|
-
<Input
|
|
101
|
-
size="large"
|
|
102
|
-
prefix={<UserOutlined/>}
|
|
103
|
-
placeholder="用户名"
|
|
104
|
-
/>
|
|
105
|
-
</Form.Item>
|
|
106
|
-
|
|
107
|
-
<Form.Item
|
|
108
|
-
name="password"
|
|
109
|
-
rules={[{required: true, message: '请输入密码!'}]}
|
|
110
|
-
>
|
|
111
|
-
<Input.Password
|
|
112
|
-
size="large"
|
|
113
|
-
prefix={<LockOutlined/>}
|
|
114
|
-
placeholder="密码"
|
|
115
|
-
/>
|
|
116
|
-
</Form.Item>
|
|
117
|
-
|
|
118
|
-
<Form.Item name="autoLogin" valuePropName="checked">
|
|
119
|
-
<Checkbox>自动登录</Checkbox>
|
|
120
|
-
</Form.Item>
|
|
121
|
-
|
|
122
|
-
<Form.Item>
|
|
123
|
-
<Button type="primary" htmlType="submit" size="large" block loading={loading}>
|
|
124
|
-
登录
|
|
125
|
-
</Button>
|
|
126
|
-
</Form.Item>
|
|
127
|
-
</Form>
|
|
128
|
-
|
|
129
|
-
{/* FEATURE012: 用户中心入口 — 注册/找回/手机登录 */}
|
|
130
|
-
<div style={{textAlign: 'center', marginTop: 16, color: '#888', fontSize: 14}}>
|
|
131
|
-
<Link to="/uc/register" style={{marginRight: 16}}>用户注册</Link>
|
|
132
|
-
<span style={{margin: '0 8px', color: '#ddd'}}>|</span>
|
|
133
|
-
<Link to="/uc/reset-password" style={{marginRight: 16}}>找回密码</Link>
|
|
134
|
-
<span style={{margin: '0 8px', color: '#ddd'}}>|</span>
|
|
135
|
-
<Link to="/uc/login">手机验证码登录</Link>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export default Login;
|
|
@@ -1,31 +0,0 @@
|
|
|
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;
|
|
@@ -1,62 +0,0 @@
|
|
|
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;
|
|
@@ -1,37 +0,0 @@
|
|
|
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|