whistle.mock-plugins
Version:
Whistle 插件,用于快速创建 API 模拟数据
850 lines (725 loc) • 13.2 kB
CSS
.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;
}
.feature-card {
position: relative;
transition: all 0.3s;
height: 100%;
display: flex;
flex-direction: column;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 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 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 300px;
color: #8c8c8c;
font-size: 16px;
}
.loading-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #1890ff;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 2s linear infinite;
margin-bottom: 16px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 响应式调整 */
@media (max-width: 768px) {
.mock-data-container {
padding: 16px;
}
.page-header {
flex-direction: column;
align-items: flex-start;
}
.header-actions {
margin-top: 16px;
width: 100%;
}
.add-button, .import-button {
flex: 1;
}
.feature-card-content {
height: auto;
}
.form-actions {
flex-direction: column;
}
.cancel-button, .submit-button {
width: 100%;
}
}
/* 修复功能模块状态标记(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;
}
}