Commit ed8426db by 岑成威

fix: 横竖屏切换

1 parent 07c9557e
Showing 26 changed files with 1009 additions and 1076 deletions
<template> <template>
<view class="home-frame-container" <!-- 物理 tab 三页共用:自定义 Tabbar + 默认槽(首页 / 接待 / 我的由 pages 填入不同主体) -->
<view class="home-frame-container scene-shell-root"
:class="[modeClass, resolutionClass, adapterClass]"> :class="[modeClass, resolutionClass, adapterClass]">
<view class="home-content"> <view class="home-content">
<HomeFrameTabbar :adapter-class="adapterClass" <HomeFrameTabbar :adapter-class="adapterClass"
...@@ -19,6 +20,7 @@ import { cssClassRef, useResolutionConfig } from "@/services/adapter"; ...@@ -19,6 +20,7 @@ import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts"; import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts"; import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import HomeFrameTabbar from "./Tabbar.uvue"; import HomeFrameTabbar from "./Tabbar.uvue";
...@@ -30,13 +32,13 @@ type SceneShellSlots = { ...@@ -30,13 +32,13 @@ type SceneShellSlots = {
default(props: SceneShellSlotProps): any default(props: SceneShellSlotProps): any
}; };
defineSlots<SceneShellSlots>();
const props = defineProps<{ const props = defineProps<{
/** 与当前路由对应:0 首页场景、1 接待中心、2 我的 */ /** 当前 tab 页下标:0 首页、1 接待、2 我的(与 un-tabbar 高亮一致) */
activeTabIndex: number activeTabIndex: number
}>(); }>();
defineSlots<SceneShellSlots>();
useResolutionConfig(); useResolutionConfig();
const adapterClass = computed((): string => { const adapterClass = computed((): string => {
...@@ -66,6 +68,11 @@ function updateApp(): void { ...@@ -66,6 +68,11 @@ function updateApp(): void {
onLoad((_options) => { onLoad((_options) => {
requestRecordPermission(); requestRecordPermission();
hideNativeTabBar();
});
onShow(() => {
hideNativeTabBar();
}); });
defineExpose({ defineExpose({
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
@update:visible="onSettingVisible" /> @update:visible="onSettingVisible" />
</view> </view>
<!-- 竖屏手机:底部 TabBar --> <!-- 竖屏手机:底部 un-tabbar(系统 tabBar 已由 SceneShell hideTabBar 隐藏) -->
<view v-else <view v-else
class="home-tabbar home-tabbar-portrait" class="home-tabbar home-tabbar-portrait"
:class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']"> :class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']">
...@@ -86,6 +86,13 @@ ...@@ -86,6 +86,13 @@
</template> </template>
</un-tabbar-item> </un-tabbar-item>
</un-tabbar> </un-tabbar>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view> </view>
</template> </template>
...@@ -96,6 +103,7 @@ import CenterPopup from "@/components/CenterPopup.uvue"; ...@@ -96,6 +103,7 @@ import CenterPopup from "@/components/CenterPopup.uvue";
import { cssClassRef } from "@/services/adapter"; import { cssClassRef } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts"; import { layoutService } from "@/services/LayoutService.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import SettingBox from "@/pages/person/SettingBox.uvue"; import SettingBox from "@/pages/person/SettingBox.uvue";
...@@ -104,6 +112,7 @@ import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts"; ...@@ -104,6 +112,7 @@ import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
const props = defineProps<{ const props = defineProps<{
adapterClass?: string adapterClass?: string
/** 与当前 tab 页一致:0 首页、1 接待中心、2 我的 */
tabIndex?: number tabIndex?: number
userInfo?: null | UTSJSONObject userInfo?: null | UTSJSONObject
}>(); }>();
...@@ -144,7 +153,6 @@ const tabbarIconSize = computed((): number => { ...@@ -144,7 +153,6 @@ const tabbarIconSize = computed((): number => {
return PORTRAIT_COMMON.tabbarIconSize as number; return PORTRAIT_COMMON.tabbarIconSize as number;
}); });
/** 横屏:un-tabbar 根节点纵向排布,高度与分辨率配置对齐 */
const landscapeTabbarRootStyle = computed((): string => { const landscapeTabbarRootStyle = computed((): string => {
const adapterCls = cssClassRef.value; const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls); const lc = getLandscapeConfig(adapterCls);
...@@ -153,7 +161,6 @@ const landscapeTabbarRootStyle = computed((): string => { ...@@ -153,7 +161,6 @@ const landscapeTabbarRootStyle = computed((): string => {
return `display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:${h};padding-left:${padLeft};padding-top:8px;padding-bottom:8px;box-sizing:border-box;`; return `display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:${h};padding-left:${padLeft};padding-top:8px;padding-bottom:8px;box-sizing:border-box;`;
}); });
/** 横屏单项行高(un-tabbar 内部横向条高度,竖向排列时每行占位) */
const landscapeTabbarInnerHeight = computed((): number => { const landscapeTabbarInnerHeight = computed((): number => {
const adapterCls = cssClassRef.value; const adapterCls = cssClassRef.value;
const lc = getLandscapeConfig(adapterCls); const lc = getLandscapeConfig(adapterCls);
...@@ -283,24 +290,6 @@ const userName = computed((): string => { ...@@ -283,24 +290,6 @@ const userName = computed((): string => {
return s !== "" ? s : ""; return s !== "" ? s : "";
}); });
function resolveMainHomeUrl(): string {
const raw = storage.get("userInfo");
let sceneType = 1;
if (raw != null) {
const st = (raw as UTSJSONObject).sceneType as null | number;
if (st != null) {
sceneType = st;
}
}
let url = "/pages/boutique/index";
if (sceneType == 0) {
url = "/pages/equity/index";
} else if (sceneType == 7) {
url = "/pages/usedCar/index";
}
return url;
}
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;
...@@ -312,21 +301,35 @@ function reLaunchPage(pagesJsonPath: string): void { ...@@ -312,21 +301,35 @@ function reLaunchPage(pagesJsonPath: string): void {
}); });
} }
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);
}
});
}
function navigateToTab(index: number): void { function navigateToTab(index: number): void {
const cur = props.tabIndex != null ? (props.tabIndex as number) : 0; const cur = props.tabIndex != null ? (props.tabIndex as number) : 0;
if (index == cur) { if (index == cur) {
return; return;
} }
if (index == 0) { if (index == 0) {
uni.reLaunch({ url: resolveMainHomeUrl() }); switchTabPage("pages/index/index");
return; return;
} }
if (index == 1) { if (index == 1) {
reLaunchPage("pages/receptionShell"); switchTabPage("pages/receptionCenter/center");
return; return;
} }
if (index == 2) { if (index == 2) {
reLaunchPage("pages/personMyShell"); switchTabPage("pages/person/myCenter");
return; return;
} }
} }
...@@ -370,10 +373,19 @@ function onChooseScene(index: number): void { ...@@ -370,10 +373,19 @@ function onChooseScene(index: number): void {
info.sceneType = sceneType; info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true }); uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0); storage.set("userInfo", info, 0);
let url = "/pages/boutique/index"; uni.switchTab({
if (sceneType == 0) url = "/pages/equity/index"; url: "/pages/index/index",
else if (sceneType == 7) url = "/pages/usedCar/index"; success: () => {
uni.reLaunch({ url }); hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
reLaunchPage("pages/index/index");
}
});
} }
function jumpPersonCenter(): void { function jumpPersonCenter(): void {
...@@ -384,7 +396,6 @@ function jumpPersonCenter(): void { ...@@ -384,7 +396,6 @@ function jumpPersonCenter(): void {
<style scoped lang="scss"> <style scoped lang="scss">
@import "./styles/common.scss"; @import "./styles/common.scss";
/* un-tabbar 为加密包,横屏需自上而下:穿透内部承载 tab 项的横向 flex 容器 */
.home-tabbar-landscape .landscape-un-tabbar > :deep(view) { .home-tabbar-landscape .landscape-un-tabbar > :deep(view) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
<template> <template>
<view class="home-frame-container" <view class="home-frame-container"
:class="[modeClass, resolutionClass, adapterClass]"> :class="[modeClass, resolutionClass, adapterClass, tabSlotEmbedClass]">
<!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content --> <!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content -->
<view class="home-content"> <view class="home-content"
<!-- Tabbar 在前:横屏 row 时自然在屏幕左侧;竖屏仍靠 order 把主内容置上 --> :class="tabbarVisible ? '' : 'hf-content-without-tabbar'">
<HomeFrameTabbar :adapter-class="adapterClass" <!-- Tabbar 在前:横屏 row 时自然在屏幕左侧;竖屏仍靠 order 把主内容置上;套壳页由 SceneShell 承载 Tabbar 时关闭 -->
:tab-index="0" <HomeFrameTabbar v-if="tabbarVisible"
:adapter-class="adapterClass"
:user-info="userInfo" /> :user-info="userInfo" />
<view class="right-side"> <view class="right-side">
...@@ -91,6 +92,8 @@ import { getLandscapeConfig } from "./styles/landscape.uts"; ...@@ -91,6 +92,8 @@ import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig } from "./styles/portrait.uts"; import { getPortraitConfig } from "./styles/portrait.uts";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
/** false:仅渲染主内容区,外层由 SceneShell 等提供 Tabbar(避免双 Tabbar) */
showTabbar?: boolean
showFooter?: boolean showFooter?: boolean
swiperCustom?: boolean swiperCustom?: boolean
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */ /** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
...@@ -105,8 +108,23 @@ const props = withDefaults(defineProps<{ ...@@ -105,8 +108,23 @@ const props = withDefaults(defineProps<{
showStartReception?: boolean showStartReception?: boolean
/** 展业工具区块标题,默认「展业工具」 */ /** 展业工具区块标题,默认「展业工具」 */
toolBoxTitle?: string toolBoxTitle?: string
/**
* 嵌入 `pages/index/index` 的 SceneShell 槽内:与外层壳叠加时作为 flex 子项占满剩余区域。
* 独立整页使用 HomeFrame 时不要传(默认 false)。
*/
embedInTabSlot?: boolean
}>(), { }>(), {
showTabbar: true,
showStartReception: true, showStartReception: true,
embedInTabSlot: false,
});
const tabbarVisible = computed((): boolean => {
return props.showTabbar !== false;
});
const tabSlotEmbedClass = computed((): string => {
return props.embedInTabSlot === true ? "hf-embed-in-tab-slot" : "";
}); });
const emit = defineEmits<{ const emit = defineEmits<{
......
<template>
<!--
层级(仅 index 物理 tab 页):
1) SceneShell:系统级 tab 壳(侧栏/底栏 + 右侧槽),见 SceneShell.uvue
2) HomeMainTab:按 userInfo.sceneType 切换下方三选一子树
3) *HomePanel:各场景业务 + 内层 HomeFrame(三卡片区,embedInTabSlot 与壳分工)
-->
<view class="hf-home-main-tab">
<view v-if="resolvedSceneType === 1"
class="hf-home-main-inner">
<BoutiqueHomePanel :logic="logic" />
</view>
<view v-else-if="resolvedSceneType === 0"
class="hf-home-main-inner">
<EquityHomePanel />
</view>
<view v-else-if="resolvedSceneType === 7"
class="hf-home-main-inner">
<UsedCarHomePanel />
</view>
<view v-else
class="hf-home-main-fallback">
<text class="hf-fallback-text">暂不支持当前场景</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
import EquityHomePanel from "@/pages/equity/components/EquityHomePanel.uvue";
import UsedCarHomePanel from "@/pages/usedCar/components/UsedCarHomePanel.uvue";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { storage } from "@/utils/storage.uts";
const props = defineProps<{
logic: BoutiqueLogic
/** SceneShell 同步的 userInfo;switchTab 回首页时随 updateApp 更新,避免子组件 onShow 不触发导致场景不刷新 */
userInfo?: null | UTSJSONObject
}>();
const logic = props.logic;
function sceneTypeFromStorage(): number {
const raw = storage.get("userInfo");
if (raw == null) {
return 1;
}
const st = (raw as UTSJSONObject).sceneType as null | number;
return st != null ? st : 1;
}
const resolvedSceneType = computed((): number => {
const u = props.userInfo;
if (u != null) {
const st = (u as UTSJSONObject).sceneType as null | number;
if (st != null) {
return st as number;
}
}
return sceneTypeFromStorage();
});
</script>
<style scoped lang="scss">
.hf-home-main-tab {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-inner {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-fallback {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.hf-fallback-text {
font-size: 15px;
color: #666;
text-align: center;
}
</style>
<template> <template>
<view class="my-center-wrap"> <view class="my-center-wrap">
<MyCenter :user-info="resolvedUserInfo" /> <MyCenterMain :user-info="resolvedUserInfo" />
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed } from "vue"; import { computed } from "vue";
import MyCenter from "@/pages/person/myCenter.uvue"; import MyCenterMain from "@/pages/person/MyCenterMain.uvue";
const props = defineProps<{ const props = defineProps<{
userInfo?: null | UTSJSONObject userInfo?: null | UTSJSONObject
......
<template> <template>
<view class="hf-reception-stack"> <view class="hf-reception-stack">
<view class="reception-center-inner"> <ReceptionCenterMain />
<ReceptionCenter @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from "vue"; import ReceptionCenterMain from "@/pages/receptionCenter/ReceptionCenterMain.uvue";
import ReceptionCenter from "@/pages/receptionCenter/center.uvue";
import ReceptionDetail from "@/pages/receptionCenter/receptionDetail.uvue";
const showReceptionDetail = ref(false);
const receptionDetailItem = ref<UTSJSONObject>({});
function onShowReceptionDetail(item: UTSJSONObject): void {
receptionDetailItem.value = item;
showReceptionDetail.value = true;
}
function onReceptionDetailClose(): void {
showReceptionDetail.value = false;
receptionDetailItem.value = {};
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -35,18 +14,6 @@ function onReceptionDetailClose(): void { ...@@ -35,18 +14,6 @@ function onReceptionDetailClose(): void {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 0; min-height: 0;
position: relative;
display: flex;
flex-direction: column;
}
.reception-center-inner,
.reception-detail-inner {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
......
...@@ -12,6 +12,13 @@ ...@@ -12,6 +12,13 @@
background: linear-gradient(to bottom, #e8f0fe, #f5f7fa); background: linear-gradient(to bottom, #e8f0fe, #f5f7fa);
} }
/* 嵌入 index tab 槽(SceneShell 右侧):在 flex 列/行里占满剩余空间,避免仅依赖 height:100% 横竖屏一侧失效 */
.home-frame-container.hf-embed-in-tab-slot {
flex: 1;
min-height: 0;
min-width: 0;
}
// ===== 内容区域布局 ===== // ===== 内容区域布局 =====
.home-content { .home-content {
position: relative; position: relative;
...@@ -34,6 +41,37 @@ ...@@ -34,6 +41,37 @@
direction: ltr; direction: ltr;
} }
/*
* 横屏 row 主槽 flex:须 min-width:0 + flex-basis:0%,否则部分端剩余宽度为 0。
* 拆成两条,避免与「首页内再嵌一套 HomeFrame」共用同一选择器时,改一侧误伤另一侧。
* - scene-shell-root:三 tab 壳(首页 / 接待 / 我的)槽位,侧栏 + 主区
* - hf-content-without-tabbar:内嵌 HomeFrame(精品 / 权益等),无内置 Tabbar
*/
.home-frame-container.scene-shell-root.mode-landscape .home-content > .right-side {
flex: 1 1 0%;
min-width: 0;
min-height: 0;
}
.home-frame-container.mode-landscape .home-content.hf-content-without-tabbar > .right-side {
flex: 1 1 0%;
min-width: 0;
min-height: 0;
}
/* 竖屏 column:主轴为高度,主槽须 min-height:0,与横屏 min-width 对称 */
.home-frame-container.scene-shell-root.mode-portrait .home-content > .right-side {
flex: 1 1 0%;
min-height: 0;
min-width: 0;
}
.home-frame-container.mode-portrait .home-content.hf-content-without-tabbar > .right-side {
flex: 1 1 0%;
min-height: 0;
min-width: 0;
}
.right-side { .right-side {
flex: 1; flex: 1;
display: flex; display: flex;
...@@ -49,6 +87,17 @@ ...@@ -49,6 +87,17 @@
order: 2; order: 2;
} }
/* HomeFrame 仅主内容、Tabbar 由 SceneShell 提供时:单栏铺满 */
.hf-content-without-tabbar .right-side {
flex: 1;
width: 100%;
min-width: 0;
}
.mode-portrait .hf-content-without-tabbar .right-side {
order: 0;
}
/* 横屏:Tabbar 在 DOM 中已先于 right-side,侧栏在物理左侧 */ /* 横屏:Tabbar 在 DOM 中已先于 right-side,侧栏在物理左侧 */
// ===== 应用内容区 ===== // ===== 应用内容区 =====
...@@ -507,3 +556,44 @@ ...@@ -507,3 +556,44 @@
border-radius: 20px; border-radius: 20px;
margin: var(--l-spacing-sm) auto 0; margin: var(--l-spacing-sm) auto 0;
} }
// ========================================================================
// 首页布局调试(仅 pages/index 的 SceneShell 挂 hf-layout-debug 时生效)
// 验证横竖屏分区后删除:index.uvue 上的 hf-layout-debug + 本段样式
// ========================================================================
.hf-layout-debug.scene-shell-root > .home-content > .right-side {
background-color: rgba(160, 140, 255, 0.22);
}
.hf-layout-debug .home-tabbar-landscape {
background-color: rgba(255, 100, 100, 0.38) !important;
}
.hf-layout-debug .home-tabbar-portrait {
background-color: rgba(255, 160, 90, 0.42) !important;
}
/* 内层 HomeFrame(embed)整块主区 */
.hf-layout-debug .hf-embed-in-tab-slot > .home-content > .right-side {
background-color: rgba(90, 200, 220, 0.2);
}
.hf-layout-debug .app-content-box.show-content-box {
background-color: rgba(120, 120, 120, 0.12);
}
.hf-layout-debug .start {
background-color: rgba(255, 230, 80, 0.55) !important;
}
.hf-layout-debug .app-content-box .content-left .module-box {
background-color: rgba(80, 200, 130, 0.4);
}
.hf-layout-debug .app-content-box .content-left .tool-box {
background-color: rgba(80, 140, 255, 0.38);
}
.hf-layout-debug .app-content-box .content-right {
background-color: rgba(200, 120, 255, 0.38);
}
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
} }
}, },
{ {
"path": "pages/receptionShell", "path": "pages/receptionCenter/center",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/personMyShell", "path": "pages/person/myCenter",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationStyle": "custom",
"navigationBarTitleText": "首页" "navigationBarTitleText": "首页"
} }
}, },
...@@ -106,5 +107,34 @@ ...@@ -106,5 +107,34 @@
"backgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8",
"pageOrientation": "auto" "pageOrientation": "auto"
}, },
"tabBar": {
"color": "#8a98b5",
"selectedColor": "#3773f8",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"fontSize": "11px",
"iconWidth": "24px",
"height": "50px",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/images/tabbar/home.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",
"text": "我的",
"iconPath": "static/images/tabbar/study.png",
"selectedIconPath": "static/images/tabbar/study-active.png"
}
]
},
"uniIdRouter": {} "uniIdRouter": {}
} }
<template> <template>
<view class="page-container container"> <view class="page-container boutique-home-panel">
<HomeFrame <HomeFrame ref="homeRef"
ref="homeRef" class="boutique-home-frame-root"
:embed-in-tab-slot="true"
:show-footer="true" :show-footer="true"
:show-tabbar="false"
:swiper-custom="true" :swiper-custom="true"
:intro-load-complete="logic.loadComplete.value" :intro-load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList" :intro-swiper-list="boutiqueIntroSwiperList"
...@@ -11,16 +13,13 @@ ...@@ -11,16 +13,13 @@
intro-empty-title="暂无套餐" intro-empty-title="暂无套餐"
:intro-empty-text="boutiqueIntroEmptyText" :intro-empty-text="boutiqueIntroEmptyText"
@intro-slide-tap="onIntroSlideTap" @intro-slide-tap="onIntroSlideTap"
@start="handleStart" @start="handleStart">
>
</HomeFrame> </HomeFrame>
<CenterPopup <CenterPopup ref="customerTypeRef"
ref="customerTypeRef"
:list="logic.typeList" :list="logic.typeList"
title="请选择当前洽谈的客户类型" title="请选择当前洽谈的客户类型"
@choose="onChooseCustomerType" @choose="onChooseCustomerType" />
/>
<PackageDetailPopup ref="packageRef" @close="closePackageDetail"> <PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<view class="package-detail-box"> <view class="package-detail-box">
...@@ -37,7 +36,8 @@ ...@@ -37,7 +36,8 @@
套餐介绍 套餐介绍
</view> </view>
<view class="package-content"> <view class="package-content">
<rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''"></rich-text> <rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''">
</rich-text>
</view> </view>
</view> </view>
</view> </view>
...@@ -46,16 +46,17 @@ ...@@ -46,16 +46,17 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, ref } from "vue"; import { ComponentPublicInstance, computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue"; import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.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 type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import type { UnSwiperItem } from "@/uni_modules/uview-unix"; import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{ const props = defineProps<{
logic: BoutiqueLogic; logic: BoutiqueLogic
}>(); }>();
const logic = props.logic; const logic = props.logic;
...@@ -93,18 +94,13 @@ const boutiqueIntroEmptyText = computed((): string => { ...@@ -93,18 +94,13 @@ const boutiqueIntroEmptyText = computed((): string => {
const t = logic.swiperNoDataObject["text"]; const t = logic.swiperNoDataObject["text"];
return t != null ? `${t}` : "敬请期待"; return t != null ? `${t}` : "敬请期待";
}); });
const homeRef = ref(null); const homeRef = ref(null);
const customerTypeRef = ref(null); const customerTypeRef = ref(null);
const packageRef = ref(null); const packageRef = ref(null);
function callExposedMethod(comp: any, methodName: string): void { function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return; if (comp == null) return;
const obj = comp as UTSJSONObject; (comp as ComponentPublicInstance).$callMethod(methodName);
const fn = obj[methodName];
if (fn != null && typeof fn === "function") {
(fn as () => void)();
}
} }
function handleStart(): void { function handleStart(): void {
...@@ -132,23 +128,32 @@ function closePackageDetail(): void { ...@@ -132,23 +128,32 @@ function closePackageDetail(): void {
} }
function updateHome(): void { function updateHome(): void {
// 横屏默认进入详情(保持旧行为)
logic.jumpPage(homeRef.value as any, ""); logic.jumpPage(homeRef.value as any, "");
} }
defineExpose({ defineExpose({
updateHome: updateHome updateHome
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.page-container { /* 套在 SceneShell flex 链内时,仅用 height:100% 竖屏常算不出高度;与权益页同级结构一致用 flex 占满 */
.page-container.boutique-home-panel {
flex: 1;
width: 100%; width: 100%;
height: 100%; min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
} }
.container { .boutique-home-frame-root {
position: relative; flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
} }
.package-detail-box { .package-detail-box {
......
<template>
<view class="page-container container">
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
:intro-load-complete="logic.loadComplete.value"
:intro-swiper-list="boutiqueIntroSwiperList"
:intro-modules="logic.packageList.value"
intro-eyebrow="精品轻改"
intro-empty-title="暂无套餐"
:intro-empty-text="boutiqueIntroEmptyText"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart">
</HomeFrame>
<CenterPopup ref="customerTypeRef"
:list="logic.typeList"
title="请选择当前洽谈的客户类型"
@choose="onChooseCustomerType" />
<PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<view class="package-detail-box">
<view class="package-box">
<view class="package-name">
套餐内容
</view>
<view class="package-content">
<rich-text :nodes="logic.chooseItem.value.content != null ? (logic.chooseItem.value.content as string) : ''"></rich-text>
</view>
</view>
<view class="package-box package-detail">
<view class="package-name">
套餐介绍
</view>
<view class="package-content">
<rich-text :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''">
</rich-text>
</view>
</view>
</view>
</PackageDetailPopup>
</view>
</template>
<script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{
logic: BoutiqueLogic;
}>();
const logic = props.logic;
const PKG_BANNER_FALLBACK: UTSJSONObject = {
"1": "/static/images/boutique/package-1.webp",
"2": "/static/images/boutique/package-2.webp"
} as UTSJSONObject;
function bannerUrlForItem(item: any): string {
const u = logic.getPkg(item, "bannerImg") as string;
if (u != null && u !== "") {
return u;
}
const tKey = `${logic.getPkg(item, "type")}`;
const fb = PKG_BANNER_FALLBACK[tKey];
if (fb != null && typeof fb === "string" && fb !== "") {
return fb as string;
}
return "/static/images/boutique/package-1.webp";
}
const boutiqueIntroSwiperList = computed((): UnSwiperItem[] => {
const list = logic.packageList.value;
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
out.push({
url: bannerUrlForItem(list[i])
} as UnSwiperItem);
}
return out;
});
const boutiqueIntroEmptyText = computed((): string => {
const t = logic.swiperNoDataObject["text"];
return t != null ? `${t}` : "敬请期待";
});
const homeRef = ref(null);
const customerTypeRef = ref(null);
const packageRef = ref(null);
function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return;
// uni-app x 组件实例在运行时不一定能 cast 成 UTSJSONObject;用 $callMethod 最稳
(comp as ComponentPublicInstance).$callMethod(methodName);
}
function handleStart(): void {
callExposedMethod(customerTypeRef.value as any, "open");
}
function onChooseCustomerType(index: number): void {
logic.chooseCustomerType(homeRef.value as any, index);
}
function toDetail(index: number): void {
const item = logic.packageList.value[index];
if (item != null) {
logic.chooseItem.value = item as UTSJSONObject;
callExposedMethod(packageRef.value as any, "open");
}
}
function onIntroSlideTap(index: number): void {
toDetail(index);
}
function closePackageDetail(): void {
logic.chooseItem.value = {};
}
function updateHome(): void {
// 竖屏进入时也保持旧行为:如果需要自动跳转详情,复用逻辑层 jumpPage
logic.jumpPage(homeRef.value as any, "");
}
defineExpose({
updateHome
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
.container {
position: relative;
}
</style>
<template> <template>
<layout-root> <view class="boutique-redirect"></view>
<BoutiquePortrait v-if="isPortrait"
ref="portraitRef"
:logic="logic" />
<BoutiqueLandscape v-else
ref="landscapeRef"
:logic="logic" />
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, ref } from "vue"; onLoad(() => {
uni.switchTab({
import BoutiqueLandscape from "@/pages/boutique/components/BoutiqueLandscape.uvue"; url: "/pages/index/index",
import BoutiquePortrait from "@/pages/boutique/components/BoutiquePortrait.uvue"; fail: (_err: any) => {
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts"; uni.reLaunch({ url: "/pages/index/index" });
import { layoutService } from "@/services/LayoutService.uts"; }
});
const logic = useBoutiqueLogic();
const isPortrait = computed(() => layoutService.isMode("portrait"));
// 注意:UTS 运行时对组件实例的类型转换较严格(容易触发 ClassCastException)。
// 这里不再通过父组件 ref 去调用子组件 expose 方法,避免运行时崩溃。
const landscapeRef = ref(null);
const portraitRef = ref(null);
onShow(async () => {
if (logic.ensureLoginOrRelauch() === false) return;
await logic.initIfNeeded();
logic.getBoutiquePackageList();
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* 入口页不承载具体样式,样式下沉到横竖屏组件 */ .boutique-redirect {
width: 100%;
height: 100%;
}
</style> </style>
...@@ -101,7 +101,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void { ...@@ -101,7 +101,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
} }
newUserInfo.sceneType = usedCarSceneType; newUserInfo.sceneType = usedCarSceneType;
storage.set("userInfo", newUserInfo, 0); storage.set("userInfo", newUserInfo, 0);
uni.reLaunch({ url: "/pages/usedCar/index" }); uni.switchTab({
url: "/pages/index/index",
fail: (_err: any) => {
uni.reLaunch({ url: "/pages/index/index" });
}
});
}).catch((error): void => { }).catch((error): void => {
uni.showToast({ title: "网络异常", icon: "none" }); uni.showToast({ title: "网络异常", icon: "none" });
}); });
......
...@@ -80,52 +80,29 @@ function jump(info: UTSJSONObject, data: any | null): void { ...@@ -80,52 +80,29 @@ function jump(info: UTSJSONObject, data: any | null): void {
info.staffUuid = info.uuid; info.staffUuid = info.uuid;
storage.set("userInfo", info, 0); storage.set("userInfo", info, 0);
const sceneType = info.sceneType as null | number;
storage.remove("boutique_YQorderSetting"); storage.remove("boutique_YQorderSetting");
let url = "/pages/index/index"; const url = "/pages/index/index";
switch (sceneType) {
case 0: {
url = "/pages/equity/index";
break;
}
case 1: {
// 精品页统一入口:由入口页内部决定横竖屏组件
url = "/pages/boutique/index";
break;
}
case 7: {
url = "/pages/usedCar/index";
break;
}
}
console.log(`准备跳转: ${ url}`); console.log(`准备跳转: ${ url}`);
uni.switchTab({
url,
fail: (_err: any) => {
uni.reLaunch({ url }); uni.reLaunch({ url });
}
});
}).catch((error) => { }).catch((error) => {
console.error(`getMerchantBrand 失败: ${ JSON.stringify(error)}`); console.error(`getMerchantBrand 失败: ${ JSON.stringify(error)}`);
info.channelType = 1; info.channelType = 1;
storage.set("userInfo", info, 0); storage.set("userInfo", info, 0);
const sceneType = info.sceneType as null | number; const url = "/pages/index/index";
let url = "/pages/index/index";
switch (sceneType) {
case 0: {
url = "/pages/equity/index";
break;
}
case 1: {
// 精品页统一入口:由入口页内部决定横竖屏组件
url = "/pages/boutique/index";
break;
}
case 7: {
url = "/pages/usedCar/index";
break;
}
}
console.log(`准备跳转(catch): ${ url}`); console.log(`准备跳转(catch): ${ url}`);
uni.switchTab({
url,
fail: (_err: any) => {
uni.reLaunch({ url }); uni.reLaunch({ url });
}
});
}); });
} }
......
<template> <template>
<scroll-view style="flex: 1" class="flex flex-col bg-indigo-500"> <!-- 唯一物理「首页」tab:SceneShell(导航壳)+ HomeMainTab(三场景);场景内各自 Panel + HomeFrame(embedInTabSlot) -->
<view class="flex flex-col"> <layout-root>
<view class="flex flex-col"> <view class="index-shell-page">
<view class="flex flex-col px-8 pt-10 pb-8 items-center"> <!-- 可拉伸层:单列 flex 下单个子项须 flex:1+min-height:0 才吃满高度;接待/我的等同层无 flex 故无此问题 -->
<text class="text-3xl font-bold text-white mb-2">uni-app x 示例</text> <view class="index-shell-scene-stretch">
<text class="text-base text-white opacity-90">功能演示与测试</text> <!-- 布局调试:确认结构后去掉 hf-layout-debug -->
</view> <SceneShell ref="shellRef"
class="hf-layout-debug"
<view class="flex flex-col px-12 py-12 flex-1 bg-gray-50 rounded-t-3xl"> :active-tab-index="0">
<view <template #default="{ userInfo }">
class="bg-white rounded-2xl shadow-lg border border-gray-200 overflow-hidden w-full" <view class="tab-panel">
:class="{ 'card-pressed': isCardPressed(item.path) }" <HomeMainTab :logic="logic"
@touchstart="handleTouchStart(item.path)" :user-info="userInfo" />
@touchend="pressedCard = ''"
@tap="toPath(item)"
v-for="item in data"
:key="item.label + item.path"
>
<!-- 使用 justify-between 而不是依赖 flex-1,兼容 App 端布局行为 -->
<view class="flex flex-row items-center p-5 w-full">
<view class="flex flex-row items-center">
<view
class="w-48 h-48 flex items-center justify-center bg-indigo-100 rounded-xl flex-shrink-0 mr-4"
>
<text class="text-2xl">{{ getIcon(item.icon) }}</text>
</view>
<text class="text-lg font-semibold text-gray-800">
{{ item.label }}
</text>
</view>
<view
class="w-32 h-32 flex items-center justify-center bg-indigo-500 rounded-lg flex-shrink-0"
style="margin-left: auto"
>
<text class="text-lg text-white font-bold">→</text>
</view>
</view> </view>
</template>
</SceneShell>
</view> </view>
</view> </view>
</view> </layout-root>
</view>
</scroll-view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { get } from "@/utils/common.uts"; import { ComponentPublicInstance, ref } from "vue";
// import { router } from "@/utils/router.uts";
type Item = {
label: string;
icon?: string;
path?: string;
disabled?: boolean;
hidden?: boolean;
children?: Item[];
};
const data = computed<Item[]>(() => {
return [
{ label: "LocalStore", icon: "database", path: "/pages/demo/local-store/index" },
{ label: "Tailwind CSS", icon: "tailwind", path: "/pages/demo/tailwindcss/index" },
{ label: "gl_tape 迁移", icon: "migrate", path: "/pages/demo/gl-tape-demo/index" },
{ label: "echart", icon: "chart", path: "/pages/demo/echarts/index" },
{ label: "录音示例", icon: "microphone", path: "/pages/demo/record/index" },
{ label: "权限", icon: "lock", path: "/pages/demo/permission/index" },
{ label: "媒体", icon: "media", path: "/pages/demo/media/index" },
{ label: "老项目", icon: "folder", path: "/pages/demo/old/index" }
];
});
const pressedCard = ref<string>(""); import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import HomeMainTab from "@/components/HomeFrame/presets/HomeMainTab.uvue";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { storage } from "@/utils/storage.uts";
// 判断卡片是否被按下(UTS 要求条件语句必须使用布尔类型) const shellRef = ref(null);
const isCardPressed = (path?: string): boolean => { const logic = useBoutiqueLogic();
if (path == null) {
return pressedCard.value === "";
}
return pressedCard.value === path;
};
// 处理触摸开始事件(UTS 要求条件语句必须使用布尔类型)
const handleTouchStart = (path?: string): void => {
if (path != null && path.length > 0) {
pressedCard.value = path;
} else {
pressedCard.value = "";
}
};
const getIcon = (icon?: string): string => { function readSceneType(): number {
// 为兼容 UTS,将图标映射改为显式分支判断,避免使用对象下标访问和 Record 等 TS 特性 const raw = storage.get("userInfo");
if (icon == "database") { if (raw == null) {
return "💾"; return 1;
}
if (icon == "tailwind") {
return "🎨";
}
if (icon == "migrate") {
return "🔄";
}
if (icon == "chart") {
return "📊";
}
if (icon == "lock") {
return "🔒";
}
if (icon == "media") {
return "🎬";
}
if (icon == "folder") {
return "📁";
}
if (icon == "microphone") {
return "🎤";
} }
// 默认图标 const st = (raw as UTSJSONObject).sceneType as null | number;
return "📄"; return st != null ? st : 1;
}; }
const toPath = (item: Item) => {
if (typeof item.path === "string" && item.path.trim().length > 0) {
// router.push({ path: item.path });
uni.navigateTo({
url: item.path,
success: () => {
// 跳转成功
},
fail: (err: any) => {
// NavigateToFailImpl 不是标准的 UTSJSONObject,需要使用索引访问
// 先输出完整的错误对象,方便调试
console.error(`页面跳转失败: ${item.path}, 完整错误对象:`, err);
// 使用索引访问属性,避免 error18
// NavigateToFailImpl 类型特殊,需要先转换为 UTSJSONObject 或使用索引访问
let errMsg = "未知错误";
let errCode: number | null = null;
let errSubject: string | null = null;
// 尝试使用 UTSJSONObject 转换
try {
// @ts-ignore - 尝试将错误对象转换为 UTSJSONObject
const errObj = new UTSJSONObject(err);
const errMsgTemp = errObj.getAny("errMsg");
const errCodeTemp = errObj.getAny("errCode");
const errSubjectTemp = errObj.getAny("errSubject");
if (errMsgTemp != null) {
errMsg = errMsgTemp as string;
}
if (errCodeTemp != null) {
errCode = errCodeTemp as number;
}
if (errSubjectTemp != null) {
errSubject = errSubjectTemp as string;
}
} catch (e: any) {
// 如果转换失败,尝试使用 JSON 序列化/反序列化
try {
const jsonStr = JSON.stringify(err);
const parsed = JSON.parse(jsonStr) as UTSJSONObject;
const errMsgTemp = get(parsed, "errMsg");
const errCodeTemp = get(parsed, "errCode");
const errSubjectTemp = get(parsed, "errSubject");
if (errMsgTemp != null) { onShow(async () => {
errMsg = errMsgTemp as string; if (logic.ensureLoginOrRelauch() === false) {
} return;
if (errCodeTemp != null) {
errCode = errCodeTemp as number;
}
if (errSubjectTemp != null) {
errSubject = errSubjectTemp as string;
} }
} catch (e2: any) { // 先同步壳层 userInfo,再读场景;避免 switchTab 回首页时插槽仍是旧数据导致子树不渲染/场景错乱
console.error("无法解析错误对象:", e2); if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
} }
const st = readSceneType();
if (st === 1) {
await logic.initIfNeeded();
logic.getBoutiquePackageList();
} }
});
</script>
// 输出详细错误信息 <style scoped lang="scss">
console.error(`页面跳转失败详情: path=${item.path}, errMsg=${errMsg}, errCode=${errCode}, errSubject=${errSubject}`); .index-shell-page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
// 根据错误码提供更友好的错误提示 /* 吃掉 index 页剩余主轴尺寸;横竖屏都要有明确高宽,内层 height:100% / flex 链才能算对 */
let toastMsg = errMsg; .index-shell-scene-stretch {
if (errCode == 4) { flex: 1;
// errCode 4 通常表示页面路径不存在或未注册 min-height: 0;
toastMsg = "页面路径不存在或未在 pages.json 中注册"; min-width: 0;
} width: 100%;
display: flex;
flex-direction: column;
}
uni.showToast({ .index-shell-scene-stretch :deep(.scene-shell-root) {
title: toastMsg, flex: 1;
icon: "none", min-height: 0;
duration: 3000 min-width: 0;
}); width: 100%;
} height: 100%;
}); }
}
pressedCard.value = "";
};
</script>
<style> .tab-panel {
/* 卡片按下效果 */ flex: 1;
.card-pressed { width: 100%;
transform: scale(0.98); height: 100%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
} }
</style> </style>
<template>
<view class="my-center">
<view class="safe-top-spacer" :style="safeTopStyle"></view>
<scroll-view class="my-scroll" :scroll-y="true" :show-scrollbar="false">
<view class="my-content">
<view class="profile-card">
<view class="profile-head">
<un-avatar :text="avatarText"
shape="circle"
size="52"
bgColor="#2f6af7"
color="#ffffff"
fontSize="20" />
<view class="profile-main">
<text class="name">{{ userName }}</text>
<text class="meta">{{ plainPhone }}</text>
</view>
<view class="scene-tag">
<text class="scene-tag-text">{{ currentSceneTitle }}</text>
</view>
</view>
<view class="profile-divider"></view>
<view class="profile-shop-row">
<text class="profile-shop-label">当前门店</text>
<text class="profile-shop-value">{{ shopName }}</text>
</view>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="账号信息" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="姓名"
:value="userName"
icon="account-fill" />
<un-cell title="门店"
:value="shopName"
icon="home-fill" />
<un-cell title="手机号"
:value="plainPhone"
icon="phone-fill" />
<un-cell title="当前场景"
:value="currentSceneTitle"
icon="grid-fill" />
</un-cell-group>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="常用功能" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="切换场景"
:value="currentSceneTitle"
icon="grid-fill"
isLink
clickable
@click="onSceneChange" />
<un-cell title="个人考勤"
icon="clock-fill"
isLink
clickable
@click="goAttendance" />
<un-cell title="系统设置"
icon="setting-fill"
isLink
clickable
@click="onSetting" />
</un-cell-group>
</view>
</view>
</scroll-view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</template>
<script setup lang="uts">
import { computed, ref, onMounted } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { resolveMainHomeUrl } from "@/utils/homeRoute.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import SettingBox from "./SettingBox.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
type SceneTypeItem = { title: string; describe: string; icon: string; };
const showScenePopup = ref(false);
const showSetting = ref(false);
const safeTopPx = ref(0);
const safeTopStyle = computed((): UTSJSONObject => {
return {
height: `${safeTopPx.value}px`,
width: "100%",
} as UTSJSONObject;
});
function syncSafeTopInset(): void {
const info = uni.getWindowInfo();
let topInset = 0;
const insets = info.safeAreaInsets;
if (insets != null) {
const t = insets.top;
if (t != null && t > 0) {
topInset = Math.round(t);
}
}
if (topInset <= 0) {
const safe = info.safeArea;
if (safe != null) {
const st = safe.top;
if (st != null && st > 0) {
topInset = Math.round(st);
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight;
if (sb != null && sb > 0) {
topInset = Math.round(sb);
}
}
safeTopPx.value = topInset;
}
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;
}
const sceneTypeIdList = computed((): number[] => {
const info = props.userInfo;
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: number[] = [];
for (const e of openArr) {
if (e == 1 || e == 0 || e == 7) {
result.push(e);
}
}
return result.length > 0 ? result : [1, 0, 7];
});
const sceneTypeList = computed((): UTSJSONObject[] => {
const result: UTSJSONObject[] = [];
for (const id of sceneTypeIdList.value) {
const item = getSceneTypeItem(id);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
return result;
});
const userName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
return raw != null ? `${raw}` : "";
});
const shopName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.shopMerchantName ?? obj.merchantName ?? "";
return raw != null ? `${raw}` : "";
});
const plainPhone = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null ? `${raw}` : "";
});
const avatarText = computed((): string => {
const name = userName.value;
if (name == "") return "我";
return name.slice(0, 1);
});
const currentSceneTitle = computed((): string => {
const info = props.userInfo;
if (info == null) return "未知";
const sceneType = (info as UTSJSONObject).sceneType as null | number;
if (sceneType == null) return "未知";
const item = getSceneTypeItem(sceneType);
return item != null ? item.title : "未知";
});
function onScenePopupVisible(v: boolean): void {
showScenePopup.value = v;
}
function onSettingVisible(v: boolean): void {
showSetting.value = v;
}
function onSceneChange(): void {
showScenePopup.value = true;
}
function onSetting(): void {
showSetting.value = true;
}
function onChooseScene(index: number): void {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) return;
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) return;
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) return;
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
uni.switchTab({
url: resolveMainHomeUrl(),
success: () => {
hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
uni.reLaunch({ url: resolveMainHomeUrl() });
}
});
}
function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
onMounted(() => {
syncSafeTopInset();
});
</script>
<style scoped lang="scss">
.my-center {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #edf4ff 0%, #f4f8ff 34%, #f7f9fc 100%);
}
.safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
.my-scroll {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.my-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.profile-card {
background: linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
border: 1px solid #dfe9f7;
border-radius: 16px;
padding: 14px 14px 12px;
box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
}
.profile-head {
display: flex;
flex-direction: row;
align-items: center;
}
.profile-main {
margin-left: 14px;
display: flex;
flex-direction: column;
flex: 1;
}
.name {
font-size: 19px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
}
.meta {
margin-top: 2px;
font-size: 12px;
color: #7b8ba3;
}
.scene-tag {
height: 26px;
padding: 0 10px;
background: #eaf2ff;
border: 1px solid #cfe0f8;
border-radius: 999px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.scene-tag-text {
font-size: 11px;
font-weight: 600;
color: #2a5ac7;
}
.profile-divider {
height: 1px;
background-color: #e6edf8;
margin-top: 10px;
margin-bottom: 10px;
}
.profile-shop-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.profile-shop-label {
font-size: 12px;
color: #8091aa;
}
.profile-shop-value {
flex: 1;
margin-left: 10px;
text-align: right;
font-size: 13px;
font-weight: 500;
color: #334155;
}
.section-shell {
width: 100%;
background-color: #ffffff;
border: 1px solid #e5edf8;
border-radius: 16px;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
padding: 2px;
box-sizing: border-box;
}
</style>
<template> <template>
<view class="my-center"> <layout-root>
<view class="safe-top-spacer" :style="safeTopStyle"></view> <view class="page-container my-route-page">
<scroll-view class="my-scroll" :scroll-y="true" :show-scrollbar="false"> <SceneShell ref="shellRef"
<view class="my-content"> :active-tab-index="2">
<view class="profile-card"> <template #default="{ userInfo }">
<view class="profile-head"> <MyCenterTab :user-info="userInfo" />
<un-avatar :text="avatarText" </template>
shape="circle" </SceneShell>
size="52" </view>
bgColor="#2f6af7" </layout-root>
color="#ffffff"
fontSize="20" />
<view class="profile-main">
<text class="name">{{ userName }}</text>
<text class="meta">{{ plainPhone }}</text>
</view>
<view class="scene-tag">
<text class="scene-tag-text">{{ currentSceneTitle }}</text>
</view>
</view>
<view class="profile-divider"></view>
<view class="profile-shop-row">
<text class="profile-shop-label">当前门店</text>
<text class="profile-shop-value">{{ shopName }}</text>
</view>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="账号信息" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="姓名"
:value="userName"
icon="account-fill" />
<un-cell title="门店"
:value="shopName"
icon="home-fill" />
<un-cell title="手机号"
:value="plainPhone"
icon="phone-fill" />
<un-cell title="当前场景"
:value="currentSceneTitle"
icon="grid-fill" />
</un-cell-group>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-shell">
<un-cell-group title="常用功能" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="切换场景"
:value="currentSceneTitle"
icon="grid-fill"
isLink
clickable
@click="onSceneChange" />
<un-cell title="个人考勤"
icon="clock-fill"
isLink
clickable
@click="goAttendance" />
<un-cell title="系统设置"
icon="setting-fill"
isLink
clickable
@click="onSetting" />
</un-cell-group>
</view>
</view>
</scroll-view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, ref, onMounted } from "vue"; import { ComponentPublicInstance, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { storage } from "@/utils/storage.uts";
import SettingBox from "./SettingBox.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
type SceneTypeItem = { title: string; describe: string; icon: string; };
const showScenePopup = ref(false);
const showSetting = ref(false);
const safeTopPx = ref(0);
const safeTopStyle = computed((): UTSJSONObject => {
return {
height: `${safeTopPx.value}px`,
width: "100%",
} as UTSJSONObject;
});
function syncSafeTopInset(): void {
const info = uni.getWindowInfo();
let topInset = 0;
const insets = info.safeAreaInsets;
if (insets != null) {
const t = insets.top;
if (t != null && t > 0) {
topInset = Math.round(t);
}
}
if (topInset <= 0) {
const safe = info.safeArea;
if (safe != null) {
const st = safe.top;
if (st != null && st > 0) {
topInset = Math.round(st);
}
}
}
if (topInset <= 0) {
const sb = info.statusBarHeight;
if (sb != null && sb > 0) {
topInset = Math.round(sb);
}
}
safeTopPx.value = topInset;
}
function getSceneTypeItem(sceneId: number): null | SceneTypeItem { import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" }; import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
const sceneTypeIdList = computed((): number[] => { const shellRef = ref(null);
const info = props.userInfo;
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: number[] = [];
for (const e of openArr) {
if (e == 1 || e == 0 || e == 7) {
result.push(e);
}
}
return result.length > 0 ? result : [1, 0, 7];
});
const sceneTypeList = computed((): UTSJSONObject[] => { onShow(() => {
const result: UTSJSONObject[] = []; if (shellRef.value != null) {
for (const id of sceneTypeIdList.value) { (shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
const item = getSceneTypeItem(id);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
} }
}
return result;
});
const userName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
return raw != null ? `${raw}` : "";
});
const shopName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.shopMerchantName ?? obj.merchantName ?? "";
return raw != null ? `${raw}` : "";
});
const phoneText = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null && `${raw}` != "" ? `手机号:${raw}` : "";
});
const plainPhone = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null ? `${raw}` : "";
});
const avatarText = computed((): string => {
const name = userName.value;
if (name == "") return "我";
return name.slice(0, 1);
});
const currentSceneTitle = computed((): string => {
const info = props.userInfo;
if (info == null) return "未知";
const sceneType = (info as UTSJSONObject).sceneType as null | number;
if (sceneType == null) return "未知";
const item = getSceneTypeItem(sceneType);
return item != null ? item.title : "未知";
});
function onScenePopupVisible(v: boolean): void {
showScenePopup.value = v;
}
function onSettingVisible(v: boolean): void {
showSetting.value = v;
}
function onSceneChange(): void {
showScenePopup.value = true;
}
function onSetting(): void {
showSetting.value = true;
}
function 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);
let url = "/pages/boutique/index";
if (sceneType == 0) url = "/pages/equity/index";
else if (sceneType == 7) url = "/pages/usedCar/index";
uni.reLaunch({ url });
}
function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
onMounted(() => {
syncSafeTopInset();
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.my-center { .page-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #edf4ff 0%, #f4f8ff 34%, #f7f9fc 100%);
}
.safe-top-spacer {
width: 100%;
flex-shrink: 0;
}
.my-scroll {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.my-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.profile-card {
background: linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
border: 1px solid #dfe9f7;
border-radius: 16px;
padding: 14px 14px 12px;
box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
}
.profile-head {
display: flex;
flex-direction: row;
align-items: center;
}
.profile-main {
margin-left: 14px;
display: flex;
flex-direction: column;
flex: 1;
}
.name {
font-size: 19px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
}
.meta {
margin-top: 2px;
font-size: 12px;
color: #7b8ba3;
}
.scene-tag {
height: 26px;
padding: 0 10px;
background: #eaf2ff;
border: 1px solid #cfe0f8;
border-radius: 999px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.scene-tag-text {
font-size: 11px;
font-weight: 600;
color: #2a5ac7;
}
.profile-divider {
height: 1px;
background-color: #e6edf8;
margin-top: 10px;
margin-bottom: 10px;
}
.profile-shop-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.profile-shop-label {
font-size: 12px;
color: #8091aa;
}
.profile-shop-value {
flex: 1;
margin-left: 10px;
text-align: right;
font-size: 13px;
font-weight: 500;
color: #334155;
}
.section-shell {
width: 100%;
background-color: #ffffff;
border: 1px solid #e5edf8;
border-radius: 16px;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
padding: 2px;
box-sizing: border-box;
} }
</style> </style>
<template>
<layout-root>
<view class="page-container my-route-page">
<SceneShell ref="shellRef" :active-tab-index="2">
<template #default="{ userInfo }">
<MyCenterTab :user-info="userInfo" />
</template>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
</style>
<template>
<layout-root>
<view class="page-container reception-route-page">
<SceneShell ref="shellRef" :active-tab-index="1">
<view class="reception-route-body">
<ReceptionStack />
</view>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import ReceptionStack from "@/components/HomeFrame/presets/ReceptionStack.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
.reception-route-body {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
position: relative;
}
</style>
<template>
<view class="page-container used-car-home-in-tab">
<HomeFrame ref="homeRef"
:embed-in-tab-slot="true"
:show-tabbar="false"
:show-footer="true">
<template #home>
<view class="home-content">
<view class="header">
<text class="title">二手车场景</text>
<text class="subtitle">Used Car</text>
</view>
<view class="action-area">
<text class="status-text">二手车场景不支持开始接待跳转</text>
</view>
<view class="info-panel">
<text class="info-label">接待状态:</text>
<text class="info-value">{{ receptionStatusText }}</text>
</view>
</view>
</template>
</HomeFrame>
</view>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { useReception } from "@/composables/useReception";
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const reception = useReception();
type RefWithValue = { value: number }
const receptionStatusText = computed((): string => {
const status = (reception as UTSJSONObject).receptionStatus as null | RefWithValue;
if (status != null && status.value == 0) {
return "未开始";
} else if (status != null && status.value == 1) {
return "接待中";
} else {
return "已完成";
}
});
onLoad((_options: OnLoadOptions) => {
uni.hideLoading();
});
onShow(() => {
const userInfo = storage.get("userInfo");
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 null | string;
const shopMerchantName = userInfoObj.shopMerchantName as null | string;
if (shopMerchantId == null || shopMerchantId == "" || shopMerchantName == null || shopMerchantName == "") {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container.used-car-home-in-tab {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.home-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48px;
}
.title {
font-size: 32px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.subtitle {
font-size: 16px;
color: #999;
}
.action-area {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32px;
}
.status-text {
font-size: 14px;
color: #ff4747;
}
.info-panel {
display: flex;
flex-direction: row;
align-items: center;
}
.info-label {
font-size: 14px;
color: #666;
}
.info-value {
font-size: 14px;
color: #333;
font-weight: 500;
}
</style>
<template> <template>
<view class="usedcar-redirect"></view>
<layout-root>
<view class="page-container">
<HomeFrame ref="homeRef" :show-footer="true">
<template #home>
<view class="home-content">
<view class="header">
<text class="title">二手车场景</text>
<text class="subtitle">Used Car</text>
</view>
<view class="action-area">
<text class="status-text">二手车场景不支持开始接待跳转</text>
</view>
<view class="info-panel">
<text class="info-label">接待状态:</text>
<text class="info-value">{{ receptionStatusText }}</text>
</view>
</view>
</template>
</HomeFrame>
</view>
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue"; onLoad(() => {
uni.switchTab({
import HomeFrame from "@/components/HomeFrame/index.uvue"; url: "/pages/index/index",
import { useReception } from "@/composables/useReception"; fail: (_err: any) => {
// import { onLoad, onShow } from '@dcloudio/uni-app' uni.reLaunch({ url: "/pages/index/index" });
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const reception = useReception();
type RefWithValue = { value: number }
const receptionStatusText = computed((): string => {
const status = (reception as UTSJSONObject).receptionStatus as null | RefWithValue;
if (status != null && status.value == 0) {
return "未开始";
} else if (status != null && status.value == 1) {
return "接待中";
} else {
return "已完成";
}
});
onLoad((options: OnLoadOptions) => {
uni.hideLoading();
});
onShow(() => {
const userInfo = storage.get("userInfo");
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 null | string;
const shopMerchantName = userInfoObj.shopMerchantName as null | string;
if (shopMerchantId == null || shopMerchantId == "" || shopMerchantName == null || shopMerchantName == "") {
storage.remove("userInfo");
storage.remove("sessionId");
uni.reLaunch({ url: "/pages/common/login/index" });
return;
}
if (homeRef.value != null) {
(homeRef.value as ComponentPublicInstance).$callMethod("updateApp");
} }
});
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.page-container { .usedcar-redirect {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.home-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48px;
}
.title {
font-size: 32px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.subtitle {
font-size: 16px;
color: #999;
}
.action-area {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32px;
}
.status-text {
font-size: 14px;
color: #ff4747;
}
.info-panel {
display: flex;
flex-direction: row;
align-items: center;
}
.info-label {
font-size: 14px;
color: #666;
}
.info-value {
font-size: 14px;
color: #333;
font-weight: 500;
}
</style> </style>
/** 首页壳路径:场景内容由壳内按 userInfo.sceneType 渲染 */
export function resolveMainHomeUrl(): string {
return "/pages/index/index";
}
/** tabBar 页:隐藏系统原生 tabBar,由 SceneShell + un-tabbar 负责展示与 switchTab */
export function hideNativeTabBar(): void {
uni.hideTabBar({
animation: false,
fail: (_err: any) => {
// 非 tab 页或未配置 tabBar 时可能失败,忽略
}
});
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!