Commit 5f2f3568 by liimin

refactor(home-frame): 优化轮播图组件响应式布局

- 为轮播图添加图片样式覆盖,确保全屏显示并保持比例
- 重构轮播图高度计算逻辑,支持多种分辨率自适应
- 添加横屏模式下的间距优化样式调整
- 更新CSS变量配置,针对不同设备方向和分辨率进行适配
- 为大屏平板和
1 parent f0278919
......@@ -236,6 +236,13 @@ function onSlideTapFromEvent(idx: any): void {
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}
.intro-swiper >>> image,
.intro-swiper >>> .u-image {
width: 100%;
height: 100%;
object-fit: cover;
}
.intro-swiper-overlay {
position: absolute;
left: 0;
......
......@@ -164,8 +164,23 @@ const resolvedIntroSwiperHeight = computed((): number => {
if (h != null) {
return h as number;
}
// 轮播图高度 = module-box 高度 - 标题栏高度(48px) - 头部高度(40px)
// 从 CSS 变量中获取 module-box-height
const isLandscape = !layoutService.isMode("portrait");
return isLandscape && layoutService.getResolutionBucket() == "1920" ? 320 : 220;
const resolution = layoutService.getResolutionBucket();
// 根据不同分辨率返回对应的高度
if (isLandscape) {
if (resolution == "1174x768") return 266; // 360 - 54 - 40
if (resolution == "1024x768") return 348; // 440 - 52 - 40
if (resolution == "816x393") return 116; // 200 - 44 - 40
return 352; // 默认横屏 440 - 48 - 40
} else {
if (resolution == "768x1174") return 556; // 650 - 54 - 40
if (resolution == "414x896") return 366; // 450 - 44 - 40
if (resolution == "393x816") return 318; // 400 - 42 - 40
return 332; // 默认竖屏 420 - 48 - 40
}
});
function onIntroSwiperChange(index: number): void {
......
......@@ -118,6 +118,27 @@
padding: var(--l-spacing-lg) 8px var(--l-spacing-2xl);
}
// 横屏模式下减小间距
.mode-landscape .right-content {
padding-top: var(--l-spacing-sm);
padding-bottom: var(--l-spacing-lg);
}
.mode-landscape .start {
margin-top: 0;
}
// 大屏平板横屏 (1174x768) 特殊优化
.layout-landscape-1174x768 .right-content {
padding-top: 4px;
padding-bottom: 8px;
}
.layout-landscape-1174x768 .start {
margin-top: 0;
height: 72px;
}
// ===== Start 按钮 =====
.start {
height: 80px;
......
......@@ -35,9 +35,10 @@ export default {
},
portrait: {
// 竖屏布局
'--module-box-height': 'auto',
'--tool-box-min-height': '400px',
// 竖屏布局 - 产品介绍占 60%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) - TabBar(60px) ≈ 屏幕高度 - 152px
'--module-box-height': '420px',
'--tool-box-min-height': '200px',
'--tool-box-margin-bottom': 'var(--l-spacing-lg)',
// Entrance 图标尺寸(竖屏)
'--entrance-icon-size': '52px',
......@@ -48,9 +49,10 @@ export default {
},
landscape: {
// 横屏布局
'--module-box-height': '320px',
'--tool-box-height': '280px',
// 横屏布局 - 产品介绍占 65%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) ≈ 屏幕高度 - 92px (TabBar在左侧,不影响高度)
'--module-box-height': '440px',
'--tool-box-height': '200px',
'--tool-box-min-height': 'auto',
'--tool-box-margin-bottom': '0',
// Entrance 图标尺寸(横屏)
......@@ -64,36 +66,67 @@ export default {
},
resolutions: {
// iPad 横屏优化 (1024x768)
// iPad 横屏优化 (1024x768) - 产品介绍占 65%
// 可用高度 = 768 - 44(状态栏) - 52(标题) ≈ 672px (TabBar在左侧,不影响高度)
'landscape-1024x768': {
'--module-box-height': '360px',
'--tool-box-height': '320px',
'--module-box-height': '440px',
'--tool-box-height': '200px',
'--common-title-height': '52px',
'--entrance-icon-size': '60px',
'--tabbar-height': '600px',
'--tabbar-icon-size': '32px',
},
// 小屏 Pad 横屏 (816x393)
// 大屏平板横屏 (1174x768) - 产品介绍占 65%
// 可用高度 = 768 - 44(状态栏) - 54(标题) ≈ 670px (TabBar在左侧,不影响高度)
'landscape-1174x768': {
'--module-box-height': '360px',
'--tool-box-height': '280px',
'--common-title-height': '54px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '640px',
'--tabbar-icon-size': '34px',
'--tabbar-width': '140px',
},
// 小屏 Pad 横屏 (816x393) - 产品介绍占 65%
// 可用高度 = 393 - 44(状态栏) - 44(标题) ≈ 305px (TabBar在左侧,不影响高度)
'landscape-816x393': {
'--module-box-height': '280px',
'--tool-box-height': '240px',
'--module-box-height': '200px',
'--tool-box-height': '90px',
'--common-title-height': '44px',
'--entrance-icon-size': '52px',
'--tabbar-height': '480px',
'--tabbar-icon-size': '26px',
},
// 大屏手机竖屏 (414x896)
// 大屏手机竖屏 (414x896) - 产品介绍占 60%
// 可用高度 = 896 - 44(状态栏) - 44(标题) - 60(TabBar) ≈ 748px
'portrait-414x896': {
'--tool-box-min-height': '180px',
'--module-box-height': '450px',
'--tool-box-min-height': '220px',
'--common-title-height': '44px',
},
// iPhone 14 Pro 竖屏 (393x816)
// iPhone 14 Pro 竖屏 (393x816) - 产品介绍占 60%
// 可用高度 = 816 - 44(状态栏) - 42(标题) - 60(TabBar) ≈ 670px
'portrait-393x816': {
'--tool-box-min-height': '160px',
'--module-box-height': '400px',
'--tool-box-min-height': '200px',
'--common-title-height': '42px',
},
// 大屏平板竖屏 (768x1174) - 产品介绍占 65%
// 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px
'portrait-768x1174': {
'--module-box-height': '550px',
'--tool-box-min-height': '380px',
'--common-title-height': '54px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '70px',
'--tabbar-icon-size': '34px',
},
}
}
......@@ -50,6 +50,7 @@ export function useScreenVars(pageVars: OptionalVars) {
pageOrient,
pageResolutions
)
console.log('screenVarsValue', screenVarsValue.value,fullResKey)
}
// 初始更新
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!