Commit 32b97ed9 by liimin

Merge branch 'feature/rework' of http://192.168.3.233:8090/monorepo/venus into feature/rework

2 parents 3f2bbaa5 697288f8
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-landscape">
<HomeFrameTabbarLandscape :adapter-class-name="adapterClassName"
:user-name="userName"
:landscape-tabbar-root-style="landscapeTabbarRootStyle"
:landscape-tabbar-inner-height="landscapeTabbarInnerHeight"
:landscape-tabbar-icon-size="landscapeTabbarIconSize"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@scene-change="onSceneChange"
@setting="onSetting"
@choose-scene="onChooseScene"
@jump-person-center="jumpPersonCenter" />
<view class="main-tab-shell-slot main-tab-shell-slot-landscape">
<slot :user-info="slotUserInfo"></slot>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
userInfo?: null | UTSJSONObject
}>();
const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const userName = _tabbar.userName;
const landscapeTabbarRootStyle = _tabbar.landscapeTabbarRootStyle;
const landscapeTabbarInnerHeight = _tabbar.landscapeTabbarInnerHeight;
const landscapeTabbarIconSize = _tabbar.landscapeTabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup;
const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onScenePopupVisible = _tabbar.onScenePopupVisible;
const onSettingVisible = _tabbar.onSettingVisible;
const onSceneChange = _tabbar.onSceneChange;
const onSetting = _tabbar.onSetting;
const onChooseScene = _tabbar.onChooseScene;
const jumpPersonCenter = _tabbar.jumpPersonCenter;
const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
.main-tab-shell-root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
}
.main-tab-shell-body-landscape {
flex: 1;
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.main-tab-shell-slot-landscape {
flex: 1 1 0%;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
</style>
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-portrait">
<view class="main-tab-shell-slot main-tab-shell-slot-portrait">
<slot :user-info="slotUserInfo"></slot>
</view>
<HomeFrameTabbarPortrait :adapter-class-name="adapterClassName"
:is-pad-portrait-mode="isPadPortraitMode"
:tabbar-height="tabbarHeight"
:tabbar-icon-size="tabbarIconSize"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@choose-scene="onChooseScene" />
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
userInfo?: null | UTSJSONObject
}>();
const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const isPadPortraitMode = _tabbar.isPadPortraitMode;
const tabbarHeight = _tabbar.tabbarHeight;
const tabbarIconSize = _tabbar.tabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup;
const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onScenePopupVisible = _tabbar.onScenePopupVisible;
const onSettingVisible = _tabbar.onSettingVisible;
const onChooseScene = _tabbar.onChooseScene;
const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
.main-tab-shell-root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
}
.main-tab-shell-body-portrait {
flex: 1;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.main-tab-shell-slot-portrait {
flex: 1 1 0%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
</style>
<template> <template>
<!-- 物理 tab 三页共用:自定义 Tabbar + 默认槽(首页 / 接待 / 我的由 pages 填入不同主体) --> <!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<view class="home-frame-container scene-shell-root" <MainTabShellPortrait v-if="shellIsPortrait"
:class="[modeClass, resolutionClass, adapterClass]"> :active-tab-index="props.activeTabIndex"
<view class="home-content"> :user-info="userInfo">
<HomeFrameTabbar :adapter-class="adapterClass" <template #default="{ userInfo: u }">
:tab-index="activeTabIndex" <slot :user-info="u"></slot>
:user-info="userInfo" /> </template>
<view class="right-side"> </MainTabShellPortrait>
<slot :user-info="userInfo"></slot> <MainTabShellLandscape v-else
</view> :active-tab-index="props.activeTabIndex"
</view> :user-info="userInfo">
</view> <template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
</template>
</MainTabShellLandscape>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, ref } from "vue"; import { computed, defineExpose, onMounted, onResize, ref, type Ref } from "vue";
import { cssClassRef, useResolutionConfig } from "@/services/adapter"; import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts"; import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts"; import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import HomeFrameTabbar from "./Tabbar.uvue"; import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
type SceneShellSlotProps = { type SceneShellSlotProps = {
userInfo: UTSJSONObject userInfo: UTSJSONObject
...@@ -39,22 +42,20 @@ const props = defineProps<{ ...@@ -39,22 +42,20 @@ const props = defineProps<{
activeTabIndex: number activeTabIndex: number
}>(); }>();
useResolutionConfig(); updateOrientation();
const orientationHook = useOrientation();
const adapterClass = computed((): string => { const shellIsPortrait = computed((): boolean => {
const cls = cssClassRef.value; const ip = orientationHook.isPortrait as Ref<boolean>;
return cls != null ? (cls as string) : ""; return ip.value == true;
}); });
const modeClass = computed((): string => { onMounted((): void => {
const modeRef = layoutService.getCurrentMode(); updateOrientation();
const m = modeRef.value;
return m == "portrait" ? "mode-portrait" : "mode-landscape";
}); });
const resolutionClass = computed((): string => { onResize((_res: any): void => {
const bucket = layoutService.getResolutionBucket(); updateOrientation();
return `res-${bucket}`;
}); });
const userInfo = ref<UTSJSONObject>({}); const userInfo = ref<UTSJSONObject>({});
...@@ -69,6 +70,7 @@ function updateApp(): void { ...@@ -69,6 +70,7 @@ function updateApp(): void {
onLoad((_options) => { onLoad((_options) => {
requestRecordPermission(); requestRecordPermission();
hideNativeTabBar(); hideNativeTabBar();
updateOrientation();
}); });
onShow(() => { onShow(() => {
...@@ -79,7 +81,3 @@ defineExpose({ ...@@ -79,7 +81,3 @@ defineExpose({
updateApp updateApp
}); });
</script> </script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
<template>
<view class="home-tabbar home-tabbar-landscape"
:class="[adapterClassName]">
<image class="home-tabbar-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" />
<view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')">
<view class="user-info">
<view class="user-avatar"></view>
<text class="user-name-text">{{ userName }}</text>
</view>
</view>
<view class="landscape-tabbar-wrap">
<view class="landscape-un-tabbar landscape-vertical-tabs"
:style="landscapeTabbarRootStyle">
<view v-for="(item, index) in tabs"
:key="index"
class="landscape-vertical-tabs__item"
:class="index === currentTabIndex ? 'landscape-vertical-tabs__item--active' : ''"
:style="tabRowStyle"
@click="onTabItemClick(index)">
<view class="landscape-vertical-tabs__inner">
<image class="landscape-vertical-tabs__icon"
mode="aspectFit"
:style="iconImageStyle"
:src="index === currentTabIndex ? item.iconSrcActive : item.iconSrcInactive" />
<text class="landscape-vertical-tabs__label">{{ item.label }}</text>
</view>
</view>
</view>
</view>
<view class="home-tabbar-footer flex-col hf-landscape-footer">
<view class="btn-placeholder" @tap="emit('sceneChange')"></view>
<view class="btn-placeholder" @tap="emit('setting')"></view>
</view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="emit('chooseScene', $event)"
@update:visible="emit('scenePopupVisible', $event)" />
<SettingBox :visible="showSetting"
@update:visible="emit('settingVisible', $event)" />
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
const props = defineProps<{
adapterClassName: string
userName: string
landscapeTabbarRootStyle: string
landscapeTabbarInnerHeight: number
landscapeTabbarIconSize: number
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
showScenePopup: boolean
showSetting: boolean
}>();
const emit = defineEmits<{
tabChange: [name: string | number]
scenePopupVisible: [v: boolean]
settingVisible: [v: boolean]
sceneChange: []
setting: []
chooseScene: [index: number]
jumpPersonCenter: []
}>();
const tabs = HOME_FRAME_TABS;
const iconImageStyle = computed((): any => {
const s = props.landscapeTabbarIconSize;
return {
width: `${s}px`,
height: `${s}px`
};
});
/** 与原 un-tabbar :height 一致,保证每项可点区域高度 */
const tabRowStyle = computed((): any => {
const h = props.landscapeTabbarInnerHeight;
return {
minHeight: `${h}px`
};
});
function onTabItemClick(index: number): void {
emit("tabChange", index);
}
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
/* 横屏侧栏:用户区 / Tab / 底按钮同一竖直中轴 */
.hf-landscape-user {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
.hf-landscape-footer {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
/* 与原先 .landscape-un-tabbar 占位一致,内部强制纵向排列 item */
.landscape-vertical-tabs {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.landscape-vertical-tabs__item {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 10px 0;
box-sizing: border-box;
}
.landscape-vertical-tabs__inner {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.landscape-vertical-tabs__icon {
flex-shrink: 0;
}
.landscape-vertical-tabs__label {
margin-top: 4px;
font-size: 12px;
color: #8a98b5;
text-align: center;
max-width: 96px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.landscape-vertical-tabs__item--active .landscape-vertical-tabs__label {
color: #3773f8;
font-weight: 500;
}
</style>
<template>
<view class="home-tabbar home-tabbar-portrait"
:class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']">
<un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar"
:fixed="true"
:placeholder="false"
:safe-area-inset-bottom="true"
active-color="#3773f8"
inactive-color="#8a98b5"
bg-color="#ffffff"
:height="tabbarHeight"
@change="emit('tabChange', ($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs"
:key="index"
:name="index"
:text="item.label"
:icon-size="tabbarIconSize">
<template #icon="{ active }">
<image v-if="active === true"
class="tabbar-icon-img"
mode="aspectFit"
:src="item.iconSrcActive" />
<image v-else
class="tabbar-icon-img"
mode="aspectFit"
:src="item.iconSrcInactive" />
</template>
</un-tabbar-item>
</un-tabbar>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="emit('chooseScene', $event)"
@update:visible="emit('scenePopupVisible', $event)" />
<SettingBox :visible="showSetting"
@update:visible="emit('settingVisible', $event)" />
</view>
</template>
<script setup lang="uts">
import CenterPopup from "@/components/CenterPopup.uvue";
import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
defineProps<{
adapterClassName: string
isPadPortraitMode: boolean
tabbarHeight: number
tabbarIconSize: number
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
showScenePopup: boolean
showSetting: boolean
}>();
const emit = defineEmits<{
tabChange: [name: string | number]
scenePopupVisible: [v: boolean]
settingVisible: [v: boolean]
chooseScene: [index: number]
}>();
const tabs = HOME_FRAME_TABS;
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
<template> <template>
<view class="home-frame-container" <view class="home-frame-container scene-shell-root"
:class="[modeClass, resolutionClass, adapterClass, tabSlotEmbedClass]"> :class="[modeClass, resolutionClass, adapterClass, tabSlotEmbedClass]">
<!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content --> <!-- 主导航 Tabbar 由 SceneShell 横/竖壳承担;此处仅内容区 -->
<view class="home-content" <view class="home-content hf-content-without-tabbar">
:class="tabbarVisible ? '' : 'hf-content-without-tabbar'">
<!-- Tabbar 在前:横屏 row 时自然在屏幕左侧;竖屏仍靠 order 把主内容置上;套壳页由 SceneShell 承载 Tabbar 时关闭 -->
<HomeFrameTabbar v-if="tabbarVisible"
:adapter-class="adapterClass"
:user-info="userInfo" />
<view class="right-side"> <view class="right-side">
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 HomeFrameTabbar) --> <!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 HomeFrameTabbar) -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom --> <!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
...@@ -83,7 +77,6 @@ import { layoutService } from "@/services/LayoutService.uts"; ...@@ -83,7 +77,6 @@ import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts"; import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import HomeFrameTabbar from "./Tabbar.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue"; import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue"; import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
...@@ -92,8 +85,6 @@ import { getLandscapeConfig } from "./styles/landscape.uts"; ...@@ -92,8 +85,6 @@ import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig } from "./styles/portrait.uts"; import { getPortraitConfig } from "./styles/portrait.uts";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
/** false:仅渲染主内容区,外层由 SceneShell 等提供 Tabbar(避免双 Tabbar) */
showTabbar?: boolean
showFooter?: boolean showFooter?: boolean
swiperCustom?: boolean swiperCustom?: boolean
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */ /** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
...@@ -114,15 +105,10 @@ const props = withDefaults(defineProps<{ ...@@ -114,15 +105,10 @@ const props = withDefaults(defineProps<{
*/ */
embedInTabSlot?: boolean embedInTabSlot?: boolean
}>(), { }>(), {
showTabbar: true,
showStartReception: true, showStartReception: true,
embedInTabSlot: false, embedInTabSlot: false,
}); });
const tabbarVisible = computed((): boolean => {
return props.showTabbar !== false;
});
const tabSlotEmbedClass = computed((): string => { const tabSlotEmbedClass = computed((): string => {
return props.embedInTabSlot === true ? "hf-embed-in-tab-slot" : ""; return props.embedInTabSlot === true ? "hf-embed-in-tab-slot" : "";
}); });
......
<template> <template>
<!-- <!--
层级(仅 index 物理 tab 页): 层级(仅 index 物理 tab 页):
1) SceneShell:系统级 tab 壳(侧栏/底栏 + 右侧槽),见 SceneShell.uvue 1) SceneShell:横/竖两套 MainTabShell + 槽,见 SceneShell.uvue
2) HomeMainTab:按 userInfo.sceneType 切换下方三选一子树 2) HomeMainTab:按 userInfo.sceneType 切换下方三选一子树
3) *HomePanel:各场景业务 + 内层 HomeFrame(三卡片区,embedInTabSlot 与壳分工) 3) *HomePanel:各场景业务 + 内层 HomeFrame(三卡片区,embedInTabSlot 与壳分工)
--> -->
......
<template> <template>
<view class="home-frame-container scene-shell-root"
:class="[modeClass, resolutionClass, adapterClass]">
<view class="my-center-wrap"> <view class="my-center-wrap">
<MyCenterMain :user-info="resolvedUserInfo" /> <MyCenterMain :user-info="resolvedUserInfo" />
</view> </view>
</view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed } from "vue"; import { computed } from "vue";
import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import MyCenterMain from "@/pages/person/MyCenterMain.uvue"; import MyCenterMain from "@/pages/person/MyCenterMain.uvue";
const props = defineProps<{ const props = defineProps<{
userInfo?: null | UTSJSONObject userInfo?: null | UTSJSONObject
}>(); }>();
useResolutionConfig();
const adapterClass = computed((): string => {
const cls = cssClassRef.value;
return cls != null ? (cls as string) : "";
});
const modeClass = computed((): string => {
const modeRef = layoutService.getCurrentMode();
const m = modeRef.value;
return m == "portrait" ? "mode-portrait" : "mode-landscape";
});
const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket();
return `res-${bucket}`;
});
const resolvedUserInfo = computed((): UTSJSONObject => { const resolvedUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo; const u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject); return u != null ? u : ({} as UTSJSONObject);
...@@ -20,10 +43,14 @@ const resolvedUserInfo = computed((): UTSJSONObject => { ...@@ -20,10 +43,14 @@ const resolvedUserInfo = computed((): UTSJSONObject => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/common.scss";
.my-center-wrap { .my-center-wrap {
flex: 1; flex: 1;
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 0; min-height: 0;
display: flex;
flex-direction: column;
} }
</style> </style>
...@@ -556,44 +556,3 @@ ...@@ -556,44 +556,3 @@
border-radius: 20px; border-radius: 20px;
margin: var(--l-spacing-sm) auto 0; margin: var(--l-spacing-sm) auto 0;
} }
// ========================================================================
// 首页布局调试(仅 pages/index 的 SceneShell 挂 hf-layout-debug 时生效)
// 验证横竖屏分区后删除:index.uvue 上的 hf-layout-debug + 本段样式
// ========================================================================
.hf-layout-debug.scene-shell-root > .home-content > .right-side {
background-color: rgba(160, 140, 255, 0.22);
}
.hf-layout-debug .home-tabbar-landscape {
background-color: rgba(255, 100, 100, 0.38) !important;
}
.hf-layout-debug .home-tabbar-portrait {
background-color: rgba(255, 160, 90, 0.42) !important;
}
/* 内层 HomeFrame(embed)整块主区 */
.hf-layout-debug .hf-embed-in-tab-slot > .home-content > .right-side {
background-color: rgba(90, 200, 220, 0.2);
}
.hf-layout-debug .app-content-box.show-content-box {
background-color: rgba(120, 120, 120, 0.12);
}
.hf-layout-debug .start {
background-color: rgba(255, 230, 80, 0.55) !important;
}
.hf-layout-debug .app-content-box .content-left .module-box {
background-color: rgba(80, 200, 130, 0.4);
}
.hf-layout-debug .app-content-box .content-left .tool-box {
background-color: rgba(80, 140, 255, 0.38);
}
.hf-layout-debug .app-content-box .content-right {
background-color: rgba(200, 120, 255, 0.38);
}
import { computed, ref } from "vue";
import { cssClassRef } from "@/services/adapter";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
export type HomeFrameTabbarSource = {
getAdapterClass: () => null | string
getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
}
export type TabItem = {
label: string;
icon: string;
name: string;
/** 模板内仅用路径字段,避免 UTS 在 slot 中调用 import 的函数 */
iconSrcActive: string;
iconSrcInactive: string;
};
export type SceneTypeItem = { describe: string; icon: string; title: string; }
export const HOME_FRAME_TABS: TabItem[] = [
{
label: "首页",
icon: "home",
name: "HomeSlot",
iconSrcActive: "/static/images/tabbar/home-active.png",
iconSrcInactive: "/static/images/tabbar/home.png"
},
{
label: "接待中心",
icon: "record",
name: "ReceptionCenter",
iconSrcActive: "/static/images/tabbar/record-active.png",
iconSrcInactive: "/static/images/tabbar/record.png"
},
{
label: "我的",
icon: "my",
name: "MyCenter",
iconSrcActive: "/static/images/tabbar/study-active.png",
iconSrcInactive: "/static/images/tabbar/study.png"
},
];
export function getSceneTypeItem(sceneId: number): null | SceneTypeItem {
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" };
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
export function getTabIconSrc(icon: string, active: boolean): string {
if (icon === "home") {
return active ? "/static/images/tabbar/home-active.png" : "/static/images/tabbar/home.png";
}
if (icon === "record") {
return active ? "/static/images/tabbar/record-active.png" : "/static/images/tabbar/record.png";
}
if (icon === "study") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
}
if (icon === "my") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
}
return "/static/images/tabbar/home.png";
}
function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed;
uni.reLaunch({
url: withSlash,
fail: (_err: any) => {
uni.reLaunch({ url: trimmed });
}
});
}
function switchTabPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const url = "/" + trimmed;
uni.switchTab({
url,
success: () => {
hideNativeTabBar();
},
fail: (_err: any) => {
reLaunchPage(trimmed);
}
});
}
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showScenePopup = ref(false);
const showSetting = ref(false);
const adapterClassName = computed((): string => {
const cls = source.getAdapterClass();
if (cls != null && cls !== "") {
return cls as string;
}
const fromRef = cssClassRef.value;
return fromRef != null ? (fromRef as string) : "";
});
const isPadPortraitMode = computed((): boolean => {
const cls = adapterClassName.value;
return cls.indexOf("layout-portrait-768x1174") >= 0;
});
const tabbarHeight = computed((): number => {
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((): number => {
const adapterCls = cssClassRef.value;
const portraitConfig = getPortraitConfig(adapterCls);
if (portraitConfig != null) {
return portraitConfig.tabbarIconSize as number;
}
return PORTRAIT_COMMON.tabbarIconSize as number;
});
const landscapeTabbarRootStyle = computed((): string => {
const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls);
const h = lc != null ? lc.leftTabsHeight : "540px";
const padX = lc != null ? lc.leftTabsPaddingLeft : "16px";
/* 左右对称,与用户区、底栏在同一中轴上对齐 */
return `display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:${h};padding-left:${padX};padding-right:${padX};padding-top:8px;padding-bottom:8px;box-sizing:border-box;`;
});
const landscapeTabbarInnerHeight = computed((): number => {
const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls);
if (lc != null && adapterCls.indexOf("1920") >= 0) {
return 64;
}
if (lc != null) {
return 58;
}
return 56;
});
const landscapeTabbarIconSize = computed((): number => {
const adapterCls = cssClassRef.value;
if (adapterCls.indexOf("1920") >= 0) {
return 32;
}
return 28;
});
const currentTabIndex = computed((): number => {
return source.getTabIndex();
});
const sceneTypeList = computed((): UTSJSONObject[] => {
const info = source.getUserInfo();
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const result: UTSJSONObject[] = [];
const valid = [1, 0, 7];
for (const element of openArr) {
const e = element as number;
if (valid.indexOf(e) >= 0) {
const item = getSceneTypeItem(e);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
}
if (result.length === 0) {
result.push(
{ title: "轻改", describe: "太阳膜升级转化", icon: "轻" } as UTSJSONObject,
{ title: "会员权益/升级", describe: "权益延保", icon: "权" } as UTSJSONObject,
{ title: "二手车", describe: "二手车业务", icon: "二" } as UTSJSONObject
);
}
return result;
});
const sceneTypeIdList = computed((): number[] => {
const info = source.getUserInfo();
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const valid = [1, 0, 7];
const result: number[] = [];
for (const element of openArr) {
const e = element as number;
if (valid.indexOf(e) >= 0) {
result.push(e);
}
}
if (result.length === 0) {
return [1, 0, 7];
}
return result;
});
const userName = computed((): string => {
const info = source.getUserInfo();
if (info == null) {
return "";
}
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
if (raw == null) {
return "";
}
const s = `${raw}`;
return s !== "" ? s : "";
});
const navigateToTab = (index: number): void => {
const cur = source.getTabIndex();
if (index == cur) {
return;
}
if (index == 0) {
switchTabPage("pages/index/index");
return;
}
if (index == 1) {
switchTabPage("pages/receptionCenter/center");
return;
}
if (index == 2) {
switchTabPage("pages/person/myCenter");
return;
}
};
const onTabChange = (name: string | number): void => {
const idx = name as number;
navigateToTab(idx);
};
const onScenePopupVisible = (v: boolean): void => {
showScenePopup.value = v;
};
const onSettingVisible = (v: boolean): void => {
showSetting.value = v;
};
const onSceneChange = (): void => {
showScenePopup.value = true;
};
const onSetting = (): void => {
showSetting.value = true;
};
const onChooseScene = (index: number): void => {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) {
return;
}
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) {
return;
}
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) {
return;
}
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
uni.switchTab({
url: "/pages/index/index",
success: () => {
hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
reLaunchPage("pages/index/index");
}
});
};
const jumpPersonCenter = (): void => {
uni.navigateTo({ url: "/pages/person/attendance" });
};
return {
showScenePopup,
showSetting,
adapterClassName,
isPadPortraitMode,
tabbarHeight,
tabbarIconSize,
landscapeTabbarRootStyle,
landscapeTabbarInnerHeight,
landscapeTabbarIconSize,
currentTabIndex,
sceneTypeList,
sceneTypeIdList,
userName,
onTabChange,
onScenePopupVisible,
onSettingVisible,
onSceneChange,
onSetting,
onChooseScene,
jumpPersonCenter
};
}
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
class="boutique-home-frame-root" class="boutique-home-frame-root"
:embed-in-tab-slot="true" :embed-in-tab-slot="true"
:show-footer="true" :show-footer="true"
:show-tabbar="false"
:swiper-custom="true" :swiper-custom="true"
:intro-load-complete="logic.loadComplete.value" :intro-load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList" :intro-swiper-list="boutiqueIntroSwiperList"
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<view class="page-container equity-page hf-equity-tab-root fade-in"> <view class="page-container equity-page hf-equity-tab-root fade-in">
<HomeFrame ref="homeRef" <HomeFrame ref="homeRef"
:embed-in-tab-slot="true" :embed-in-tab-slot="true"
:show-tabbar="false"
:show-footer="true" :show-footer="true"
:swiper-custom="true" :swiper-custom="true"
:intro-load-complete="loadComplete" :intro-load-complete="loadComplete"
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
<view class="index-shell-page"> <view class="index-shell-page">
<!-- 可拉伸层:单列 flex 下单个子项须 flex:1+min-height:0 才吃满高度;接待/我的等同层无 flex 故无此问题 --> <!-- 可拉伸层:单列 flex 下单个子项须 flex:1+min-height:0 才吃满高度;接待/我的等同层无 flex 故无此问题 -->
<view class="index-shell-scene-stretch"> <view class="index-shell-scene-stretch">
<!-- 布局调试:确认结构后去掉 hf-layout-debug -->
<SceneShell ref="shellRef" <SceneShell ref="shellRef"
class="hf-layout-debug"
:active-tab-index="0"> :active-tab-index="0">
<template #default="{ userInfo }"> <template #default="{ userInfo }">
<view class="tab-panel"> <view class="tab-panel">
...@@ -74,6 +72,14 @@ onShow(async () => { ...@@ -74,6 +72,14 @@ onShow(async () => {
flex-direction: column; flex-direction: column;
} }
.index-shell-scene-stretch :deep(.main-tab-shell-root) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
height: 100%;
}
.index-shell-scene-stretch :deep(.scene-shell-root) { .index-shell-scene-stretch :deep(.scene-shell-root) {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
......
...@@ -30,5 +30,15 @@ onShow(() => { ...@@ -30,5 +30,15 @@ onShow(() => {
.page-container { .page-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
}
.page-container :deep(.main-tab-shell-root) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
height: 100%;
} }
</style> </style>
<template> <template>
<card-container variant="funnel" :root-style="flowCardRootStyle"> <card-container variant="funnel">
<view class="title-box"> <view class="title-box">
<text class="title-text" :style="flowTitleTextStyle">门店客流情况</text> <text class="title-text">门店客流情况</text>
</view> </view>
<view class="funnel-container" :style="funnelContainerStyle"> <view class="funnel-container">
<view class="flow-layout" :style="flowLayoutStyle"> <view class="flow-layout">
<view class="funnel-main" :style="funnelMainStyle"> <view class="funnel-main">
<view class="metric-card" :style="metricCardStyle"> <view class="metric-card">
<text class="metric-label" :style="metricLabelTextStyle">累计交付数</text> <text class="metric-label">累计交付数</text>
<text class="metric-value" :style="metricValueTextStyle">{{ funnelCountDisplay1 }}</text> <text class="metric-value">{{ funnelCountDisplay1 }}</text>
</view> </view>
<view class="metric-card metric-card-secondary" :style="metricCardSecondaryStyle"> <view class="metric-card metric-card-secondary">
<text class="metric-label" :style="metricLabelTextStyle">实际触客数</text> <text class="metric-label">实际触客数</text>
<text class="metric-value" :style="metricValueTextStyle">{{ funnelCountDisplay2 }}</text> <text class="metric-value">{{ funnelCountDisplay2 }}</text>
</view> </view>
</view> </view>
<view class="rate-badge" :style="rateBadgeStyle"> <view class="rate-badge">
<text class="rate-caption" :style="rateCaptionTextStyle">触客率</text> <text class="rate-caption">触客率</text>
<text class="rate-value" :style="rateValueTextStyle">{{ contactRateMasked }}%</text> <text class="rate-value">{{ contactRateMasked }}%</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -27,11 +27,6 @@ ...@@ -27,11 +27,6 @@
<script setup lang="uts"> <script setup lang="uts">
import { computed } from 'vue' import { computed } from 'vue'
import CardContainer from './CardContainer.uvue' import CardContainer from './CardContainer.uvue'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitDashboardConfig,
type ReceptionPortraitDashboardConfig
} from '../styles/portrait.uts'
/** 业绩看板聚合数据,与 center 中 performanceData 同源 */ /** 业绩看板聚合数据,与 center 中 performanceData 同源 */
const props = withDefaults( const props = withDefaults(
...@@ -95,119 +90,11 @@ const contactRateMasked = computed((): string => { ...@@ -95,119 +90,11 @@ const contactRateMasked = computed((): string => {
} }
return contactRateDisplay.value return contactRateDisplay.value
}) })
const portraitDash = computed((): ReceptionPortraitDashboardConfig | null => {
return getReceptionPortraitDashboardConfig(cssClassRef.value)
})
function flowPick(mapper: (c: ReceptionPortraitDashboardConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitDash.value
if (c == null) {
return {} as UTSJSONObject
}
return mapper(c)
}
const flowCardRootStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
padding: c.dashCardPadding,
borderRadius: c.dashCardBorderRadius,
boxShadow: c.dashCardBoxShadow,
marginBottom: c.dashCardFunnelMarginBottom
} as UTSJSONObject
})
})
const flowTitleTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashFlowTitleFontSize } as UTSJSONObject
})
})
const funnelContainerStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
borderRadius: c.dashFunnelContainerBorderRadius,
padding: c.dashFunnelContainerPadding,
marginTop: c.dashFunnelContainerMarginTop
} as UTSJSONObject
})
})
const flowLayoutStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { minHeight: c.dashFlowLayoutMinHeight } as UTSJSONObject
})
})
const funnelMainStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
minHeight: c.dashFunnelMainMinHeight,
paddingRight: c.dashFunnelMainPaddingRight
} as UTSJSONObject
})
})
const metricCardStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
minHeight: c.dashMetricCardMinHeight,
borderRadius: c.dashMetricCardBorderRadius,
padding: c.dashMetricCardPadding
} as UTSJSONObject
})
})
const metricCardSecondaryStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { marginTop: c.dashMetricCardSecondaryMarginTop } as UTSJSONObject
})
})
const metricLabelTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashMetricLabelFontSize } as UTSJSONObject
})
})
const metricValueTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
fontSize: c.dashMetricValueFontSize,
marginTop: c.dashMetricValueMarginTop
} as UTSJSONObject
})
})
const rateBadgeStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
width: c.dashRateBadgeWidth,
height: c.dashRateBadgeHeight,
borderRadius: c.dashRateBadgeBorderRadius
} as UTSJSONObject
})
})
const rateCaptionTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return { fontSize: c.dashRateCaptionFontSize } as UTSJSONObject
})
})
const rateValueTextStyle = computed((): UTSJSONObject => {
return flowPick((c) => {
return {
fontSize: c.dashRateValueFontSize,
marginTop: c.dashRateValueMarginTop
} as UTSJSONObject
})
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/common.scss";
.title-box { .title-box {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
...@@ -216,8 +103,8 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -216,8 +103,8 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
.title-text { .title-text {
color: #333333; color: #333333;
font-size: 14px; font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 600; font-weight: 700;
} }
.funnel-container { .funnel-container {
...@@ -249,7 +136,7 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -249,7 +136,7 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
.metric-card { .metric-card {
width: 100%; width: 100%;
min-height: 48px; min-height: var(--reception-dash-flow-metric-card-min-height, 48px);
border-radius: 12px; border-radius: 12px;
background: rgba(255, 255, 255, 0.86); background: rgba(255, 255, 255, 0.86);
box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10);
...@@ -267,23 +154,23 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -267,23 +154,23 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
} }
.metric-label { .metric-label {
font-size: 11px; font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #7b90ad; color: #7b90ad;
line-height: 14px; line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
} }
.metric-value { .metric-value {
margin-top: 3px; margin-top: 3px;
font-size: 19px; font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700; font-weight: 700;
color: #1e40af; color: #1e40af;
line-height: 22px; line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
} }
.rate-badge { .rate-badge {
width: 94px; width: var(--reception-dash-flow-rate-badge-size, 94px);
height: 94px; height: var(--reception-dash-flow-rate-badge-size, 94px);
border-radius: 47px; border-radius: var(--reception-dash-flow-rate-badge-radius, 47px);
background-color: #eaf2ff; background-color: #eaf2ff;
background-image: linear-gradient(145deg, #eaf2ff 0%, #dbeafe 100%); background-image: linear-gradient(145deg, #eaf2ff 0%, #dbeafe 100%);
border: 1px solid #cfe0ff; border: 1px solid #cfe0ff;
...@@ -296,14 +183,16 @@ const rateValueTextStyle = computed((): UTSJSONObject => { ...@@ -296,14 +183,16 @@ const rateValueTextStyle = computed((): UTSJSONObject => {
} }
.rate-caption { .rate-caption {
font-size: 11px; font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #5f7ea8; color: #5f7ea8;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
} }
.rate-value { .rate-value {
margin-top: 2px; margin-top: 2px;
font-size: 17px; font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700; font-weight: 700;
color: #1d4ed8; color: #1d4ed8;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
} }
</style> </style>
<template> <template>
<card-container :root-style="outputCardRootStyle"> <card-container class="reception-dash-output-card">
<view class="tabs-box" :style="outputTabsBoxStyle"> <view class="tabs-box">
<un-segmented <un-segmented
shape="circle" shape="circle"
type="card" type="card"
:font-size="segmentedFontSize" :font-size="'var(--reception-dash-segmented-font-size)'"
:custom-style="{ height: 'var(--reception-dash-segmented-height)' }"
:model-value="tabIndex" :model-value="tabIndex"
active-color="#000000" active-color="#000000"
@update:model-value="onSegmentedTabIndex" @update:model-value="onSegmentedTabIndex"
...@@ -20,31 +21,24 @@ ...@@ -20,31 +21,24 @@
:key="idx" :key="idx"
class="compare-row" class="compare-row"
:class="{ 'compare-row-last': idx == compareRows.length - 1 }" :class="{ 'compare-row-last': idx == compareRows.length - 1 }"
:style="compareRowStyle(idx)"
> >
<text class="compare-label" :style="compareLabelTextStyle">{{ row.label }}</text> <text class="compare-label">{{ row.label }}</text>
<view class="compare-bar-bg" :style="compareBarBgStyle"> <view class="compare-bar-bg">
<view <view
class="compare-bar-fill" class="compare-bar-fill"
:class="row.barClass" :class="row.barClass"
:style="compareBarFillStyle(row)" :style="compareBarFillStyle(row)"
></view> ></view>
</view> </view>
<text class="compare-value" :style="compareValueTextStyle">{{ metricsVisible ? row.value : '****' }}</text> <text class="compare-value">{{ metricsVisible ? row.value : '****' }}</text>
</view> </view>
</view> </view>
</card-container> </card-container>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue' import CardContainer from './CardContainer.uvue'
import type { CompareRow } from '../types/reception-output-types.uts' import type { CompareRow } from '../types/reception-output-types.uts'
import { cssClassRef } from '@/services/adapter'
import {
getReceptionPortraitDashboardConfig,
type ReceptionPortraitDashboardConfig
} from '../styles/portrait.uts'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
...@@ -70,102 +64,26 @@ const onSegmentedTabIndex = (v: number): void => { ...@@ -70,102 +64,26 @@ const onSegmentedTabIndex = (v: number): void => {
emit('update:tabIndex', v) emit('update:tabIndex', v)
} }
const portraitDash = computed((): ReceptionPortraitDashboardConfig | null => {
return getReceptionPortraitDashboardConfig(cssClassRef.value)
})
function outPick(mapper: (c: ReceptionPortraitDashboardConfig) => UTSJSONObject): UTSJSONObject {
const c = portraitDash.value
if (c == null) {
return {} as UTSJSONObject
}
return mapper(c)
}
const outputCardRootStyle = computed((): UTSJSONObject => {
return outPick((c) => {
return {
padding: c.dashCardPadding,
borderRadius: c.dashCardBorderRadius,
boxShadow: c.dashCardBoxShadow
} as UTSJSONObject
})
})
const outputTabsBoxStyle = computed((): UTSJSONObject => {
return outPick((c) => {
return { marginBottom: c.dashOutputTabsMarginBottom } as UTSJSONObject
})
})
const segmentedFontSize = computed((): number => {
const c = portraitDash.value
if (c != null) {
return c.dashSegmentedFontSize
}
return 14
})
const compareLabelTextStyle = computed((): UTSJSONObject => {
return outPick((c) => {
return {
fontSize: c.dashCompareLabelFontSize,
width: c.dashCompareLabelWidth
} as UTSJSONObject
})
})
const compareBarBgStyle = computed((): UTSJSONObject => {
return outPick((c) => {
return {
height: c.dashCompareBarHeight,
borderRadius: c.dashCompareBarBorderRadius,
marginRight: c.dashCompareBarBgMarginRight
} as UTSJSONObject
})
})
function compareBarFillStyle(row: CompareRow): UTSJSONObject { function compareBarFillStyle(row: CompareRow): UTSJSONObject {
const base = { width: row.barWidthPercent } as UTSJSONObject
const c = portraitDash.value
if (c == null) {
return base
}
return { return {
width: row.barWidthPercent, width: row.barWidthPercent,
height: c.dashCompareBarHeight, height: 'var(--reception-dash-compare-bar-height)',
borderRadius: c.dashCompareBarBorderRadius borderRadius: 'var(--reception-dash-compare-bar-border-radius)'
} as UTSJSONObject
}
const compareValueTextStyle = computed((): UTSJSONObject => {
return outPick((c) => {
return {
fontSize: c.dashCompareValueFontSize,
width: c.dashCompareValueWidth,
fontWeight: '700'
} as UTSJSONObject } as UTSJSONObject
})
})
function compareRowStyle(idx: number): UTSJSONObject {
const c = portraitDash.value
if (c == null) {
return {} as UTSJSONObject
}
const last = idx == props.compareRows.length - 1
if (last) {
return {} as UTSJSONObject
}
return { marginBottom: c.dashCompareRowMarginBottom } as UTSJSONObject
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.reception-dash-output-card {
padding: var(--reception-dash-card-padding);
border-radius: var(--reception-dash-card-border-radius);
box-shadow: var(--reception-dash-card-box-shadow);
}
.tabs-box { .tabs-box {
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
margin-bottom: 24px; margin-bottom: var(--reception-dash-output-tabs-margin-bottom);
} }
.compare-section { .compare-section {
...@@ -175,7 +93,7 @@ function compareRowStyle(idx: number): UTSJSONObject { ...@@ -175,7 +93,7 @@ function compareRowStyle(idx: number): UTSJSONObject {
.compare-row { .compare-row {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin-bottom: 16px; margin-bottom: var(--reception-dash-compare-row-margin-bottom);
} }
.compare-row-last { .compare-row-last {
...@@ -183,24 +101,24 @@ function compareRowStyle(idx: number): UTSJSONObject { ...@@ -183,24 +101,24 @@ function compareRowStyle(idx: number): UTSJSONObject {
} }
.compare-label { .compare-label {
font-size: 13px; font-size: var(--reception-dash-compare-label-font-size);
color: #64748b; color: #64748b;
width: 90px; width: var(--reception-dash-compare-label-width);
} }
.compare-bar-bg { .compare-bar-bg {
flex: 1; flex: 1;
height: 6px; height: var(--reception-dash-compare-bar-height);
background-color: rgba(22, 119, 255, 0.08); background-color: rgba(22, 119, 255, 0.08);
border-radius: 4px; border-radius: var(--reception-dash-compare-bar-border-radius);
margin-right: 12px; margin-right: var(--reception-dash-compare-bar-bg-margin-right);
overflow: hidden; overflow: hidden;
flex-direction: row; flex-direction: row;
} }
.compare-bar-fill { .compare-bar-fill {
height: 100%; height: 100%;
border-radius: 4px; border-radius: var(--reception-dash-compare-bar-border-radius);
} }
.bg-blue-500 { .bg-blue-500 {
...@@ -212,10 +130,10 @@ function compareRowStyle(idx: number): UTSJSONObject { ...@@ -212,10 +130,10 @@ function compareRowStyle(idx: number): UTSJSONObject {
} }
.compare-value { .compare-value {
font-size: 13px; font-size: var(--reception-dash-compare-value-font-size);
font-weight: 600; font-weight: 700;
color: #1e293b; color: #1e293b;
width: 60px; width: var(--reception-dash-compare-value-width);
text-align: right; text-align: right;
} }
</style> </style>
...@@ -9,4 +9,8 @@ ...@@ -9,4 +9,8 @@
.reception-tabs-container{ .reception-tabs-container{
padding: var(--reception-tabs-container-padding); padding: var(--reception-tabs-container-padding);
margin-top: var(--reception-tabs-container-margin-top); margin-top: var(--reception-tabs-container-margin-top);
background-color: var(--reception-tabs-container-bgc);
}
.reception-main-tabs {
font-size: var(--reception-main-tabs-font-size);
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,41 @@ ...@@ -2,6 +2,41 @@
export default { export default {
common: { common: {
'--home-box-bg': '#FF4444', '--home-box-bg': '#FF4444',
// receptionCenter: tabs 默认字体(可被 resolutions 覆盖)
'--reception-main-tabs-active-font-size': '17px',
'--reception-main-tabs-inactive-font-size': '15px',
// 兼容旧变量(scss 里有引用)
'--reception-main-tabs-font-size': '17px',
// receptionCenter: dashboard(CardOutputValue) 默认样式变量(可被 resolutions 覆盖)
'--reception-dash-card-padding': '16px 20px',
'--reception-dash-card-border-radius': '22px',
'--reception-dash-card-box-shadow': '0 6px 22px rgba(15, 23, 42, 0.08)',
'--reception-dash-output-tabs-margin-bottom': '24px',
'--reception-dash-segmented-font-size': '14px',
'--reception-dash-segmented-height': '40px',
'--reception-dash-compare-row-margin-bottom': '16px',
'--reception-dash-compare-label-font-size': '13px',
'--reception-dash-compare-label-width': '90px',
'--reception-dash-compare-bar-height': '6px',
'--reception-dash-compare-bar-border-radius': '4px',
'--reception-dash-compare-bar-bg-margin-right': '12px',
'--reception-dash-compare-value-font-size': '13px',
'--reception-dash-compare-value-width': '60px',
// receptionCenter: dashboard(CardFlow) 默认字体变量(可被 resolutions 覆盖)
'--reception-dash-flow-title-font-size': '14px',
'--reception-dash-flow-metric-label-font-size': '11px',
'--reception-dash-flow-metric-value-font-size': '19px',
'--reception-dash-flow-metric-card-min-height': '48px',
'--reception-dash-flow-metric-label-line-height': '14px',
'--reception-dash-flow-metric-value-line-height': '22px',
'--reception-dash-flow-rate-caption-font-size': '11px',
'--reception-dash-flow-rate-caption-line-height': '14px',
'--reception-dash-flow-rate-value-font-size': '17px',
'--reception-dash-flow-rate-value-line-height': '22px',
'--reception-dash-flow-rate-badge-size': '94px',
'--reception-dash-flow-rate-badge-radius': '47px',
}, },
portrait: { portrait: {
'--adapter-color': 'red', '--adapter-color': 'red',
...@@ -26,6 +61,39 @@ export default { ...@@ -26,6 +61,39 @@ export default {
// 'padding': '10px' // 'padding': '10px'
'--reception-tabs-container-padding': '8px 12px 60px' '--reception-tabs-container-padding': '8px 12px 60px'
'--reception-tabs-container-margin-top': '30px' '--reception-tabs-container-margin-top': '30px'
'--reception-tabs-container-bgc': '#ffffff',
// 针对 768x1174 竖屏:tabs 字体自适应增大
'--reception-main-tabs-active-font-size': '24px',
'--reception-main-tabs-inactive-font-size': '22px',
// 兼容旧变量(scss 里有引用)
'--reception-main-tabs-font-size': '24px',
// 针对 768x1174 竖屏:看板(CardOutputValue) 字体/宽高自适应增大
'--reception-dash-output-tabs-margin-bottom': '28px',
'--reception-dash-segmented-font-size': '19px',
'--reception-dash-segmented-height': '48px',
'--reception-dash-compare-row-margin-bottom': '18px',
'--reception-dash-compare-label-font-size': '17px',
'--reception-dash-compare-label-width': '104px',
'--reception-dash-compare-bar-height': '12px',
'--reception-dash-compare-bar-border-radius': '6px',
'--reception-dash-compare-bar-bg-margin-right': '14px',
'--reception-dash-compare-value-font-size': '17px',
'--reception-dash-compare-value-width': '72px',
// 针对 768x1174 竖屏:客流卡片(CardFlow) 文本样式自适应增大
'--reception-dash-flow-title-font-size': '20px',
'--reception-dash-flow-metric-label-font-size': '16px',
'--reception-dash-flow-metric-value-font-size': '28px',
'--reception-dash-flow-metric-card-min-height': '72px',
'--reception-dash-flow-metric-label-line-height': '20px',
'--reception-dash-flow-metric-value-line-height': '34px',
'--reception-dash-flow-rate-caption-font-size': '16px',
'--reception-dash-flow-rate-caption-line-height': '20px',
'--reception-dash-flow-rate-value-font-size': '26px',
'--reception-dash-flow-rate-value-line-height': '32px',
'--reception-dash-flow-rate-badge-size': '140px',
'--reception-dash-flow-rate-badge-radius': '70px',
}, },
'landscape-1174x768': { 'landscape-1174x768': {
'--adapter-color': '#FF4444', '--adapter-color': '#FF4444',
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<view class="page-container used-car-home-in-tab"> <view class="page-container used-car-home-in-tab">
<HomeFrame ref="homeRef" <HomeFrame ref="homeRef"
:embed-in-tab-slot="true" :embed-in-tab-slot="true"
:show-tabbar="false"
:show-footer="true"> :show-footer="true">
<template #home> <template #home>
<view class="home-content"> <view class="home-content">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!