refactor: UI/UX 全面重构 — 设计系统统一
设计系统: - uni.scss 扩展:间距/圆角/字体/阴影/动画 token 体系 - 新建 styles/mixins.scss:20+ 公共 mixin 页面重构(12 个页面): - 首页/记账/统计/账单/个人中心/预算/分类管理 - 群组管理/通知中心/管理员/用户管理/编辑资料 所有硬编码替换为设计 token: - 颜色:#FFF8F0→$bg, #FFFFFF→$surface, #FF8C69→$primary 等 - 间距:40rpx→$space-xl, 24rpx→$space-md 等 - 字体:28rpx→$font-lg, 24rpx→$font-md 等 - 圆角:20rpx→$radius-lg, 40rpx→$radius-2xl 等 - 阴影:统一使用 $shadow-md/$shadow-sm 重复样式提取为 mixin: - page-base, sticky-header, nav-bar, card, modal-mask - tabs, tab, state-box, shimmer, flex-center 等
This commit is contained in:
238
client/src/styles/mixins.scss
Normal file
238
client/src/styles/mixins.scss
Normal file
@@ -0,0 +1,238 @@
|
||||
/* ===== 公共 Mixins ===== */
|
||||
|
||||
// 页面基础样式
|
||||
@mixin page-base {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
|
||||
// 粘性头部
|
||||
@mixin sticky-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
// 状态栏
|
||||
@mixin status-bar {
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
// 卡片
|
||||
@mixin card($radius: $radius-2xl) {
|
||||
background: $surface;
|
||||
border-radius: $radius;
|
||||
border: 2rpx solid $border;
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
|
||||
// 导航栏
|
||||
@mixin nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: $space-sm $space-xl $space-md;
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
@mixin nav-back {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&:active { opacity: 0.6; }
|
||||
}
|
||||
|
||||
// 页面标题
|
||||
@mixin page-title {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: $font-2xl;
|
||||
font-weight: 600;
|
||||
color: $text;
|
||||
padding: $space-sm 0 $space-md;
|
||||
}
|
||||
|
||||
// 状态空/错误/加载
|
||||
@mixin state-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: $space-sm;
|
||||
padding: 120rpx 0;
|
||||
}
|
||||
|
||||
@mixin state-text {
|
||||
font-size: $font-lg;
|
||||
color: $text-muted;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
@mixin tabs-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: $space-sm;
|
||||
}
|
||||
|
||||
@mixin tabs {
|
||||
display: inline-flex;
|
||||
background: $surface-warm;
|
||||
border-radius: $radius-lg;
|
||||
padding: $space-xs;
|
||||
}
|
||||
|
||||
@mixin tab {
|
||||
padding: $space-sm $space-xl;
|
||||
border-radius: $radius-lg;
|
||||
font-size: $font-lg;
|
||||
color: $text-sec;
|
||||
transition: all $transition-normal;
|
||||
|
||||
&.active {
|
||||
background: $surface;
|
||||
color: $primary;
|
||||
font-weight: 600;
|
||||
box-shadow: $shadow-sm;
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗
|
||||
@mixin modal-mask {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
@mixin bottom-modal {
|
||||
width: 100%;
|
||||
max-height: 80vh;
|
||||
background: $surface;
|
||||
border-radius: $radius-2xl $radius-2xl 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@mixin modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: $space-lg $space-xl $space-md;
|
||||
border-bottom: 2rpx solid $border;
|
||||
}
|
||||
|
||||
@mixin modal-title {
|
||||
font-size: $font-xl;
|
||||
font-weight: 600;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
@mixin modal-close {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: $border;
|
||||
&:active { background: darken($border, 5%); }
|
||||
}
|
||||
|
||||
// 列表项
|
||||
@mixin list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $space-md;
|
||||
padding: $space-lg $space-lg;
|
||||
background: $surface;
|
||||
border-radius: $radius-xl;
|
||||
border: 2rpx solid $border;
|
||||
box-shadow: $shadow-md;
|
||||
margin-bottom: $space-sm;
|
||||
}
|
||||
|
||||
// 输入框
|
||||
@mixin input {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
padding: 0 $space-md;
|
||||
background: $bg;
|
||||
border-radius: $radius-lg;
|
||||
border: 2rpx solid $border;
|
||||
font-size: $font-lg;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
// 按钮
|
||||
@mixin btn-primary {
|
||||
height: 80rpx;
|
||||
padding: 0 $space-lg;
|
||||
background: linear-gradient(135deg, $primary, $primary-dark);
|
||||
border-radius: $radius-lg;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&:active { opacity: 0.8; }
|
||||
}
|
||||
|
||||
@mixin btn-primary-text {
|
||||
font-size: $font-lg;
|
||||
font-weight: 600;
|
||||
color: $surface;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@mixin btn-ghost {
|
||||
padding: $space-sm $space-md;
|
||||
background: $surface-warm;
|
||||
border-radius: $radius-md;
|
||||
&:active { background: $border; }
|
||||
}
|
||||
|
||||
@mixin btn-ghost-text {
|
||||
font-size: $font-md;
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
// Shimmer 动画
|
||||
@mixin shimmer {
|
||||
background: linear-gradient(90deg, $border 25%, $surface-warm 50%, $border 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
// Flex 工具
|
||||
@mixin flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@mixin flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
// 文本溢出
|
||||
@mixin text-ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// 安全区域
|
||||
@mixin safe-bottom {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
Reference in New Issue
Block a user