whistle.mock-plugins 1.1.0 → 1.1.1-beta.2
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/app/cgi-bin/interfaces.js +3 -0
- package/app/public/js/index.js +1 -1
- package/lib/ruleManager.js +168 -58
- package/lib/server.js +120 -0
- package/package.json +1 -1
- package/ui/src/pages/InterfaceManagement.js +151 -3
- package/ui/src/pages/MockData.js +47 -5
- package/ui/src/styles/mock-data.css +37 -1
package/ui/src/pages/MockData.js
CHANGED
|
@@ -338,6 +338,33 @@ const MockData = () => {
|
|
|
338
338
|
const formattedDate = feature.createdAt
|
|
339
339
|
? new Date(feature.createdAt).toLocaleDateString()
|
|
340
340
|
: '未知日期';
|
|
341
|
+
|
|
342
|
+
// 处理卡片点击事件
|
|
343
|
+
const handleCardClick = (e) => {
|
|
344
|
+
// 检查点击目标是否是开关或其父元素
|
|
345
|
+
const target = e.target;
|
|
346
|
+
const switchElement = target.closest('.ant-switch') || target.closest('.feature-name .ant-switch');
|
|
347
|
+
|
|
348
|
+
// 如果点击的是开关区域,则不执行跳转
|
|
349
|
+
if (switchElement) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// 检查是否点击了操作按钮区域
|
|
354
|
+
const actionElement = target.closest('.ant-card-actions') || target.closest('.ant-card-actions li');
|
|
355
|
+
if (actionElement) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// 执行跳转到接口管理界面
|
|
360
|
+
viewInterfaces(feature);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// 处理开关点击事件,阻止事件冒泡
|
|
364
|
+
const handleSwitchClick = (checked, e) => {
|
|
365
|
+
e.stopPropagation(); // 阻止事件冒泡到卡片
|
|
366
|
+
handleToggleActive(feature.id, feature.active);
|
|
367
|
+
};
|
|
341
368
|
|
|
342
369
|
return (
|
|
343
370
|
<Col xs={24} sm={12} md={8} lg={6} key={feature.id} style={{ marginBottom: 16 }}>
|
|
@@ -349,18 +376,32 @@ const MockData = () => {
|
|
|
349
376
|
<Card
|
|
350
377
|
hoverable
|
|
351
378
|
className={`feature-card ${!feature.active ? 'inactive-feature' : ''}`}
|
|
379
|
+
onClick={handleCardClick}
|
|
380
|
+
style={{ cursor: 'pointer' }}
|
|
352
381
|
actions={[
|
|
353
382
|
<Tooltip title="管理接口">
|
|
354
|
-
<ApiOutlined key="interfaces" onClick={() =>
|
|
383
|
+
<ApiOutlined key="interfaces" onClick={(e) => {
|
|
384
|
+
e.stopPropagation();
|
|
385
|
+
viewInterfaces(feature);
|
|
386
|
+
}} />
|
|
355
387
|
</Tooltip>,
|
|
356
388
|
<Tooltip title="编辑功能">
|
|
357
|
-
<EditOutlined key="edit" onClick={() =>
|
|
389
|
+
<EditOutlined key="edit" onClick={(e) => {
|
|
390
|
+
e.stopPropagation();
|
|
391
|
+
openModal(feature);
|
|
392
|
+
}} />
|
|
358
393
|
</Tooltip>,
|
|
359
394
|
<Tooltip title="删除功能">
|
|
360
|
-
<DeleteOutlined key="delete" onClick={() =>
|
|
395
|
+
<DeleteOutlined key="delete" onClick={(e) => {
|
|
396
|
+
e.stopPropagation();
|
|
397
|
+
deleteFeature(feature.id);
|
|
398
|
+
}} />
|
|
361
399
|
</Tooltip>,
|
|
362
400
|
<Tooltip title="导出配置">
|
|
363
|
-
<ExportOutlined key="export" onClick={() =>
|
|
401
|
+
<ExportOutlined key="export" onClick={(e) => {
|
|
402
|
+
e.stopPropagation();
|
|
403
|
+
exportFeatureConfig(feature);
|
|
404
|
+
}} />
|
|
364
405
|
</Tooltip>
|
|
365
406
|
]}
|
|
366
407
|
>
|
|
@@ -372,8 +413,9 @@ const MockData = () => {
|
|
|
372
413
|
|
|
373
414
|
<Switch
|
|
374
415
|
checked={feature.active}
|
|
375
|
-
onChange={
|
|
416
|
+
onChange={handleSwitchClick}
|
|
376
417
|
size="small"
|
|
418
|
+
onClick={(e) => e.stopPropagation()}
|
|
377
419
|
/>
|
|
378
420
|
</div>
|
|
379
421
|
|
|
@@ -23,11 +23,47 @@
|
|
|
23
23
|
border-radius: 8px;
|
|
24
24
|
overflow: hidden;
|
|
25
25
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
26
|
+
cursor: pointer;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.feature-card:hover {
|
|
29
30
|
transform: translateY(-5px);
|
|
30
|
-
box-shadow: 0
|
|
31
|
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
|
32
|
+
border-color: #40a9ff;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.feature-card:active {
|
|
36
|
+
transform: translateY(-2px);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* 添加卡片点击提示 */
|
|
40
|
+
.feature-card::before {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
right: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
background: linear-gradient(135deg, rgba(24, 144, 255, 0.02), rgba(24, 144, 255, 0.05));
|
|
48
|
+
opacity: 0;
|
|
49
|
+
transition: opacity 0.3s;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.feature-card:hover::before {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* 为卡片内容添加相对定位,确保在渐变层之上 */
|
|
59
|
+
.feature-card .ant-card-body {
|
|
60
|
+
position: relative;
|
|
61
|
+
z-index: 2;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.feature-card .ant-card-actions {
|
|
65
|
+
position: relative;
|
|
66
|
+
z-index: 2;
|
|
31
67
|
}
|
|
32
68
|
|
|
33
69
|
.feature-card-content {
|