upload project

This commit is contained in:
unknown 2025-12-27 17:16:03 +08:00
commit 06961cae04
422 changed files with 110626 additions and 0 deletions

503
styles/components.wxss Normal file
View file

@ -0,0 +1,503 @@
/* 通用组件样式库 - 现代化UI组件 */
/* ===== 按钮组件 ===== */
.btn {
display: flex;
align-items: center;
justify-content: center;
min-height: 88rpx;
padding: 0 32rpx;
border-radius: 12rpx;
font-size: 28rpx;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border: none;
cursor: pointer;
position: relative;
overflow: hidden;
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.1);
opacity: 0;
transition: opacity 0.3s ease;
}
.btn:active::before {
opacity: 1;
}
.btn-primary {
background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
color: white;
box-shadow: 0 4rpx 16rpx rgba(76, 175, 80, 0.3);
}
.btn-primary:active {
transform: translateY(2rpx);
box-shadow: 0 2rpx 8rpx rgba(76, 175, 80, 0.3);
}
.btn-secondary {
background: var(--bg-primary);
color: var(--text-primary);
border: 2rpx solid var(--border-medium);
}
.btn-secondary:active {
background: var(--bg-secondary);
border-color: var(--border-dark);
}
.btn-ghost {
background: transparent;
color: var(--primary-500);
border: 2rpx solid var(--primary-500);
}
.btn-ghost:active {
background: rgba(76, 175, 80, 0.1);
}
.btn-text {
background: transparent;
color: var(--primary-500);
min-height: 64rpx;
padding: 0 16rpx;
}
.btn-text:active {
background: rgba(76, 175, 80, 0.1);
}
.btn-sm {
min-height: 64rpx;
padding: 0 24rpx;
font-size: 24rpx;
border-radius: 8rpx;
}
.btn-lg {
min-height: 96rpx;
padding: 0 48rpx;
font-size: 32rpx;
border-radius: 16rpx;
}
.btn-disabled {
opacity: 0.5;
pointer-events: none;
}
/* ===== 卡片组件 ===== */
.card {
background: var(--bg-primary);
border-radius: 16rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
overflow: hidden;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:active {
transform: scale(0.98);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
}
.card-header {
padding: 24rpx;
border-bottom: 1rpx solid var(--border-light);
}
.card-body {
padding: 24rpx;
}
.card-footer {
padding: 24rpx;
border-top: 1rpx solid var(--border-light);
background: var(--bg-secondary);
}
.card-elevated {
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
}
.card-flat {
box-shadow: none;
border: 1rpx solid var(--border-light);
}
/* ===== 输入框组件 ===== */
.input-group {
margin-bottom: 24rpx;
}
.input-label {
display: block;
font-size: 24rpx;
font-weight: 500;
color: var(--text-secondary);
margin-bottom: 8rpx;
}
.input {
width: 100%;
height: 88rpx;
padding: 0 24rpx;
background: var(--bg-primary);
border: 2rpx solid var(--border-medium);
border-radius: 12rpx;
font-size: 28rpx;
color: var(--text-primary);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-sizing: border-box;
}
.input:focus {
border-color: var(--primary-500);
box-shadow: 0 0 0 6rpx rgba(76, 175, 80, 0.1);
}
.input::placeholder {
color: var(--text-tertiary);
}
.input-error {
border-color: var(--error);
}
.input-error:focus {
border-color: var(--error);
box-shadow: 0 0 0 6rpx rgba(244, 67, 54, 0.1);
}
.input-success {
border-color: var(--success);
}
.input-textarea {
height: 160rpx;
padding: 24rpx;
resize: none;
}
/* ===== 头像组件 ===== */
.avatar {
display: flex;
align-items: center;
justify-content: center;
background: var(--primary-100);
color: var(--primary-600);
font-weight: 600;
overflow: hidden;
position: relative;
}
.avatar-xs {
width: 48rpx;
height: 48rpx;
border-radius: 12rpx;
font-size: 20rpx;
}
.avatar-sm {
width: 64rpx;
height: 64rpx;
border-radius: 16rpx;
font-size: 24rpx;
}
.avatar-md {
width: 80rpx;
height: 80rpx;
border-radius: 20rpx;
font-size: 28rpx;
}
.avatar-lg {
width: 120rpx;
height: 120rpx;
border-radius: 30rpx;
font-size: 36rpx;
}
.avatar-xl {
width: 160rpx;
height: 160rpx;
border-radius: 40rpx;
font-size: 48rpx;
}
.avatar-round {
border-radius: 50%;
}
.avatar-image {
width: 100%;
height: 100%;
object-fit: cover;
}
.avatar-online::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 24rpx;
height: 24rpx;
background: var(--success);
border: 4rpx solid var(--bg-primary);
border-radius: 50%;
}
/* ===== 徽章组件 ===== */
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 32rpx;
height: 32rpx;
padding: 0 8rpx;
background: var(--error);
color: white;
font-size: 20rpx;
font-weight: 600;
border-radius: 16rpx;
line-height: 1;
}
.badge-sm {
min-width: 24rpx;
height: 24rpx;
padding: 0 6rpx;
font-size: 18rpx;
border-radius: 12rpx;
}
.badge-lg {
min-width: 40rpx;
height: 40rpx;
padding: 0 12rpx;
font-size: 22rpx;
border-radius: 20rpx;
}
.badge-dot {
width: 16rpx;
height: 16rpx;
min-width: 16rpx;
padding: 0;
border-radius: 50%;
}
.badge-primary {
background: var(--primary-500);
}
.badge-success {
background: var(--success);
}
.badge-warning {
background: var(--warning);
}
.badge-info {
background: var(--info);
}
/* ===== 分割线组件 ===== */
.divider {
height: 1rpx;
background: var(--border-light);
margin: 24rpx 0;
}
.divider-thick {
height: 16rpx;
background: var(--bg-secondary);
margin: 0;
}
.divider-text {
display: flex;
align-items: center;
margin: 24rpx 0;
color: var(--text-tertiary);
font-size: 24rpx;
}
.divider-text::before,
.divider-text::after {
content: '';
flex: 1;
height: 1rpx;
background: var(--border-light);
}
.divider-text::before {
margin-right: 16rpx;
}
.divider-text::after {
margin-left: 16rpx;
}
/* ===== 加载组件 ===== */
.loading {
display: flex;
align-items: center;
justify-content: center;
padding: 48rpx;
}
.loading-spinner {
width: 48rpx;
height: 48rpx;
border: 4rpx solid var(--border-light);
border-top: 4rpx solid var(--primary-500);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-text {
margin-left: 16rpx;
color: var(--text-secondary);
font-size: 24rpx;
}
/* ===== 空状态组件 ===== */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 96rpx 48rpx;
text-align: center;
}
.empty-icon {
width: 120rpx;
height: 120rpx;
margin-bottom: 24rpx;
opacity: 0.5;
}
.empty-title {
font-size: 32rpx;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 8rpx;
}
.empty-description {
font-size: 24rpx;
color: var(--text-secondary);
line-height: 1.5;
margin-bottom: 32rpx;
}
/* ===== 列表项组件 ===== */
.list-item {
display: flex;
align-items: center;
padding: 24rpx;
background: var(--bg-primary);
transition: background-color 0.3s ease;
min-height: 88rpx;
box-sizing: border-box;
}
.list-item:active {
background: var(--bg-secondary);
}
.list-item-avatar {
margin-right: 24rpx;
}
.list-item-content {
flex: 1;
min-width: 0;
}
.list-item-title {
font-size: 28rpx;
font-weight: 500;
color: var(--text-primary);
margin-bottom: 4rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.list-item-subtitle {
font-size: 24rpx;
color: var(--text-secondary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.list-item-action {
margin-left: 16rpx;
flex-shrink: 0;
}
.list-item-border {
border-bottom: 1rpx solid var(--border-light);
}
/* ===== 标签组件 ===== */
.tag {
display: inline-flex;
align-items: center;
padding: 8rpx 16rpx;
background: var(--bg-secondary);
color: var(--text-secondary);
font-size: 22rpx;
font-weight: 500;
border-radius: 8rpx;
border: 1rpx solid var(--border-light);
}
.tag-primary {
background: rgba(76, 175, 80, 0.1);
color: var(--primary-600);
border-color: rgba(76, 175, 80, 0.2);
}
.tag-success {
background: rgba(76, 175, 80, 0.1);
color: var(--success);
border-color: rgba(76, 175, 80, 0.2);
}
.tag-warning {
background: rgba(255, 152, 0, 0.1);
color: var(--warning);
border-color: rgba(255, 152, 0, 0.2);
}
.tag-error {
background: rgba(244, 67, 54, 0.1);
color: var(--error);
border-color: rgba(244, 67, 54, 0.2);
}
.tag-sm {
padding: 4rpx 12rpx;
font-size: 20rpx;
border-radius: 6rpx;
}

251
styles/design-system.wxss Normal file
View file

@ -0,0 +1,251 @@
/* 全局设计系统 - 基于Material Design 3和现代移动端最佳实践 */
/* ===== 颜色系统 ===== */
:root {
/* 主色调 - 基于微信绿色调优化 */
--primary-50: #e8f5e8;
--primary-100: #c8e6c9;
--primary-200: #a5d6a7;
--primary-300: #81c784;
--primary-400: #66bb6a;
--primary-500: #4caf50;
--primary-600: #43a047;
--primary-700: #388e3c;
--primary-800: #2e7d32;
--primary-900: #1b5e20;
/* 中性色 - 现代化灰色系统 */
--neutral-0: #ffffff;
--neutral-50: #fafafa;
--neutral-100: #f5f5f5;
--neutral-200: #eeeeee;
--neutral-300: #e0e0e0;
--neutral-400: #bdbdbd;
--neutral-500: #9e9e9e;
--neutral-600: #757575;
--neutral-700: #616161;
--neutral-800: #424242;
--neutral-900: #212121;
/* 语义化颜色 */
--success: #4caf50;
--warning: #ff9800;
--error: #f44336;
--info: #2196f3;
/* 背景色 */
--bg-primary: #ffffff;
--bg-secondary: #fafafa;
--bg-tertiary: #f5f5f5;
--bg-overlay: rgba(0, 0, 0, 0.5);
/* 文字颜色 */
--text-primary: #212121;
--text-secondary: #757575;
--text-tertiary: #bdbdbd;
--text-inverse: #ffffff;
/* 边框颜色 */
--border-light: #f0f0f0;
--border-medium: #e0e0e0;
--border-dark: #d0d0d0;
}
/* ===== 字体系统 ===== */
.text-display {
font-size: 48rpx;
font-weight: 700;
line-height: 1.2;
}
.text-headline {
font-size: 40rpx;
font-weight: 600;
line-height: 1.3;
}
.text-title {
font-size: 36rpx;
font-weight: 600;
line-height: 1.4;
}
.text-subtitle {
font-size: 32rpx;
font-weight: 500;
line-height: 1.4;
}
.text-body {
font-size: 28rpx;
font-weight: 400;
line-height: 1.5;
}
.text-caption {
font-size: 24rpx;
font-weight: 400;
line-height: 1.4;
}
.text-label {
font-size: 22rpx;
font-weight: 500;
line-height: 1.3;
letter-spacing: 0.5rpx;
}
/* ===== 间距系统 ===== */
.p-xs { padding: 8rpx; }
.p-sm { padding: 16rpx; }
.p-md { padding: 24rpx; }
.p-lg { padding: 32rpx; }
.p-xl { padding: 48rpx; }
.px-xs { padding-left: 8rpx; padding-right: 8rpx; }
.px-sm { padding-left: 16rpx; padding-right: 16rpx; }
.px-md { padding-left: 24rpx; padding-right: 24rpx; }
.px-lg { padding-left: 32rpx; padding-right: 32rpx; }
.px-xl { padding-left: 48rpx; padding-right: 48rpx; }
.py-xs { padding-top: 8rpx; padding-bottom: 8rpx; }
.py-sm { padding-top: 16rpx; padding-bottom: 16rpx; }
.py-md { padding-top: 24rpx; padding-bottom: 24rpx; }
.py-lg { padding-top: 32rpx; padding-bottom: 32rpx; }
.py-xl { padding-top: 48rpx; padding-bottom: 48rpx; }
.m-xs { margin: 8rpx; }
.m-sm { margin: 16rpx; }
.m-md { margin: 24rpx; }
.m-lg { margin: 32rpx; }
.m-xl { margin: 48rpx; }
.mx-xs { margin-left: 8rpx; margin-right: 8rpx; }
.mx-sm { margin-left: 16rpx; margin-right: 16rpx; }
.mx-md { margin-left: 24rpx; margin-right: 24rpx; }
.mx-lg { margin-left: 32rpx; margin-right: 32rpx; }
.mx-xl { margin-left: 48rpx; margin-right: 48rpx; }
.my-xs { margin-top: 8rpx; margin-bottom: 8rpx; }
.my-sm { margin-top: 16rpx; margin-bottom: 16rpx; }
.my-md { margin-top: 24rpx; margin-bottom: 24rpx; }
.my-lg { margin-top: 32rpx; margin-bottom: 32rpx; }
.my-xl { margin-top: 48rpx; margin-bottom: 48rpx; }
/* ===== 圆角系统 ===== */
.rounded-none { border-radius: 0; }
.rounded-xs { border-radius: 4rpx; }
.rounded-sm { border-radius: 8rpx; }
.rounded-md { border-radius: 12rpx; }
.rounded-lg { border-radius: 16rpx; }
.rounded-xl { border-radius: 24rpx; }
.rounded-full { border-radius: 50%; }
/* ===== 阴影系统 ===== */
.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06); }
.shadow-md { box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08); }
.shadow-lg { box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12); }
.shadow-xl { box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.16); }
/* ===== 布局系统 ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-none { flex: none; }
/* ===== 定位系统 ===== */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
/* ===== 宽高系统 ===== */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-screen { width: 100vw; }
.h-screen { height: 100vh; }
/* ===== 透明度系统 ===== */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }
/* ===== 过渡动画系统 ===== */
.transition-all { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-opacity { transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-transform { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
/* ===== 变换系统 ===== */
.scale-95 { transform: scale(0.95); }
.scale-100 { transform: scale(1); }
.scale-105 { transform: scale(1.05); }
.translate-y-full { transform: translateY(100%); }
.translate-y-0 { transform: translateY(0); }
/* ===== 安全区域适配 ===== */
.safe-area-top {
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
}
.safe-area-bottom {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.safe-area-left {
padding-left: constant(safe-area-inset-left);
padding-left: env(safe-area-inset-left);
}
.safe-area-right {
padding-right: constant(safe-area-inset-right);
padding-right: env(safe-area-inset-right);
}
/* ===== 触摸友好 ===== */
.touch-target {
min-height: 88rpx; /* 44px */
min-width: 88rpx;
}
/* ===== 文字颜色工具类 ===== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }
/* ===== 背景颜色工具类 ===== */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-error { background-color: var(--error); }
.bg-info { background-color: var(--info); }
/* ===== 边框工具类 ===== */
.border { border: 1rpx solid var(--border-medium); }
.border-light { border: 1rpx solid var(--border-light); }
.border-dark { border: 1rpx solid var(--border-dark); }
.border-t { border-top: 1rpx solid var(--border-medium); }
.border-b { border-bottom: 1rpx solid var(--border-medium); }
.border-l { border-left: 1rpx solid var(--border-medium); }
.border-r { border-right: 1rpx solid var(--border-medium); }

403
styles/responsive.wxss Normal file
View file

@ -0,0 +1,403 @@
/* 响应式布局系统 - 基于全球最佳实践 */
/* ===== 断点系统 ===== */
/* 基于主流设备尺寸定义断点 */
/* 小屏手机: 320-480px (iPhone SE, 小屏Android) */
@media (max-width: 480px) {
.container {
padding: 16rpx;
}
.text-responsive {
font-size: 26rpx;
}
.btn-responsive {
min-height: 80rpx;
font-size: 26rpx;
}
.card-responsive {
margin: 8rpx;
padding: 16rpx;
}
.avatar-responsive {
width: 64rpx;
height: 64rpx;
}
}
/* 中屏手机: 481-600px (iPhone 6/7/8, 中等Android) */
@media (min-width: 481px) and (max-width: 600px) {
.container {
padding: 24rpx;
}
.text-responsive {
font-size: 28rpx;
}
.btn-responsive {
min-height: 88rpx;
font-size: 28rpx;
}
.card-responsive {
margin: 12rpx;
padding: 20rpx;
}
.avatar-responsive {
width: 72rpx;
height: 72rpx;
}
}
/* 大屏手机: 601-768px (iPhone Plus/Pro, 大屏Android) */
@media (min-width: 601px) and (max-width: 768px) {
.container {
padding: 32rpx;
}
.text-responsive {
font-size: 30rpx;
}
.btn-responsive {
min-height: 96rpx;
font-size: 30rpx;
}
.card-responsive {
margin: 16rpx;
padding: 24rpx;
}
.avatar-responsive {
width: 80rpx;
height: 80rpx;
}
}
/* 平板设备: 769px+ (iPad, 大屏平板) */
@media (min-width: 769px) {
.container {
padding: 48rpx;
max-width: 1200rpx;
margin: 0 auto;
}
.text-responsive {
font-size: 32rpx;
}
.btn-responsive {
min-height: 104rpx;
font-size: 32rpx;
}
.card-responsive {
margin: 20rpx;
padding: 32rpx;
}
.avatar-responsive {
width: 96rpx;
height: 96rpx;
}
/* 平板专用布局 */
.tablet-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300rpx, 1fr));
gap: 24rpx;
}
.tablet-sidebar {
width: 300rpx;
position: fixed;
left: 0;
top: 0;
bottom: 0;
background: var(--bg-primary);
border-right: 1rpx solid var(--border-light);
}
.tablet-main {
margin-left: 300rpx;
padding: 24rpx;
}
}
/* ===== 屏幕密度适配 ===== */
/* 基于设备像素比优化显示效果 */
/* 低密度屏幕 (dpr <= 1.5) */
@media (-webkit-max-device-pixel-ratio: 1.5) {
.border-thin {
border-width: 1rpx;
}
.shadow-responsive {
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
/* 中密度屏幕 (1.5 < dpr <= 2.5) */
@media (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 2.5) {
.border-thin {
border-width: 1rpx;
}
.shadow-responsive {
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.12);
}
}
/* 高密度屏幕 (dpr > 2.5) */
@media (-webkit-min-device-pixel-ratio: 2.5) {
.border-thin {
border-width: 2rpx;
}
.shadow-responsive {
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.15);
}
}
/* ===== 方向适配 ===== */
/* 横屏和竖屏的不同布局 */
/* 竖屏模式 */
@media (orientation: portrait) {
.orientation-adaptive {
flex-direction: column;
}
.portrait-only {
display: block;
}
.landscape-only {
display: none;
}
.portrait-stack {
flex-direction: column;
}
.portrait-full-width {
width: 100%;
}
}
/* 横屏模式 */
@media (orientation: landscape) {
.orientation-adaptive {
flex-direction: row;
}
.portrait-only {
display: none;
}
.landscape-only {
display: block;
}
.landscape-split {
flex-direction: row;
}
.landscape-half-width {
width: 50%;
}
/* 横屏时减少垂直间距 */
.landscape-compact {
padding-top: 16rpx;
padding-bottom: 16rpx;
}
}
/* ===== 触摸友好设计 ===== */
/* 基于人体工程学的触摸区域设计 */
/* 最小触摸目标 (44px = 88rpx) */
.touch-target-min {
min-width: 88rpx;
min-height: 88rpx;
}
/* 推荐触摸目标 (48px = 96rpx) */
.touch-target-recommended {
min-width: 96rpx;
min-height: 96rpx;
}
/* 大触摸目标 (56px = 112rpx) */
.touch-target-large {
min-width: 112rpx;
min-height: 112rpx;
}
/* 触摸间距 (8px = 16rpx) */
.touch-spacing {
margin: 16rpx;
}
/* ===== 可访问性增强 ===== */
/* 提升用户体验的可访问性设计 */
/* 高对比度模式 */
@media (prefers-contrast: high) {
.accessible-text {
color: #000000;
background: #ffffff;
}
.accessible-border {
border: 2rpx solid #000000;
}
}
/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
.motion-safe {
animation: none;
transition: none;
}
}
/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
.dark-adaptive {
background: #1a1a1a;
color: #ffffff;
}
.dark-card {
background: #2a2a2a;
border-color: #404040;
}
.dark-border {
border-color: #404040;
}
}
/* ===== 网格系统 ===== */
/* 灵活的响应式网格布局 */
.grid {
display: grid;
gap: 24rpx;
}
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
/* 响应式网格 */
.grid-responsive {
display: grid;
gap: 24rpx;
grid-template-columns: repeat(auto-fit, minmax(280rpx, 1fr));
}
/* 网格项目 */
.grid-item {
min-width: 0; /* 防止内容溢出 */
}
.grid-span-2 { grid-column: span 2; }
.grid-span-3 { grid-column: span 3; }
.grid-span-4 { grid-column: span 4; }
/* ===== 弹性布局增强 ===== */
/* 现代化的Flexbox布局工具 */
.flex-responsive {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.flex-item {
flex: 1 1 auto;
min-width: 0;
}
.flex-item-grow {
flex-grow: 1;
}
.flex-item-shrink {
flex-shrink: 1;
}
.flex-item-no-shrink {
flex-shrink: 0;
}
/* ===== 容器查询模拟 ===== */
/* 基于容器大小的样式调整 */
.container-sm {
max-width: 640rpx;
}
.container-md {
max-width: 768rpx;
}
.container-lg {
max-width: 1024rpx;
}
.container-xl {
max-width: 1280rpx;
}
.container-responsive {
width: 100%;
margin: 0 auto;
padding: 0 24rpx;
}
/* ===== 文字响应式 ===== */
/* 基于屏幕大小的文字缩放 */
.text-scale-sm {
font-size: clamp(20rpx, 2.5vw, 24rpx);
}
.text-scale-md {
font-size: clamp(24rpx, 3vw, 28rpx);
}
.text-scale-lg {
font-size: clamp(28rpx, 3.5vw, 32rpx);
}
.text-scale-xl {
font-size: clamp(32rpx, 4vw, 40rpx);
}
/* ===== 间距响应式 ===== */
/* 基于屏幕大小的间距调整 */
.spacing-responsive {
padding: clamp(16rpx, 3vw, 32rpx);
}
.margin-responsive {
margin: clamp(8rpx, 2vw, 24rpx);
}
.gap-responsive {
gap: clamp(12rpx, 2.5vw, 24rpx);
}

222
styles/screen-adaption.wxss Normal file
View file

@ -0,0 +1,222 @@
/* 小程序屏幕适配通用样式 - 解决滚动条问题 */
/* 基于最新的微信小程序最佳实践 */
/* 全局页面样式 - 禁用滚动 */
page {
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 通用页面容器 - 全屏高度适配 */
.page-container {
height: 100vh;
min-height: 100vh;
max-height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
box-sizing: border-box;
position: relative;
}
/* 适配安全区域 */
.safe-area-container {
height: 100vh;
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 内容区域 - 可滚动 */
.scrollable-content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
box-sizing: border-box;
}
/* 固定头部 */
.fixed-header {
position: sticky;
top: 0;
z-index: 1000;
flex-shrink: 0;
}
/* 固定底部 */
.fixed-footer {
position: sticky;
bottom: 0;
z-index: 1000;
flex-shrink: 0;
}
/* 适配不同屏幕尺寸的媒体查询 */
/* iPhone SE (375x667) */
@media screen and (max-width: 375px) {
.page-container {
font-size: 28rpx;
}
}
/* iPhone 12/13/14 (390x844) */
@media screen and (max-width: 390px) and (min-height: 844px) {
.page-container {
height: 100vh;
}
}
/* iPhone 12/13/14 Pro Max (428x926) */
@media screen and (max-width: 428px) and (min-height: 926px) {
.page-container {
height: 100vh;
}
}
/* iPad适配 */
@media screen and (min-width: 768px) {
.page-container {
max-width: 750rpx;
margin: 0 auto;
}
}
/* 禁用选择和长按 */
.no-select {
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
/* 防止点击穿透 */
.prevent-touch {
pointer-events: none;
}
.allow-touch {
pointer-events: auto;
}
/* 通用动画 */
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
.slide-up {
animation: slideUp 0.3s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideUp {
from {
transform: translateY(20rpx);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
/* 响应式字体大小 */
.responsive-text {
font-size: clamp(24rpx, 2.5vw, 32rpx);
}
.responsive-title {
font-size: clamp(32rpx, 4vw, 48rpx);
}
.responsive-subtitle {
font-size: clamp(26rpx, 3vw, 36rpx);
}
/* 通用间距 */
.spacing-xs { margin: 8rpx; }
.spacing-sm { margin: 16rpx; }
.spacing-md { margin: 24rpx; }
.spacing-lg { margin: 32rpx; }
.spacing-xl { margin: 48rpx; }
.padding-xs { padding: 8rpx; }
.padding-sm { padding: 16rpx; }
.padding-md { padding: 24rpx; }
.padding-lg { padding: 32rpx; }
.padding-xl { padding: 48rpx; }
/* Flexbox布局助手 */
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-column {
display: flex;
flex-direction: column;
}
.flex-row {
display: flex;
flex-direction: row;
}
.flex-1 {
flex: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
/* 通用圆角 */
.rounded-sm { border-radius: 8rpx; }
.rounded-md { border-radius: 16rpx; }
.rounded-lg { border-radius: 24rpx; }
.rounded-xl { border-radius: 32rpx; }
.rounded-full { border-radius: 50%; }
/* 通用阴影 */
.shadow-sm {
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.shadow-md {
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
}
.shadow-lg {
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
}
/* 调试模式 - 开发时使用 */
.debug-border {
border: 2rpx solid red !important;
}
.debug-bg {
background: rgba(255, 0, 0, 0.1) !important;
}