whistle.mock-plugins 1.2.1-beta.4 → 1.2.1-beta.6
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/VERSION.md +6 -1
- package/app/public/js/index.js +1 -1
- package/package.json +1 -1
- package/ui/src/index.js +6 -26
- package/ui/src/pages/InterfaceManagementV2.js +1 -18
- package/ui/src/pages/MockDataV2.js +1 -2
- package/ui/src/pages/Settings.js +6 -88
- package/ui/src/pages/InterfaceManagement.js +0 -1863
- package/ui/src/pages/MockData.js +0 -710
package/package.json
CHANGED
package/ui/src/index.js
CHANGED
|
@@ -7,39 +7,19 @@ import 'antd/dist/reset.css'; // 导入antd样式,使用适合的版本
|
|
|
7
7
|
import './styles/global.css';
|
|
8
8
|
import './App.css';
|
|
9
9
|
|
|
10
|
-
// 导入页面组件
|
|
11
|
-
import MockData from './pages/
|
|
12
|
-
import InterfaceManagement from './pages/
|
|
10
|
+
// 导入页面组件
|
|
11
|
+
import MockData from './pages/MockDataV2';
|
|
12
|
+
import InterfaceManagement from './pages/InterfaceManagementV2';
|
|
13
13
|
import Settings from './pages/Settings';
|
|
14
14
|
|
|
15
|
-
// 导入页面组件 - V2版本(重构后)
|
|
16
|
-
import MockDataV2 from './pages/MockDataV2';
|
|
17
|
-
import InterfaceManagementV2 from './pages/InterfaceManagementV2';
|
|
18
|
-
|
|
19
|
-
// UI版本检测函数
|
|
20
|
-
const getUIVersion = () => {
|
|
21
|
-
try {
|
|
22
|
-
return localStorage.getItem('ui-version') || 'v1';
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.error('获取UI版本设置失败:', error);
|
|
25
|
-
return 'v1';
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
15
|
const App = () => {
|
|
30
|
-
const uiVersion = getUIVersion();
|
|
31
|
-
|
|
32
|
-
// 根据版本选择对应组件
|
|
33
|
-
const MockDataComponent = uiVersion === 'v2' ? MockDataV2 : MockData;
|
|
34
|
-
const InterfaceManagementComponent = uiVersion === 'v2' ? InterfaceManagementV2 : InterfaceManagement;
|
|
35
|
-
|
|
36
16
|
return (
|
|
37
17
|
<Router>
|
|
38
18
|
<div className="App">
|
|
39
19
|
<Switch>
|
|
40
|
-
<Route exact path="/" component={
|
|
41
|
-
<Route exact path="/interface" component={
|
|
42
|
-
<Route path="/interface/:featureId" component={
|
|
20
|
+
<Route exact path="/" component={MockData} />
|
|
21
|
+
<Route exact path="/interface" component={InterfaceManagement} />
|
|
22
|
+
<Route path="/interface/:featureId" component={InterfaceManagement} />
|
|
43
23
|
<Route path="/settings" component={Settings} />
|
|
44
24
|
<Redirect to="/" />
|
|
45
25
|
</Switch>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* InterfaceManagementV2.js -
|
|
3
|
-
* 这是重构后的新版本界面,提供更好的用户体验和功能优化
|
|
4
|
-
* 当前内容与V1版本相同,等待后续重构
|
|
2
|
+
* InterfaceManagementV2.js - 接口管理页面
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
import React, { useState, useEffect } from 'react';
|
|
@@ -1068,21 +1066,6 @@ const InterfaceManagement = () => {
|
|
|
1068
1066
|
return (
|
|
1069
1067
|
<AppLayout>
|
|
1070
1068
|
<div className="interface-management-container">
|
|
1071
|
-
{/* V2版本标识 */}
|
|
1072
|
-
<div style={{
|
|
1073
|
-
position: 'absolute',
|
|
1074
|
-
top: '10px',
|
|
1075
|
-
right: '10px',
|
|
1076
|
-
backgroundColor: '#52c41a',
|
|
1077
|
-
color: 'white',
|
|
1078
|
-
padding: '4px 8px',
|
|
1079
|
-
borderRadius: '4px',
|
|
1080
|
-
fontSize: '12px',
|
|
1081
|
-
zIndex: 1000
|
|
1082
|
-
}}>
|
|
1083
|
-
重构后版本 V2
|
|
1084
|
-
</div>
|
|
1085
|
-
|
|
1086
1069
|
{/* 警告信息置顶显示 */}
|
|
1087
1070
|
{!features.length && (
|
|
1088
1071
|
<Alert
|
package/ui/src/pages/Settings.js
CHANGED
|
@@ -1,64 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import AppLayout from '../components/AppLayout';
|
|
3
|
-
import { Card,
|
|
3
|
+
import { Card, Typography, Empty } from 'antd';
|
|
4
4
|
import '../styles/settings.css';
|
|
5
5
|
|
|
6
6
|
const { Title, Text, Paragraph } = Typography;
|
|
7
7
|
|
|
8
|
-
// localStorage工具函数
|
|
9
|
-
const getUIVersion = () => {
|
|
10
|
-
try {
|
|
11
|
-
return localStorage.getItem('ui-version') || 'v1';
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error('获取UI版本设置失败:', error);
|
|
14
|
-
return 'v1';
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const setUIVersion = (version) => {
|
|
19
|
-
try {
|
|
20
|
-
localStorage.setItem('ui-version', version);
|
|
21
|
-
return true;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error('保存UI版本设置失败:', error);
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
8
|
const Settings = () => {
|
|
29
|
-
const [uiVersion, setUiVersionState] = useState(getUIVersion());
|
|
30
|
-
|
|
31
|
-
// 页面加载时同步localStorage状态
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const currentVersion = getUIVersion();
|
|
34
|
-
setUiVersionState(currentVersion);
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
// 处理UI版本切换
|
|
38
|
-
const handleUIVersionChange = (checked) => {
|
|
39
|
-
const newVersion = checked ? 'v2' : 'v1';
|
|
40
|
-
|
|
41
|
-
if (setUIVersion(newVersion)) {
|
|
42
|
-
setUiVersionState(newVersion);
|
|
43
|
-
|
|
44
|
-
// 提示用户刷新页面以应用更改
|
|
45
|
-
message.success({
|
|
46
|
-
content: `已切换到${checked ? '重构后' : '重构前'}版本,页面将自动刷新`,
|
|
47
|
-
duration: 2,
|
|
48
|
-
onClose: () => {
|
|
49
|
-
window.location.reload();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// 1秒后自动刷新
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
window.location.reload();
|
|
56
|
-
}, 1000);
|
|
57
|
-
} else {
|
|
58
|
-
message.error('设置保存失败,请重试');
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
9
|
return (
|
|
63
10
|
<AppLayout>
|
|
64
11
|
<div className="page-container">
|
|
@@ -72,39 +19,10 @@ const Settings = () => {
|
|
|
72
19
|
</div>
|
|
73
20
|
|
|
74
21
|
<Card title="界面设置" className="settings-card">
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
切换使用重构前后的界面版本
|
|
80
|
-
</Paragraph>
|
|
81
|
-
</div>
|
|
82
|
-
<div className="setting-control">
|
|
83
|
-
<Switch
|
|
84
|
-
checked={uiVersion === 'v2'}
|
|
85
|
-
onChange={handleUIVersionChange}
|
|
86
|
-
checkedChildren="重构后"
|
|
87
|
-
unCheckedChildren="重构前"
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<Divider />
|
|
93
|
-
|
|
94
|
-
<div style={{ padding: '16px 0' }}>
|
|
95
|
-
<Title level={5}>版本说明</Title>
|
|
96
|
-
<div style={{ marginLeft: '16px' }}>
|
|
97
|
-
<Paragraph>
|
|
98
|
-
<Text strong>重构前版本:</Text> 当前稳定版本的功能模块管理和接口管理界面
|
|
99
|
-
</Paragraph>
|
|
100
|
-
<Paragraph>
|
|
101
|
-
<Text strong>重构后版本:</Text> 新设计的界面版本,提供更好的用户体验和功能优化
|
|
102
|
-
</Paragraph>
|
|
103
|
-
<Paragraph type="warning">
|
|
104
|
-
<Text>注意:切换版本后页面将自动刷新以应用更改</Text>
|
|
105
|
-
</Paragraph>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
22
|
+
<Empty
|
|
23
|
+
description="暂无可配置项"
|
|
24
|
+
style={{ padding: '40px 0' }}
|
|
25
|
+
/>
|
|
108
26
|
</Card>
|
|
109
27
|
</div>
|
|
110
28
|
</AppLayout>
|