UNPKG

whistle.mock-plugins

Version:

Whistle 插件,用于快速创建 API 模拟数据

1,322 lines (1,133 loc) 23.1 kB
/* 全局样式变量 */ :root { --primary-color: #1890ff; --primary-hover: #40a9ff; --primary-active: #096dd9; --success-color: #52c41a; --warning-color: #faad14; --error-color: #f5222d; --font-color: #262626; --text-secondary: #595959; --text-light: #8c8c8c; --border-color: #f0f0f0; --border-radius: 8px; --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); --transition-time: 0.3s; } /* 页面容器 */ .interface-management-container { padding: 24px; min-height: calc(100vh - 120px); } /* 统一控制台 */ .interface-control-panel { margin-bottom: 16px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); overflow: hidden; } .control-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; } .control-left { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; } .control-right { display: flex; align-items: center; } .feature-selector { display: flex; align-items: center; background: #f9f9f9; padding: 6px 12px; border-radius: var(--border-radius); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); transition: all var(--transition-time); } .feature-selector:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); } .feature-selector span { margin-right: 8px; font-weight: 600; color: var(--text-secondary); font-size: 14px; } .control-panel-stats { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 8px 0; min-height: 40px; } .stats-left { display: flex; align-items: center; flex-wrap: wrap; } .stats-right { display: flex; align-items: center; gap: 12px; } .stat-item { display: inline-flex; align-items: center; font-size: 14px; } .stat-label { color: var(--text-secondary); margin-right: 6px; } .stat-value { font-weight: 600; color: var(--font-color); } .selected-count { font-weight: 600; color: var(--primary-color); font-size: 13px; } /* 旧版样式兼容 */ .interface-header-card { margin-bottom: 16px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); overflow: hidden; } .interface-management-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; } .feature-selector-container { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; } .interface-actions { display: flex; align-items: center; } .add-interface-button { background: linear-gradient(to right, var(--primary-color), var(--primary-hover)); border: none; box-shadow: 0 2px 6px rgba(24, 144, 255, 0.25); transition: all var(--transition-time); } .add-interface-button:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(24, 144, 255, 0.4); } /* 分组筛选区域 */ .filter-card { margin-bottom: 16px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); } .filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .filter-title { font-weight: 600; font-size: 15px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; } .group-tags-container { margin-bottom: 12px; max-height: 120px; overflow-y: auto; padding: 8px 0; } .group-tags { display: flex; flex-wrap: wrap; gap: 8px; } .group-tag { cursor: pointer; user-select: none; transition: all 0.2s; padding: 6px 12px; font-size: 13px; } .group-tag:hover { transform: translateY(-2px); } .group-tag.active { font-weight: 600; } .group-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; } .empty-groups { color: #999; font-style: italic; padding: 8px 0; } /* 接口列表区域 */ .list-header-card { margin-bottom: 16px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); } .list-header { display: flex; justify-content: space-between; align-items: center; } .list-header-info { display: flex; align-items: center; justify-content: space-between; width: 100%; } .feature-info { display: flex; align-items: center; gap: 8px; } .feature-info .label { color: var(--text-secondary); font-weight: 500; } .feature-info .value { font-weight: 600; color: var(--font-color); } .group-badge { margin-left: 12px; } .interface-stats { font-size: 13px; } .selected-count { font-weight: 600; color: var(--primary-color); } .batch-actions { display: flex; align-items: center; gap: 8px; } .list-container-card { border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); margin-bottom: 40px; } .interface-list-container { padding: 0; } /* 表格样式增强 */ .interface-table th { background-color: #f5f7fa !important; font-weight: 600; padding: 12px 16px !important; color: #333; white-space: nowrap; } .interface-table td { padding: 12px 16px !important; white-space: nowrap; overflow: hidden; } /* 当前响应列需要 overflow: visible 以显示完整的下拉菜单 */ .interface-table td.current-response-cell { overflow: visible !important; } /* 卡片视图样式 */ .interface-card-view { padding-bottom: 20px; } .interface-card { border-radius: 8px; transition: all 0.3s; height: 100%; } .interface-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); } .interface-card.inactive { background-color: #f5f5f5; border: 1px solid #e8e8e8; opacity: 0.8; } .interface-card-header { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; position: relative; } .interface-card-title { font-weight: 600; font-size: 15px; margin-right: 40px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .interface-card-switch { position: absolute; right: 0; top: 0; } .interface-card-group { cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: flex-start; } .url-pattern-container { background: #f5f7fa; padding: 8px; border-radius: 4px; margin-bottom: 10px; } .interface-card .url-pattern { font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: #333; } .interface-card-info { margin-bottom: 12px; } .info-item { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; } .info-label { font-size: 12px; color: #666; } .status-badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; } .status-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; } .status-warning { background: #fff7e6; border: 1px solid #ffd591; color: #faad14; } .status-error { background: #fff1f0; border: 1px solid #ffa39e; color: #f5222d; } .interface-card-actions { display: flex; justify-content: space-between; margin-top: 12px; gap: 8px; } .card-pagination { display: flex; justify-content: center; margin-top: 20px; padding: 0 16px 16px; } .test-interface-container { padding: 20px; background: #f9f9f9; border-radius: var(--border-radius); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); margin-top: 24px; } .test-result { margin-top: 24px; padding: 20px; border-radius: var(--border-radius); background-color: #fff; border: 1px solid var(--border-color); box-shadow: var(--card-shadow); } .result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); } .result-header h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--font-color); } .status { font-size: 14px; padding: 4px 12px; border-radius: 20px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; } .status.success { background-color: #f6ffed; border: 1px solid #b7eb8f; color: var(--success-color); } .status.error { background-color: #fff2f0; border: 1px solid #ffccc7; color: var(--error-color); } .result-content { display: flex; flex-direction: column; gap: 12px; } .result-item { display: flex; align-items: flex-start; padding: 8px 12px; background: #fafafa; border-radius: 6px; transition: background-color var(--transition-time); } .result-item:hover { background: #f0f0f0; } .result-item .label { font-weight: 600; width: 120px; flex-shrink: 0; color: var(--text-secondary); } .result-item .value { word-break: break-all; color: var(--font-color); font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; } .result-body { margin-top: 16px; } .result-body .label { font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); } .result-body pre { margin: 0; padding: 16px; background-color: #f5f5f5; border-radius: var(--border-radius); max-height: 400px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 14px; line-height: 1.6; border: 1px solid #e8e8e8; } .result-error { color: var(--error-color); padding: 12px 16px; background-color: #fff2f0; border-radius: var(--border-radius); border-left: 4px solid var(--error-color); } .breadcrumb { display: flex; align-items: center; font-size: 14px; margin-bottom: 16px; } .breadcrumb .link { color: var(--primary-color); cursor: pointer; transition: color var(--transition-time); } .breadcrumb .link:hover { color: var(--primary-hover); text-decoration: underline; } .breadcrumb .separator { margin: 0 12px; color: #d9d9d9; } .breadcrumb .current { color: var(--text-secondary); font-weight: 500; } .add-button { background: linear-gradient(to right, var(--primary-color), var(--primary-hover)); color: white; border: none; border-radius: var(--border-radius); padding: 0 20px; height: 40px; cursor: pointer; font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: all var(--transition-time); box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35); } .add-button:hover { background: linear-gradient(to right, var(--primary-hover), var(--primary-active)); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(24, 144, 255, 0.5); } .feature-details { background-color: white; border-radius: var(--border-radius); box-shadow: var(--card-shadow); padding: 24px; margin-bottom: 24px; border-left: 4px solid var(--primary-color); } .feature-name { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; } .feature-name h1 { font-size: 22px; font-weight: 600; color: var(--font-color); margin: 0; } .status-badge { font-size: 13px; padding: 4px 12px; border-radius: 20px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; } .status-badge.active { background-color: #f6ffed; color: var(--success-color); border: 1px solid #b7eb8f; } .status-badge.inactive { background-color: #fff1f0; color: var(--error-color); border: 1px solid #ffa39e; } .feature-description { color: var(--text-secondary); font-size: 15px; margin: 0; line-height: 1.6; } /* 重复的表格样式已移除,使用上面的统一定义 */ .interface-table tr.inactive { color: var(--text-light); background-color: #f9f9f9; opacity: 0.7; } .url-pattern { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; padding: 4px 8px; background: #f5f5f5; border-radius: 4px; display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* 接口状态开关 */ .status-switch { position: relative; display: inline-block; width: 48px; height: 24px; } .status-switch input { opacity: 0; width: 0; height: 0; } .status-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; } .status-switch .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; } .status-switch input:checked + .slider { background-color: var(--success-color); } .status-switch input:checked + .slider:before { transform: translateX(24px); } /* 操作按钮 */ .action-button { border: none; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: all var(--transition-time); margin-right: 8px; } .test-button { background-color: #e6f7ff; color: var(--primary-color); border: 1px solid #91d5ff; } .test-button:hover { background-color: #bae7ff; } .edit-button { background-color: #fcf6bd; color: #d4b106; border: 1px solid #ffd666; } .edit-button:hover { background-color: #fff1b8; } .delete-button { background-color: #fff2f0; color: var(--error-color); border: 1px solid #ffccc7; } .delete-button:hover { background-color: #ffa39e; color: #fff; } /* 空状态 */ .empty-data { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; background: #fafafa; border-radius: var(--border-radius); text-align: center; margin-top: 24px; } .empty-icon { font-size: 64px; color: #d9d9d9; margin-bottom: 24px; } .empty-text { color: var(--text-secondary); font-size: 16px; margin-bottom: 24px; } .create-interface-button { background: linear-gradient(to right, var(--primary-color), var(--primary-hover)); color: white; border: none; border-radius: var(--border-radius); padding: 0 24px; height: 44px; cursor: pointer; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: all var(--transition-time); box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35); } .create-interface-button:hover { background: linear-gradient(to right, var(--primary-hover), var(--primary-active)); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(24, 144, 255, 0.5); } /* 加载状态 */ .loading { display: flex; justify-content: center; align-items: center; padding: 40px; font-size: 16px; color: var(--text-secondary); } /* 错误容器样式 */ .error-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; color: #8c8c8c; } .error-icon { font-size: 48px; margin-bottom: 16px; } .error-message { font-size: 16px; margin-bottom: 24px; } .back-button { height: 36px; padding: 0 20px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; } .back-button:hover { background-color: #40a9ff; } /* 模态框样式 */ .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; } .modal { background-color: white; border-radius: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); width: 600px; max-width: 90%; max-height: 90vh; overflow-y: auto; } .interface-modal { width: 700px; } .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid #f0f0f0; } .modal-header h2 { margin: 0; font-size: 16px; font-weight: 600; color: #262626; } .close-button { background: none; border: none; font-size: 20px; color: #8c8c8c; cursor: pointer; } .interface-form { padding: 16px; } .form-row { display: flex; gap: 16px; } .form-row .form-group { flex: 1; } .form-group { margin-bottom: 16px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #262626; } .response-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; } .format-button { background-color: #f0f5ff; color: #597ef7; border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 12px; } .format-button:hover { background-color: #d6e4ff; } .checkbox-label, .radio-label { display: flex; align-items: center; gap: 8px; font-weight: normal; color: #262626; margin-bottom: 8px; } .radio-group { display: flex; gap: 24px; } .form-group input[type="text"], .form-group input[type="number"], .form-group select { width: 100%; height: 32px; padding: 0 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; } .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; resize: vertical; font-family: monospace; } .help-text { font-size: 12px; color: #8c8c8c; margin-top: 4px; display: block; } .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #f0f0f0; } .cancel-button { height: 32px; padding: 0 16px; background-color: white; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; font-size: 14px; } .submit-button { height: 32px; padding: 0 16px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; } /* 全屏TextArea样式 */ .textarea-fullscreen-btn { position: absolute; top: 8px; right: 32px; background: rgba(255, 255, 255, 0.9); border: 1px solid #d9d9d9; z-index: 10; } .textarea-fullscreen-btn:hover { background: rgba(255, 255, 255, 1); border-color: #40a9ff; } .textarea-fullscreen-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #1f1f1f; z-index: 1000; display: flex; flex-direction: column; } .textarea-fullscreen-header { padding: 12px 16px; border-bottom: 1px solid #333; display: flex; justify-content: flex-end; align-items: center; } .textarea-fullscreen-editor { flex: 1; border: none !important; background: #1f1f1f !important; color: #ffffff !important; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important; font-size: 14px !important; line-height: 1.6 !important; resize: none !important; padding: 16px !important; outline: none !important; box-shadow: none !important; } .textarea-fullscreen-editor:focus { background: #1f1f1f !important; border: none !important; box-shadow: none !important; } /* 延迟时间样式 */ .delay-active { color: #1890ff; font-weight: 500; } .delay-inactive { color: #999; font-style: italic; } /* 状态码样式 */ .status-success { color: #52c41a; font-weight: 500; } .status-warning { color: #faad14; font-weight: 500; } .status-error { color: #f5222d; font-weight: 500; } /* 接口名称样式 */ .interface-name { font-weight: 500; } /* URL模式样式 */ .url-pattern { font-family: monospace; color: #333; } /* 无响应数据样式 */ .no-response { color: #999; font-style: italic; } /* 内联列设置按钮样式 */ .inline-column-settings-btn { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; border: 1px solid #d9d9d9; background: #ffffff; color: #666; font-size: 12px; transition: all 0.2s ease; } .inline-column-settings-btn:hover { border-color: #4096ff; background: #f0f9ff; color: #4096ff; } .inline-column-settings-btn:active { border-color: #1677ff; background: #e6f4ff; } /* 紧凑排序 Chips */ .sortable-chip { display: inline-flex; align-items: center; padding: 2px 10px; height: 24px; border: 1px solid #e6e6e6; border-radius: 12px; background: #fff; font-size: 12px; color: #595959; cursor: move; user-select: none; white-space: nowrap; } .sortable-chip:hover { border-color: #bfbfbf; box-shadow: 0 1px 2px rgba(0,0,0,0.06); } .sortable-chip-active { background: #e6f7ff; border-color: #91d5ff; color: #1677ff; } .sortable-ghost { opacity: 0.6; } /* 接口弹窗样式 */ .interface-modal .ant-modal-header { border-bottom: 1px solid #f0f0f0; padding: 16px 24px; margin-bottom: 0; } .interface-modal .ant-modal-body { padding: 0; } .interface-modal .ant-card { border: 1px solid #e8e8e8; border-radius: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); } .interface-modal .ant-card-head { background: #fafafa; border-bottom: 1px solid #f0f0f0; padding: 0 20px; min-height: 48px; } .interface-modal .ant-card-head-title { font-size: 14px; font-weight: 600; color: #262626; padding: 12px 0; } .interface-modal .ant-form-item-label > label { font-size: 13px; font-weight: 500; color: #434343; } .interface-modal .ant-form-item { margin-bottom: 16px; } .interface-modal .ant-input, .interface-modal .ant-select-selector { border-radius: 6px; border: 1px solid #d9d9d9; } .interface-modal .ant-input:focus, .interface-modal .ant-select-focused .ant-select-selector { border-color: #4096ff; box-shadow: 0 0 0 2px rgba(64, 150, 255, 0.1); } /* 接口弹窗中的折叠面板样式 */ .interface-modal .ant-collapse { background: transparent; border: none; } .interface-modal .ant-collapse-item { margin-bottom: 16px; background: #ffffff; border: 1px solid #e8e8e8; border-radius: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); } .interface-modal .ant-collapse-header { background: #fafafa; border-bottom: 1px solid #f0f0f0; border-radius: 8px 8px 0 0 !important; padding: 16px 20px !important; font-size: 14px; font-weight: 600; color: #262626; } .interface-modal .ant-collapse-content { border-top: none; background: #ffffff; border-radius: 0 0 8px 8px; } .interface-modal .ant-collapse-content-box { padding: 20px; } .interface-modal .ant-collapse-arrow { color: #666 !important; font-size: 12px !important; } /* 参数匹配规则帮助按钮样式 */ .interface-modal .ant-popover-inner-content { padding: 12px; } .interface-modal .ant-popover-title { font-weight: 600; color: #262626; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; } /* 分页器样式 */ .interface-table .ant-pagination-options { margin-right: 16px; } /* 可调整列宽样式 */ .column-resize-handle { position: absolute; right: -5px; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 1; user-select: none; } .column-resize-handle:hover { background-color: rgba(24, 144, 255, 0.2); } .column-resize-handle::after { content: ''; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 2px; height: 20px; background-color: #d9d9d9; transition: background-color 0.3s; } .column-resize-handle:hover::after { background-color: #1890ff; }