whistle.mock-plugins 1.1.3-dev.15 → 1.1.3-dev.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.mock-plugins",
3
- "version": "1.1.3-dev.15",
3
+ "version": "1.1.3-dev.17",
4
4
  "description": "Whistle 插件,用于快速创建 API 模拟数据",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -10,12 +10,12 @@ import AppLayout from '../components/AppLayout';
10
10
  import {
11
11
  Table, Button, Modal, Form, Input, Select, message, Switch,
12
12
  Popconfirm, Alert, Space, Card, Badge, Tooltip, Row, Col,
13
- Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer, Dropdown, Menu
13
+ Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer, Dropdown, Menu, Collapse
14
14
  } from 'antd';
15
15
  import {
16
16
  PlusOutlined, EditOutlined, DeleteOutlined,
17
17
  FileTextOutlined, PlusCircleOutlined, SettingOutlined,
18
- SearchOutlined, FilterOutlined, ReloadOutlined, DownOutlined
18
+ SearchOutlined, FilterOutlined, ReloadOutlined, DownOutlined, QuestionCircleOutlined
19
19
  } from '@ant-design/icons';
20
20
  import '../styles/interface-management.css';
21
21
  import axios from 'axios';
@@ -1286,7 +1286,7 @@ const InterfaceManagement = () => {
1286
1286
  open={modalVisible}
1287
1287
  onOk={handleSubmit}
1288
1288
  onCancel={handleCancel}
1289
- width={900}
1289
+ width={1200}
1290
1290
  destroyOnClose
1291
1291
  okText={editingInterface ? '保存' : '创建'}
1292
1292
  cancelText="取消"
@@ -1317,17 +1317,21 @@ const InterfaceManagement = () => {
1317
1317
  responseDelay: '0'
1318
1318
  }}
1319
1319
  >
1320
- {/* 第一步:基础信息 */}
1321
- <Card
1322
- title={
1323
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1324
- <Badge count="1" style={{ backgroundColor: '#1677ff' }} />
1325
- <span>基础信息</span>
1326
- </div>
1327
- }
1320
+ <Collapse
1321
+ defaultActiveKey={editingInterface ? ['3'] : ['1', '2', '3']}
1328
1322
  style={{ marginBottom: '16px' }}
1329
- bodyStyle={{ padding: '20px' }}
1323
+ ghost
1330
1324
  >
1325
+ {/* 第一步:基础信息 */}
1326
+ <Collapse.Panel
1327
+ header={
1328
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1329
+ <Badge count="1" style={{ backgroundColor: '#1677ff' }} />
1330
+ <span>基础信息</span>
1331
+ </div>
1332
+ }
1333
+ key="1"
1334
+ >
1331
1335
  <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1332
1336
  <div style={{ flex: 1 }}>
1333
1337
  <Form.Item
@@ -1374,19 +1378,18 @@ const InterfaceManagement = () => {
1374
1378
  </Form.Item>
1375
1379
  </div>
1376
1380
  </div>
1377
- </Card>
1381
+ </Collapse.Panel>
1378
1382
 
1379
- {/* 第二步:URL配置 */}
1380
- <Card
1381
- title={
1382
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1383
- <Badge count="2" style={{ backgroundColor: '#1677ff' }} />
1384
- <span>URL配置</span>
1385
- </div>
1386
- }
1387
- style={{ marginBottom: '16px' }}
1388
- bodyStyle={{ padding: '20px' }}
1389
- >
1383
+ {/* 第二步:URL配置 */}
1384
+ <Collapse.Panel
1385
+ header={
1386
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1387
+ <Badge count="2" style={{ backgroundColor: '#1677ff' }} />
1388
+ <span>URL配置</span>
1389
+ </div>
1390
+ }
1391
+ key="2"
1392
+ >
1390
1393
  <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1391
1394
  <div style={{ flex: 1 }}>
1392
1395
  <Form.Item
@@ -1528,19 +1531,18 @@ const InterfaceManagement = () => {
1528
1531
  {/* 这里可以留空或添加其他字段 */}
1529
1532
  </div>
1530
1533
  </div>
1531
- </Card>
1534
+ </Collapse.Panel>
1532
1535
 
1533
- {/* 第三步:高级配置 */}
1534
- <Card
1535
- title={
1536
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1537
- <Badge count="3" style={{ backgroundColor: '#1677ff' }} />
1538
- <span>高级配置</span>
1539
- </div>
1540
- }
1541
- style={{ marginBottom: '16px' }}
1542
- bodyStyle={{ padding: '20px' }}
1543
- >
1536
+ {/* 第三步:高级配置 */}
1537
+ <Collapse.Panel
1538
+ header={
1539
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1540
+ <Badge count="3" style={{ backgroundColor: '#1677ff' }} />
1541
+ <span>高级配置</span>
1542
+ </div>
1543
+ }
1544
+ key="3"
1545
+ >
1544
1546
 
1545
1547
  {/* 根据proxyType显示不同的表单项 */}
1546
1548
  <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.proxyType !== currentValues.proxyType}>
@@ -1654,30 +1656,42 @@ const InterfaceManagement = () => {
1654
1656
  />
1655
1657
  </div>
1656
1658
  ))}
