Commit e5af7338 by liimin

refactor(home): 重构首页组件以支持动态分辨率适配

- 移除 iOS 调试配置和 uni-agent 权限配置文件
- 注释掉 WebSocket 自动连接功能
- 为入口组件添加滚动支持并使用百分比宽度实现响应式布局
- 在 LeftSide 组件中添加 key 属性和动态类名绑定
- 将分辨率相关的计算逻辑迁移到专门的样式配置文件
- 更新 HomeFrame 组件以使用新的动态样式系统
- 从 LayoutRoot 组件中更新分辨率状态引用
- 移除页面中的硬编码样式,统一使用动态配置管理
1 parent bac20d86
......@@ -2,14 +2,8 @@
"version" : "1.0",
"configurations" : [
{
"customPlaygroundType" : "local",
"playground" : "custom",
"type" : "uni-app:app-android"
},
{
"customPlaygroundType" : "device",
"playground" : "standard",
"type" : "uni-app:app-ios"
}
]
}
......@@ -19,7 +19,7 @@ export default {
updateResolutionConfig();
// 连接(自动登录)
// #ifdef APP
ws.connect();
// ws.connect();
// #endif
},
onShow () {
......
......@@ -95,10 +95,12 @@ function getIconUrl(icon: string): string {
display: flex;
flex-wrap: wrap;
flex-direction: row;
overflow-y: auto; // 允许垂直滚动
overflow-x: hidden;
}
.entrance-item {
width: 100px;
width: 30%; // 使用百分比宽度,保证三列布局
display: flex;
flex-direction: column;
align-items: center;
......@@ -119,7 +121,7 @@ function getIconUrl(icon: string): string {
}
.entrance-item-compact {
width: 92px;
width: 30%; // compact 模式也使用百分比
margin-bottom: 16px;
}
......
<template>
<!-- 横屏 / Pad:左侧竖向导航(头像 + 场景切换 + 设置) -->
<view v-if="!isPortraitMode"
class="left-side left-side-pad">
:key="adapterClassName"
class="left-side left-side-pad"
:class="[adapterClassName]">
<image class="left-side-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" />
......@@ -40,8 +42,9 @@
<!-- 竖屏手机:uView 底部 TabBar,图标沿用 static/images/tabbar -->
<view v-else
:key="adapterClassName"
class="left-side left-side-portrait"
:class="[isPadPortraitMode ? 'left-side-portrait-pad' : '']">
:class="[adapterClassName, isPadPortraitMode ? 'left-side-portrait-pad' : '']">
<un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar"
:fixed="false"
......@@ -60,12 +63,10 @@
<template #icon="{ active }">
<image v-if="active === true"
class="tabbar-icon-img"
:class="[isPadPortraitMode ? 'tabbar-icon-img-pad' : '']"
mode="aspectFit"
:src="getTabIconSrc(item.icon, true)" />
<image v-else
class="tabbar-icon-img"
:class="[isPadPortraitMode ? 'tabbar-icon-img-pad' : '']"
mode="aspectFit"
:src="getTabIconSrc(item.icon, false)" />
</template>
......@@ -79,12 +80,17 @@ import { computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { storage } from "@/utils/storage.uts";
import { cssClassRef } from "@/services/adapter";
import SettingBox from "@/pages/person/SettingBox.uvue";
// 导入样式变量
import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
const props = defineProps<{
isPortrait?: boolean
isPadPortrait?: boolean
adapterClass?: string
tabIndex?: number
userInfo?: null | UTSJSONObject
}>();
......@@ -99,16 +105,44 @@ const isPortraitMode = computed((): boolean => {
return props.isPortrait === true;
});
const adapterClassName = computed((): string => {
const cls = props.adapterClass as null | string;
return cls != null ? cls : "";
});
const isPadPortraitMode = computed((): boolean => {
return props.isPadPortrait === true;
const cls = adapterClassName.value;
return cls.indexOf("layout-portrait-768x1174") >= 0;
});
const tabbarHeight = computed((): string => {
return isPadPortraitMode.value ? "76" : "56";
// TabBar 高度 - 根据分辨率动态设置
const tabbarHeight = computed((): number => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
// 竖屏配置
const portraitConfig = getPortraitConfig(adapterCls);
if (portraitConfig != null) {
return portraitConfig.tabbarHeight as number;
}
// 默认值
return PORTRAIT_COMMON.tabbarHeight as number;
});
const tabbarIconSize = computed((): string => {
return isPadPortraitMode.value ? "30" : "24";
// TabBar 图标尺寸 - 根据分辨率动态设置
const tabbarIconSize = computed((): number => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
// 竖屏配置
const portraitConfig = getPortraitConfig(adapterCls);
if (portraitConfig != null) {
return portraitConfig.tabbarIconSize as number;
}
// 默认值
return PORTRAIT_COMMON.tabbarIconSize as number;
});
const currentTabIndex = computed((): number => {
......@@ -279,198 +313,5 @@ function jumpPersonCenter(): void {
</script>
<style scoped lang="scss">
.left-side {
display: flex;
flex-direction: column;
position: relative;
width: 120px; /* toRpx(240) / 2 */
flex-shrink: 0;
/* 背景图用下层 image 实现,此处仅作 fallback */
background-image: linear-gradient(to bottom, #e8f0fe, #e8ecf5);
}
.left-side-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.left-side .user-box,
.left-side .left-tabs,
.left-side .left-footer {
position: relative;
z-index: 1;
}
.left-side-pad {
}
.left-side-portrait {
width: 100%;
flex-shrink: 0;
flex-direction: column;
align-items: stretch;
padding: 0;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.portrait-un-tabbar {
width: 100%;
}
.tabbar-icon-img {
width: 24px;
height: 24px;
}
.tabbar-icon-img-pad {
width: 30px;
height: 30px;
}
.left-side-portrait-pad {
padding-bottom: 6px;
}
.portrait-top-row {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
.portrait-top-row .user-box {
padding-top: 0;
padding-right: var(--l-spacing-md);
flex-shrink: 0;
}
.portrait-action {
flex-shrink: 0;
}
.user-box {
padding-top: 46px; /* toRpx(92) / 2 */
}
/* App 端不支持 cursor,H5 可保留手型 */
/* #ifdef H5 */
.user-box-clickable {
cursor: pointer;
}
/* #endif */
.user-info-row {
flex-direction: row;
align-items: center;
}
.user-info-row .user-avatar {
margin-right: var(--l-spacing-sm);
}
.user-info-row .user-name-text {
margin-top: 0;
max-width: 80px;
}
.user-info {
width: 92px; /* toRpx(184) / 2 */
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
position: relative;
}
.user-avatar {
width: 50px; /* toRpx(100) / 2 */
height: 50px; /* toRpx(100) / 2 */
border: 1px solid #ffffff; /* toRpx(2) / 2 */
box-shadow: 0 2px 4px 0 #0000001a; /* toRpx(4,8) / 2 */
border-radius: 50%;
}
.user-name-text {
font-size: 14px; /* toRpx(28) / 2 */
color: #292d33;
margin-top: 8px; /* toRpx(16) / 2 */
max-width: 56px; /* toRpx(112) / 2 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
.left-tabs {
width: 100%;
height: 540px; /* toRpx(1080) / 2 */
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
// top: 50%;
left: 0;
// transform: translateY(-50%);
padding: 8px 0; /* toRpx(16) / 2 */
padding-left: 16px; /* toRpx(32) / 2 */
}
.tab-item {
width: 80px; /* toRpx(104) / 2 */
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 12.5px; /* toRpx(25) / 2 */
}
.icon-box {
width: 52px; /* toRpx(104) / 2 */
height: 52px; /* toRpx(104) / 2 */
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
border-radius: 26px; /* toRpx(52) / 2 */
}
.icon-placeholder {
width: 32px;
height: 32px;
background-color: #8a98b5;
border-radius: 8px;
}
.icon-active {
background-color: #3773f8;
}
.tab-label {
font-size: 13px; /* toRpx(26) / 2 */
color: #8a98b5;
margin-top: 6px; /* toRpx(12) / 2 */
text-align: center;
}
.tabActive .tab-label {
color: #3773f8;
}
.left-footer {
margin-top: auto;
padding-bottom: 40px; /* toRpx(80) / 2 */
}
.btn-placeholder {
width: 40px;
height: 40px;
background-color: #e8eaef;
border-radius: 20px;
margin: var(--l-spacing-sm) auto 0;
}
@import "./styles/common.scss";
</style>
// ========================================================================
// HomeFrame 公共样式 - 横竖屏通用
// ========================================================================
// ===== HomeFrame 容器基础样式 =====
.home-frame-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
position: relative;
background: linear-gradient(to bottom, #e8f0fe, #f5f7fa);
}
// ===== 内容区域布局 =====
.home-content {
position: relative;
flex: 1;
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
overflow: hidden;
}
.home-content-pad {
flex-direction: row;
}
.home-content-portrait {
flex-direction: column;
}
.detail-content {
flex: 1;
width: 100%;
height: 100%;
overflow: hidden;
}
.right-side {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.mode-portrait .right-side {
order: 1;
}
.mode-portrait .left-side-portrait {
order: 2;
}
// ===== 应用内容区 =====
.app-content-box {
margin-top: 40px;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.right-content {
padding: 0 var(--l-spacing-xl) 0 var(--l-spacing-md);
}
// ===== Start 按钮 =====
.start {
height: 96px;
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
overflow: hidden;
flex-shrink: 0;
min-width: 140px;
border-radius: 24px;
background-image: linear-gradient(to right bottom, #1677ff, #469cff);
box-shadow: 0 8px 24px rgba(22, 119, 255, 0.25);
transition-property: transform, box-shadow, opacity;
transition-duration: 0.15s;
transition-timing-function: ease-out;
}
.start-glow {
position: absolute;
left: 18px;
top: 18px;
right: 18px;
bottom: 18px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.16);
animation: startGlowPulse 1.8s ease-in-out infinite;
}
.start-shine {
position: absolute;
top: -30%;
bottom: -30%;
width: 42px;
left: -52px;
background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0));
transform: rotate(14deg);
animation: startShineSweep 2.6s ease-in-out infinite;
}
.start-hover {
transform: scale(0.92);
box-shadow: 0 2px 8px rgba(22, 119, 255, 0.1);
opacity: 0.8;
}
.start-inner {
position: relative;
z-index: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0;
background-color: transparent;
}
.start-icon-wrap {
width: 28px;
height: 28px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.92);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-right: 10px;
box-shadow: 0 3px 8px rgba(22, 119, 255, 0.22);
animation: startIconBreath 1.6s ease-in-out infinite;
}
.start-text {
font-size: 22px;
font-weight: bold;
color: #ffffff;
text-align: center;
letter-spacing: 2px;
}
@keyframes startGlowPulse {
0% {
opacity: 0.28;
}
50% {
opacity: 0.46;
}
100% {
opacity: 0.28;
}
}
@keyframes startShineSweep {
0% {
left: -56px;
opacity: 0;
}
20% {
opacity: 1;
}
70% {
left: calc(100% + 16px);
opacity: 1;
}
100% {
left: calc(100% + 24px);
opacity: 0;
}
}
@keyframes startIconBreath {
0% {
transform: scale(1);
}
50% {
transform: scale(1.07);
}
100% {
transform: scale(1);
}
}
// ===== 右侧内容盒子 =====
.right-content-box {
flex: 1;
display: flex;
flex-direction: row;
padding: var(--l-spacing-md) 0 var(--l-spacing-2xl);
overflow: hidden;
}
.box-class {
background: rgba(255, 255, 255, 0.6);
border-radius: var(--l-spacing-lg);
overflow: hidden;
display: flex;
flex-direction: column;
}
.content-left {
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
margin-right: var(--l-spacing-lg);
}
.content-right {
flex: 1;
min-width: 200px;
display: flex;
flex-direction: column;
}
// ===== 模块盒子(使用 CSS 变量作为默认值)=====
.module-box {
height: var(--l-module-box-height);
margin-bottom: var(--l-spacing-lg);
}
.tool-box {
flex: 1;
min-height: var(--l-tool-box-min-height);
}
// ===== 通用标题和内容 =====
.common-title {
height: var(--l-common-title-height);
display: flex;
flex-direction: row;
align-items: center;
padding-left: var(--l-spacing-lg);
}
.title-text {
font-size: 16px;
font-weight: 500;
color: #333;
}
.content-box {
flex: 1;
padding: 0 var(--l-spacing-lg) var(--l-spacing-lg);
overflow: hidden;
}
.swiper-placeholder {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.placeholder-text {
font-size: var(--l-font-sm);
color: #999;
}
.message-box {
flex: 1;
min-height: 0;
}
.legacy-home-wrap {
flex: 1;
width: 100%;
height: 100%;
overflow: hidden;
}
.reception-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
position: relative;
}
.reception-center-inner,
.reception-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
.my-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
}
.store-addr {
position: absolute;
left: 50%;
bottom: 24rpx;
transform: translateX(-50%);
display: flex;
flex-direction: row;
align-items: center;
}
.icon-addr {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
background-color: #4673ff;
border-radius: 4rpx;
}
.addr-text {
font-size: 24rpx;
color: #999999;
word-wrap: break-word;
white-space: normal;
line-height: 32rpx;
margin-left: 4rpx;
flex-shrink: 0;
}
.addr-line {
width: 600rpx;
height: 2rpx;
margin: 0 40rpx;
flex-shrink: 0;
}
.addr-line-left {
background: linear-gradient(to left, #eeeeee, rgba(216, 216, 216, 0));
}
.addr-line-right {
background: linear-gradient(to right, #eeeeee, rgba(216, 216, 216, 0));
}
// ===== LeftSide 横屏导航基础样式 =====
.left-side {
display: flex;
flex-direction: column;
position: relative;
width: 120px;
flex-shrink: 0;
background-image: linear-gradient(to bottom, #e8f0fe, #e8ecf5);
.left-side-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.user-box,
.left-tabs,
.left-footer {
position: relative;
z-index: 1;
}
}
.left-side-pad {
}
.left-side-portrait {
width: 100%;
flex-shrink: 0;
flex-direction: column;
align-items: stretch;
padding: 0;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.portrait-un-tabbar {
width: 100%;
}
.tabbar-icon-img {
width: 24px;
height: 24px;
}
.tabbar-icon-img-pad {
width: 30px;
height: 30px;
}
.left-side-portrait-pad {
padding-bottom: 6px;
}
.portrait-top-row {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
.user-box {
padding-top: 0;
padding-right: var(--l-spacing-md);
flex-shrink: 0;
}
}
.portrait-action {
flex-shrink: 0;
}
.user-box {
padding-top: 46px;
}
.user-box-clickable {
cursor: pointer;
}
.user-info-row {
flex-direction: row;
align-items: center;
.user-avatar {
margin-right: var(--l-spacing-sm);
}
.user-name-text {
margin-top: 0;
max-width: 80px;
}
}
.user-info {
width: 92px;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
position: relative;
}
.user-avatar {
width: 50px;
height: 50px;
border: 1px solid #ffffff;
box-shadow: 0 2px 4px 0 #0000001a;
border-radius: 50%;
}
.user-name-text {
font-size: 14px;
color: #292d33;
margin-top: 8px;
max-width: 56px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
// LeftSide 横屏导航基础样式
.left-tabs {
width: 100%;
height: 540px;
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
left: 0;
padding: 8px 0;
padding-left: 16px;
}
.tab-item {
width: 80px;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 12.5px;
}
.icon-box {
width: 52px;
height: 52px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
border-radius: 26px;
}
.icon-placeholder {
width: 32px;
height: 32px;
background-color: #8a98b5;
border-radius: 8px;
}
.icon-active {
background-color: #3773f8;
}
.tab-label {
font-size: 13px;
color: #8a98b5;
margin-top: 6px;
text-align: center;
}
.tabActive {
.tab-label {
color: #3773f8;
}
}
.left-footer {
margin-top: auto;
padding-bottom: 40px;
}
.btn-placeholder {
width: 40px;
height: 40px;
background-color: #e8eaef;
border-radius: 20px;
margin: var(--l-spacing-sm) auto 0;
}
// ========================================================================
// HomeFrame 公共样式变量 - UTS 定义
// ========================================================================
/**
* 模块盒子高度(默认值)
*/
export const MODULE_BOX_HEIGHT = 'var(--l-module-box-height)';
/**
* ToolBox 最小高度(默认值)
*/
export const TOOL_BOX_MIN_HEIGHT = 'var(--l-tool-box-min-height)';
/**
* Common Title 高度(默认值)
*/
export const COMMON_TITLE_HEIGHT = 'var(--l-common-title-height)';
/**
* Left Tabs 高度(默认)
*/
export const LEFT_TABS_HEIGHT = '540px';
/**
* Icon Box 尺寸(默认)
*/
export const ICON_BOX_SIZE = '52px';
export const ICON_BOX_RADIUS = '26px';
/**
* Tab Label 字体大小(默认)
*/
export const TAB_LABEL_FONTSIZE = '13px';
/**
* TabBar 高度(默认竖屏)
*/
export const TABBAR_HEIGHT_DEFAULT = 56;
/**
* TabBar 图标尺寸(默认竖屏)
*/
export const TABBAR_ICON_SIZE_DEFAULT = 24;
// ========================================================================
// HomeFrame 横屏样式变量 - UTS 定义(按分辨率)
// ========================================================================
/**
* 横屏配置类型
*/
export type LandscapeConfig = {
// index.uvue 布局
rightContentBoxPadding?: string
moduleBoxHeight: string
toolBoxHeight: string
toolBoxContentPaddingBottom?: string
// LeftSide 导航
leftTabsHeight: string
leftTabsPaddingLeft: string
iconBoxSize: string
iconBoxRadius: string
tabLabelFontSize: string
}
/**
* 1174x768 横屏配置
*/
export const LANDSCAPE_1174x768: LandscapeConfig = {
// index.uvue 布局
rightContentBoxPadding: '6px 0 10px',
moduleBoxHeight: '340px',
toolBoxHeight: '152px',
toolBoxContentPaddingBottom: '14px',
// LeftSide 导航
leftTabsHeight: '560px',
leftTabsPaddingLeft: '18px',
iconBoxSize: '56px',
iconBoxRadius: '28px',
tabLabelFontSize: '14px'
};
/**
* 1920x1080 横屏配置
*/
export const LANDSCAPE_1920x1080: LandscapeConfig = {
// index.uvue 布局
moduleBoxHeight: '320px',
toolBoxHeight: '480px',
// LeftSide 导航
leftTabsHeight: '620px',
leftTabsPaddingLeft: '22px',
iconBoxSize: '64px',
iconBoxRadius: '32px',
tabLabelFontSize: '16px'
};
/**
* 根据分辨率获取横屏配置
*/
export function getLandscapeConfig(resolutionKey: string): null | LandscapeConfig {
// UTS 中字符串比较可能有问题,使用 indexOf 替代
if (resolutionKey.indexOf('layout-landscape-1174x768') >= 0) {
return LANDSCAPE_1174x768;
}
if (resolutionKey.indexOf('layout-landscape-1920x1080') >= 0) {
return LANDSCAPE_1920x1080;
}
return null;
}
// ========================================================================
// HomeFrame 竖屏样式变量 - UTS 定义(按分辨率)
// ========================================================================
/**
* 竖屏配置类型
*/
export type PortraitConfig = {
// index.uvue 布局
rightContentBoxPadding?: string
moduleBoxHeight?: string
moduleBoxMinHeight?: string
moduleBoxMarginBottom?: string
toolBoxMinHeight?: string
toolBoxMarginBottom?: string
toolBoxHeight?: string
// LeftSide TabBar
leftSidePortraitPaddingBottom?: string
tabbarHeight: number
tabbarIconSize: number
}
/**
* 768x1174 竖屏配置(Pad 竖屏)
*/
export const PORTRAIT_768x1174: PortraitConfig = {
// index.uvue 布局
rightContentBoxPadding: '10px 0 0',
moduleBoxHeight: '55%',
moduleBoxMinHeight: '400px',
moduleBoxMarginBottom: '12px',
toolBoxMinHeight: '452px',
toolBoxHeight: '552px',
toolBoxMarginBottom: '60px',
// LeftSide TabBar
leftSidePortraitPaddingBottom: '8px',
tabbarHeight: 106,
tabbarIconSize: 60
};
/**
* 其他竖屏分辨率(默认)
*/
export const PORTRAIT_COMMON: PortraitConfig = {
// LeftSide TabBar
tabbarHeight: 56,
tabbarIconSize: 24
};
/**
* 根据分辨率获取竖屏配置
*/
export function getPortraitConfig(resolutionKey: string): null | PortraitConfig {
// UTS 中字符串比较可能有问题,使用 indexOf 替代
if (resolutionKey.indexOf('layout-portrait-768x1174') >= 0) {
return PORTRAIT_768x1174;
}
return null;
}
......@@ -7,7 +7,7 @@
<script setup lang="uts">
import { computed, onMounted, onUnmounted, type Ref } from 'vue'
import { useLayout } from '@/composables/useLayout'
import { resolutionState, updateResolutionConfig, useResolutionConfig } from '@/services/adapter/index.uts'
import { cssClassRef, updateResolutionConfig, useResolutionConfig } from '@/services/adapter'
import { layoutService } from '@/services/LayoutService.uts'
const layout = useLayout()
......@@ -50,8 +50,8 @@ function syncLayoutRootResolution(): void {
}
const adapterClass = computed((): string => {
const cls = resolutionState.cssClass
return cls != null ? cls : ''
const cls = cssClassRef.value
return cls != null ? (cls as string) : ''
})
const modeClass = computed((): string => {
......
......@@ -182,88 +182,20 @@
padding: 6px 0 var(--l-spacing-2xl);
}
.page-container :deep(.module-box) {
margin-bottom: 10px;
}
.page-container :deep(.module-box .common-title),
.page-container :deep(.tool-box .common-title) {
height: 44px;
padding-left: 14px;
}
.page-container :deep(.module-box .title-text),
.page-container :deep(.tool-box .title-text) {
font-size: 15px;
font-weight: 600;
color: #1e293b;
}
.page-container :deep(.module-box .content-box) {
padding: 0 2px 2px;
}
.page-container :deep(.tool-box) {
background: rgba(255, 255, 255, 0.9);
border: 1px solid #deebfb;
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
flex: 1.25;
min-height: 0;
}
.page-container :deep(.tool-box .common-title) {
border-bottom: 1px solid #e6eef9;
background: linear-gradient(135deg, rgba(243, 248, 255, 0.95) 0%, rgba(236, 244, 255, 0.95) 100%);
}
.page-container :deep(.tool-box .content-box) {
flex: 1;
min-height: 0;
padding: 6px 10px 8px;
overflow-y: auto;
overflow-x: hidden;
display: block;
}
.page-container :deep(.tool-box .content-box > *) {
width: 100%;
max-width: 100%;
margin-left: auto;
margin-right: auto;
}
.page-container :deep(.tool-box .content-box .entrance-list) {
justify-content: space-between;
align-content: flex-start;
width: 100%;
padding: 0;
box-sizing: border-box;
}
.page-container :deep(.tool-box .content-box .entrance-item) {
width: 31.5%;
margin-right: 0;
margin-left: 0;
margin-bottom: 14px;
}
.page-container :deep(.tool-box .content-box .entrance-box) {
height: auto;
}
.page-container :deep(.tool-box .content-box .entrance-item-compact) {
margin-bottom: 10px;
}
.page-container :deep(.tool-box .content-box .entrance-icon-compact) {
width: 40px;
height: 40px;
}
.page-container :deep(.tool-box .content-box .entrance-name-compact) {
font-size: 11px;
margin-top: 3px;
}
// 已移除 margin-bottom,由 HomeFrame 统一管理
// .page-container :deep(.module-box) {
// margin-bottom: 10px;
// }
// 已移除 common-title 高度,避免影响 HomeFrame 全局布局
// .page-container :deep(.module-box .common-title),
// .page-container :deep(.tool-box .common-title) {
// height: 44px;
// padding-left: 14px;
// }
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// 请查看:components/HomeFrame/styles/homeframe-*.scss
.detail-content {
width: 100%;
......
......@@ -67,38 +67,36 @@
padding-top: 10px;
}
:deep(.module-box .common-title),
:deep(.tool-box .common-title) {
height: 72px;
padding-left: 24px;
}
:deep(.module-box .title-text),
:deep(.tool-box .title-text) {
font-size: 24px;
}
:deep(.module-box) {
margin-bottom: 16px;
}
:deep(.tool-box .content-box) {
padding: 12px 16px 16px;
}
:deep(.tool-box .content-box .entrance-item) {
margin-bottom: 20px;
}
:deep(.tool-box .content-box .entrance-icon-compact) {
width: 64px;
height: 64px;
}
:deep(.tool-box .content-box .entrance-name-compact) {
font-size: 17px;
margin-top: 8px;
}
// 已移除 module-box/tool-box 高度相关样式,避免影响 HomeFrame 全局布局
// :deep(.module-box .common-title),
// :deep(.tool-box .common-title) {
// height: 72px;
// padding-left: 24px;
// }
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// :deep(.module-box .title-text),
// :deep(.tool-box .title-text) {
// font-size: 24px;
// }
//
// :deep(.tool-box .content-box) {
// padding: 12px 16px 16px;
// }
//
// :deep(.tool-box .content-box .entrance-item) {
// margin-bottom: 20px;
// }
//
// :deep(.tool-box .content-box .entrance-icon-compact) {
// width: 64px;
// height: 64px;
// }
//
// :deep(.tool-box .content-box .entrance-name-compact) {
// font-size: 17px;
// margin-top: 8px;
// }
}
:deep(.layout-landscape-1174x768) .equity-page {
......@@ -168,34 +166,36 @@
font-size: 14px;
}
:deep(.module-box .common-title),
:deep(.tool-box .common-title) {
height: 52px;
padding-left: 16px;
}
:deep(.module-box .title-text),
:deep(.tool-box .title-text) {
font-size: 17px;
}
:deep(.tool-box .content-box) {
padding: 8px 12px 10px;
}
:deep(.tool-box .content-box .entrance-item) {
margin-bottom: 12px;
}
:deep(.tool-box .content-box .entrance-icon-compact) {
width: 46px;
height: 46px;
}
:deep(.tool-box .content-box .entrance-name-compact) {
font-size: 12px;
margin-top: 4px;
}
// 已移除 module-box/tool-box 高度相关样式,避免影响 HomeFrame 全局布局
// :deep(.module-box .common-title),
// :deep(.tool-box .common-title) {
// height: 52px;
// padding-left: 16px;
// }
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// :deep(.module-box .title-text),
// :deep(.tool-box .title-text) {
// font-size: 17px;
// }
//
// :deep(.tool-box .content-box) {
// padding: 8px 12px 10px;
// }
//
// :deep(.tool-box .content-box .entrance-item) {
// margin-bottom: 12px;
// }
//
// :deep(.tool-box .content-box .entrance-icon-compact) {
// width: 46px;
// height: 46px;
// }
//
// :deep(.tool-box .content-box .entrance-name-compact) {
// font-size: 12px;
// margin-top: 4px;
// }
}
:deep(.layout-landscape-common) .equity-page {
......@@ -269,36 +269,34 @@
padding-top: 6px;
}
:deep(.module-box .common-title),
:deep(.tool-box .common-title) {
height: 48px;
padding-left: 15px;
}
:deep(.module-box .title-text),
:deep(.tool-box .title-text) {
font-size: 16px;
}
:deep(.module-box) {
margin-bottom: 10px;
}
:deep(.tool-box .content-box) {
padding: 7px 10px 8px;
}
:deep(.tool-box .content-box .entrance-item) {
margin-bottom: 11px;
}
:deep(.tool-box .content-box .entrance-icon-compact) {
width: 42px;
height: 42px;
}
:deep(.tool-box .content-box .entrance-name-compact) {
font-size: 11px;
margin-top: 3px;
}
// 已移除 module-box/tool-box 高度相关样式,避免影响 HomeFrame 全局布局
// :deep(.module-box .common-title),
// :deep(.tool-box .common-title) {
// height: 48px;
// padding-left: 15px;
// }
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// :deep(.module-box .title-text),
// :deep(.tool-box .title-text) {
// font-size: 16px;
// }
//
// :deep(.tool-box .content-box) {
// padding: 7px 10px 8px;
// }
//
// :deep(.tool-box .content-box .entrance-item) {
// margin-bottom: 11px;
// }
//
// :deep(.tool-box .content-box .entrance-icon-compact) {
// width: 42px;
// height: 42px;
// }
//
// :deep(.tool-box .content-box .entrance-name-compact) {
// font-size: 11px;
// margin-top: 3px;
// }
}
......@@ -15,18 +15,19 @@
line-height: 24px;
}
:deep(.module-box .common-title) {
height: 56px;
padding-left: 18px;
}
:deep(.module-box .title-text) {
font-size: 18px;
}
:deep(.tool-box .content-box .entrance-item) {
margin-bottom: 14px;
}
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// :deep(.module-box .common-title) {
// height: 56px;
// padding-left: 18px;
// }
//
// :deep(.module-box .title-text) {
// font-size: 18px;
// }
//
// :deep(.tool-box .content-box .entrance-item) {
// margin-bottom: 14px;
// }
}
:deep(.layout-portrait-common) .equity-page {
......@@ -94,37 +95,35 @@
padding: 6px 0 calc(var(--l-spacing-sm) + 8px);
}
:deep(.module-box .common-title),
:deep(.tool-box .common-title) {
height: 48px;
padding-left: 16px;
}
:deep(.module-box .title-text),
:deep(.tool-box .title-text) {
font-size: 16px;
}
:deep(.module-box) {
margin-bottom: 10px;
}
:deep(.tool-box .content-box) {
padding: 8px 10px 10px;
}
:deep(.tool-box .content-box .entrance-item) {
width: 31.5%;
margin-bottom: 12px;
}
:deep(.tool-box .content-box .entrance-icon-compact) {
width: 42px;
height: 42px;
}
:deep(.tool-box .content-box .entrance-name-compact) {
font-size: 12px;
margin-top: 4px;
}
// 已移除 module-box/tool-box 高度相关样式,避免影响 HomeFrame 全局布局
// :deep(.module-box .common-title),
// :deep(.tool-box .common-title) {
// height: 48px;
// padding-left: 16px;
// }
// 所有 module-box/tool-box 相关样式已迁移到 HomeFrame 组件样式文件中
// :deep(.module-box .title-text),
// :deep(.tool-box .title-text) {
// font-size: 16px;
// }
//
// :deep(.tool-box .content-box) {
// padding: 8px 10px 10px;
// }
//
// :deep(.tool-box .content-box .entrance-item) {
// width: 31.5%;
// margin-bottom: 12px;
// }
//
// :deep(.tool-box .content-box .entrance-icon-compact) {
// width: 42px;
// height: 42px;
// }
//
// :deep(.tool-box .content-box .entrance-name-compact) {
// font-size: 12px;
// margin-top: 4px;
// }
}
......@@ -2,7 +2,7 @@ import { logger } from "@/services/logger/index.uts";
import type { AppResolutionConfig, ResponsiveImage } from "./types/index.uts";
import { initRegistry, landscapeMap, portraitMap } from "./registry.uts";
import { resolutionState } from "./store.uts";
import { cssClassRef, resolutionState } from "./store.uts";
function isNearResolution(
w: number,
......@@ -109,12 +109,17 @@ function applyResolutionConfig(
winWidth: number,
winHeight: number
): void {
resolutionState.config = cfg;
resolutionState.currentKey = key;
resolutionState.cssClass = cssCls;
resolutionState.pixelRatio = pxRatio;
resolutionState.windowWidth = winWidth;
resolutionState.windowHeight = winHeight;
// 使用 Object.assign 确保响应式更新
Object.assign(resolutionState, {
config: cfg,
currentKey: key,
pixelRatio: pxRatio,
windowWidth: winWidth,
windowHeight: winHeight
});
// 使用 ref 确保 cssClass 的响应式更新
cssClassRef.value = cssCls;
logger.info(`[ResolutionAdapt] Applied config: ${key}, cssClass: ${cssCls}`);
}
......
......@@ -8,7 +8,7 @@ export { useResponsiveImage } from "./hooks.uts";
export { initRegistry, landscapeMap, portraitMap } from "./registry.uts";
// 导出状态
export { resolutionState, ResolutionState } from "./store.uts";
export { resolutionState, ResolutionState, cssClassRef } from "./store.uts";
// 导出类型
export * from "./types/index.uts";
import { reactive } from "vue";
import { reactive, ref } from "vue";
import type { AppResolutionConfig } from "./types/index.uts";
......@@ -7,7 +7,6 @@ import type { AppResolutionConfig } from "./types/index.uts";
*/
export type ResolutionState = {
config: AppResolutionConfig | null
cssClass: string
currentKey: string
pixelRatio: number
windowWidth: number
......@@ -15,13 +14,17 @@ export type ResolutionState = {
}
/**
* CSS 类名(使用 ref 确保响应式)
*/
export const cssClassRef = ref<string>('layout-default');
/**
* 全局分辨率状态 (响应式)
* - 使用 Object.assign 确保类型正确
*/
const initialState: ResolutionState = {
config: null,
currentKey: '',
cssClass: 'layout-default',
pixelRatio: 1,
windowWidth: 0,
windowHeight: 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!