2025-11-02
将订单分配页面的"保存草稿"和"确认订单"按钮恢复到精美的原始样式,同时支持所有屏幕尺寸(桌面端、平板端、移动端)。
文件: src/modules/project/pages/project-detail/stages/stage-order.component.scss
为.action-buttons和.action-buttons-horizontal提供统一样式支持,确保HTML中使用任一类名都能正常工作。
.action-buttons,
.action-buttons-horizontal {
// 样式定义
}
布局: Flex横向布局
.action-buttons,
.action-buttons-horizontal {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
padding: 24px 16px;
margin-top: 24px;
background: linear-gradient(to bottom, #ffffff, #f8f9fa);
border-radius: 12px;
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
.btn {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 14px 28px;
border-radius: 10px;
font-size: 15px;
font-weight: 600;
min-height: 50px;
flex: 1;
max-width: 200px;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
.icon {
width: 20px;
height: 20px;
transition: transform 0.3s ease;
}
// 按钮涟漪效果
&::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.3);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
&:active::before {
width: 300px;
height: 300px;
}
}
}
主按钮样式(.btn-primary):
&.btn-primary {
background: linear-gradient(135deg, var(--primary-color) 0%, #2f6ce5 100%);
color: white;
box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.25);
&:hover:not(:disabled) {
background: linear-gradient(135deg, #2f6ce5 0%, #1e5fd9 100%);
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
.icon {
transform: scale(1.1);
}
}
&:active:not(:disabled) {
transform: translateY(-1px);
}
}
边框按钮样式(.btn-outline):
&.btn-outline {
background: white;
color: var(--primary-color);
border: 2px solid var(--primary-color);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
&:hover:not(:disabled) {
background: var(--primary-color);
color: white;
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
.icon {
transform: scale(1.1);
}
}
&:active:not(:disabled) {
transform: translateY(-1px);
}
}
@media (max-width: 768px) and (min-width: 481px) {
.action-buttons,
.action-buttons-horizontal {
gap: 12px;
padding: 20px 14px;
.btn {
padding: 13px 20px;
font-size: 14px;
min-height: 50px;
.icon {
width: 18px;
height: 18px;
}
}
}
}
@media (max-width: 480px) {
.action-buttons,
.action-buttons-horizontal {
// 移动端保持横排显示
flex-direction: row;
gap: 8px;
padding: 16px 12px;
margin-top: 16px;
overflow-x: auto; // 如果屏幕太小,允许横向滚动
.btn {
max-width: none;
flex: 1;
min-width: 90px; // 设置最小宽度,保证按钮不会太窄
padding: 12px 16px;
font-size: 13px;
min-height: 48px;
white-space: nowrap; // 防止文字换行
.icon {
width: 16px;
height: 16px;
}
}
}
}
✅ 渐变背景: 主按钮使用渐变色,视觉层次丰富 ✅ 涟漪效果: 点击时的涟漪动画,提升交互体验 ✅ 阴影效果: 多层次阴影,增强立体感 ✅ 悬停动画: 平滑的上移效果和图标缩放 ✅ 容器背景: 淡雅的渐变背景和圆角设计
┌──────────────────────────────────────────┐
│ ┌────────────────┐ ┌────────────────┐ │
│ │ 保存草稿 │ │ 确认订单 │ │
│ └────────────────┘ └────────────────┘ │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ ┌──────────────┐ ┌──────────────┐ │
│ │ 保存草稿 │ │ 确认订单 │ │
│ └──────────────┘ └──────────────┘ │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ ┌────────────┐ ┌────────────┐ │
│ │ 保存草稿 │ │ 确认订单 │ │
│ └────────────┘ └────────────┘ │
└──────────────────────────────────────────┘
linear-gradient() 实现渐变背景transition 实现平滑动画transform 实现位移和缩放::before 实现涟漪效果var(--primary-color) 使用主题色| 屏幕尺寸 | 容器间距 | 按钮高度 | 字体大小 | 图标大小 | 按钮间距 |
|---|---|---|---|---|---|
| 桌面端 | 24px 16px | 50px | 15px | 20px | 16px |
| 平板端 | 20px 14px | 50px | 14px | 18px | 12px |
| 移动端 | 16px 12px | 48px | 13px | 16px | 8px |
<div class="action-buttons">
<button class="btn btn-outline" (click)="saveDraft()" [disabled]="saving">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="..."/>
</svg>
保存草稿
</button>
<button class="btn btn-primary" (click)="submitForOrder()" [disabled]="saving">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="..."/>
</svg>
确认订单
</button>
</div>
✅ 按钮样式已恢复到精美的原始设计 ✅ 所有屏幕尺寸完美适配 ✅ 交互动画流畅自然 ✅ 视觉效果精美大方 ✅ 代码结构清晰规范
完成时间: 2025-11-02
测试状态: ✅ 待测试
文档状态: ✅ 已完成