1657
- <Button
1658
- type="dashed"
1659
- onClick={() => add()}
1660
- icon={<PlusOutlined />}
1661
- style={{ width: '100%', marginTop: '8px' }}
1662
- >
1663
- 添加参数匹配规则
1664
- </Button>
1665
- {fields.length > 0 && (
1666
- <div style={{
1667
- fontSize: '12px',
1668
- color: '#666',
1669
- marginTop: '8px',
1670
- padding: '8px',
1671
- backgroundColor: '#f5f5f5',
1672
- borderRadius: '4px'
1673
- }}>
1674
- <div><strong>说明:</strong></div>
1675
- <div>• <strong>精确匹配</strong>:参数值完全相等</div>
1676
- <div>• <strong>包含</strong>:参数值包含指定内容</div>
1677
- <div>• <strong>正则</strong>:参数值符合正则表达式</div>
1678
- <div>• <strong>嵌套路径</strong>:使用点号分隔,如 data.user.id</div>
1679
- </div>
1680
- )}
1659
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', marginTop: '8px' }}>
1660
+ <Button
1661
+ type="dashed"
1662
+ onClick={() => add()}
1663
+ icon={<PlusOutlined />}
1664
+ style={{ flex: 1 }}
1665
+ >
1666
+ 添加参数匹配规则
1667
+ </Button>
1668
+ <Popover
1669
+ content={
1670
+ <div style={{ maxWidth: '300px' }}>
1671
+ <div style={{ marginBottom: '8px', fontWeight: 'bold' }}>匹配规则说明:</div>
1672
+ <div style={{ lineHeight: '1.6' }}>
1673
+ <div>• <strong>精确匹配</strong>:参数值完全相等</div>
1674
+ <div>• <strong>包含</strong>:参数值包含指定内容</div>
1675
+ <div>• <strong>正则</strong>:参数值符合正则表达式</div>
1676
+ <div>• <strong>嵌套路径</strong>:使用点号分隔,如 data.user.id</div>
1677
+ </div>
1678
+ </div>
1679
+ }
1680
+ title="参数匹配规则"
1681
+ trigger="click"
1682
+ placement="top"
1683
+ >
1684
+ <Button
1685
+ type="text"
1686
+ icon={<QuestionCircleOutlined />}
1687
+ style={{
1688
+ color: '#999',
1689
+ padding: '4px'
1690
+ }}
1691
+ size="small"
1692
+ />
1693
+ </Popover>
1694
+ </div>
1681
1695
  </>
1682
1696
  )}
1683
1697
  </Form.List>
@@ -1801,7 +1815,8 @@ const InterfaceManagement = () => {
1801
1815
  return null;
1802
1816
  }}
1803
1817
  </Form.Item>
1804
- </Card>
1818
+ </Collapse.Panel>
1819
+ </Collapse>
1805
1820
  </Form>
1806
1821
  </div>
1807
1822
  </Modal>
@@ -1197,6 +1197,57 @@
1197
1197
  box-shadow: 0 0 0 2px rgba(64, 150, 255, 0.1);
1198
1198
  }
1199
1199
 
1200
+ /* 接口弹窗中的折叠面板样式 */
1201
+ .interface-modal .ant-collapse {
1202
+ background: transparent;
1203
+ border: none;
1204
+ }
1205
+
1206
+ .interface-modal .ant-collapse-item {
1207
+ margin-bottom: 16px;
1208
+ background: #ffffff;
1209
+ border: 1px solid #e8e8e8;
1210
+ border-radius: 8px;
1211
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
1212
+ }
1213
+
1214
+ .interface-modal .ant-collapse-header {
1215
+ background: #fafafa;
1216
+ border-bottom: 1px solid #f0f0f0;
1217
+ border-radius: 8px 8px 0 0 !important;
1218
+ padding: 16px 20px !important;
1219
+ font-size: 14px;
1220
+ font-weight: 600;
1221
+ color: #262626;
1222
+ }
1223
+
1224
+ .interface-modal .ant-collapse-content {
1225
+ border-top: none;
1226
+ background: #ffffff;
1227
+ border-radius: 0 0 8px 8px;
1228
+ }
1229
+
1230
+ .interface-modal .ant-collapse-content-box {
1231
+ padding: 20px;
1232
+ }
1233
+
1234
+ .interface-modal .ant-collapse-arrow {
1235
+ color: #666 !important;
1236
+ font-size: 12px !important;
1237
+ }
1238
+
1239
+ /* 参数匹配规则帮助按钮样式 */
1240
+ .interface-modal .ant-popover-inner-content {
1241
+ padding: 12px;
1242
+ }
1243
+
1244
+ .interface-modal .ant-popover-title {
1245
+ font-weight: 600;
1246
+ color: #262626;
1247
+ padding: 8px 12px;
1248
+ border-bottom: 1px solid #f0f0f0;
1249
+ }
1250
+
1200
1251
  /* 分页器样式 */
1201
1252
  .interface-table .ant-pagination-options {
1202
1253
  margin-right: 16px;