@yuku123/z-frontend-common 0.1.2 → 0.1.3
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.css +1 -0
- package/dist/z-frontend-common.es.js +6153 -300
- package/dist/z-frontend-common.umd.js +22 -4
- package/package.json +5 -4
- package/src/components/Ctc/Layout.jsx +328 -0
- package/src/components/Ctc/Layout.module.css +145 -0
- package/src/components/Ctc/agentTeam/index.tsx +308 -0
- package/src/components/Ctc/login/AuthPage.module.css +26 -0
- package/src/components/Ctc/login/AuthPage.tsx +235 -0
- package/src/components/Ctc/login/index.less +49 -0
- package/src/components/Ctc/login/index.tsx +142 -0
- package/src/components/Ctc/userPanel/index.tsx +998 -0
- package/src/components/Ctc/webide/index.tsx +272 -0
- package/src/components/LowCode/LowCodeModel.jsx +962 -0
- package/src/components/LowCode/LowCodePage.jsx +31 -0
- package/src/components/LowCode/LowCodeRuntime.jsx +335 -0
- package/src/components/LowCode/MaterializePage.jsx +235 -0
- package/src/components/LowCode/index.js +1 -0
- package/src/components/MockPlatform/CurlImportModal.jsx +362 -0
- package/src/components/MockPlatform/EndpointsTab.jsx +509 -0
- package/src/components/MockPlatform/EnvironmentsTab.jsx +212 -0
- package/src/components/MockPlatform/MockTemplateHelper.jsx +200 -0
- package/src/components/MockPlatform/OpenApiImportModal.jsx +305 -0
- package/src/components/MockPlatform/RecordingsTab.jsx +397 -0
- package/src/components/MockPlatform/RequestLogsTab.jsx +239 -0
- package/src/components/MockPlatform/ScenariosTab.jsx +236 -0
- package/src/components/MockPlatform/TestCasesTab.jsx +462 -0
- package/src/components/MockPlatform/index.jsx +127 -0
- package/src/components/Overview.jsx +74 -0
- package/src/index.js +26 -27
- package/src/services/agentTeam.js +7 -0
- package/src/services/api.js +84 -0
- package/src/services/ctcAc.js +7 -0
- package/src/services/ctcAcDomain.js +7 -0
- package/src/services/ctcAuthorization.js +7 -0
- package/src/services/ctcSurl.js +7 -0
- package/src/services/ctcUser.js +7 -0
- package/src/services/job.js +7 -0
- package/src/services/metaApp.js +7 -0
- package/src/services/privateConfig.js +7 -0
- package/src/services/request.js +6 -0
- package/src/services/webide.js +6 -0
- package/src/services/workspace.js +21 -0
|
@@ -0,0 +1,142 @@
|
|
|
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 message="账户或密码错误" 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;
|