UNPKG

whistle.mock-plugins

Version:

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

419 lines (355 loc) 6.42 kB
/* 全局样式重置 */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; color: #333; background-color: #f5f5f5; line-height: 1.6; } /* 通用布局样式 */ .app-layout { display: flex; flex-direction: column; min-height: 100vh; } .app-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 60px; background-color: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); z-index: 10; } .app-logo { display: flex; align-items: center; font-size: 1.5rem; font-weight: bold; color: #2c3e50; } .app-logo img { height: 32px; margin-right: 10px; } .search-bar { flex: 1; max-width: 400px; margin: 0 20px; position: relative; } .search-bar input { width: 100%; padding: 8px 12px; padding-left: 35px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; } .search-bar::before { content: '🔍'; position: absolute; left: 10px; top: 8px; color: #aaa; } .action-buttons { display: flex; gap: 10px; } .action-btn { padding: 8px 12px; background-color: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s; } .action-btn:hover { background-color: #2980b9; } .app-main { display: flex; flex: 1; } .app-sidebar { width: 240px; background-color: #fff; box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05); padding: 20px 0; } .sidebar-header { padding: 0 20px 15px; border-bottom: 1px solid #eee; font-weight: bold; font-size: 1.1rem; } .feature-list { list-style: none; margin-top: 15px; } .feature-item { padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background-color 0.2s; } .feature-item:hover { background-color: #f0f7ff; } .feature-item.active { background-color: #e6f7ff; border-right: 3px solid #1890ff; } .feature-name { flex: 1; } .feature-count { font-size: 12px; padding: 2px 8px; background-color: #eee; border-radius: 10px; } .add-feature-btn { margin: 20px; padding: 8px 12px; background-color: #f0f7ff; color: #1890ff; border: 1px dashed #1890ff; border-radius: 4px; width: calc(100% - 40px); text-align: center; cursor: pointer; transition: all 0.2s; } .add-feature-btn:hover { background-color: #e6f7ff; } .sidebar-footer { margin-top: auto; padding: 15px 20px; font-size: 12px; color: #999; border-top: 1px solid #eee; } .app-content { flex: 1; padding: 20px; overflow-y: auto; } .content-header { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; } .content-title { font-size: 1.5rem; font-weight: bold; color: #2c3e50; } .content-controls { display: flex; gap: 10px; } .view-toggle, .sort-select { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; background-color: #fff; cursor: pointer; } .view-toggle:hover, .sort-select:hover { border-color: #bbb; } /* 卡片和列表通用样式 */ .features-container { margin-top: 20px; } .card-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; } .list-view .feature-row { display: flex; justify-content: space-between; align-items: center; padding: 15px; margin-bottom: 10px; background-color: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .list-view .feature-info { flex: 1; } .list-view .feature-actions { display: flex; gap: 10px; } /* 表单和表格通用样式 */ .config-form-container { background-color: #fff; border-radius: 4px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .config-form { display: flex; flex-direction: column; gap: 15px; } .form-group { display: flex; flex-direction: column; gap: 5px; } .form-group label { font-weight: 500; } .form-group input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; } .form-actions { display: flex; justify-content: flex-end; margin-top: 10px; } .submit-btn { padding: 8px 16px; background-color: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s; } .submit-btn:hover { background-color: #2980b9; } .config-list-container { background-color: #fff; border-radius: 4px; padding: 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .config-table { width: 100%; border-collapse: collapse; margin-top: 10px; } .config-table th, .config-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; } .config-table th { font-weight: 500; color: #666; } .config-table tr.inactive { color: #999; background-color: #f9f9f9; } .empty-list { padding: 20px; text-align: center; color: #999; } /* 开关按钮样式 */ .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: #2196F3; } 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; } .edit-btn { background-color: #f0f7ff; color: #1890ff; margin-right: 5px; } .delete-btn { background-color: #fff0f0; color: #ff4d4f; } .edit-btn:hover { background-color: #e6f7ff; } .delete-btn:hover { background-color: #ffd4d4; } /* 响应式布局 */ @media (max-width: 768px) { .app-main { flex-direction: column; } .app-sidebar { width: 100%; order: 2; } .app-content { order: 1; } .card-view { grid-template-columns: 1fr; } .search-bar { display: none; } }