whistle.mock-plugins 1.1.3-dev.14 → 1.1.3-dev.16

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.14",
3
+ "version": "1.1.3-dev.16",
4
4
  "description": "Whistle 插件,用于快速创建 API 模拟数据",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@ 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,
@@ -1262,36 +1262,77 @@ const InterfaceManagement = () => {
1262
1262
 
1263
1263
  {/* 接口编辑/创建模态框 */}
1264
1264
  <Modal
1265
- title={editingInterface ? '编辑接口' : '添加接口'}
1265
+ title={
1266
+ <div style={{
1267
+ fontSize: '18px',
1268
+ fontWeight: 600,
1269
+ color: '#262626',
1270
+ display: 'flex',
1271
+ alignItems: 'center',
1272
+ gap: '8px'
1273
+ }}>
1274
+ <span>{editingInterface ? '编辑接口' : '添加接口'}</span>
1275
+ <Badge
1276
+ count="配置向导"
1277
+ style={{
1278
+ backgroundColor: '#f0f9ff',
1279
+ color: '#1677ff',
1280
+ fontSize: '11px',
1281
+ fontWeight: 'normal'
1282
+ }}
1283
+ />
1284
+ </div>
1285
+ }
1266
1286
  open={modalVisible}
1267
1287
  onOk={handleSubmit}
1268
1288
  onCancel={handleCancel}
1269
- width={800}
1289
+ width={1200}
1270
1290
  destroyOnClose
1271
1291
  okText={editingInterface ? '保存' : '创建'}
1272
1292
  cancelText="取消"
1273
- bodyStyle={{ maxHeight: '70vh', overflow: 'auto', padding: '24px' }}
1293
+ bodyStyle={{
1294
+ maxHeight: '75vh',
1295
+ overflow: 'auto',
1296
+ padding: '0',
1297
+ background: '#fafafa'
1298
+ }}
1299
+ className="interface-modal"
1274
1300
  >
1275
- <Form
1276
- form={form}
1277
- layout="vertical"
1278
- initialValues={{
1279
- name: '',
1280
- group: '',
1281
- pattern: '',
1282
- proxyType: 'response',
1283
- statusCode: '200',
1284
- contentType: 'application/json; charset=utf-8',
1285
- responses: [],
1286
- httpMethod: 'ALL',
1287
- targetUrl: '',
1288
- headerItems: [],
1289
- paramMatchers: [],
1290
- responseDelay: '0'
1291
- }}
1292
- >
1293
- {/* 基础信息表单项 */}
1294
- <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1301
+ <div style={{ padding: '24px' }}>
1302
+ <Form
1303
+ form={form}
1304
+ layout="vertical"
1305
+ initialValues={{
1306
+ name: '',
1307
+ group: '',
1308
+ pattern: '',
1309
+ proxyType: 'response',
1310
+ statusCode: '200',
1311
+ contentType: 'application/json; charset=utf-8',
1312
+ responses: [],
1313
+ httpMethod: 'ALL',
1314
+ targetUrl: '',
1315
+ headerItems: [],
1316
+ paramMatchers: [],
1317
+ responseDelay: '0'
1318
+ }}
1319
+ >
1320
+ <Collapse
1321
+ defaultActiveKey={editingInterface ? ['1', '2'] : ['1', '2', '3']}
1322
+ style={{ marginBottom: '16px' }}
1323
+ ghost
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
+ >
1335
+ <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1295
1336
  <div style={{ flex: 1 }}>
1296
1337
  <Form.Item
1297
1338
  name="name"
@@ -1335,10 +1376,21 @@ const InterfaceManagement = () => {
1335
1376
  ))}
1336
1377
  </Select>
1337
1378
  </Form.Item>
1338
- </div>
1339
- </div>
1340
-
1341
- <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1379
+ </div>
1380
+ </div>
1381
+ </Collapse.Panel>
1382
+
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
+ >
1393
+ <div style={{ display: 'flex', flexDirection: 'row', gap: '16px' }}>
1342
1394
  <div style={{ flex: 1 }}>
1343
1395
  <Form.Item
1344
1396
  name="pattern"
@@ -1478,7 +1530,19 @@ const InterfaceManagement = () => {
1478
1530
  <div style={{ flex: 1 }}>
1479
1531
  {/* 这里可以留空或添加其他字段 */}
1480
1532
  </div>
1481
- </div>
1533
+ </div>
1534
+ </Collapse.Panel>
1535
+
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
+ >
1482
1546
 
1483
1547
  {/* 根据proxyType显示不同的表单项 */}
1484
1548
  <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.proxyType !== currentValues.proxyType}>
@@ -1739,7 +1803,10 @@ const InterfaceManagement = () => {
1739
1803
  return null;
1740
1804
  }}
1741
1805
  </Form.Item>
1742
- </Form>
1806
+ </Collapse.Panel>
1807
+ </Collapse>
1808
+ </Form>
1809
+ </div>
1743
1810
  </Modal>
1744
1811
 
1745
1812
  {/* 使用拆分后的预览模态框组件 */}
@@ -1144,6 +1144,98 @@
1144
1144
  background: #e6f4ff;
1145
1145
  }
1146
1146
 
1147
+ /* 接口弹窗样式 */
1148
+ .interface-modal .ant-modal-header {
1149
+ border-bottom: 1px solid #f0f0f0;
1150
+ padding: 16px 24px;
1151
+ margin-bottom: 0;
1152
+ }
1153
+
1154
+ .interface-modal .ant-modal-body {
1155
+ padding: 0;
1156
+ }
1157
+
1158
+ .interface-modal .ant-card {
1159
+ border: 1px solid #e8e8e8;
1160
+ border-radius: 8px;
1161
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
1162
+ }
1163
+
1164
+ .interface-modal .ant-card-head {
1165
+ background: #fafafa;
1166
+ border-bottom: 1px solid #f0f0f0;
1167
+ padding: 0 20px;
1168
+ min-height: 48px;
1169
+ }
1170
+
1171
+ .interface-modal .ant-card-head-title {
1172
+ font-size: 14px;
1173
+ font-weight: 600;
1174
+ color: #262626;
1175
+ padding: 12px 0;
1176
+ }
1177
+
1178
+ .interface-modal .ant-form-item-label > label {
1179
+ font-size: 13px;
1180
+ font-weight: 500;
1181
+ color: #434343;
1182
+ }
1183
+
1184
+ .interface-modal .ant-form-item {
1185
+ margin-bottom: 16px;
1186
+ }
1187
+
1188
+ .interface-modal .ant-input,
1189
+ .interface-modal .ant-select-selector {
1190
+ border-radius: 6px;
1191
+ border: 1px solid #d9d9d9;
1192
+ }
1193
+
1194
+ .interface-modal .ant-input:focus,
1195
+ .interface-modal .ant-select-focused .ant-select-selector {
1196
+ border-color: #4096ff;
1197
+ box-shadow: 0 0 0 2px rgba(64, 150, 255, 0.1);
1198
+ }
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
+
1147
1239
  /* 分页器样式 */
1148
1240
  .interface-table .ant-pagination-options {
1149
1241
  margin-right: 16px;