Commit 6d43edfc by 李伟康

Merge branch 'v1.0.0' of http://192.168.3.233:8090/app/sales-assist-mobile into v1.0.0

2 parents 3a61e5d9 35adf822
Showing 74 changed files with 776 additions and 3764 deletions
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-landscape">
<HomeFrameTabbarLandscape :user-name="userName"
: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, inject, type Ref } from "vue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const userName = _tabbar.userName;
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 r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} 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 :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, inject, type Ref } from "vue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
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 r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} 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>
<scroll-view class="message-index" scroll-y="true">
<view class="message-placeholder">
<view class="placeholder-item">
<text class="placeholder-date">2026-01-16</text>
<view class="placeholder-row">
<view class="placeholder-icon"></view>
<text class="placeholder-title">活动中心</text>
<text class="placeholder-time">17:47</text>
</view>
</view>
<view class="placeholder-item">
<text class="placeholder-date">2026-01-13</text>
<view class="placeholder-row">
<view class="placeholder-icon"></view>
<text class="placeholder-title">企业通知</text>
<text class="placeholder-time">16:11</text>
</view>
</view>
<text class="coming-soon">敬请期待</text>
</view>
</scroll-view>
</template>
<script setup lang="uts">
</script>
<style scoped lang="scss">
.message-index {
width: 100%;
height: 100%;
}
.message-placeholder {
padding: var(--l-spacing-md);
display: flex;
flex-direction: column;
}
.placeholder-item {
display: flex;
flex-direction: column;
margin-bottom: var(--l-spacing-md);
padding-bottom: var(--l-spacing-md);
border-bottom: 1px solid #eee;
}
.placeholder-date {
font-size: var(--l-font-xs);
color: #999;
margin-bottom: var(--l-spacing-xs);
}
.placeholder-row {
display: flex;
flex-direction: row;
align-items: center;
}
.placeholder-icon {
width: var(--l-font-2xl);
height: var(--l-font-2xl);
background-color: #4673ff;
border-radius: var(--l-radius-lg);
margin-right: var(--l-spacing-xs);
}
.placeholder-title {
flex: 1;
font-size: var(--l-font-sm);
color: #333;
}
.placeholder-time {
font-size: var(--l-font-xs);
color: #999;
}
.coming-soon {
font-size: var(--l-font-sm);
color: #999;
text-align: center;
margin-top: var(--l-spacing-lg);
}
</style>
<template>
<!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<MainTabShellPortrait v-if="shellIsPortrait"
:active-tab-index="props.activeTabIndex">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
</template>
</MainTabShellPortrait>
<MainTabShellLandscape v-else
:active-tab-index="props.activeTabIndex">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
</template>
</MainTabShellLandscape>
</template>
<script setup lang="uts">
import { computed, defineExpose, onMounted, onResize, provide, ref, type Ref } from "vue";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
import { SCENE_SHELL_USER_INFO_INJECT_KEY } from "./tabbarShared.uts";
type SceneShellSlotProps = {
userInfo: UTSJSONObject
};
type SceneShellSlots = {
default(props: SceneShellSlotProps): any
};
defineSlots<SceneShellSlots>();
const props = defineProps<{
/** 当前 tab 页下标:0 首页、1 接待、2 我的(与 un-tabbar 高亮一致) */
activeTabIndex: number
}>();
updateOrientation();
const orientationHook = useOrientation();
const shellIsPortrait = computed((): boolean => {
const ip = orientationHook.isPortrait as Ref<boolean>;
return ip.value == true;
});
onMounted((): void => {
// await requestRecordPermission();
hideNativeTabBar();
updateOrientation();
});
onResize((_res: any): void => {
updateOrientation();
});
const userInfo = ref<UTSJSONObject>({});
provide(SCENE_SHELL_USER_INFO_INJECT_KEY, userInfo);
function updateApp(): void {
const info = storage.get("userInfo");
if (info != null) {
userInfo.value = info as UTSJSONObject;
}
}
onShow(() => {
hideNativeTabBar();
});
defineExpose({
updateApp
});
</script>
<template>
<HomeFrameTabbarLandscape v-if="!isPortraitMode"
:user-name="userName"
: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" />
<HomeFrameTabbarPortrait v-else
: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" />
</template>
<script setup lang="uts">
import { computed, type Ref } from "vue";
import { useOrientation } from "@/services/adapter/hooks/index.uts";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
const props = defineProps<{
tabIndex?: number
userInfo?: null | UTSJSONObject
}>();
const orientationHook = useOrientation();
const isPortraitMode = computed((): boolean => {
const ip = orientationHook.isPortrait as Ref<boolean>;
return ip.value == true;
});
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const userName = _tabbar.userName;
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;
</script>
<template>
<view class="home-tabbar home-tabbar-landscape">
<!-- <image class="home-tabbar-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" /> -->
<view class="hf-landscape-column">
<view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')">
<view class="hf-landscape-profile">
<un-avatar :text="avatarText"
shape="circle"
size="42"
bgColor="#2f6af7"
color="#ffffff"
fontSize="20" />
<text class="hf-landscape-name">{{ userName }}</text>
</view>
</view>
</view>
<view class="landscape-tabbar-wrap">
<view class="landscape-un-tabbar landscape-vertical-tabs">
<view v-for="(item, index) in tabs"
:key="index"
class="landscape-vertical-tabs__item"
:class="index === currentTabIndex ? 'landscape-vertical-tabs__item--active' : ''"
@click="onTabItemClick(index)">
<view class="landscape-vertical-tabs__inner">
<image class="landscape-vertical-tabs__icon"
mode="aspectFit"
: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="hf-landscape-footer-btn"
@tap="emit('sceneChange')">
<image class="hf-landscape-footer-icon"
mode="aspectFit"
src="/static/images/home/scene-change.png" />
</view>
<view class="hf-landscape-footer-btn hf-landscape-footer-btn--after"
@tap="emit('setting')">
<image class="hf-landscape-footer-icon"
mode="aspectFit"
src="/static/images/home/setting.png" />
</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<{
userName: string
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;
/** 与 MyCenterMain 一致:姓名首字,空则「我」 */
const avatarText = computed((): string => {
const n = props.userName;
if (n == null || n === "") {
return "我";
}
const s = n as string;
if (s.length <= 0) {
return "我";
}
return s.substring(0, 1);
});
function onTabItemClick(index: number): void {
emit("tabChange", index);
}
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
/* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */
.hf-landscape-column {
flex-shrink: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: 14px 10px 0;
position: relative;
z-index: 1;
}
/* 横屏侧栏:用户区 / Tab / 底按钮同一竖直中轴 */
.hf-landscape-user {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding-top: 0;
flex-shrink: 0;
}
.hf-landscape-profile {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
.hf-landscape-name {
margin-top: 10px;
font-size: 14px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
text-align: center;
width: 100%;
max-width: 104px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.hf-landscape-footer {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
flex-shrink: 0;
padding-left: 10px;
padding-right: 10px;
}
.hf-landscape-footer-btn {
width: 44px;
height: 44px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.hf-landscape-footer-btn--after {
margin-top: 12px;
}
.hf-landscape-footer-icon {
width: 40px;
height: 40px;
flex-shrink: 0;
}
/* 横屏侧栏 Tab:占满中间 landscape-tabbar-wrap,条目在剩余高度内垂直居中 */
.landscape-vertical-tabs {
flex: 1;
min-height: 0;
width: 100%;
padding-left: var(--tabbar-padding, 16px);
padding-right: var(--tabbar-padding, 16px);
padding-top: 8px;
padding-bottom: 8px;
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: 18px 0;
box-sizing: border-box;
}
.landscape-vertical-tabs__item + .landscape-vertical-tabs__item {
margin-top: 10px;
}
.landscape-vertical-tabs__inner {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.landscape-vertical-tabs__icon {
width: var(--tabbar-icon-size, 28px);
height: var(--tabbar-icon-size, 28px);
flex-shrink: 0;
}
.landscape-vertical-tabs__label {
margin-top: 6px;
font-size: 12px;
color: #8a98b5;
text-align: center;
width: 100%;
max-width: 104px;
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 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"
@change="emit('tabChange', ($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs"
:key="index"
:name="index"
:text="item.label">
<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<{
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";
/* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */
.tabbar-icon-img {
width: var(--tabbar-icon-size, 24px);
height: var(--tabbar-icon-size, 24px);
}
</style>
<template>
<!-- <view class="home-frame-container scene-shell-root hf-embed-in-tab-slot"> -->
<!-- 主导航 Tabbar 由 TabBarShell 横/竖壳承担;此处仅内容区 -->
<!-- <view class="home-content hf-content-without-tabbar"> -->
<!-- <view class="right-side"> -->
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 HomeFrameTabbar) -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
<view class="app-content-box">
<!-- ✅ 性能优化:骨架屏 + 异步加载 -->
<StartReceptionSkeleton v-if="!startReceptionLoaded" />
<view v-else-if="props.showStartReception"
class="start"
hover-class="start-hover"
@click="onStartClick">
<view class="start-inner">
<view class="start-icon-wrap">
<un-icon name="play-right-fill" size="14" color="#1677ff"></un-icon>
</view>
<text class="start-text">开始接待</text>
</view>
</view>
<view class="right-content-box flex-row">
<view class="content-left">
<view class="module-box box-class">
<!-- ✅ 性能优化:骨架屏 + 异步加载 -->
<ProductIntroSkeleton v-if="!productIntroLoaded" />
<view v-else-if="props.swiperCustom" class="content-box">
<ProductIntroSwiper
:load-complete="props.introLoadComplete ?? false"
:swiper-list="props.introSwiperList ?? []"
:modules="props.introModules ?? []"
:eyebrow="props.introEyebrow ?? '权益中心'"
:empty-title="props.introEmptyTitle ?? '权益配置中'"
:empty-text="props.introEmptyText ?? '敬请期待'"
:show-switch-product="props.introShowSwitchProduct ?? false"
@swiper-change="onIntroSwiperChange"
@slide-tap="onIntroSlideTap"
@switchProduct="onIntroSwitchProduct" />
</view>
<view v-else class="content-box swiper-placeholder">
<text class="placeholder-text">敬请期待</text>
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">
<text class="title-text">{{ props.toolBoxTitle ?? '展业工具' }}</text>
</view>
<view class="content-box tool-content-box">
<!-- 展业工具骨架屏 -->
<ToolSkeleton v-if="!toolBoxLoaded" :count="4" />
<view v-else class="swiper-placeholder">
<un-empty
mode="data"
text="敬请期待"
>
</un-empty>
</view>
</view>
</view>
</view>
<!-- <view class="content-right box-class">
<view class="common-title">
<text class="title-text">服务中心</text>
</view>
<view class="content-box">
<HomeFrameMessageIndex class="message-box" />
</view>
</view> -->
</view>
</view>
<!-- </view> -->
<!-- </view> -->
<!-- </view> -->
</template>
<script setup lang="uts">
import { defineExpose, onMounted, ref } from "vue";
// ✅ 从 uview-unix 模块导入 UnSwiperItem 类型
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue";
import StartReceptionSkeleton from "@/components/Skeleton/StartReceptionSkeleton.uvue";
import ToolSkeleton from "@/components/Skeleton/ToolSkeleton.uvue";
import { delay } from "@/utils/delay.uts"; // ✅ 导入延迟执行工具函数
// import { cssClassRef, useResolutionConfig } from "@/services/adapter";
// import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
const props = withDefaults(defineProps<{
showFooter?: boolean
swiperCustom?: boolean
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
introLoadComplete?: boolean
introSwiperList?: UnSwiperItem[]
introModules?: any[]
introEyebrow?: string
introEmptyTitle?: string
introEmptyText?: string
introSwiperHeight?: number | null
/** 精品 Pad:产品介绍区展示「切换产品」按钮(对齐 simgle_app HomeSlot) */
introShowSwitchProduct?: boolean
/** 是否显示「开始接待」按钮;未传或为 true 时显示 */
showStartReception?: boolean
/** 展业工具区块标题,默认「展业工具」 */
toolBoxTitle?: string
/**
* 嵌入 `pages/index/index` 的 TabBarShell 槽内:与外层壳叠加时作为 flex 子项占满剩余区域。
* 独立整页使用 HomeFrame 时不要传(默认 false)。
*/
embedInTabSlot?: boolean
}>(), {
showStartReception: true,
introShowSwitchProduct: false,
embedInTabSlot: false,
});
const emit = defineEmits<{
start: []
introSwiperChange: [index: number]
introSlideTap: [index: number]
introSwitchProduct: []
}>();
function onIntroSwiperChange(index: number): void {
emit("introSwiperChange", index);
}
function onIntroSlideTap(index: number): void {
emit("introSlideTap", index);
}
function onIntroSwitchProduct(): void {
emit("introSwitchProduct");
}
/** ✅ 性能优化:分模块异步加载状态管理 */
const startReceptionLoaded = ref<boolean>(false); // 开始接待按钮加载状态
const productIntroLoaded = ref<boolean>(false); // 产品介绍模块加载状态
const toolBoxLoaded = ref<boolean>(false); // 展业工具加载状态
// ✅ 性能优化:updateApp 保留供外部调用,但当前无实际逻辑
function updateApp(): void {
// TODO: 如需刷新用户信息,在此添加逻辑
}
function onStartClick(): void {
emit("start");
}
onMounted((): void => {
requestRecordPermission();
// ✅ 性能优化:分模块异步加载,避免低端机白屏
// 初始状态已为 false,无需重复设置
// startReceptionLoaded.value = false; // ← 冗余,移除
// productIntroLoaded.value = false; // ← 冗余,移除
// toolBoxLoaded.value = false; // ← 冗余,移除
// ✅ 修复白屏:增加首次延迟时间,确保骨架屏完全渲染后再开始显示内容
// 低端机上骨架屏渲染可能需要 50-100ms
delay(() => {
// 1. 第一个模块:开始接待按钮(最快)
startReceptionLoaded.value = true;
delay(() => {
// 2. 第二个模块:产品介绍
productIntroLoaded.value = true;
delay(() => {
// 3. 第三个模块:展业工具(最慢)
toolBoxLoaded.value = true;
}, 2); // 约 32ms
}, 2); // 约 32ms
}, 4); // ✅ 增加到 64ms,给骨架屏足够的渲染时间
});
defineExpose({
updateApp
});
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
<template>
<view class="home-frame-container scene-shell-root"
>
<view class="my-center-wrap">
<MyCenterMain :user-info="resolvedUserInfo" />
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
// import { cssClassRef, useResolutionConfig } from "@/services/adapter";
// import { layoutService } from "@/services/LayoutService.uts";
import MyCenterMain from "@/pages/person/MyCenterMain.uvue";
const props = defineProps<{
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 u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.my-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
</style>
<template>
<view class="hf-reception-stack">
<ReceptionCenter />
</view>
</template>
<script setup lang="uts">
import ReceptionCenter from "@/pages/receptionCenter/center.uvue";
</script>
<style scoped lang="scss">
.hf-reception-stack {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
</style>
# HomeFrame 响应式样式配置
## 🎨 企业级设计系统
HomeFrame 采用现代化的企业级设计语言,融合以下核心设计理念:
### 设计原则
- **视觉层次**:通过阴影、渐变、圆角建立清晰的层级关系
- **微交互**:悬停效果、过渡动画提升用户体验
- **响应式适配**:横竖屏自动切换,多分辨率精确适配
- **一致性**:统一的设计令牌(Design Tokens)确保视觉一致性
### 核心特性
✨ **玻璃态卡片** - `backdrop-filter: blur(10px)` 营造现代感
🌈 **渐变色彩** - 企业级渐变色方案(primary/secondary/success)
💫 **流畅动画** - cubic-bezier 缓动函数实现自然过渡
📐 **精确间距** - 8px 网格系统保证布局规整
🎯 **响应式图标** - Entrance 组件图标尺寸随屏幕自适应
---
## 架构说明
HomeFrame 组件采用 **CSS 变量 + layout-root** 的响应式方案,无需手动处理横竖屏切换。
### 核心原理
1. **配置文件** - `index.vars.uts` 定义所有响应式变量
2. **自动注入** - `layout-root` 组件根据屏幕状态自动应用对应的 CSS 变量
3. **样式引用** - SCSS 中使用 `var(--xxx)` 引用变量,自动响应变化
## 配置文件结构
```typescript
// styles/index.vars.uts
export default {
common: {
// 所有场景通用
'--common-title-height': '48px',
// 设计系统变量
'--l-spacing-sm': '8px',
'--l-radius-lg': '16px',
'--l-shadow-md': '0 4px 16px rgba(0, 0, 0, 0.08)',
'--l-bg-card': 'rgba(255, 255, 255, 0.85)',
'--l-gradient-primary': 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
},
portrait: {
// 竖屏专用
'--module-box-height': 'auto',
'--tool-box-min-height': '280px',
'--entrance-icon-size': '52px',
},
landscape: {
// 横屏专用
'--module-box-height': '320px',
'--tool-box-height': '280px',
'--entrance-icon-size': '56px',
},
resolutions: {
// 精确分辨率适配(优先级最高)
'landscape-1024x768': {
'--module-box-height': '360px',
'--entrance-icon-size': '60px',
},
}
}
```
## 使用方式
### 1. 在组件中导入配置
```typescript
import pageVars from "./styles/index.vars"
```
### 2. 在 SCSS 中使用 CSS 变量
```scss
.module-box {
height: var(--module-box-height);
min-height: var(--tool-box-min-height);
}
```
### 3. 无需任何 JavaScript 逻辑
❌ **不需要**:
- 监听屏幕旋转事件
- 手动计算样式
- 条件判断横竖屏
- 动态绑定 `:style`
✅ **只需要**:
- 定义 CSS 变量
- 在 SCSS 中引用
## 变量命名规范
HomeFrame 布局相关变量简洁命名,间距和字体保留 `l-` 前缀:
### 基础变量
| 变量名 | 说明 | 示例值 |
|--------|------|--------|
| `--module-box-height` | 产品介绍模块高度 | `320px` / `auto` |
| `--tool-box-height` | 展业工具模块高度(横屏) | `280px` |
| `--tool-box-min-height` | 展业工具最小高度(竖屏) | `280px` |
| `--tool-box-margin-bottom` | 展业工具底部间距 | `16px` / `0` |
| `--common-title-height` | 通用标题高度 | `48px` |
| `--tabbar-height` | TabBar 高度 | `60px` / `540px` |
| `--tabbar-icon-size` | TabBar 图标大小 | `24px` / `28px` |
| `--tabbar-width` | TabBar 宽度(横屏) | `120px` |
| `--tabbar-padding` | TabBar 内边距(横屏) | `16px` |
| `--entrance-icon-size` | Entrance 图标尺寸 | `52px` / `56px` |
| `--entrance-item-gap` | Entrance 项目间距 | `20px` / `24px` |
### 设计系统变量
| 变量名 | 说明 | 示例值 |
|--------|------|--------|
| `--l-spacing-*` | 间距变量 (xs/sm/md/lg/xl/2xl/3xl) | `4px` ~ `32px` |
| `--l-font-*` | 字体变量 (xs/sm/md/lg) | `12px` ~ `18px` |
| `--l-radius-*` | 圆角变量 (sm/md/lg/xl) | `8px` ~ `20px` |
| `--l-shadow-*` | 阴影变量 (sm/md/lg) | 多层次阴影 |
| `--l-bg-card` | 卡片背景色 | `rgba(255, 255, 255, 0.85)` |
| `--l-gradient-*` | 渐变色 (primary/secondary/success) | 企业级渐变 |
## 配置层级与优先级
```
resolutions[方向-分辨率] > portrait/landscape > common
(最高) (中) (最低)
```
**合并规则**:后合并的配置覆盖前面的同名属性
## 调试方法
1. 打开控制台,查看 `[useScreenVars]` 日志
2. 确认当前应用的 CSS 变量值
3. 旋转屏幕,观察变量是否自动更新
## 注意事项
⚠️ **重要**:
- 变量名必须与 `index.vars.uts` 中定义的完全一致
- 分辨率 key 格式:`{方向}-{宽}x{高}`,如 `portrait-393x816`
- UTS 对象属性间必须用逗号分隔
- 不要在组件中使用 `:style` 动态绑定,让 CSS 变量自动生效
## 扩展新分辨率
在 `resolutions` 中添加新的配置即可:
```typescript
resolutions: {
// 新增 iPad Pro 横屏
'landscape-1366x1024': {
'--module-box-height': '400px',
'--tool-box-height': '320px',
}
}
```
系统会自动识别并应用,无需修改其他代码。
// ========================================================================
// HomeFrame 公共样式 - 横竖屏通用
// ========================================================================
// ===== HomeFrame 容器基础样式 =====
// .home-frame-container {
// width: 100%;
// height: 100%;
// display: flex;
// flex-direction: column;
// position: relative;
// background-color: var(--bg-page, #F8FAFC);
// }
/* 嵌入 index tab 槽(TabBarShell 右侧):在 flex 列/行里占满剩余空间,避免仅依赖 height:100% 横竖屏一侧失效 */
// .home-frame-container.hf-embed-in-tab-slot {
// flex: 1;
// min-height: 0;
// min-width: 0;
// }
// ===== 内容区域布局 =====
.home-content {
// position: relative;
// flex: 1;
// display: flex;
// flex-direction: row;
// width: 100%;
// height: 100%;
// overflow: hidden;
}
// .right-side {
// height: 100%;
// display: flex;
// flex-direction: column;
// overflow: hidden;
// // padding-bottom: var(--tabbar-height);
// }
/* 横屏:Tabbar 在 DOM 中已先于 right-side,侧栏在物理左侧 */
// ===== 应用内容区 =====
.app-content-box {
/* 横屏:与左侧 Tabbar 用户区视觉对齐;竖屏见下方 .mode-portrait 覆盖 */
// margin-top: 40px;
flex: 1;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
padding:var(--content-tabbar-gap, 12px);
// padding: 0 var(--content-box-padding-side);
// margin-bottom: var(--content-box-margin-bottom); /* ✅ 竖屏下为底部 tabBar 预留空间 */
// border:1px solid green
}
// .mode-portrait .app-content-box {
// margin-top: 0;
// }
.right-content {
// padding: var(--l-spacing-lg) 8px var(--l-spacing-2xl);
}
// 大屏平板横屏 (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;
box-sizing: border-box;
position: relative;
z-index: 100;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
overflow: visible;
flex-shrink: 0;
min-width: 100px;
margin-top: 0;
// margin: var(--l-spacing-sm) 0;
padding: 0;
border-radius: var(--l-radius-xl);
background-color: #667eea;
// ✅ 性能优化:移除 box-shadow,低端机渲染压力大
// box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
// ✅ 性能优化:移除 transition,减少重绘开销
}
.start-hover {
// ✅ 性能优化:用 opacity 替代 transform + box-shadow
opacity: 0.85;
}
.start-inner {
position: relative;
z-index: 10;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 var(--l-spacing-lg);
background-color: transparent;
}
.start-icon-wrap {
width: 32px;
height: 32px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.95);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-right: 10px;
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.start-text {
font-size: var(--l-font-lg);
font-weight: 600;
color: #ffffff;
text-align: center;
letter-spacing: 1px;
}
// ✅ UVUE 不支持 @keyframes,已移除动画定义
// 原 startGlowPulse、startShineSweep、startIconBreath 动画已删除
// ===== 右侧内容盒子 =====
.right-content-box {
flex: 1;
display: flex;
flex-direction: row;
// gap: var(--l-spacing-lg);
// padding: var(--l-spacing-md) 0 var(--l-spacing-3xl);
margin-top: var(--l-spacing-md);
overflow: hidden;
// border:1px solid blue
}
.box-class {
background: var(--l-bg-card);
// ✅ UVUE 不支持 backdrop-filter,低端机性能优化
border-radius: var(--l-radius-lg);
overflow: hidden;
display: flex;
flex-direction: column;
// ✅ 性能优化:移除 box-shadow,低端机渲染压力大
// box-shadow: var(--l-shadow-md);
}
.box-class:hover {
// ✅ 性能优化:hover 在移动端无意义,且增加开销
// box-shadow: var(--l-shadow-lg);
// background: var(--l-bg-card-hover);
}
.content-left {
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
.content-right {
flex: 1;
min-width: 200px;
display: flex;
flex-direction: column;
// border:1px solid yellow
}
// ===== 模块盒子(使用 CSS 变量)=====
.module-box {
height: var(--module-box-height);
margin-bottom: var(--l-spacing-xl);
display: flex; // 启用 flex 布局
flex-direction: column; // 垂直排列
}
.tool-box {
flex: 1;
display: flex;
flex-direction: column;
// border:1px solid red
}
// ===== 通用标题和内容 =====
.common-title {
height: var(--common-title-height);
display: flex;
flex-direction: row;
align-items: center;
padding-left: var(--l-spacing-lg);
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
background-color: var(--bg-card, #FFFFFF);
}
.title-text {
font-size: var(--l-font-md);
font-weight: 600;
color: #1a1a1a;
letter-spacing: 0.5px;
position: relative;
}
// ✅ UVUE 不支持 ::before 伪元素,已移除左侧装饰条
// .title-text::before {
// content: '';
// position: absolute;
// left: -12px;
// top: 50%;
// transform: translateY(-50%);
// width: 3px;
// height: 16px;
// background-color: var(--l-color-primary, #667eea);
// border-radius: 2px;
// }
.content-box {
flex: 1;
padding: 0;
overflow: hidden;
}
// 工具区内容区:确保填充剩余空间并支持垂直居中
.tool-content-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.swiper-placeholder {
width: 100%;
height: 100%;
display: flex;
flex-direction: column; // 改为 column 以支持垂直居中
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;
// ✅ UVUE 不支持 word-wrap,white-space: normal 已可实现换行
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-color: #eeeeee;
}
.addr-line-right {
background-color: #eeeeee;
}
// ===== HomeFrame Tabbar(横屏左侧 / 竖屏底部)=====
.home-tabbar {
display: flex;
flex-direction: column;
position: relative;
// width: 120px;
flex-shrink: 0;
background-color: var(--bg-card, #FFFFFF);
.home-tabbar-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.hf-landscape-column,
.user-box,
.landscape-tabbar-wrap,
.home-tabbar-footer {
position: relative;
z-index: 1;
}
}
.home-tabbar-landscape {
min-height: 0;
height: 100%;
align-self: stretch;
}
.home-tabbar-portrait {
width: 100%;
height: var(--tabbar-height, 70px); /* ✅ 使用 CSS 变量控制 tabbar 高度 */
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;
}
.home-tabbar-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 {
// ✅ UVUE 不支持 cursor,移动端无鼠标指针
}
.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;
}
// 横屏:中间区域放 un-tabbar(组件根节点通过 custom-style 纵向排列)
.landscape-tabbar-wrap {
flex: 1;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.landscape-un-tabbar {
width: 100%;
flex: 1;
min-height: 0;
}
/* 横屏:footer 为侧栏第三段,由父级 flex 贴底;竖屏若复用此类名再按需加 margin */
.home-tabbar-footer {
flex-shrink: 0;
// padding-bottom: 10px;
}
.btn-placeholder {
width: 40px;
height: 40px;
background-color: #e8eaef;
border-radius: 20px;
margin: var(--l-spacing-sm) auto 0;
}
/**
* Tabbar Hooks 统一导出
*
* 集中管理 tabbar 相关的 Composable Hooks
*/
// 通用 tabbar 逻辑
export { useTabbarCommon } from "./useTabbar.uts";
export type { UseTabbarCommonReturn } from "./useTabbar.uts";
// 横屏用户信息逻辑
export { useLandscapeUserInfo } from "./useLandscapeUserInfo.uts";
export type { UseLandscapeUserInfoReturn } from "./useLandscapeUserInfo.uts";
/**
* 横屏 Tabbar 用户信息 Hook
*
* 管理横屏侧栏的用户头像和姓名显示
*/
import { ref, onMounted, type Ref } from "vue";
import { storage } from "@/utils/storage.uts";
import { toStr } from "@/utils/common.uts";
/** Hook 返回值类型 */
type UseLandscapeUserInfoReturn = {
userName: Ref<string>
avatarText: Ref<string>
}
export function useLandscapeUserInfo(): UseLandscapeUserInfoReturn {
const userName = ref<string>("");
/** ✅ 头像文字:从 storage 获取用户信息,取姓名首字 */
const avatarText = ref<string>("我");
onMounted(() => {
const userInfo = storage.getUserInfo();
if (userInfo != null) {
const __userName = toStr(userInfo.get("userName") ?? "");
userName.value = __userName;
avatarText.value = __userName == "" ? "我" : __userName.substring(0, 1);
}
});
return {
userName,
avatarText
};
}
/**
* Tabbar 通用逻辑 Hook
*
* 提取 Portrait 和 Landscape 的公共逻辑,减少代码重复
*/
import { HOME_FRAME_TABS, type TabItem } from "../tabbarShared.uts";
/** Hook 返回值类型 */
type UseTabbarCommonReturn = {
tabs: TabItem[]
getIconSrc: (item: TabItem, active: boolean) => string
}
export function useTabbarCommon(): UseTabbarCommonReturn {
const tabs = HOME_FRAME_TABS;
/**
* 根据激活状态获取图标路径
*/
const getIconSrc = (item: TabItem, active: boolean): string => {
return active ? item.iconSrcActive : item.iconSrcInactive;
};
return {
tabs,
getIconSrc
};
}
/**
* Tabbar 模块导出
*
* 统一导出 tabbar 相关的组件和工具函数
*/
// 场景壳组件导出(唯一入口)
export { default as TabBarShell } from "./TabBarShell.uvue";
// Tabbar 组件导出
export { default as HomeFrameTabbarLandscape } from "./Landscape.uvue";
export { default as HomeFrameTabbarPortrait } from "./Portrait.uvue";
// Composable Hooks
export { useTabbarCommon, useLandscapeUserInfo } from "./hooks";
export type { UseTabbarCommonReturn, UseLandscapeUserInfoReturn } from "./hooks";
// 类型和工具函数导出
export type { HomeFrameTabbarSource } from "./tabbarShared.uts";
export { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar, HOME_FRAME_TABS } from "./tabbarShared.uts";
import { computed, ref } from "vue";
import { storage } from "@/utils/storage.uts";
import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
export type HomeFrameTabbarSource = {
getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
}
/** SceneShell `provide`:`Ref<UTSJSONObject>`;MainTabShell `inject`,与插槽同源 */
export const SCENE_SHELL_USER_INFO_INJECT_KEY = "homeFrame.sceneShellUserInfo"
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 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);
notifyUserSceneTypeChanged(sceneType);
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,
currentTabIndex,
sceneTypeList,
sceneTypeIdList,
userName,
onTabChange,
onScenePopupVisible,
onSettingVisible,
onSceneChange,
onSetting,
onChooseScene,
jumpPersonCenter
};
}
<template>
<un-page class="layout-root layout-column-shell" :class="[resolutionState.cssClass]">
<slot />
</un-page>
</template>
<script setup lang="uts">
import { resolutionState, useResolutionConfig } from "@/services/adapter/index.uts";
// 在这里统一调用初始化,确保任何使用 Layout 的页面都能获得正确的配置
useResolutionConfig();
</script>
<style>
.layout-column-shell {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
</style>
...@@ -56,7 +56,7 @@ import BannerSkeleton from "@/components/Skeleton/BannerSkeleton.uvue"; ...@@ -56,7 +56,7 @@ import BannerSkeleton from "@/components/Skeleton/BannerSkeleton.uvue";
// ✅ 从 uview-unix 模块导入 UnSwiperItem 类型 // ✅ 从 uview-unix 模块导入 UnSwiperItem 类型
import type { UnSwiperItem } from "@/uni_modules/uview-unix"; import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import { useScreenVars } from "@/services/adapter/hooks/index.uts"; import { useScreenVars } from "@/services/adapter/hooks/index.uts";
import homeFramePageVars from "./styles/index.vars.uts"; // ✅ 直接导入 import homeFramePageVars from "@/pages/index/styles/index.vars";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
loadComplete: boolean loadComplete: boolean
......
<template>
<view class="rrl-root">
<view class="rrl-header">
<text class="rrl-title">最近接待记录</text>
<text class="rrl-more" @click="onViewAll">查看全部</text>
</view>
<view class="rrl-content">
<view v-if="loading" class="rrl-loading">
<text class="rrl-loading-text">加载中...</text>
</view>
<view v-else-if="cardList.length == 0" class="rrl-empty">
<text class="rrl-empty-text">暂无接待记录</text>
</view>
<view v-else :class="['rrl-list', isPortrait ? 'rrl-list--portrait' : 'rrl-list--landscape']">
<view
v-for="(item, idx) in cardList"
:key="'rrl-' + idx"
class="rrl-card"
@click="onCardClick(item.rawData)"
>
<view class="rrl-card-top">
<text class="rrl-card-name">{{ item.customerName }}</text>
<text :class="['rrl-card-badge', item.badgeBgClass]">
{{ item.resultText }}
</text>
</view>
<view class="rrl-card-info">
<text class="rrl-card-label">{{ item.carTypeText }}</text>
<text class="rrl-card-time">{{ item.timeText }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { type Ref, computed, onMounted, ref } from "vue";
import { getList } from "@/api/receiption.uts";
import { useOrientation } from "@/services/adapter/hooks/index.uts";
import { getStr } from "@/pages/receptionCenter/types/reception-center-helpers.uts";
import { formatReceptionDateTime, getReceptionResultBadgeBgClass } from "@/pages/receptionCenter/lists/reception-list-helpers.uts";
type ReceptionCardItem = {
customerName: string;
resultText: string;
badgeBgClass: string;
carTypeText: string;
timeText: string;
rawData: UTSJSONObject;
};
const props = withDefaults(defineProps<{
/** 最多展示条数 */
limit?: number
}>(), {
limit: 3
});
// 横竖屏检测
const orientationHook = useOrientation();
const isPortrait = computed((): boolean => {
return (orientationHook.isPortrait as Ref<boolean>).value;
});
const cardList = ref<ReceptionCardItem[]>([]);
const loading = ref(true);
function buildCardItem(row: UTSJSONObject): ReceptionCardItem {
const result = getStr(row, 'result');
const resultText = result != '' ? result : '进行中';
const carType = getStr(row, 'carType');
const carTypeText = carType != '' ? carType : '未填写车型';
return {
customerName: getStr(row, 'customerName'),
resultText: resultText,
badgeBgClass: getReceptionResultBadgeBgClass(result),
carTypeText: carTypeText,
timeText: formatReceptionDateTime(row, 'start'),
rawData: row
} as ReceptionCardItem;
}
async function fetchRecentList(): Promise<void> {
loading.value = true;
try {
const params = {
pageNum: 1,
pageSize: props.limit,
orderFinishFlag: "1"
} as UTSJSONObject;
const resp = await getList(params);
const respObj = resp as UTSJSONObject;
const rows = (respObj.data as UTSJSONObject)?.rows as UTSJSONObject[] | null;
const data = rows != null ? rows : ([] as UTSJSONObject[]);
const items: ReceptionCardItem[] = [];
let i = 0;
while (i < data.length) {
items.push(buildCardItem(data[i]));
i++;
}
cardList.value = items;
} catch (_e) {
cardList.value = [];
} finally {
loading.value = false;
}
}
function onCardClick(rawData: UTSJSONObject): void {
uni.navigateTo({
url: `/pages/receptionCenter/forms/FormDetail?record=${encodeURIComponent(JSON.stringify(rawData))}`
});
}
function onViewAll(): void {
uni.navigateTo({ url: "/pages/receptionCenter/center" });
}
onMounted(() => {
void fetchRecentList();
});
</script>
<style scoped lang="scss">
.rrl-root {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
min-height: 0;
max-height: 100%;
overflow: hidden;
}
.rrl-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 6px 0 8px 0;
flex-shrink: 0;
}
.rrl-title {
font-size: 16px;
font-weight: 600;
color: #1e293b;
}
.rrl-more {
font-size: 13px;
color: #3773f8;
padding: 4px 0;
}
.rrl-content {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
}
.rrl-loading,
.rrl-empty {
display: flex;
align-items: center;
justify-content: center;
padding: 24px 0;
}
.rrl-loading-text {
font-size: 14px;
color: #94a3b8;
}
.rrl-empty-text {
font-size: 14px;
color: #94a3b8;
}
.rrl-list {
display: flex;
}
/* 竖屏:纵向排列,纵向滚动 */
.rrl-list--portrait {
flex-direction: column;
}
.rrl-list--portrait .rrl-card {
width: 100%;
margin-bottom: 10px;
}
.rrl-list--portrait .rrl-card:last-child {
margin-bottom: 0;
}
/* 横屏:横向排列,占满一行 */
.rrl-list--landscape {
flex-direction: row;
flex-wrap: nowrap;
}
.rrl-list--landscape .rrl-card {
flex: 1;
margin-right: 10px;
min-width: 0;
}
.rrl-list--landscape .rrl-card:last-child {
margin-right: 0;
}
.rrl-card {
background: #ffffff;
border: 1px solid #f1f5f9;
border-radius: 12px;
padding: 12px 14px;
box-sizing: border-box;
flex-shrink: 0;
}
.rrl-card-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
}
.rrl-card-name {
font-size: 15px;
font-weight: 600;
color: #1e293b;
flex: 1;
margin-right: 8px;
}
.rrl-card-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 10px;
flex-shrink: 0;
}
.rrl-card-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.rrl-card-label {
font-size: 13px;
color: #64748b;
}
.rrl-card-time {
font-size: 12px;
color: #94a3b8;
}
</style>
...@@ -59,7 +59,11 @@ ...@@ -59,7 +59,11 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { useTabbarCommon, useLandscapeUserInfo } from "./hooks"; import { ref, onMounted } from "vue";
import { HOME_FRAME_TABS as tabs } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
import { toStr } from "@/utils/common.uts";
const props = defineProps<{ const props = defineProps<{
currentTabIndex: number currentTabIndex: number
...@@ -72,8 +76,17 @@ const emit = defineEmits<{ ...@@ -72,8 +76,17 @@ const emit = defineEmits<{
switchStore: [] switchStore: []
}>(); }>();
const { tabs } = useTabbarCommon(); const userName = ref<string>("");
const { userName, avatarText } = useLandscapeUserInfo(); const avatarText = ref<string>("我");
onMounted(() => {
const userInfo = storage.getUserInfo();
if (userInfo != null) {
const __userName = toStr(userInfo.get("userName") ?? "");
userName.value = __userName;
avatarText.value = __userName == "" ? "我" : __userName.substring(0, 1);
}
});
function onTabItemClick(index: number): void { function onTabItemClick(index: number): void {
emit("tabChange", index); emit("tabChange", index);
...@@ -81,7 +94,59 @@ function onTabItemClick(index: number): void { ...@@ -81,7 +94,59 @@ function onTabItemClick(index: number): void {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/common.scss"; /* ===== 原 common.scss 中横屏 TabBar 相关样式 ===== */
.home-tabbar {
display: flex;
flex-direction: column;
position: relative;
flex-shrink: 0;
background-color: var(--bg-card, #FFFFFF);
.home-tabbar-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.hf-landscape-column,
.user-box,
.landscape-tabbar-wrap,
.home-tabbar-footer {
position: relative;
z-index: 1;
}
}
.home-tabbar-landscape {
min-height: 0;
height: 100%;
align-self: stretch;
}
.user-box {
padding-top: 46px;
}
.user-box-clickable {
}
.landscape-tabbar-wrap {
flex: 1;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.home-tabbar-footer {
flex-shrink: 0;
}
/* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */ /* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */
.hf-landscape-column { .hf-landscape-column {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { useTabbarCommon } from "./hooks"; import { HOME_FRAME_TABS as tabs } from "./tabbarShared.uts";
const props = defineProps<{ const props = defineProps<{
currentTabIndex: number currentTabIndex: number
...@@ -34,12 +34,35 @@ const props = defineProps<{ ...@@ -34,12 +34,35 @@ const props = defineProps<{
const emit = defineEmits<{ const emit = defineEmits<{
tabChange: [name: string | number] tabChange: [name: string | number]
}>(); }>();
const { tabs } = useTabbarCommon();
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/common.scss"; /* ===== 原 common.scss 中竖屏 TabBar 相关样式 ===== */
.home-tabbar {
display: flex;
flex-direction: column;
position: relative;
flex-shrink: 0;
background-color: var(--bg-card, #FFFFFF);
}
.home-tabbar-portrait {
width: 100%;
height: var(--tabbar-height, 70px);
flex-shrink: 0;
flex-direction: column;
align-items: stretch;
padding: 0;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.home-tabbar-portrait-pad {
padding-bottom: 6px;
}
.portrait-un-tabbar {
width: 100%;
}
/* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */ /* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */
.tabbar-icon-img { .tabbar-icon-img {
......
<template> <template>
<layout-root :page-vars="resolvedPageVars">
<!-- TabBar 壳组件:横/竖两套布局 + 默认槽;方向由 useOrientation 驱动 --> <!-- TabBar 壳组件:横/竖两套布局 + 默认槽;方向由 useOrientation 驱动 -->
<view v-if="shellIsPortrait" class="scene-shell-root-portrait"> <view v-if="shellIsPortrait" class="scene-shell-root-portrait">
<view class="scene-shell-slot-portrait"> <view class="scene-shell-main-portrait">
<slot></slot> <slot></slot>
</view> </view>
<view class="scene-shell-tabbar-portrait"> <view class="scene-shell-tabbar-portrait">
<Portrait :current-tab-index="props.activeTabIndex" <Portrait :current-tab-index="props.activeTabIndex"
@tab-change="onTabChange" /> @tab-change="(name: string | number) => onTabChange(name)" />
</view> </view>
</view> </view>
<view v-else class="scene-shell-root-landscape"> <view v-else class="scene-shell-root-landscape">
<view class="scene-shell-body-landscape"> <view class="scene-shell-body-landscape">
<Landscape :user-name="userName" <Landscape :user-name="userName"
:current-tab-index="props.activeTabIndex" :current-tab-index="props.activeTabIndex"
@tab-change="onTabChange" @tab-change="(name: string | number) => onTabChange(name)"
@setting="onSetting" @setting="onSetting"
@jump-person-center="jumpPersonCenter" @jump-person-center="jumpPersonCenter"
@switch-store="onSwitchStore" /> @switch-store="onSwitchStore" />
<view class="scene-shell-slot-landscape"> <view class="scene-shell-main-landscape">
<slot></slot> <slot></slot>
</view> </view>
</view> </view>
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
<!-- ✅ 统一的设置弹窗(横竖屏共用) --> <!-- ✅ 统一的设置弹窗(横竖屏共用) -->
<SettingBox :visible="showSetting" <SettingBox :visible="showSetting"
@update:visible="onSettingVisible" /> @update:visible="onSettingVisible" />
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
...@@ -39,13 +41,24 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts"; ...@@ -39,13 +41,24 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import Landscape from "./Landscape.uvue"; import Landscape from "./Landscape.uvue";
import Portrait from "./Portrait.uvue"; import Portrait from "./Portrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts"; import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts"; import { navigateToTab, useHomeFrameTabbar } from "./tabbarShared.uts";
// pageVars 自动匹配
import homePageVars from "@/pages/index/styles/index.vars";
import personVars from "@/pages/person/styles/index.vars";
defineSlots(); defineSlots();
const props = defineProps<{ const props = defineProps<{
/** 当前 tab 页下标:0 首页、1 接待中心、2 我的(与 un-tabbar 高亮一致) */ /** 当前 tab 页下标:0 首页、1 我的(与 un-tabbar 高亮一致) */
activeTabIndex: number activeTabIndex: number
/** 页面 CSS 变量,不传时根据 activeTabIndex 自动匹配 */
pageVars?: UTSJSONObject
}>();
const emit = defineEmits<{
/** tab 切换事件:外部可监听做差异化操作(如数据埋点),页面切换已由 TabBar 内部统一处理 */
tabChange: [name: string | number]
}>(); }>();
// updateOrientation(); // updateOrientation();
...@@ -56,6 +69,15 @@ const shellIsPortrait = computed((): boolean => { ...@@ -56,6 +69,15 @@ const shellIsPortrait = computed((): boolean => {
return ip.value == true; return ip.value == true;
}); });
/** 页面 CSS 变量:优先使用显式传入,否则根据 activeTabIndex 自动匹配 */
const resolvedPageVars = computed((): UTSJSONObject => {
if (props.pageVars != null) {
return props.pageVars;
}
if (props.activeTabIndex == 0) return homePageVars as UTSJSONObject;
return personVars as UTSJSONObject;
});
// ✅ Tabbar 逻辑(userInfo 从 storage 直接获取) // ✅ Tabbar 逻辑(userInfo 从 storage 直接获取)
const tabbarSource: HomeFrameTabbarSource = { const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex, getTabIndex: (): number => props.activeTabIndex,
...@@ -67,12 +89,18 @@ const tabbarSource: HomeFrameTabbarSource = { ...@@ -67,12 +89,18 @@ const tabbarSource: HomeFrameTabbarSource = {
const _tabbar = useHomeFrameTabbar(tabbarSource); const _tabbar = useHomeFrameTabbar(tabbarSource);
const userName = _tabbar.userName; const userName = _tabbar.userName;
const showSetting = _tabbar.showSetting; const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onSettingVisible = _tabbar.onSettingVisible; const onSettingVisible = _tabbar.onSettingVisible;
const onSetting = _tabbar.onSetting; const onSetting = _tabbar.onSetting;
const jumpPersonCenter = _tabbar.jumpPersonCenter; const jumpPersonCenter = _tabbar.jumpPersonCenter;
const onSwitchStore = _tabbar.onSwitchStore; const onSwitchStore = _tabbar.onSwitchStore;
/** 统一处理 tab 切换:导航页面 + 转发事件给外部 */
function onTabChange(name: string | number): void {
const idx = name as number;
navigateToTab(idx, props.activeTabIndex);
emit("tabChange", name);
}
onMounted((): void => { onMounted((): void => {
requestRecordPermission(); requestRecordPermission();
hideNativeTabBar(); hideNativeTabBar();
...@@ -94,16 +122,19 @@ onShow(() => { ...@@ -94,16 +122,19 @@ onShow(() => {
min-width: 0; min-width: 0;
} }
.scene-shell-slot-portrait { /** 竖屏:主内容区(TabBar 上方),统一边距 */
.scene-shell-main-portrait {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
padding: 0 var(--content-box-padding-side, 8px);
} }
.scene-shell-tabbar-portrait { .scene-shell-tabbar-portrait {
flex-shrink: 0;
height: var(--tabbar-height, 70px); /* ✅ 使用 CSS 变量控制 tabbar 高度 */ height: var(--tabbar-height, 70px); /* ✅ 使用 CSS 变量控制 tabbar 高度 */
} }
...@@ -128,12 +159,14 @@ onShow(() => { ...@@ -128,12 +159,14 @@ onShow(() => {
overflow: hidden; overflow: hidden;
} }
.scene-shell-slot-landscape { /** 横屏:主内容区(TabBar 右侧),统一边距 */
.scene-shell-main-landscape {
flex: 1 1 0%; flex: 1 1 0%;
min-width: 0; min-width: 0;
min-height: 0; min-height: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
padding: 0 var(--content-box-padding-side, 8px);
} }
</style> </style>
...@@ -8,9 +8,6 @@ export type HomeFrameTabbarSource = { ...@@ -8,9 +8,6 @@ export type HomeFrameTabbarSource = {
getUserInfo: () => null | UTSJSONObject getUserInfo: () => null | UTSJSONObject
} }
/** TabBarShell `provide`:`Ref<UTSJSONObject>`;MainTabShell `inject`,与插槽同源 */
export const SCENE_SHELL_USER_INFO_INJECT_KEY = "homeFrame.sceneShellUserInfo"
/** /**
* 横屏侧栏头像文案:与 simgle_app `LeftSide` 使用 `userInfo.userName` 一致; * 横屏侧栏头像文案:与 simgle_app `LeftSide` 使用 `userInfo.userName` 一致;
* 数科/ROP 返回里常见 `name`、`staffName`、`nickName`、`merchantName` 等作回退。 * 数科/ROP 返回里常见 `name`、`staffName`、`nickName`、`merchantName` 等作回退。
...@@ -41,7 +38,7 @@ export type TabItem = { ...@@ -41,7 +38,7 @@ export type TabItem = {
iconSrcInactive: string; iconSrcInactive: string;
}; };
/** 与 pages.json tabBar 一致:首页 | 接待中心 | 我的(选店为普通页,见 shukeSelectStoreNav) */ /** 与 pages.json tabBar 一致:首页 | 我的 */
export const HOME_FRAME_TABS: TabItem[] = [ export const HOME_FRAME_TABS: TabItem[] = [
{ {
label: "首页", label: "首页",
...@@ -51,13 +48,6 @@ export const HOME_FRAME_TABS: TabItem[] = [ ...@@ -51,13 +48,6 @@ export const HOME_FRAME_TABS: TabItem[] = [
iconSrcInactive: "/static/images/tabbar/home.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: "我的", label: "我的",
icon: "my", icon: "my",
name: "MyCenter", name: "MyCenter",
...@@ -66,22 +56,6 @@ export const HOME_FRAME_TABS: TabItem[] = [ ...@@ -66,22 +56,6 @@ export const HOME_FRAME_TABS: TabItem[] = [
}, },
]; ];
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 { function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath; const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed; const withSlash = "/" + trimmed;
...@@ -107,6 +81,24 @@ function switchTabPage(pagesJsonPath: string): void { ...@@ -107,6 +81,24 @@ function switchTabPage(pagesJsonPath: string): void {
}); });
} }
/**
* 统一 tab 导航函数:可在 TabBar 子组件内部直接调用,
* 外部同时可通过 @tab-change 事件监听做差异化操作。
*/
export function navigateToTab(index: number, currentTabIndex: number): void {
if (index == currentTabIndex) {
return;
}
if (index == 0) {
switchTabPage("pages/index/index");
return;
}
if (index == 1) {
switchTabPage("pages/person/myCenter");
return;
}
}
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showSetting = ref(false); const showSetting = ref(false);
...@@ -118,28 +110,13 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { ...@@ -118,28 +110,13 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
return resolveHomeFrameDisplayName(source.getUserInfo()); return resolveHomeFrameDisplayName(source.getUserInfo());
}); });
const navigateToTab = (index: number): void => { const navigateTab = (index: number): void => {
const cur = source.getTabIndex(); navigateToTab(index, 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 onTabChange = (name: string | number): void => {
const idx = name as number; const idx = name as number;
navigateToTab(idx); navigateTab(idx);
}; };
const onSettingVisible = (v: boolean): void => { const onSettingVisible = (v: boolean): void => {
......
...@@ -34,11 +34,11 @@ import NoData from "./NoData.uvue"; ...@@ -34,11 +34,11 @@ import NoData from "./NoData.uvue";
import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue"; import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
type SceneItem = { class SceneItem {
actived: boolean actived: boolean = false
sceneDesc: string sceneDesc: string = ""
sceneName: string sceneName: string = ""
sceneType: number sceneType: number = 0
} }
const sceneList = ref<SceneItem[]>([ const sceneList = ref<SceneItem[]>([
......
...@@ -10,13 +10,23 @@ import { computed, type ComputedRef } from "vue"; ...@@ -10,13 +10,23 @@ import { computed, type ComputedRef } from "vue";
import { RecordService } from "@/services/recorder/RecordService.uts"; import { RecordService } from "@/services/recorder/RecordService.uts";
/** /**
* 获取录音服务实例 * 录音服务返回值类型
* @returns 录音服务单例
*/ */
export function useRecordService(): { class UseRecordServiceResult {
recordService: RecordService; recordService: RecordService;
isRecording: ComputedRef<boolean>; isRecording: ComputedRef<boolean>;
} {
constructor(recordService: RecordService, isRecording: ComputedRef<boolean>) {
this.recordService = recordService;
this.isRecording = isRecording;
}
}
/**
* 获取录音服务实例
* @returns 录音服务单例
*/
export function useRecordService(): UseRecordServiceResult {
const recordService = RecordService.getInstance(); const recordService = RecordService.getInstance();
// 响应式计算属性:是否正在录音 // 响应式计算属性:是否正在录音
...@@ -24,8 +34,5 @@ export function useRecordService(): { ...@@ -24,8 +34,5 @@ export function useRecordService(): {
return recordService.isReceptioning(); return recordService.isReceptioning();
}); });
return { return new UseRecordServiceResult(recordService, isRecording);
recordService,
isRecording
};
} }
# 图片缓存配置说明
## 📋 配置文件位置
```
config/image-cache.config.uts
```
## ⚙️ 默认配置
```typescript
export const DEFAULT_IMAGE_CACHE_CONFIG: ImageCacheConfig = {
enabled: false, // ⚠️ 默认禁用,提升性能
expiryTime: 7 * 24 * 60 * 60 * 1000, // 7天
maxCacheCount: 100
};
```
## 🎯 为什么默认禁用?
### 1. **性能优化**
- 避免低端机 Storage 阻塞导致 ANR(应用无响应)
- 减少主线程负担,提升页面加载速度
- 降低内存占用
### 2. **用户体验**
- 快速启动,无白屏等待
- 流畅的页面切换
- 减少卡顿和掉帧
### 3. **资源节省**
- 减少 Storage 空间占用
- 降低网络请求(虽然禁用了缓存,但图片本身会从 CDN 加载)
## 🔧 如何启用缓存
### 方法 1:修改配置文件(全局生效)
编辑 `config/image-cache.config.uts`:
```typescript
export const DEFAULT_IMAGE_CACHE_CONFIG: ImageCacheConfig = {
enabled: true, // ✅ 改为 true 启用
expiryTime: 7 * 24 * 60 * 60 * 1000,
maxCacheCount: 100
};
```
### 方法 2:运行时动态修改(推荐)
在设置页面或应用启动时:
```typescript
import imageCache from "@/services/cache/ImageCacheService.uts";
// 启用缓存
imageCache.setEnabled(true);
// 禁用缓存
imageCache.setEnabled(false);
```
### 方法 3:在代码中临时启用
```typescript
import imageCache from "@/services/cache/ImageCacheService.uts";
// 临时启用(仅当前会话)
imageCache.updateConfig({
enabled: true,
expiryTime: 3 * 24 * 60 * 60 * 1000, // 3天
maxCacheCount: 50
});
```
## 📊 配置项说明
| 配置项 | 类型 | 默认值 | 说明 |
|--------|------|--------|------|
| `enabled` | boolean | `false` | 是否启用缓存 |
| `expiryTime` | number | `7天` | 缓存过期时间(毫秒) |
| `maxCacheCount` | number | `100` | 最大缓存数量 |
## 💡 使用建议
### 低端机(内存 < 2GB)
```typescript
// 保持默认禁用
imageCache.setEnabled(false);
```
### 中高端机(内存 >= 4GB)
```typescript
// 可以启用,但限制缓存数量
imageCache.updateConfig({
enabled: true,
maxCacheCount: 50, // 限制数量
expiryTime: 3 * 24 * 60 * 60 * 1000 // 缩短过期时间
});
```
### 离线场景需求强
```typescript
// 完全启用,延长过期时间
imageCache.updateConfig({
enabled: true,
expiryTime: 30 * 24 * 60 * 60 * 1000, // 30天
maxCacheCount: 200
});
```
## 🔍 检查缓存状态
```typescript
import imageCache from "@/services/cache/ImageCacheService.uts";
// 检查是否启用
const enabled = imageCache.isEnabled();
console.log('缓存状态:', enabled ? '已启用' : '已禁用');
// 获取统计信息
const stats = imageCache.getCacheStats();
console.log('缓存统计:', stats);
// {
// totalCount: 50, // 总缓存数
// validCount: 45, // 有效缓存数
// expiredCount: 5 // 过期缓存数
// }
```
## 🗑️ 清理缓存
```typescript
import imageCache from "@/services/cache/ImageCacheService.uts";
// 清空所有缓存
imageCache.clearAllCache();
// 删除单个缓存
imageCache.removeCache('cache_key');
```
## 📝 注意事项
1. **默认禁用是出于性能考虑** - 除非有明确的离线需求,否则建议保持禁用
2. **启用后会增加 Storage 占用** - 注意监控存储空间
3. **缓存会自动清理** - 过期或超出数量限制时自动删除
4. **异步写入不阻塞** - 即使启用也不会影响主线程性能
## 🚀 最佳实践
```typescript
// App.uvue 或 main.uts
import imageCache from "@/services/cache/ImageCacheService.uts";
import { isImageCacheEnabled } from "@/config/image-cache.config.uts";
onLaunch(() => {
// 根据设备性能决定是否启用
const deviceInfo = uni.getDeviceInfo();
if (isImageCacheEnabled()) {
// 配置已启用,可以根据设备调整参数
if (deviceInfo.memorySize < 2 * 1024) {
// 低端机:禁用
imageCache.setEnabled(false);
console.log('[性能优化] 低端机已禁用图片缓存');
} else {
// 中高端机:启用但限制数量
imageCache.updateConfig({
maxCacheCount: 50
});
console.log('[性能优化] 已启用图片缓存(限制50条)');
}
}
});
```
---
**总结**:默认禁用缓存是为了保证最佳性能,如需离线功能可按需启用。
/**
* 图片缓存配置
*
* 说明:
* - 默认禁用图片缓存,以提升低端机性能
* - 可在设置页面中由用户手动启用
* - 启用后支持离线访问,但会增加 Storage 占用
*/
export interface ImageCacheConfig {
/** 是否启用图片缓存(默认禁用) */
enabled: boolean;
/** 缓存过期时间(毫秒),默认 7 天 */
expiryTime: number;
/** 最大缓存数量,默认 100 条 */
maxCacheCount: number;
}
/**
* 默认图片缓存配置
*
* 注意:默认禁用缓存,原因:
* 1. 避免低端机 Storage 阻塞导致 ANR
* 2. 减少内存占用
* 3. 提升页面加载速度
*
* 如需启用,可在设置页面中修改
*/
export const DEFAULT_IMAGE_CACHE_CONFIG: ImageCacheConfig = {
enabled: false, // ⚠️ 默认禁用,提升性能
expiryTime: 7 * 24 * 60 * 60 * 1000, // 7天
maxCacheCount: 100
};
/**
* 获取图片缓存配置
*/
export function getImageCacheConfig(): ImageCacheConfig {
return DEFAULT_IMAGE_CACHE_CONFIG;
}
/**
* 检查图片缓存是否启用
*/
export function isImageCacheEnabled(): boolean {
return DEFAULT_IMAGE_CACHE_CONFIG.enabled;
}
...@@ -101,10 +101,8 @@ ...@@ -101,10 +101,8 @@
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.uvue", "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.uvue",
"^home-frame$": "@/components/HomeFrame/index.uvue",
"^layout-root$": "@/components/LayoutRoot/index.uvue", "^layout-root$": "@/components/LayoutRoot/index.uvue",
"^Layout$": "@/components/Layout/index.uvue", "^Layout$": "@/components/Layout/index.uvue",
"^segment-tab$": "@/pages/receptionCenter/SegmentTab.uvue",
"^reception-detail$": "@/pages/receptionCenter/receptionDetail.uvue", "^reception-detail$": "@/pages/receptionCenter/receptionDetail.uvue",
"^app-navbar$": "@/components/AppNavbar/index.uvue" "^app-navbar$": "@/components/AppNavbar/index.uvue"
} }
...@@ -137,12 +135,6 @@ ...@@ -137,12 +135,6 @@
"selectedIconPath": "static/images/tabbar/home-active.png" "selectedIconPath": "static/images/tabbar/home-active.png"
}, },
{ {
"pagePath": "pages/receptionCenter/center",
"text": "接待中心",
"iconPath": "static/images/tabbar/record.png",
"selectedIconPath": "static/images/tabbar/record-active.png"
},
{
"pagePath": "pages/person/myCenter", "pagePath": "pages/person/myCenter",
"text": "我的", "text": "我的",
"iconPath": "static/images/tabbar/study.png", "iconPath": "static/images/tabbar/study.png",
......
<template> <template>
<view class="page-container boutique-home-panel"> <view class="content-left">
<HomeFrame ref="homeRef" <view class="module-box box-class">
class="boutique-home-frame-root" <!-- ✅ 性能优化:骨架屏 + 异步加载 -->
:embed-in-tab-slot="true" <ProductIntroSkeleton v-if="!logic.loadComplete.value" />
:show-footer="true" <view v-else class="content-box">
:swiper-custom="true" <ProductIntroSwiper
:intro-load-complete="logic.loadComplete.value" :load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList" :swiper-list="boutiqueIntroSwiperList"
:intro-modules="introModulesForHomeFrame" :modules="introModulesForHomeFrame"
:intro-eyebrow="boutiqueIntroEyebrowText" :eyebrow="boutiqueIntroEyebrowText"
intro-empty-title="暂无数据" empty-title="暂无数据"
:intro-empty-text="boutiqueIntroEmptyText" :empty-text="boutiqueIntroEmptyText"
:intro-show-switch-product="true" :show-switch-product="true"
@intro-slide-tap="onIntroSlideTap" @slide-tap="onIntroSlideTap"
@introSwitchProduct="onIntroSwitchProduct" @switch-product="onIntroSwitchProduct" />
@start="handleStart"> </view>
</HomeFrame> </view>
<view class="recent-list-wrapper">
<RecentReceptionList />
</view>
<CenterPopup :list="padBusinessTypePopupItems" <CenterPopup :list="padBusinessTypePopupItems"
title="请选择接待类型" title="请选择接待类型"
...@@ -50,22 +53,35 @@ ...@@ -50,22 +53,35 @@
<script setup lang="uts"> <script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts"; import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, nextTick, ref } from "vue"; import { ComponentPublicInstance, computed, nextTick, onShow, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue"; import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue"; import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import { recordService } from "@/services/recorder/index.uts"; import ProductIntroSwiper from "@/components/ProductIntroSwiper.uvue";
import { storage } from "@/utils/storage.uts"; import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue";
// ✅ 从 uview-unix 模块导入 UnSwiperItem 类型 // ✅ 从 uview-unix 模块导入 UnSwiperItem 类型
import type { UnSwiperItem } from "@/uni_modules/uview-unix"; import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import RecentReceptionList from "@/components/RecentReceptionList.uvue";
const props = defineProps<{ const props = defineProps<{
logic: BoutiqueLogic /** 可选的业务逻辑对象,不传时内部自动创建(遵循场景 panel 自包含约定) */
logic?: BoutiqueLogic | null
}>(); }>();
const logic = props.logic; const logic: BoutiqueLogic = (props.logic != null) ? props.logic : useBoutiqueLogic();
/** 组件级 onShow:每次页面展示时刷新数据(initIfNeeded 有内部防重复守卫) */
let _initialized = false;
onShow(() => {
if (!_initialized) {
_initialized = true;
void logic.initIfNeeded();
}
void logic.getBoutiquePackageList();
});
/** 模板里对嵌套 ComputedRef 的解包因端而异,用本地 computed 收口 */ /** 模板里对嵌套 ComputedRef 的解包因端而异,用本地 computed 收口 */
const introModulesForHomeFrame = computed((): any[] => { const introModulesForHomeFrame = computed((): any[] => {
...@@ -117,7 +133,6 @@ const padBusinessTypePopupItems = computed((): any[] => { ...@@ -117,7 +133,6 @@ const padBusinessTypePopupItems = computed((): any[] => {
return list != null ? list : ([] as any[]); return list != null ? list : ([] as any[]);
}); });
const homeRef = ref(null);
const packageRef = ref(null); const packageRef = ref(null);
/** 切换产品:受控弹层(与 CenterPopup `visible` + `update:visible` 用法一致) */ /** 切换产品:受控弹层(与 CenterPopup `visible` + `update:visible` 用法一致) */
const showPadBusinessTypePopup = ref<boolean>(false); const showPadBusinessTypePopup = ref<boolean>(false);
...@@ -127,49 +142,6 @@ function callExposedMethod(comp: any, methodName: string): void { ...@@ -127,49 +142,6 @@ function callExposedMethod(comp: any, methodName: string): void {
(comp as ComponentPublicInstance).$callMethod(methodName); (comp as ComponentPublicInstance).$callMethod(methodName);
} }
async function handleStart(): Promise<void> {
const permitted = await recordService.isPermission();
if (permitted != true) {
return;
}
let typeCode = logic.padSelectedTypeCode.value;
if (typeCode === "") {
const tiRaw = storage.get("typeItem");
if (tiRaw != null) {
// iOS 兼容:storage.get 可能返回字符串,需要解析
let ti: UTSJSONObject | null = null;
if (typeof tiRaw === "string") {
const strVal = tiRaw as string;
// 检查是否为空字符串
if (strVal.length > 0) {
try {
ti = JSON.parse(strVal) as UTSJSONObject;
} catch (e) {
console.error('[BoutiqueHomePanel] 解析 typeItem 失败');
}
}
} else if (tiRaw instanceof UTSJSONObject) {
ti = tiRaw as UTSJSONObject;
}
if (ti != null) {
const v = ti["typeCode"] as string | null;
typeCode = v != null ? v : "";
}
}
}
if (typeCode === "") {
uni.showToast({ title: "请先加载或选择产品类型", icon: "none" });
return;
}
const q = `typeCode=${encodeURIComponent(typeCode)}&type=edit`;
uni.navigateTo({ url: `/pages/equity/detail/index?${q}` });
}
function onChooseCustomerType(index: number): void {
logic.chooseCustomerType(homeRef.value as any, index);
}
function toDetail(index: number): void { function toDetail(index: number): void {
const list = logic.introCarouselItems.value; const list = logic.introCarouselItems.value;
const item = index >= 0 && index < list.length ? list[index] : null; const item = index >= 0 && index < list.length ? list[index] : null;
...@@ -205,33 +177,27 @@ function closePackageDetail(): void { ...@@ -205,33 +177,27 @@ function closePackageDetail(): void {
logic.chooseItem.value = {}; logic.chooseItem.value = {};
} }
function updateHome(): void {
logic.jumpPage(homeRef.value as any, "");
}
defineExpose({
updateHome
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* 套在 TabBarShell flex 链内时,仅用 height:100% 竖屏常算不出高度;与权益页同级结构一致用 flex 占满 */ .content-left {
.page-container.boutique-home-panel {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; width: 100%;
box-sizing: border-box; height: 100%;
min-height: 0;
}
.module-box {
flex-shrink: 0;
height: var(--module-box-height, 420px);
} }
.boutique-home-frame-root { .recent-list-wrapper {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
min-width: 0; overflow: hidden;
width: 100%; margin-top: var(--l-spacing-sm, 8px);
} }
.package-detail-box { .package-detail-box {
......
<template> <template>
<view class="page-container equity-page hf-equity-tab-root fade-in"> <view class="content-left">
<HomeFrame ref="homeRef" <view class="module-box box-class">
:embed-in-tab-slot="true" <ProductIntroSkeleton v-if="!loadComplete" />
:show-footer="true" <view v-else class="content-box">
:swiper-custom="true" <ProductIntroSwiper
:intro-load-complete="loadComplete" :load-complete="loadComplete"
:intro-swiper-list="equitySwiperList" :swiper-list="equitySwiperList"
:intro-modules="moduleList" :modules="moduleList"
intro-eyebrow="权益中心" eyebrow="权益中心"
intro-empty-title="权益配置中" empty-title="权益配置中"
@intro-slide-tap="onIntroSlideTap" empty-text="敬请期待"
@start="handleStart"> @slide-tap="onIntroSlideTap" />
</HomeFrame> </view>
</view>
<view class="tool-box box-class">
<view class="common-title">
<text class="title-text">{{ toolBoxTitle }}</text>
</view>
<view class="content-box tool-content-box">
<ToolSkeleton v-if="!toolBoxLoaded" :count="4" />
<view v-else class="swiper-placeholder">
<un-empty mode="data" text="敬请期待"></un-empty>
</view>
</view>
</view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue"; import { computed, onMounted, ref } from "vue";
// ✅ UVUE 类型导入:uview-unix 模块为二进制文件,使用本地定义的类型 // ✅ UVUE 类型导入:uview-unix 模块为二进制文件,使用本地定义的类型
import { UnSwiperItem } from "@/types/uview-unix-types.uts"; import { UnSwiperItem } from "@/types/uview-unix-types.uts";
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList, getPadBusinessTypeListApi } from "@/api/common-api.uts"; import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
import { getMockData, getSoureData } from "@/api/system-api.uts"; import { getMockData, getSoureData } from "@/api/system-api.uts";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import imageCache from "@/services/cache/ImageCacheService.uts";
import { recordService } from "@/services/recorder/index.uts";
import { dispatch, state } from "@/store/index.uts"; import { dispatch, state } from "@/store/index.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { delay } from "@/utils/delay.uts";
import ProductIntroSwiper from "@/components/ProductIntroSwiper.uvue";
import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue";
import ToolSkeleton from "@/components/Skeleton/ToolSkeleton.uvue";
const homeRef = ref(null);
const loadComplete = ref<boolean>(false); const loadComplete = ref<boolean>(false);
const moduleList = ref<Array<any>>([]); const moduleList = ref<Array<any>>([]);
const toolList = ref<Array<any>>([]); const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>(""); const mediaId = ref<number | string>("");
const toolBoxTitle = ref<string>("展业工具");
const toolBoxLoaded = ref<boolean>(false);
const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp"; const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp";
...@@ -129,105 +143,6 @@ function setViewInfo(data: any): void { ...@@ -129,105 +143,6 @@ function setViewInfo(data: any): void {
} }
} }
/** 与 `useBoutiqueLogic.normalizePadBizTypeRows` 一致:biz-types/list 响应容错 */
function normalizePadBizTypeRows(bizRes: any | null): any[] {
if (bizRes == null) {
return [] as any[];
}
if (Array.isArray(bizRes)) {
return bizRes as any[];
}
const root = bizRes as UTSJSONObject;
const d = root["data"];
if (d != null && Array.isArray(d)) {
return d as any[];
}
if (d != null) {
const obj = d as UTSJSONObject;
const list = obj["list"];
if (list != null && Array.isArray(list)) {
return list as any[];
}
const records = obj["records"];
if (records != null && Array.isArray(records)) {
return records as any[];
}
}
return [] as any[];
}
const rowPadTypeCode = (row: UTSJSONObject): string => {
const a = row["typeCode"] as string | null;
if (a != null && a !== "") {
return a;
}
const b = row["type_code"] as string | null;
return b != null ? b : "";
};
const rowPadTypeName = (row: UTSJSONObject): string => {
const a = row["typeName"] as string | null;
if (a != null && a !== "") {
return a;
}
const b = row["type_name"] as string | null;
return b != null ? b : "";
};
/** 无 `typeItem` 时拉 biz-types 首条写入 storage,与 simgle_app 权益首页 onLoad 一致 */
async function ensurePadTypeItemForReception(): Promise<void> {
const existing = storage.get("typeItem") as UTSJSONObject | null;
if (existing != null) {
const tc = existing["typeCode"] as string | null;
if (tc != null && tc !== "") {
return;
}
}
try {
const bizRes = await getPadBusinessTypeListApi();
const rows = normalizePadBizTypeRows(bizRes);
if (rows.length == 0) {
return;
}
const first = rows[0] as UTSJSONObject;
const typeCode = rowPadTypeCode(first);
const typeName = rowPadTypeName(first);
if (typeCode === "") {
return;
}
storage.set(
"typeItem",
{
typeCode: typeCode,
typeName: typeName
} as UTSJSONObject,
0
);
} catch (_e) {
// 忽略:handleStart 会提示无 typeCode
}
}
async function handleStart(): Promise<void> {
const permitted = await recordService.isPermission();
if (permitted != true) {
return;
}
await ensurePadTypeItemForReception();
const typeItem = storage.get("typeItem") as UTSJSONObject | null;
let typeCode = "";
if (typeItem != null) {
const tc = typeItem["typeCode"] as string | null;
typeCode = tc != null ? tc : "";
}
if (typeCode === "") {
uni.showToast({ title: "未获取到展业类型,请稍后重试", icon: "none" });
return;
}
const q = `typeCode=${encodeURIComponent(typeCode)}&type=edit`;
uni.navigateTo({ url: `/pages/equity/detail/index?${q}` });
}
function getReceptionCover(obj: UTSJSONObject): string { function getReceptionCover(obj: UTSJSONObject): string {
const source = obj.receptionSourceDetailList; const source = obj.receptionSourceDetailList;
if (source == null) { if (source == null) {
...@@ -329,9 +244,8 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis ...@@ -329,9 +244,8 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis
const storageKey = `source_${sceneType}_${shopMerchantId}`; const storageKey = `source_${sceneType}_${shopMerchantId}`;
// ✅ 简化调用:imageCache 内部自动判断是否启用
let data: null | UTSJSONObject = null; let data: null | UTSJSONObject = null;
const cachedData = imageCache.getCache(storageKey); const cachedData = storage.get(storageKey) as UTSJSONObject | null;
if (cachedData != null) { if (cachedData != null) {
data = cachedData as UTSJSONObject; data = cachedData as UTSJSONObject;
...@@ -352,8 +266,7 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis ...@@ -352,8 +266,7 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis
if (requestData != null) { if (requestData != null) {
setViewInfo(requestData as UTSJSONObject); setViewInfo(requestData as UTSJSONObject);
// ✅ 简化调用:imageCache 内部自动判断是否写入 storage.set(storageKey, requestData, 0);
imageCache.setCache(storageKey, requestData);
} else { } else {
loadComplete.value = true; loadComplete.value = true;
} }
...@@ -433,7 +346,7 @@ function get_Vehicle_Sales_Data(): void { ...@@ -433,7 +346,7 @@ function get_Vehicle_Sales_Data(): void {
}); });
} }
onLoad((_options) => { function initEquityData(): void {
getMockData(true).then(mockdata => { getMockData(true).then(mockdata => {
console.log(mockdata, "==="); console.log(mockdata, "===");
const userInfo = storage.get("userInfo") as UTSJSONObject; const userInfo = storage.get("userInfo") as UTSJSONObject;
...@@ -447,6 +360,15 @@ onLoad((_options) => { ...@@ -447,6 +360,15 @@ onLoad((_options) => {
} }
}); });
get_Vehicle_Sales_Data(); get_Vehicle_Sales_Data();
}
onLoad((_options) => {
initEquityData();
});
// 作为子组件嵌入 TabBarShell 槽时 onLoad 不触发,补 onMounted
onMounted(() => {
initEquityData();
}); });
onShow(() => { onShow(() => {
...@@ -469,6 +391,12 @@ onShow(() => { ...@@ -469,6 +391,12 @@ onShow(() => {
return; return;
} }
}); });
// 延迟加载展业工具骨架屏
delay(() => {
toolBoxLoaded.value = true;
}, 4);
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -476,13 +404,11 @@ onShow(() => { ...@@ -476,13 +404,11 @@ onShow(() => {
@import "../styles/landscape.scss"; @import "../styles/landscape.scss";
@import "../styles/portrait.scss"; @import "../styles/portrait.scss";
/* 与 BoutiqueHomePanel 一致:嵌在 TabBarShell 槽内时参与 flex,避免竖屏高度链断掉 */ .content-left {
.hf-equity-tab-root { width: 100%;
flex: 1; height: 100%;
min-height: 0;
min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box; min-height: 0;
} }
</style> </style>
<template>
<view v-if="showStartReception"
class="start"
hover-class="start-hover"
@click="onStartClick">
<view class="start-inner">
<view class="start-icon-wrap">
<un-icon name="play-right-fill" size="14" color="#1677ff"></un-icon>
</view>
<text class="start-text">开始接待</text>
</view>
</view>
</template>
<script setup lang="uts">
import { recordService } from "@/services/recorder/index.uts";
import { storage } from "@/utils/storage.uts";
const props = withDefaults(defineProps<{
/** 是否显示「开始接待」按钮 */
showStartReception?: boolean
/**
* 业务类型编码,不传时自动从 storage 读取。
* 消费方按场景传入(如精品场景从 logic.padSelectedTypeCode 获取),
* 无个性化需求可不传。
*/
typeCode?: string
}>(), {
showStartReception: true,
typeCode: "",
});
const emit = defineEmits<{
/** 开始接待事件:外部可监听做差异化操作,页面跳转已由 RecordStart 内部统一处理 */
start: []
}>();
async function onStartClick(): Promise<void> {
// 1. 统一检查录音权限
const permitted = await recordService.isPermission();
if (permitted != true) {
return;
}
// 2. 获取 typeCode:优先使用传入值,否则从 storage 读取
let typeCode = props.typeCode;
if (typeCode === "") {
const typeItem = storage.get("typeItem") as UTSJSONObject | null;
if (typeItem != null) {
const tc = typeItem["typeCode"] as string | null;
typeCode = tc != null ? tc : "";
}
}
// 3. 校验 typeCode
if (typeCode === "") {
uni.showToast({ title: "请先加载或选择产品类型", icon: "none" });
return;
}
// 4. 统一跳转接待详情页
const q = `typeCode=${encodeURIComponent(typeCode)}&type=edit`;
uni.navigateTo({ url: `/pages/equity/detail/index?${q}` });
// 5. 通知外部
emit("start");
}
</script>
<style scoped lang="scss">
.start {
height: 80px;
box-sizing: border-box;
position: relative;
z-index: 100;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
overflow: visible;
flex-shrink: 0;
min-width: 100px;
margin-top: 0;
padding: 0;
border-radius: var(--l-radius-xl);
background-color: #667eea;
}
.start-hover {
opacity: 0.85;
}
.start-inner {
position: relative;
z-index: 10;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 var(--l-spacing-lg);
background-color: transparent;
}
.start-icon-wrap {
width: 32px;
height: 32px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.95);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-right: 10px;
}
.start-text {
font-size: var(--l-font-lg);
font-weight: 600;
color: #ffffff;
text-align: center;
letter-spacing: 1px;
}
</style>
<template> <template>
<!-- <!--
简化版首页:仅产品介绍(精品套餐),无多场景切换。 ScenePanelShell — 场景面板策略调度壳
TabBarShell:横/竖 MainTabShell + 槽,见 TabBarShell.uvue Strategy 模式:每个场景 panel 是一条独立的 Strategy,
通过 sceneContext 自判激活状态,无需 if/else 链。
新增场景:创建 panel → 在此 import + 添加一行标签。
--> -->
<view class="hf-home-main-tab"> <view class="app-content-box">
<view class="hf-home-main-inner"> <view class="right-content-box flex-row">
<BoutiqueHomePanel :logic="logic" /> <BoutiqueHomePanel />
<!-- 预留:新增场景时在此处添加 <EquityHomePanel /> 等标签 -->
</view> </view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue"; import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
const props = defineProps<{
logic: BoutiqueLogic
}>();
const logic = props.logic;
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.hf-home-main-tab { .app-content-box {
flex: 1; flex: 1;
width: 100%;
height: 100%; height: 100%;
min-height: 0; width: 100%;
min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden;
padding: var(--content-tabbar-gap, 12px);
} }
.hf-home-main-inner { .right-content-box {
flex: 1; flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: row;
margin-top: var(--l-spacing-md);
overflow: hidden;
} }
</style> </style>
<template> <template>
<!-- 物理「首页」tab:TabBarShell + 产品介绍(精品) --> <TabBarShell :active-tab-index="0">
<layout-root :page-vars="pageVars">
<view class="index-shell-page"> <view class="index-shell-page">
<view class="index-shell-scene-stretch"> <view class="index-shell-scene-stretch">
<TabBarShell ref="shellRef"
:active-tab-index="0">
<template #default>
<view class="tab-panel"> <view class="tab-panel">
<HomeMainTab :logic="logic" /> <RecordStart />
<ScenePanelShell />
</view> </view>
</template>
</TabBarShell>
</view> </view>
</view> </view>
</layout-root> </TabBarShell>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue"; import TabBarShell from "@/components/TabBar/TabBarShell.uvue";
import RecordStart from "./RecordStart.uvue";
import ScenePanelShell from "./ScenePanelShell.uvue";
import { provideSceneContext } from "./sceneContext.uts";
import { storage } from "@/utils/storage.uts";
import TabBarShell from "@/components/HomeFrame/tabbar/TabBarShell.uvue"; /** 当前场景 ID(默认精品,后续可从用户配置读取) */
import HomeMainTab from "@/components/HomeFrame/presets/HomeMainTab.uvue"; provideSceneContext("boutique");
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import pageVars from "@/components/HomeFrame/styles/index.vars"
const shellRef = ref(null);
const logic = useBoutiqueLogic();
onShow(async () => { onShow(async () => {
await logic.initIfNeeded(); const userInfo = storage.get("userInfo");
await logic.getBoutiquePackageList(); if (userInfo == null) {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
const userInfoObj = userInfo as UTSJSONObject;
const shopMerchantId = (userInfoObj.shopMerchantId as string) ?? "";
if (shopMerchantId == null || shopMerchantId === "") {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
}); });
</script> </script>
...@@ -40,7 +49,6 @@ onShow(async () => { ...@@ -40,7 +49,6 @@ onShow(async () => {
flex-direction: column; flex-direction: column;
} }
/* 吃掉 index 页剩余主轴尺寸;横竖屏都要有明确高宽,内层 height:100% / flex 链才能算对 */
.index-shell-scene-stretch { .index-shell-scene-stretch {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
...@@ -74,5 +82,6 @@ onShow(async () => { ...@@ -74,5 +82,6 @@ onShow(async () => {
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
} }
</style> </style>
/**
* 场景调度 Context(Strategy 模式的上下文层)
*
* 角色分配:
* ScenePanelShell(Context)→ provide 当前场景 ID
* 各场景 panel(Strategy) → inject + useSceneActivation 自判激活
*
* 新增场景时:在 ScenePanelShell 注册 provide + 添加一行 panel 标签即可,
* 无需修改任何条件分支逻辑。
*/
import { computed, inject, provide, ref, type ComputedRef, type Ref } from "vue";
/** provide/inject 的 key */
export const SCENE_KEY = "__scene_current__";
export type SceneContext = {
currentScene: Ref<string>;
};
/** 被 ScenePanelShell 调用:向子树广播当前场景 ID */
export function provideSceneContext(initialScene: string): SceneContext {
const currentScene: Ref<string> = ref(initialScene);
provide(SCENE_KEY, currentScene);
return { currentScene };
}
/**
* 场景 panel 调用:判断本 panel 是否处于激活场景。
* 返回 ComputedRef,场景切换时模板 v-if 自动响应。
* 若无 SceneContext(独立使用场景)默认 true,兼容单场景独立运行。
*/
export function useSceneActivation(sceneId: string): ComputedRef<boolean> {
const ctx = inject<SceneContext | null>(SCENE_KEY, null);
if (ctx == null) {
return computed(() => true);
}
return computed(() => ctx.currentScene.value === sceneId);
}
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<CommonFunctions <CommonFunctions
@select-store="goSelectStore" @select-store="goSelectStore"
@attendance="goAttendance" @attendance="goAttendance"
@setting="onSetting" /> @setting="onSetting"
@reception-entry="goReceptionCenter" />
</view> </view>
</view> </view>
...@@ -49,7 +50,7 @@ import SettingBox from "./SettingBox.uvue"; ...@@ -49,7 +50,7 @@ import SettingBox from "./SettingBox.uvue";
import ProfileCard from "./components/ProfileCard.uvue"; import ProfileCard from "./components/ProfileCard.uvue";
import AccountInfo from "./components/AccountInfo.uvue"; import AccountInfo from "./components/AccountInfo.uvue";
import CommonFunctions from "./components/CommonFunctions.uvue"; import CommonFunctions from "./components/CommonFunctions.uvue";
import { resolveHomeFrameDisplayName } from "@/components/HomeFrame/tabbar/tabbarShared.uts"; import { resolveHomeFrameDisplayName } from "@/components/TabBar/tabbarShared.uts";
import { toObj,toStr, type ObjOrNull } from "@/utils/common.uts"; import { toObj,toStr, type ObjOrNull } from "@/utils/common.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
...@@ -148,6 +149,10 @@ function goAttendance(): void { ...@@ -148,6 +149,10 @@ function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" }); uni.navigateTo({ url: "/pages/person/attendance" });
} }
function goReceptionCenter(): void {
uni.navigateTo({ url: "/pages/receptionCenter/center" });
}
async function goSelectStore(): Promise<void> { async function goSelectStore(): Promise<void> {
try { try {
uni.showLoading({ title: "加载中", mask: true }); uni.showLoading({ title: "加载中", mask: true });
......
<template> <template>
<InfoSection title="常用功能" :border="false"> <InfoSection title="常用功能" :border="false">
<un-cell title="接待记录"
icon="chat-fill"
isLink
clickable
@click="onReceptionEntry"
size="large" />
<un-cell title="选择门店" <un-cell title="选择门店"
icon="home-fill" icon="home-fill"
isLink isLink
...@@ -27,6 +33,7 @@ const emit = defineEmits<{ ...@@ -27,6 +33,7 @@ const emit = defineEmits<{
selectStore: [] selectStore: []
attendance: [] attendance: []
setting: [] setting: []
receptionEntry: []
}>() }>()
function onSelectStore(): void { function onSelectStore(): void {
...@@ -40,4 +47,8 @@ function onAttendance(): void { ...@@ -40,4 +47,8 @@ function onAttendance(): void {
function onSetting(): void { function onSetting(): void {
emit('setting') emit('setting')
} }
function onReceptionEntry(): void {
emit('receptionEntry')
}
</script> </script>
<template> <template>
<layout-root :page-vars="pageVars">
<TabBarShell ref="shellRef" <TabBarShell ref="shellRef"
:active-tab-index="2"> :active-tab-index="1">
<!-- ✅ 修复空指针:骨架屏和真实内容同时渲染 --> <!-- ✅ 修复空指针:骨架屏和真实内容同时渲染 -->
<PersonSkeleton v-if="!userInfoLoaded" /> <PersonSkeleton v-if="!userInfoLoaded" />
<MyCenterMain @loaded="onMyCenterLoaded" /> <MyCenterMain @loaded="onMyCenterLoaded" />
</TabBarShell> </TabBarShell>
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from "vue"; import { ref } from "vue";
import TabBarShell from "@/components/HomeFrame/tabbar/TabBarShell.uvue"; import TabBarShell from "@/components/TabBar/TabBarShell.uvue";
import pageVars from "./styles/index.vars";
import MyCenterMain from "./MyCenterMain.uvue"; import MyCenterMain from "./MyCenterMain.uvue";
import PersonSkeleton from "./skeleton/PersonSkeleton.uvue"; import PersonSkeleton from "./skeleton/PersonSkeleton.uvue";
......
<template>
<view :class="rootClass" :style="containerRootStyle">
<slot />
</view>
</template>
<script setup lang="uts">
import { computed } from 'vue'
/**
* 接待看板统一毛玻璃卡片容器:背景、描边、圆角、阴影与 flex 纵向布局。
* - plain:仅外壳,无默认内边距与底部间距(自行控制留白)
* - output:24px 内边距(产值、对比条等卡片)
* - funnel:同 output,并保留底部 10px 外边距(与列表间距一致)
*/
const props = withDefaults(
defineProps<{
variant?: 'plain' | 'output' | 'funnel'
/** 追加在根节点上的 class,空格分隔,便于业务侧扩展布局或覆盖 */
extraClass?: string
/** 分辨率适配等场景下覆盖 padding / 圆角 / 外边距(与 class 叠加,内联优先) */
rootStyle?: UTSJSONObject | null
}>(),
{
variant: 'output',
extraClass: '',
rootStyle: null
}
)
const containerRootStyle = computed((): UTSJSONObject => {
const s = props.rootStyle
if (s != null) {
return s
}
return {} as UTSJSONObject
})
const rootClass = computed((): string => {
let s = 'card-container'
if (props.variant == 'output' || props.variant == 'funnel') {
s += ' card-container--padded'
}
if (props.variant == 'funnel') {
s += ' card-container--funnel-gap'
}
if (props.extraClass != null && props.extraClass != '') {
s += ' ' + props.extraClass
}
return s
})
</script>
<style scoped lang="scss">
.card-container {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(255, 255, 255, 0.6);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
border-radius: 20px;
flex-direction: column;
}
.card-container--padded {
padding: 12px 8px 8px 8px;
}
.card-container--funnel-gap {
margin-bottom: var(--card-container--funnel-gap, 14px);
}
</style>
<template>
<card-container variant="funnel">
<view class="title-box">
<text class="title-text">接待记录情况</text>
</view>
<view class="funnel-container">
<view class="flow-layout">
<view class="funnel-main">
<view class="metric-card metric-card-primary">
<text class="metric-label">接待成交数</text>
<text class="metric-value">{{ funnelCountDisplay1 }}</text>
</view>
<view class="metric-card metric-card-secondary">
<text class="metric-label">接待战败数</text>
<text class="metric-value">{{ funnelCountDisplay2 }}</text>
</view>
</view>
<view class="rate-badge">
<text class="rate-caption">接待成交率</text>
<text class="rate-value">{{ contactRateMasked }}%</text>
</view>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
/** 业绩看板聚合数据,与 center 中 performanceData 同源 */
const props = withDefaults(
defineProps<{
performanceData?: UTSJSONObject | null
/** 为 false 时隐藏客流数值 */
metricsVisible?: boolean
}>(),
{
performanceData: null,
metricsVisible: true
}
)
const performanceRef = computed((): UTSJSONObject => {
const pd = props.performanceData
return pd != null ? pd : ({} as UTSJSONObject)
})
function getNum(data: UTSJSONObject, key: string): number {
const v = data[key]
if (v == null) {
return 0
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? 0 : n
}
const cumulativeDeliveryCount = computed(() => getNum(performanceRef.value, 'cumulativeDeliveryCount'))
const actualContactCount = computed(() => getNum(performanceRef.value, 'actualContactCount'))
const funnelCountDisplay1 = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return `${cumulativeDeliveryCount.value}`
})
const funnelCountDisplay2 = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return `${actualContactCount.value}`
})
/** 触客率展示:接口可能返回 0.8(小数)或 80(百分比) */
const contactRateDisplay = computed(() => {
const v = getNum(performanceRef.value, 'contactRate')
if (v > 0 && v < 1) {
return (v * 100).toFixed(1)
}
return v.toFixed(1)
})
const contactRateMasked = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return contactRateDisplay.value
})
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.title-box {
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 700;
}
.funnel-container {
background-color: var(--bg-card-hover, #F4F8FF);
border-radius: 16px;
padding: 8px;
margin-top: var(--reception-dash-flow-card-margin-top, 10px);
flex-direction: column;
overflow: hidden;
}
.flow-layout {
width: 100%;
min-height: 108px;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.funnel-main {
flex: 1;
min-height: 108px;
flex-direction: var(--reception-dash-flow-metric-layout-direction, column);
align-items: stretch;
justify-content: center;
padding-right: var(--reception-dash-flow-metric-to-rate-gap, 10px);
box-sizing: border-box;
}
.metric-card {
width: var(--reception-dash-flow-metric-card-width, 100%);
flex-grow: var(--reception-dash-flow-metric-card-flex-grow, 0);
flex-shrink: var(--reception-dash-flow-metric-card-flex-shrink, 0);
flex-basis: var(--reception-dash-flow-metric-card-flex-basis, auto);
min-height: var(--reception-dash-flow-metric-card-min-height, 48px);
border-radius: 12px;
background: rgba(255, 255, 255, 0.86);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10);
padding: 8px 12px;
box-sizing: border-box;
flex-direction: column;
align-items: var(--reception-dash-flow-metric-text-align-items, flex-start);
justify-content: center;
}
.metric-card-primary {
margin-right: var(--reception-dash-flow-metric-card-primary-margin-right, 0px);
}
.metric-card-secondary {
margin-top: var(--reception-dash-flow-metric-card-secondary-margin-top, 8px);
background: rgba(255, 255, 255, 0.74);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.metric-label {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #7b90ad;
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
width: 100%;
text-align: var(--reception-dash-flow-metric-text-align, left);
}
.metric-value {
margin-top: 3px;
font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700;
color: #1e40af;
line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
width: 100%;
text-align: var(--reception-dash-flow-metric-text-align, left);
}
.rate-badge {
width: var(--reception-dash-flow-rate-badge-size, 94px);
height: var(--reception-dash-flow-rate-badge-size, 94px);
border-radius: var(--reception-dash-flow-rate-badge-radius, 47px);
background-color: var(--bg-card-hover, #EAF2FF);
border: 1px solid #cfe0ff;
box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
padding: 0 8px;
box-sizing: border-box;
flex-direction: column;
align-items: center;
justify-content: center;
}
.rate-caption {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #5f7ea8;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
}
.rate-value {
margin-top: 2px;
font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700;
color: #1d4ed8;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
}
</style>
<template>
<card-container class="card-month-value">
<view class="title-box">
<text class="title-text">本月业绩</text>
</view>
<view class="output-summary">
<!-- 左侧数值 -->
<view class="summary-left">
<text class="summary-label">本月预估总产值</text>
<view class="summary-value-box">
<text class="summary-value-num">{{ summaryNumDisplay }}</text>
<text class="summary-value-unit">{{ summaryUnitDisplay }}</text>
</view>
<view class="summary-personal">
<text class="personal-label">个人产值占比:</text>
<text class="personal-value">{{ personalValueDisplay }}</text>
</view>
</view>
<!-- 右侧环形图 -->
<view class="summary-right">
<view class="ring-chart-wrap">
<!-- 底部灰色环 -->
<view class="ring-bg"></view>
<!-- 进度半圆 -->
<view v-if="ringProgressVisible" class="ring-progress-wrap">
<view class="ring-half ring-half-left">
<view class="ring-half-inner" :style="ringLeftStyle"></view>
</view>
<view class="ring-half ring-half-right">
<view class="ring-half-inner" :style="ringRightStyle"></view>
</view>
</view>
<!-- 中间文本 -->
<view class="ring-inner-text">
<text class="ring-value">{{ ringPercentDisplay }}</text>
<text class="ring-label">个人业绩占比</text>
</view>
</view>
</view>
</view>
<!-- 底部指标 -->
<view class="month-target-box">
<view class="target-item">
<text class="target-label">本月目标产值</text>
<text class="target-value">{{ targetValueDisplay }}</text>
</view>
<view class="target-item">
<text class="target-label">本月达成</text>
<text class="target-value">{{ achievementValueDisplay }}</text>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
import type { OutputSummary } from '../types/reception-output-types.uts'
const props = withDefaults(
defineProps<{
summary: OutputSummary
targetValueText: string
achievementValueText: string
/** 为 false 时隐藏产值与达成相关数值 */
metricsVisible?: boolean
}>(),
{
targetValueText: '--',
achievementValueText: '--',
metricsVisible: true
}
)
/** 环形图用百分比:隐藏时不展示进度弧 */
const ringPercentNumForChart = computed((): number => {
if (props.metricsVisible == false) {
return 0
}
return props.summary.ringPercentNum
})
const summaryNumDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.summary.summaryValueNum
})
const summaryUnitDisplay = computed((): string => {
if (props.metricsVisible == false) {
return ''
}
return props.summary.summaryValueUnit
})
const personalValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.summary.personalValue
})
const ringPercentDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return props.summary.ringPercent
})
/** 有效数据且>0时才显示进度弧;0 或无数据仅展示浅色背景环 */
const ringProgressVisible = computed((): boolean => {
if (props.metricsVisible == false) {
return false
}
const p = ringPercentNumForChart.value
// 无数据常见占位:'--';隐藏态为 '**'
const text = ringPercentDisplay.value
const hasData = text != '--' && text != '**' && text != ''
return hasData && p > 0
})
const targetValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '****'
}
return props.targetValueText
})
const achievementValueDisplay = computed((): string => {
if (props.metricsVisible == false) {
return '**'
}
return props.achievementValueText
})
// 左半圆旋转:0-50% 时旋转 P*360°,50-100% 时固定 180°
const ringLeftStyle = computed((): UTSJSONObject => {
const p = ringPercentNumForChart.value
const p01 = p > 100 ? 1 : (p < 0 ? 0 : p / 100)
const deg = p01 <= 0.5 ? p01 * 360 : 180
return { transform: `rotate(${deg}deg)` } as UTSJSONObject
})
// 右半圆旋转:>50% 时旋转 (P-0.5)*360°,形成连续弧
const ringRightStyle = computed((): UTSJSONObject => {
const p = ringPercentNumForChart.value
const p01 = p > 100 ? 1 : (p < 0 ? 0 : p / 100)
const deg = p01 > 0.5 ? (p01 - 0.5) * 360 : 0
return { transform: `rotate(${deg}deg)` } as UTSJSONObject
})
</script>
<style scoped lang="scss">
.card-month-value {
margin-bottom: 16px;
}
.title-box {
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-month-title-font-size);
font-weight: 700;
}
.output-summary {
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-top: var(--reception-dash-month-output-summary-margin-top);
}
.summary-left {
flex-direction: column;
}
.summary-label {
font-size: var(--reception-dash-month-summary-label-font-size);
color: #64748b;
margin-bottom: var(--reception-dash-month-summary-label-margin-bottom);
}
.summary-value-box {
display: flex;
flex-direction: row;
align-items: flex-end;
}
.summary-value-num {
font-size: var(--reception-dash-month-summary-num-font-size);
font-weight: bold;
color: #1677ff;
}
.summary-value-unit {
font-size: var(--reception-dash-month-summary-unit-font-size);
color: #1677ff;
margin-left: var(--reception-dash-month-summary-unit-margin-left);
padding-bottom: var(--reception-dash-month-summary-unit-padding-bottom);
}
.summary-personal {
flex-direction: row;
margin-top: var(--reception-dash-month-personal-margin-top);
background-color: rgba(22, 119, 255, 0.05);
padding: var(--reception-dash-month-personal-padding);
border-radius: var(--reception-dash-month-personal-radius);
}
.personal-label {
font-size: var(--reception-dash-month-personal-label-font-size);
color: #64748b;
}
.personal-value {
font-size: var(--reception-dash-month-personal-value-font-size);
font-weight: 700;
color: #1677ff;
margin-left: 4px;
}
.summary-right {
position: relative;
flex-direction: column;
align-items: center;
}
.ring-chart-wrap {
position: relative;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
}
.ring-bg {
position: absolute;
left: 0;
top: 0;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
border-radius: var(--reception-dash-month-ring-radius);
border-width: var(--reception-dash-month-ring-border-width);
border-style: solid;
border-color: rgba(22, 119, 255, 0.08);
box-sizing: border-box;
}
.ring-progress-wrap {
position: absolute;
left: 0;
top: 0;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
}
.ring-half {
position: absolute;
top: 0;
width: var(--reception-dash-month-ring-half-size);
height: var(--reception-dash-month-ring-size);
overflow: hidden;
}
.ring-half-left {
left: 0;
}
.ring-half-right {
left: var(--reception-dash-month-ring-half-right-left);
}
.ring-half-inner {
position: absolute;
width: var(--reception-dash-month-ring-size);
height: var(--reception-dash-month-ring-size);
border-radius: var(--reception-dash-month-ring-radius);
border-width: var(--reception-dash-month-ring-border-width);
border-style: solid;
border-color: #1677ff;
box-sizing: border-box;
transform-origin: var(--reception-dash-month-ring-transform-origin);
}
.ring-half-left .ring-half-inner {
left: 0;
border-right-color: transparent;
border-bottom-color: transparent;
}
.ring-half-right .ring-half-inner {
left: var(--reception-dash-month-ring-half-inner-right-left);
border-left-color: transparent;
border-bottom-color: transparent;
}
.ring-inner-text {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
flex-direction: column;
align-items: center;
justify-content: center;
}
.ring-value {
font-size: var(--reception-dash-month-ring-value-font-size);
font-weight: bold;
color: #1e293b;
}
.ring-label {
font-size: var(--reception-dash-month-ring-label-font-size);
color: #64748b;
margin-top: var(--reception-dash-month-ring-label-margin-top);
}
.month-target-box {
flex-direction: row;
justify-content: space-between;
padding-top: var(--reception-dash-month-target-padding-top);
}
.target-item {
flex-direction: column;
}
.target-label {
font-size: var(--reception-dash-month-target-label-font-size);
color: #64748b;
}
.target-value {
font-size: var(--reception-dash-month-target-value-font-size);
font-weight: 700;
color: #1e293b;
margin-top: var(--reception-dash-month-target-value-margin-top);
}
</style>
<template>
<card-container class="reception-dash-output-card">
<view class="tabs-box">
<un-segmented
shape="circle"
type="card"
:font-size="'var(--reception-dash-segmented-font-size)'"
:custom-style="{ height: 'var(--reception-dash-segmented-height)' }"
:model-value="tabIndex"
active-color="#000000"
@update:model-value="onSegmentedTabIndex"
>
<un-segmented-item text="本月交付转化率"></un-segmented-item>
<un-segmented-item text="本月交付客单价"></un-segmented-item>
</un-segmented>
</view>
<view class="compare-section">
<view
v-for="(row, idx) in compareRows"
:key="idx"
class="compare-row"
:class="{ 'compare-row-last': idx == compareRows.length - 1 }"
>
<text class="compare-label">{{ row.label }}</text>
<view class="compare-bar-bg">
<view
class="compare-bar-fill"
:class="row.barClass"
:style="compareBarFillStyle(row)"
></view>
</view>
<text class="compare-value">{{ metricsVisible ? row.value : '****' }}</text>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import CardContainer from './CardContainer.uvue'
import type { CompareRow } from '../types/reception-output-types.uts'
const props = withDefaults(
defineProps<{
/** 0=本月交付转化率,1=本月交付客单价 */
tabIndex: number
compareRows: CompareRow[]
/** 为 false 时隐藏对比数值 */
metricsVisible?: boolean
}>(),
{
tabIndex: 0,
compareRows: (): CompareRow[] => [],
metricsVisible: true
}
)
const emit = defineEmits<{
'update:tabIndex': [value: number]
}>()
/** UTS 下勿用 computed({ get, set }) 做 v-model 桥接,运行时会 ClassCastException */
const onSegmentedTabIndex = (v: number): void => {
emit('update:tabIndex', v)
}
function compareBarFillStyle(row: CompareRow): UTSJSONObject {
return {
width: row.barWidthPercent,
height: 'var(--reception-dash-compare-bar-height)',
borderRadius: 'var(--reception-dash-compare-bar-border-radius)'
} as UTSJSONObject
}
</script>
<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 {
flex-direction: row;
justify-content: space-between;
margin-bottom: var(--reception-dash-output-tabs-margin-bottom);
}
.compare-section {
flex-direction: column;
}
.compare-row {
flex-direction: row;
align-items: center;
margin-bottom: var(--reception-dash-compare-row-margin-bottom);
}
.compare-row-last {
margin-bottom: 0;
}
.compare-label {
font-size: var(--reception-dash-compare-label-font-size);
color: #64748b;
width: var(--reception-dash-compare-label-width);
}
.compare-bar-bg {
flex: 1;
height: var(--reception-dash-compare-bar-height);
background-color: rgba(22, 119, 255, 0.08);
border-radius: var(--reception-dash-compare-bar-border-radius);
margin-right: var(--reception-dash-compare-bar-bg-margin-right);
overflow: hidden;
flex-direction: row;
}
.compare-bar-fill {
height: 100%;
border-radius: var(--reception-dash-compare-bar-border-radius);
}
.bg-blue-500 {
background-color: #1677ff;
}
.bg-blue-400 {
background-color: #60a5fa;
}
.compare-value {
font-size: var(--reception-dash-compare-value-font-size);
font-weight: 700;
color: #1e293b;
width: var(--reception-dash-compare-value-width);
text-align: right;
}
</style>
<template>
<card-container variant="funnel">
<view class="title-row">
<text class="title-text">接待时效统计</text>
<view class="pill" :class="metricsVisible ? 'pill--on' : 'pill--off'">
<text class="pill-text">{{ metricsVisible ? '实时' : '隐藏' }}</text>
</view>
</view>
<view class="surface">
<view class="kpi-grid">
<view class="kpi-item kpi-item--primary">
<text class="kpi-label">今日接待</text>
<view class="kpi-value-row">
<text class="kpi-value">{{ metricsVisible ? `${todayReceptionCount}` : '****' }}</text>
<text class="kpi-unit">单</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">待跟进</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? `${todayFollowUpCount}` : '****' }}</text>
<text class="kpi-unit">条</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">平均耗时</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? `${avgMinutes}` : '**' }}</text>
<text class="kpi-unit">分钟</text>
</view>
</view>
<view class="kpi-item">
<text class="kpi-label">接待总时长</text>
<view class="kpi-value-row">
<text class="kpi-value kpi-value--dark">{{ metricsVisible ? peakHour : '**:**' }}</text>
</view>
</view>
</view>
<view class="divider"></view>
<view class="trend-row">
<view class="trend-meta">
<text class="trend-title">近 7 日接待趋势</text>
<text class="trend-sub">{{ metricsVisible ? `${weekTotal}` : '***' }}<text class="trend-sub-unit"> 单</text></text>
</view>
<view class="trend-bars">
<view
v-for="(h, i) in barHeights"
:key="i"
class="bar"
:class="i == barHeights.length - 1 ? 'bar--active' : ''"
:style="{ height: `${h}px` }"
></view>
</view>
</view>
</view>
</card-container>
</template>
<script setup lang="uts">
import { computed } from 'vue'
import CardContainer from './CardContainer.uvue'
const props = withDefaults(
defineProps<{
data?: UTSJSONObject | null
metricsVisible?: boolean
}>(),
{
data: null,
metricsVisible: true
}
)
const metricsVisible = computed((): boolean => props.metricsVisible != false)
const dataRef = computed((): UTSJSONObject => {
const d = props.data
return d != null ? d : ({} as UTSJSONObject)
})
function getNum(data: UTSJSONObject, key: string): number {
const v = data[key]
if (v == null) {
return 0
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? 0 : n
}
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) {
return ''
}
return `${v}`
}
const todayReceptionCount = computed((): number => getNum(dataRef.value, 'todayReceptionCount'))
const todayFollowUpCount = computed((): number => getNum(dataRef.value, 'todayFollowUpCount'))
const avgMinutes = computed((): number => {
const v = getNum(dataRef.value, 'avgMinutes')
const r = Math.round(v)
return r < 0 ? 0 : r
})
const peakHour = computed((): string => {
const s = getStr(dataRef.value, 'peakHour')
return s != '' ? s : '14:00'
})
const weekTrend = computed((): number[] => {
const v = dataRef.value['weekTrend']
if (v == null || (Array.isArray(v)) != true) {
return [12, 18, 15, 22, 16, 19, 24]
}
const arr = v as Array<any>
const out: number[] = []
const n = arr.length
const take = n > 7 ? 7 : n
for (let i = 0; i < take; i++) {
const x = arr[i]
const num = typeof x == 'number' ? x : parseFloat(`${x}`)
out.push(isNaN(num) ? 0 : num)
}
while (out.length < 7) {
out.push(0)
}
return out
})
const weekTotal = computed((): number => {
const t = weekTrend.value
let sum = 0
for (let i = 0; i < t.length; i++) {
sum += t[i]
}
return sum
})
const barHeights = computed((): number[] => {
if (metricsVisible.value == false) {
return [10, 10, 10, 10, 10, 10, 10]
}
const t = weekTrend.value
let max = 0
for (let i = 0; i < t.length; i++) {
if (t[i] > max) {
max = t[i]
}
}
const base = 12
const top = 56
const span = top - base
const out: number[] = []
for (let i = 0; i < t.length; i++) {
const v = t[i]
const ratio = max > 0 ? (v / max) : 0
const h = base + Math.round(span * ratio)
out.push(h)
}
return out
})
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.title-row {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.title-text {
color: #333333;
font-size: var(--reception-dash-flow-title-font-size, 14px);
font-weight: 700;
}
.pill {
height: 24px;
padding: 0 10px;
border-radius: 999px;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid rgba(203, 213, 225, 0.9);
background-color: rgba(248, 250, 252, 0.92);
}
.pill--on {
border-color: rgba(59, 130, 246, 0.25);
background-color: rgba(239, 246, 255, 0.92);
}
.pill--off {
border-color: rgba(148, 163, 184, 0.35);
background-color: rgba(241, 245, 249, 0.92);
}
.pill-text {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
color: #475569;
font-weight: 600;
}
.surface {
background-color: var(--bg-card-hover, #F4F8FF);
border-radius: 16px;
padding: 8px;
margin-top: var(--reception-dash-flow-card-margin-top, 10px);
flex-direction: column;
overflow: hidden;
}
.kpi-grid {
width: 100%;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.kpi-item {
width: 48.5%;
min-height: 56px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.84);
border: 1px solid rgba(255, 255, 255, 0.75);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
padding: var(--reception-dash-flow-kpi-padding, 10px);
box-sizing: border-box;
flex-direction: column;
justify-content: center;
margin-bottom: var(--reception-dash-flow-kpi-margin-bottom, 10px);
}
.kpi-item--primary {
background-color: var(--bg-card, #E1EFFF);
border-color: rgba(59, 130, 246, 0.20);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}
.kpi-label {
font-size: var(--reception-dash-flow-metric-label-font-size, 11px);
color: #6b86a6;
line-height: var(--reception-dash-flow-metric-label-line-height, 14px);
}
.kpi-value-row {
margin-top: 4px;
flex-direction: row;
align-items: center; // ✅ UVUE 不支持 baseline,改用 center
}
.kpi-value {
font-size: var(--reception-dash-flow-metric-value-font-size, 19px);
font-weight: 700; // ✅ UVUE 不支持 800,改为 700 (bold)
color: #1d4ed8;
line-height: var(--reception-dash-flow-metric-value-line-height, 22px);
}
.kpi-value--dark {
color: #0f172a;
}
.kpi-unit {
margin-left: 6px;
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #64748b;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
font-weight: 600;
}
.divider {
height: 1px;
width: 100%;
background-color: rgba(148, 163, 184, 0.22);
margin: 4px 0;
}
.trend-row {
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
}
.trend-meta {
flex: 1;
padding-right: 10px;
box-sizing: border-box;
flex-direction: column;
justify-content: flex-end;
}
.trend-title {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
color: #6b86a6;
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
}
.trend-sub {
margin-top: 4px;
font-size: var(--reception-dash-flow-rate-value-font-size, 17px);
font-weight: 700; // ✅ UVUE 不支持 800,改为 700 (bold)
color: #0f172a;
line-height: var(--reception-dash-flow-rate-value-line-height, 22px);
}
.trend-sub-unit {
font-size: var(--reception-dash-flow-rate-caption-font-size, 11px);
line-height: var(--reception-dash-flow-rate-caption-line-height, 14px);
color: #64748b;
font-weight: 600;
}
.trend-bars {
width: 132px;
height: var(--reception-dash-timeboard-trend-bars-height, 64px);
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
}
.bar {
width: 14px;
border-radius: 10px;
background-color: rgba(148, 163, 184, 0.55);
}
.bar--active {
background-color: rgba(59, 130, 246, 0.96);
// ✅ 性能优化:移除 box-shadow
// box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!