UNPKG

whistle.mock-plugins

Version:

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

1,185 lines (1,002 loc) 18.7 kB
.mock-data-container { padding: 24px; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); } .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; } /* 页面标题区域样式 */ .title-section { flex: 1; } .title-with-badge { display: flex; align-items: center; margin-bottom: 8px; } .page-title { margin: 0 !important; font-size: 24px; font-weight: 600; color: #262626; line-height: 1.2; } .page-description { color: #8c8c8c; font-size: 14px; line-height: 1.5; margin: 0; } /* 控制面板卡片样式 */ .control-panel-card { border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); border: 1px solid #f0f0f0; } .control-panel-card .ant-card-body { padding: 20px 24px; } /* 统计信息区域 */ .stats-section { display: flex; gap: 24px; align-items: center; } .stats-item { display: flex; flex-direction: column; align-items: center; text-align: center; } .stats-number { font-size: 24px; font-weight: 600; color: #1890ff; line-height: 1; margin-bottom: 4px; } .stats-label { font-size: 12px; color: #8c8c8c; line-height: 1; } /* 控制组样式 */ .control-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .control-label { font-size: 14px; color: #595959; white-space: nowrap; font-weight: 500; } .control-label .anticon { margin-right: 6px; color: #1890ff; } .page-info { font-size: 13px; color: #8c8c8c; white-space: nowrap; } /* 功能列表卡片样式 */ .feature-list-card { border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); border: 1px solid #f0f0f0; min-height: 400px; } .feature-list-card .ant-card-body { padding: 24px; } .feature-grid { min-height: 300px; } .feature-card { position: relative; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); height: 100%; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); border: 1px solid #f0f0f0; cursor: pointer; background: #ffffff; } .feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); border-color: #d9d9d9; } .feature-card:active { transform: translateY(-2px); } /* 添加卡片悬浮效果 */ .feature-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(24, 144, 255, 0.02), rgba(24, 144, 255, 0.04)); opacity: 0; transition: opacity 0.3s ease; pointer-events: none; z-index: 1; } .feature-card:hover::before { opacity: 1; } /* 为卡片内容添加相对定位,确保在渐变层之上 */ .feature-card .ant-card-body { position: relative; z-index: 2; padding: 20px; } .feature-card .ant-card-actions { position: relative; z-index: 2; border-top: 1px solid #f0f0f0; background: #fafafa; } .feature-card .ant-card-actions li { transition: all 0.2s ease; } .feature-card .ant-card-actions li:hover { background: #f0f0f0; } /* 不活跃功能卡片样式 */ .feature-card.inactive-feature { opacity: 0.7; filter: grayscale(0.3); } .feature-card.inactive-feature:hover { opacity: 0.9; filter: grayscale(0.1); } .feature-card-content { padding: 16px; height: 140px; display: flex; flex-direction: column; } .feature-name { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; } .feature-name h4 { margin: 0; font-size: 18px; color: #1890ff; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .status-tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; } .status-tag.inactive { background-color: #fff1f0; color: #f5222d; border: 1px solid #ffa39e; } .status-tag.active { background-color: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; } .feature-description { color: #666; font-size: 14px; margin-bottom: 16px; flex: 1; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .feature-stat { margin-top: auto; color: #8c8c8c; font-size: 13px; display: flex; justify-content: space-between; align-items: center; } .feature-date { color: #999; font-size: 12px; } .inactive-feature { opacity: 0.75; background-color: #fafafa; } .inactive-feature .ant-card-meta-title { color: #999; } .empty-data { text-align: center; padding: 48px 0; background-color: #f9f9f9; border-radius: 8px; margin: 24px 0; } .loading { text-align: center; padding: 48px 0; } .mock-data-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .mock-data-header h2 { font-size: 18px; margin: 0; color: #1890ff; } .add-mock-btn { background-color: #1890ff; color: white; border: none; border-radius: 4px; padding: 8px 16px; cursor: pointer; transition: background-color 0.3s; } .add-mock-btn:hover { background-color: #40a9ff; } .mock-editor { background-color: #f9f9f9; border-radius: 8px; padding: 20px; margin-bottom: 20px; } .mock-form { display: flex; flex-direction: column; gap: 15px; } .form-row { display: flex; gap: 15px; } .method-select { width: 120px; } .path-input { flex: 1; } .form-group { display: flex; flex-direction: column; gap: 5px; } .form-group label { font-weight: 500; color: #333; } .form-group input, .form-group select, .form-group textarea { padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; transition: border-color 0.3s; font-family: inherit; } .form-group textarea { font-family: monospace; resize: vertical; min-height: 150px; } .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #40a9ff; outline: none; box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); } .form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; } .cancel-btn { padding: 8px 16px; background-color: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; transition: all 0.3s; } .cancel-btn:hover { background-color: #e6e6e6; } .save-btn { padding: 8px 16px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.3s; } .save-btn:hover { background-color: #40a9ff; } .mock-table { width: 100%; border-collapse: collapse; } .mock-table th, .mock-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; } .mock-table th { font-weight: 500; color: #666; background-color: #f9f9f9; } .mock-table tr.inactive { color: #999; background-color: #f9f9f9; } .mock-table tr:hover { background-color: #f5f5f5; } .toggle-switch { position: relative; display: inline-block; width: 40px; height: 20px; } .toggle-switch input { opacity: 0; width: 0; height: 0; } .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; } .toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; } input:checked + .toggle-slider { background-color: #1890ff; } input:checked + .toggle-slider:before { transform: translateX(20px); } .edit-btn, .delete-btn { padding: 5px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; margin-right: 5px; } .edit-btn { background-color: #f0f7ff; color: #1890ff; } .delete-btn { background-color: #fff0f0; color: #ff4d4f; } .edit-btn:hover { background-color: #e6f7ff; } .delete-btn:hover { background-color: #ffd4d4; } .empty-list { text-align: center; padding: 30px; color: #999; font-style: italic; background-color: #f9f9f9; border-radius: 4px; } .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; } .page-header h1 { font-size: 24px; font-weight: 600; color: #1890ff; margin: 0; } .header-actions { display: flex; gap: 12px; } .add-button, .import-button { height: 36px; padding: 0 16px; border-radius: 4px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; border: none; font-weight: 500; transition: all 0.3s; } .add-button { background-color: #1890ff; color: white; } .add-button:hover { background-color: #40a9ff; box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2); } .import-button { background-color: #52c41a; color: white; } .import-button:hover { background-color: #73d13d; box-shadow: 0 4px 12px rgba(82, 196, 26, 0.2); } .feature-list-container { background-color: white; border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); overflow: hidden; } .feature-table { width: 100%; border-collapse: collapse; } .feature-table th, .feature-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; } .feature-table th { background-color: #fafafa; color: #8c8c8c; font-weight: 500; font-size: 14px; } .feature-table tr:hover { background-color: #fafafa; } .feature-table tr.inactive { color: #a6a6a6; background-color: #f9f9f9; } .action-buttons { display: flex; gap: 8px; } .edit-button, .delete-button, .interface-button, .export-button { border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 12px; } .interface-button { background-color: #e6f7ff; color: #1890ff; } .interface-button:hover { background-color: #bae7ff; } .export-button { background-color: #f6ffed; color: #52c41a; } .export-button:hover { background-color: #d9f7be; } .edit-button { background-color: #f0f5ff; color: #597ef7; } .edit-button:hover { background-color: #d6e4ff; } .delete-button { background-color: #fff1f0; color: #f5222d; } .delete-button:hover { background-color: #ffccc7; } /* 切换开关样式 */ .switch { position: relative; display: inline-block; width: 36px; height: 20px; } .switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 20px; } .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #1890ff; } input:checked + .slider:before { transform: translateX(16px); } /* 空数据样式 */ .empty-data { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 0; color: #8c8c8c; } .empty-icon { font-size: 48px; margin-bottom: 16px; color: #d9d9d9; } .empty-text { font-size: 16px; margin-bottom: 24px; color: #8c8c8c; } .empty-actions { display: flex; gap: 16px; } .create-button, .import-button-large { height: 36px; padding: 0 20px; border-radius: 4px; cursor: pointer; font-size: 14px; border: none; display: flex; align-items: center; justify-content: center; } .create-button { background-color: #1890ff; color: white; } .create-button:hover { background-color: #40a9ff; } .import-button-large { background-color: #52c41a; color: white; } .import-button-large:hover { background-color: #73d13d; } /* 模态框样式 */ .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; animation: fadeIn 0.3s; } .modal { background-color: white; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); width: 500px; max-width: 90%; max-height: 90vh; overflow-y: auto; animation: slideIn 0.3s; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid #f0f0f0; } .modal-header h2 { margin: 0; font-size: 18px; font-weight: 600; color: #1890ff; } .close-button { background: none; border: none; font-size: 20px; color: #999; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.3s; } .close-button:hover { background-color: #f5f5f5; color: #555; } .feature-form { padding: 24px; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; } .checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: #333; cursor: pointer; } .form-group input[type="text"] { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; transition: all 0.3s; } .form-group input[type="text"]:focus { border-color: #40a9ff; box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); outline: none; } .form-group input[type="checkbox"] { width: 16px; height: 16px; margin: 0; } .form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; } .cancel-button { height: 40px; padding: 0 16px; background-color: white; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; font-size: 14px; transition: all 0.3s; } .cancel-button:hover { background-color: #f5f5f5; } .submit-button { height: 40px; padding: 0 24px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: all 0.3s; } .submit-button:hover { background-color: #40a9ff; } /* 加载中样式 */ /* 加载状态样式 */ .loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; gap: 16px; } .loading-text { color: #8c8c8c; font-size: 16px; } /* 空状态样式 */ .custom-empty { padding: 60px 20px; } .empty-image { margin-bottom: 16px; } .empty-description { margin-bottom: 24px; } .empty-title { font-size: 16px; font-weight: 500; color: #262626; margin-bottom: 8px; } .empty-subtitle { font-size: 14px; color: #8c8c8c; line-height: 1.5; } .empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; } /* 分页组件样式 */ .pagination-wrapper { margin-top: 32px; padding-top: 24px; border-top: 1px solid #f0f0f0; display: flex; justify-content: center; } .custom-pagination { display: flex; justify-content: center; } .custom-pagination .ant-pagination-total-text { color: #8c8c8c; font-size: 14px; } /* 响应式调整 */ @media (max-width: 768px) { .mock-data-container { padding: 16px; } .page-title-bar { flex-direction: column; align-items: flex-start; gap: 16px; } .page-actions { width: 100%; justify-content: flex-start; } .stats-section { justify-content: space-around; gap: 16px; } .control-group { justify-content: flex-start; } .control-panel-card .ant-card-body { padding: 16px; } .feature-list-card .ant-card-body { padding: 16px; } .feature-card-content { height: auto; } .form-actions { flex-direction: column; } .cancel-button, .submit-button { width: 100%; } .empty-actions { flex-direction: column; align-items: center; } .empty-actions .ant-btn { width: 200px; } } @media (max-width: 576px) { .stats-section { flex-direction: column; gap: 12px; align-items: stretch; } .stats-item { flex-direction: row; justify-content: space-between; align-items: center; padding: 8px 12px; background: #fafafa; border-radius: 6px; } .stats-number { font-size: 20px; } .stats-label { font-size: 13px; } .control-group { flex-direction: column; align-items: flex-start; gap: 8px; } .page-info { order: -1; font-weight: 500; } } /* 修复功能模块状态标记(ribbon)与按钮的重叠问题 */ .ant-ribbon.ant-ribbon-placement-end { top: 5px; /* 向下调整 ribbon 位置 */ right: 0px; z-index: 5; } /* 确保功能卡片右上角有足够空间容纳 ribbon */ .ant-card-extra { margin-right: 70px; /* 为 ribbon 提供足够空间 */ } /* 当屏幕宽度较小时调整 ribbon 位置 */ @media (max-width: 576px) { .ant-ribbon.ant-ribbon-placement-end { top: 3px; z-index: 5; } .ant-card-extra { margin-right: 60px; } } /* 视图切换控制样式 */ .view-mode-controls { display: flex; justify-content: flex-end; align-items: center; } .view-mode-controls .ant-btn-group { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); } /* 列表视图样式 */ .feature-list-card .ant-table-wrapper { margin-top: 0; } .feature-list-card .ant-table { font-size: 14px; } .feature-list-card .ant-table-thead > tr > th { background-color: #fafafa; font-weight: 600; color: #262626; padding: 16px; } .feature-list-card .ant-table-tbody > tr > td { padding: 16px; } .feature-list-card .ant-table-tbody > tr:hover { background-color: #f5f5f5; } .feature-list-card .ant-table-tbody > tr.inactive-row { background-color: #fafafa; opacity: 0.7; } .feature-list-card .ant-table-tbody > tr.inactive-row:hover { background-color: #f0f0f0; } /* 列表视图中的操作按钮样式 */ .feature-list-card .ant-btn-link { padding: 4px 8px; height: auto; } /* 响应式调整 */ @media (max-width: 768px) { .view-mode-controls { justify-content: center; margin-top: 12px; } .feature-list-card .ant-table { font-size: 13px; } .feature-list-card .ant-table-thead > tr > th, .feature-list-card .ant-table-tbody > tr > td { padding: 12px 8px; } }