upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
403
styles/responsive.wxss
Normal file
403
styles/responsive.wxss
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue