Commit a80cc5e4 by liimin

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

2 parents 9754b526 ed8426db
Showing 36 changed files with 1174 additions and 1222 deletions
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"version" : "1.0", "version" : "1.0",
"configurations" : [ "configurations" : [
{ {
"customPlaygroundType" : "local",
"playground" : "custom", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
......
<template> <template>
<view class="home-frame-container" <!-- 物理 tab 三页共用:自定义 Tabbar + 默认槽(首页 / 接待 / 我的由 pages 填入不同主体) -->
:key="adapterClass" <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"
:tab-index="activeTabIndex"
:user-info="userInfo" />
<view class="right-side"> <view class="right-side">
<slot :user-info="userInfo"></slot> <slot :user-info="userInfo"></slot>
</view> </view>
<HomeFrameLeftSide :adapter-class="adapterClass"
:tab-index="activeTabIndex"
:user-info="userInfo" />
</view> </view>
</view> </view>
</template> </template>
...@@ -20,8 +20,9 @@ import { cssClassRef, useResolutionConfig } from "@/services/adapter"; ...@@ -20,8 +20,9 @@ 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 HomeFrameLeftSide from "./LeftSide.uvue"; import HomeFrameTabbar from "./Tabbar.uvue";
type SceneShellSlotProps = { type SceneShellSlotProps = {
userInfo: UTSJSONObject userInfo: UTSJSONObject
...@@ -31,13 +32,13 @@ type SceneShellSlots = { ...@@ -31,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 => {
...@@ -67,6 +68,11 @@ function updateApp(): void { ...@@ -67,6 +68,11 @@ function updateApp(): void {
onLoad((_options) => { onLoad((_options) => {
requestRecordPermission(); requestRecordPermission();
hideNativeTabBar();
});
onShow(() => {
hideNativeTabBar();
}); });
defineExpose({ defineExpose({
......
<template> <template>
<view class="home-frame-container" <view class="home-frame-container"
:key="adapterClass" :class="[modeClass, resolutionClass, adapterClass, tabSlotEmbedClass]">
:class="[modeClass, resolutionClass, adapterClass]">
<!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content --> <!-- 首页内容区:横竖方向由容器 modeClass + common.scss 控制 .home-content -->
<view class="home-content"> <view class="home-content"
:class="tabbarVisible ? '' : 'hf-content-without-tabbar'">
<!-- Tabbar 在前:横屏 row 时自然在屏幕左侧;竖屏仍靠 order 把主内容置上;套壳页由 SceneShell 承载 Tabbar 时关闭 -->
<HomeFrameTabbar v-if="tabbarVisible"
:adapter-class="adapterClass"
:user-info="userInfo" />
<view class="right-side"> <view class="right-side">
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 LeftSide 导航) --> <!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 HomeFrameTabbar) -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom --> <!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
<view v-if="useCardLayout" class="app-content-box right-content show-content-box"> <view v-if="useCardLayout" class="app-content-box right-content show-content-box">
<view v-if="resolvedShowStartReception" <view v-if="resolvedShowStartReception"
...@@ -64,10 +68,6 @@ ...@@ -64,10 +68,6 @@
</view> </view>
</view> </view>
</view> </view>
<HomeFrameLeftSide :adapter-class="adapterClass"
:tab-index="0"
:user-info="userInfo" />
</view> </view>
</view> </view>
</template> </template>
...@@ -83,7 +83,7 @@ import { layoutService } from "@/services/LayoutService.uts"; ...@@ -83,7 +83,7 @@ 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 HomeFrameLeftSide from "./LeftSide.uvue"; import HomeFrameTabbar from "./Tabbar.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue"; import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue"; import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
...@@ -92,6 +92,8 @@ import { getLandscapeConfig } from "./styles/landscape.uts"; ...@@ -92,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 配套,由页面传入列表与文案 */
...@@ -106,8 +108,23 @@ const props = withDefaults(defineProps<{ ...@@ -106,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;
...@@ -30,6 +37,39 @@ ...@@ -30,6 +37,39 @@
.mode-landscape .home-content { .mode-landscape .home-content {
flex-direction: row; flex-direction: row;
/* 避免系统 RTL 下「第一个子节点」跑到视觉右侧,侧栏需始终在物理左侧 */
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 {
...@@ -43,12 +83,26 @@ ...@@ -43,12 +83,26 @@
order: 1; order: 1;
} }
.mode-portrait .left-side-portrait { .mode-portrait .home-tabbar-portrait {
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,侧栏在物理左侧 */
// ===== 应用内容区 ===== // ===== 应用内容区 =====
.app-content-box { .app-content-box {
/* 横屏:与左侧 Tabbar 用户区视觉对齐;竖屏见下方 .mode-portrait 覆盖 */
margin-top: 40px; margin-top: 40px;
flex: 1; flex: 1;
display: flex; display: flex;
...@@ -56,6 +110,10 @@ ...@@ -56,6 +110,10 @@
overflow: hidden; overflow: hidden;
} }
.mode-portrait .app-content-box {
margin-top: 0;
}
.right-content { .right-content {
padding: 0 var(--l-spacing-xl) 0 var(--l-spacing-md); padding: 0 var(--l-spacing-xl) 0 var(--l-spacing-md);
} }
...@@ -344,8 +402,8 @@ ...@@ -344,8 +402,8 @@
background: linear-gradient(to right, #eeeeee, rgba(216, 216, 216, 0)); background: linear-gradient(to right, #eeeeee, rgba(216, 216, 216, 0));
} }
// ===== LeftSide 横屏导航基础样式 ===== // ===== HomeFrame Tabbar(横屏左侧 / 竖屏底部)=====
.left-side { .home-tabbar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
...@@ -353,7 +411,7 @@ ...@@ -353,7 +411,7 @@
flex-shrink: 0; flex-shrink: 0;
background-image: linear-gradient(to bottom, #e8f0fe, #e8ecf5); background-image: linear-gradient(to bottom, #e8f0fe, #e8ecf5);
.left-side-bg-img { .home-tabbar-bg-img {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
...@@ -364,17 +422,18 @@ ...@@ -364,17 +422,18 @@
} }
.user-box, .user-box,
.left-tabs, .landscape-tabbar-wrap,
.left-footer { .home-tabbar-footer {
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
} }
.left-side-pad { .home-tabbar-landscape {
min-height: 0;
} }
.left-side-portrait { .home-tabbar-portrait {
width: 100%; width: 100%;
flex-shrink: 0; flex-shrink: 0;
flex-direction: column; flex-direction: column;
...@@ -397,7 +456,7 @@ ...@@ -397,7 +456,7 @@
height: 30px; height: 30px;
} }
.left-side-portrait-pad { .home-tabbar-portrait-pad {
padding-bottom: 6px; padding-bottom: 6px;
} }
...@@ -468,70 +527,73 @@ ...@@ -468,70 +527,73 @@
text-align: center; text-align: center;
} }
// LeftSide 横屏导航基础样式 // 横屏:中间区域放 un-tabbar(组件根节点通过 custom-style 纵向排列)
.left-tabs { .landscape-tabbar-wrap {
flex: 1;
min-height: 0;
width: 100%; width: 100%;
height: 540px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
position: absolute; align-items: center;
left: 0;
padding: 8px 0;
padding-left: 16px;
} }
.tab-item { .landscape-un-tabbar {
width: 80px; width: 100%;
display: flex; flex: 1;
flex-direction: column; min-height: 0;
align-items: center;
margin-bottom: 12.5px;
} }
.icon-box { .home-tabbar-footer {
width: 52px; margin-top: auto;
height: 52px; padding-bottom: 40px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
border-radius: 26px;
} }
.icon-placeholder { .btn-placeholder {
width: 32px; width: 40px;
height: 32px; height: 40px;
background-color: #8a98b5; background-color: #e8eaef;
border-radius: 8px; border-radius: 20px;
margin: var(--l-spacing-sm) auto 0;
} }
.icon-active { // ========================================================================
background-color: #3773f8; // 首页布局调试(仅 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);
} }
.tab-label { .hf-layout-debug .home-tabbar-landscape {
font-size: 13px; background-color: rgba(255, 100, 100, 0.38) !important;
color: #8a98b5;
margin-top: 6px;
text-align: center;
} }
.tabActive { .hf-layout-debug .home-tabbar-portrait {
.tab-label { background-color: rgba(255, 160, 90, 0.42) !important;
color: #3773f8;
}
} }
.left-footer { /* 内层 HomeFrame(embed)整块主区 */
margin-top: auto; .hf-layout-debug .hf-embed-in-tab-slot > .home-content > .right-side {
padding-bottom: 40px; background-color: rgba(90, 200, 220, 0.2);
} }
.btn-placeholder { .hf-layout-debug .app-content-box.show-content-box {
width: 40px; background-color: rgba(120, 120, 120, 0.12);
height: 40px; }
background-color: #e8eaef;
border-radius: 20px; .hf-layout-debug .start {
margin: var(--l-spacing-sm) auto 0; 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);
} }
...@@ -12,7 +12,7 @@ export type LandscapeConfig = { ...@@ -12,7 +12,7 @@ export type LandscapeConfig = {
toolBoxHeight: string toolBoxHeight: string
toolBoxContentPaddingBottom?: string toolBoxContentPaddingBottom?: string
// LeftSide 导航 // HomeFrame Tabbar(横屏)
leftTabsHeight: string leftTabsHeight: string
leftTabsPaddingLeft: string leftTabsPaddingLeft: string
iconBoxSize: string iconBoxSize: string
...@@ -30,7 +30,7 @@ export const LANDSCAPE_1174x768: LandscapeConfig = { ...@@ -30,7 +30,7 @@ export const LANDSCAPE_1174x768: LandscapeConfig = {
toolBoxHeight: '152px', toolBoxHeight: '152px',
toolBoxContentPaddingBottom: '14px', toolBoxContentPaddingBottom: '14px',
// LeftSide 导航 // HomeFrame Tabbar(横屏)
leftTabsHeight: '560px', leftTabsHeight: '560px',
leftTabsPaddingLeft: '18px', leftTabsPaddingLeft: '18px',
iconBoxSize: '56px', iconBoxSize: '56px',
...@@ -46,7 +46,7 @@ export const LANDSCAPE_1920x1080: LandscapeConfig = { ...@@ -46,7 +46,7 @@ export const LANDSCAPE_1920x1080: LandscapeConfig = {
moduleBoxHeight: '320px', moduleBoxHeight: '320px',
toolBoxHeight: '480px', toolBoxHeight: '480px',
// LeftSide 导航 // HomeFrame Tabbar(横屏)
leftTabsHeight: '620px', leftTabsHeight: '620px',
leftTabsPaddingLeft: '22px', leftTabsPaddingLeft: '22px',
iconBoxSize: '64px', iconBoxSize: '64px',
......
...@@ -15,7 +15,7 @@ export type PortraitConfig = { ...@@ -15,7 +15,7 @@ export type PortraitConfig = {
toolBoxMarginBottom?: string toolBoxMarginBottom?: string
toolBoxHeight?: string toolBoxHeight?: string
// LeftSide TabBar // HomeFrame Tabbar(竖屏)
leftSidePortraitPaddingBottom?: string leftSidePortraitPaddingBottom?: string
tabbarHeight: number tabbarHeight: number
tabbarIconSize: number tabbarIconSize: number
...@@ -34,7 +34,7 @@ export const PORTRAIT_768x1174: PortraitConfig = { ...@@ -34,7 +34,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
toolBoxHeight: '552px', toolBoxHeight: '552px',
toolBoxMarginBottom: '60px', toolBoxMarginBottom: '60px',
// LeftSide TabBar // HomeFrame Tabbar(竖屏)
leftSidePortraitPaddingBottom: '8px', leftSidePortraitPaddingBottom: '8px',
tabbarHeight: 106, tabbarHeight: 106,
tabbarIconSize: 60 tabbarIconSize: 60
...@@ -44,7 +44,7 @@ export const PORTRAIT_768x1174: PortraitConfig = { ...@@ -44,7 +44,7 @@ export const PORTRAIT_768x1174: PortraitConfig = {
* 其他竖屏分辨率(默认) * 其他竖屏分辨率(默认)
*/ */
export const PORTRAIT_COMMON: PortraitConfig = { export const PORTRAIT_COMMON: PortraitConfig = {
// LeftSide TabBar // HomeFrame Tabbar(竖屏)
tabbarHeight: 56, tabbarHeight: 56,
tabbarIconSize: 24 tabbarIconSize: 24
}; };
......
...@@ -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"
:show-footer="true" :embed-in-tab-slot="true"
:swiper-custom="true" :show-footer="true"
:intro-load-complete="logic.loadComplete.value" :show-tabbar="false"
:intro-swiper-list="boutiqueIntroSwiperList" :swiper-custom="true"
:intro-modules="logic.packageList.value" :intro-load-complete="logic.loadComplete.value"
intro-eyebrow="精品轻改" :intro-swiper-list="boutiqueIntroSwiperList"
intro-empty-title="暂无套餐" :intro-modules="logic.packageList.value"
:intro-empty-text="boutiqueIntroEmptyText" intro-eyebrow="精品轻改"
@intro-slide-tap="onIntroSlideTap" intro-empty-title="暂无套餐"
@start="handleStart" :intro-empty-text="boutiqueIntroEmptyText"
> @intro-slide-tap="onIntroSlideTap"
</HomeFrame> @start="handleStart">
</HomeFrame>
<CenterPopup
ref="customerTypeRef" <CenterPopup 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"> <view class="package-box">
<view class="package-box"> <view class="package-name">
<view class="package-name"> 套餐内容
套餐内容 </view>
</view> <view class="package-content">
<view class="package-content"> <rich-text :nodes="logic.chooseItem.value.content != null ? (logic.chooseItem.value.content as string) : ''"></rich-text>
<rich-text :nodes="logic.chooseItem.value.content != null ? (logic.chooseItem.value.content as string) : ''"></rich-text> </view>
</view> </view>
</view> <view class="package-box package-detail">
<view class="package-box package-detail"> <view class="package-name">
<view class="package-name"> 套餐介绍
套餐介绍 </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 :nodes="logic.chooseItem.value.scriptIntroduction != null ? (logic.chooseItem.value.scriptIntroduction as string) : ''"></rich-text> </rich-text>
</view> </view>
</view> </view>
</view> </view>
</PackageDetailPopup> </PackageDetailPopup>
</view> </view>
</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,34 +94,29 @@ const boutiqueIntroEmptyText = computed((): string => { ...@@ -93,34 +94,29 @@ 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 {
callExposedMethod(customerTypeRef.value as any, "open"); callExposedMethod(customerTypeRef.value as any, "open");
} }
function onChooseCustomerType(index: number): void { function onChooseCustomerType(index: number): void {
logic.chooseCustomerType(homeRef.value as any, index); logic.chooseCustomerType(homeRef.value as any, index);
} }
function toDetail(index: number): void { function toDetail(index: number): void {
const item = logic.packageList.value[index]; const item = logic.packageList.value[index];
if (item != null) { if (item != null) {
logic.chooseItem.value = item as UTSJSONObject; logic.chooseItem.value = item as UTSJSONObject;
callExposedMethod(packageRef.value as any, "open"); callExposedMethod(packageRef.value as any, "open");
} }
} }
function onIntroSlideTap(index: number): void { function onIntroSlideTap(index: number): void {
...@@ -128,64 +124,73 @@ function onIntroSlideTap(index: number): void { ...@@ -128,64 +124,73 @@ function onIntroSlideTap(index: number): void {
} }
function closePackageDetail(): void { function closePackageDetail(): void {
logic.chooseItem.value = {}; logic.chooseItem.value = {};
} }
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 占满 */
width: 100%; .page-container.boutique-home-panel {
height: 100%; flex: 1;
width: 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 {
padding-bottom: 50px; padding-bottom: 50px;
margin: 0 var(--l-spacing-xl); margin: 0 var(--l-spacing-xl);
} }
.package-box { .package-box {
border-radius: var(--l-radius-xl); border-radius: var(--l-radius-xl);
background: #ffffff; background: #ffffff;
box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15); box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15);
margin-bottom: var(--l-spacing-xl); margin-bottom: var(--l-spacing-xl);
box-sizing: border-box; box-sizing: border-box;
padding: var(--l-spacing-xl); padding: var(--l-spacing-xl);
} }
.package-name { .package-name {
color: #333; color: #333;
font-size: var(--l-font-xl); font-size: var(--l-font-xl);
font-weight: 500; font-weight: 500;
line-height: 28px; line-height: 28px;
margin-bottom: var(--l-spacing-md); margin-bottom: var(--l-spacing-md);
} }
.package-content { .package-content {
line-height: 22px; line-height: 22px;
color: #333; color: #333;
font-size: 14px; font-size: 14px;
} }
.package-detail { .package-detail {
border: 2px solid rgba(70, 115, 255, 0.5); border: 2px solid rgba(70, 115, 255, 0.5);
background: rgba(70, 115, 255, 0.1); background: rgba(70, 115, 255, 0.1);
box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15); box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15);
} }
.package-detail .package-name { .package-detail .package-name {
color: #4673ff; color: #4673ff;
} }
</style> </style>
<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>
...@@ -103,7 +103,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void { ...@@ -103,7 +103,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" });
}); });
......
...@@ -98,52 +98,29 @@ function jump(info: UTSJSONObject, data: any | null): void { ...@@ -98,52 +98,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.reLaunch({ url }); uni.switchTab({
url,
fail: (_err: any) => {
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.reLaunch({ url }); uni.switchTab({
url,
fail: (_err: any) => {
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>
</view> </template>
</view> </SceneShell>
</view> </view>
</view> </view>
</scroll-view> </layout-root>
</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[]>(() => { import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
return [ import HomeMainTab from "@/components/HomeFrame/presets/HomeMainTab.uvue";
{ label: "LocalStore", icon: "database", path: "/pages/demo/local-store/index" }, import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
{ label: "Tailwind CSS", icon: "tailwind", path: "/pages/demo/tailwindcss/index" }, import { storage } from "@/utils/storage.uts";
{ 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>(""); const shellRef = ref(null);
const logic = useBoutiqueLogic();
// 判断卡片是否被按下(UTS 要求条件语句必须使用布尔类型)
const isCardPressed = (path?: string): boolean => {
if (path == null) {
return pressedCard.value === "";
}
return pressedCard.value === path;
};
// 处理触摸开始事件(UTS 要求条件语句必须使用布尔类型) function readSceneType(): number {
const handleTouchStart = (path?: string): void => { const raw = storage.get("userInfo");
if (path != null && path.length > 0) { if (raw == null) {
pressedCard.value = path; return 1;
} else {
pressedCard.value = "";
} }
}; const st = (raw as UTSJSONObject).sceneType as null | number;
return st != null ? st : 1;
}
const getIcon = (icon?: string): string => { onShow(async () => {
// 为兼容 UTS,将图标映射改为显式分支判断,避免使用对象下标访问和 Record 等 TS 特性 if (logic.ensureLoginOrRelauch() === false) {
if (icon == "database") { return;
return "💾";
}
if (icon == "tailwind") {
return "🎨";
}
if (icon == "migrate") {
return "🔄";
}
if (icon == "chart") {
return "📊";
}
if (icon == "lock") {
return "🔒";
} }
if (icon == "media") { // 先同步壳层 userInfo,再读场景;避免 switchTab 回首页时插槽仍是旧数据导致子树不渲染/场景错乱
return "🎬"; if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
} }
if (icon == "folder") { const st = readSceneType();
return "📁"; if (st === 1) {
await logic.initIfNeeded();
logic.getBoutiquePackageList();
} }
if (icon == "microphone") { });
return "🎤";
}
// 默认图标
return "📄";
};
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) {
errMsg = errMsgTemp as string;
}
if (errCodeTemp != null) {
errCode = errCodeTemp as number;
}
if (errSubjectTemp != null) {
errSubject = errSubjectTemp as string;
}
} catch (e2: any) {
console.error("无法解析错误对象:", e2);
}
}
// 输出详细错误信息
console.error(`页面跳转失败详情: path=${item.path}, errMsg=${errMsg}, errCode=${errCode}, errSubject=${errSubject}`);
// 根据错误码提供更友好的错误提示
let toastMsg = errMsg;
if (errCode == 4) {
// errCode 4 通常表示页面路径不存在或未注册
toastMsg = "页面路径不存在或未在 pages.json 中注册";
}
uni.showToast({
title: toastMsg,
icon: "none",
duration: 3000
});
}
});
}
pressedCard.value = "";
};
</script> </script>
<style> <style scoped lang="scss">
/* 卡片按下效果 */ .index-shell-page {
.card-pressed { width: 100%;
transform: scale(0.98); height: 100%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); display: flex;
flex-direction: column;
}
/* 吃掉 index 页剩余主轴尺寸;横竖屏都要有明确高宽,内层 height:100% / flex 链才能算对 */
.index-shell-scene-stretch {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
display: flex;
flex-direction: column;
}
.index-shell-scene-stretch :deep(.scene-shell-root) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
height: 100%;
}
.tab-panel {
flex: 1;
width: 100%;
height: 100%;
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 => { import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
return { import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
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 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>
...@@ -127,8 +127,8 @@ const preEntryIconSize = computed((): number => { ...@@ -127,8 +127,8 @@ const preEntryIconSize = computed((): number => {
}) })
</script> </script>
<style> <style scoped lang="scss">
@import "../styles/reception-filter-shared.css"; @import "../styles/reception-filter-shared.scss";
.filter-group-compact.filter-group-entry-segmented { .filter-group-compact.filter-group-entry-segmented {
flex: 1 1 0; flex: 1 1 0;
......
...@@ -133,8 +133,8 @@ const reviewTagArrowStyle = computed((): UTSJSONObject => { ...@@ -133,8 +133,8 @@ const reviewTagArrowStyle = computed((): UTSJSONObject => {
}) })
</script> </script>
<style> <style scoped lang="scss">
@import "../styles/reception-filter-shared.css"; @import "../styles/reception-filter-shared.scss";
.filter-actions.filter-actions--review { .filter-actions.filter-actions--review {
flex: 2 1 0; flex: 2 1 0;
......
.adapter{
color:var(--adapter-color);
font-size: var(--adapter-fontsize);
}
.test-view{
height: var(--test-view-height);
background-color: var(--test-view-bg, transparent);
}
.reception-tabs-container{
padding: var(--reception-tabs-container-padding);
}
\ No newline at end of file \ No newline at end of file
// 约定式命名:必须叫 index.vars.uts
export default {
common: {
'--home-box-bg': '#FF4444',
},
portrait: {
'--adapter-color': 'red',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'red',
// 'padding': '10px'
},
landscape: {
'--adapter-color': 'green',
'--adapter-fontsize': '50px',
'--test-view-height': '30px',
'--test-view-bg': 'green',
// 'padding': '10px'
},
resolutions: {
'portrait-768x1174': {
'--adapter-color': 'blue',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'blue',
// 'padding': '10px'
'--reception-tabs-container-padding': '8px 12px 60px'
},
'landscape-1174x768': {
'--adapter-color': '#FF4444',
'--adapter-fontsize': '20px',
'--test-view-width': '100%',
'--test-view-height': '30px',
'--test-view-bg': 'pink',
// 'padding': '10px'
},
},
}
...@@ -27,35 +27,35 @@ ...@@ -27,35 +27,35 @@
.entry-filter-segmented-wrap { .entry-filter-segmented-wrap {
align-items: stretch; align-items: stretch;
}
.entry-filter-segmented-wrap .un-segmented { .un-segmented {
flex: 1; flex: 1;
width: 100%; width: 100%;
border-width: 0; border-width: 0;
background-color: rgba(0, 0, 0, 0.04); background-color: rgba(0, 0, 0, 0.04);
border-radius: 10px; border-radius: 10px;
padding: 2px; padding: 2px;
} }
.entry-filter-segmented-wrap .un-segmented__item { .un-segmented__item {
border-width: 0; border-width: 0;
border-radius: 10px; border-radius: 10px;
}
.entry-filter-segmented-wrap .un-segmented__item .un-segmented__item__text { .un-segmented__item__text {
color: #64748b; color: #64748b;
font-size: 14px; font-size: 14px;
} }
.entry-filter-segmented-wrap .un-segmented__item--active { &--active {
background-color: #ffffff; background-color: #ffffff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.entry-filter-segmented-wrap .un-segmented__item--active .un-segmented__item__text { .un-segmented__item__text {
color: #1677ff; color: #1677ff;
font-weight: 600; font-weight: 600;
}
}
}
} }
.filter-actions { .filter-actions {
......
<template> <template>
<layout-root :page-vars="pageVars">
<view class="list-content-wrapper"> <view class="list-content-wrapper">
<!-- 横屏分栏时:子 Tab + 筛选区固定在列表上方,仅下方列表滚动,避免随滚动移出视区 --> <!-- 横屏分栏时:子 Tab + 筛选区固定在列表上方,仅下方列表滚动,避免随滚动移出视区 -->
<view v-if="stickyHeader == true" class="list-header-fixed"> <view v-if="stickyHeader == true" class="list-header-fixed">
...@@ -141,6 +142,7 @@ ...@@ -141,6 +142,7 @@
</list-item> </list-item>
</list-view> </list-view>
</view> </view>
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
...@@ -155,7 +157,7 @@ import { ...@@ -155,7 +157,7 @@ import {
getReceptionPortraitListSubTabsConfig, getReceptionPortraitListSubTabsConfig,
type ReceptionPortraitListSubTabsConfig, type ReceptionPortraitListSubTabsConfig,
} from '../styles/portrait.uts' } from '../styles/portrait.uts'
import pageVars from '../styles/index.vars'
const props = defineProps<{ const props = defineProps<{
/** 横屏分栏时为 true:子 Tab + 筛选区不参与纵向滚动,固定在列表区域顶部 */ /** 横屏分栏时为 true:子 Tab + 筛选区不参与纵向滚动,固定在列表区域顶部 */
stickyHeader?: boolean stickyHeader?: boolean
...@@ -219,7 +221,8 @@ const showReceptionEmpty = computed((): boolean => { ...@@ -219,7 +221,8 @@ const showReceptionEmpty = computed((): boolean => {
}) })
</script> </script>
<style> <style scoped lang="scss">
@import "../styles/common.scss";
.list-content-wrapper { .list-content-wrapper {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
......
<template> <template>
<scroll-view class="dashboard-scroll-view" :scroll-y="true" :show-scrollbar="false"> <layout-root :page-vars="pageVars">
<!-- <scroll-view class="dashboard-scroll-view" :scroll-y="true" :show-scrollbar="false"> -->
<!-- <view class="test test-view">
<text class="test-orientation-text">hooks</text>
</view> -->
<view class="dashboard-content" :style="dashboardContentStyle"> <view class="dashboard-content" :style="dashboardContentStyle">
<view class="card-header" :style="dashboardCardHeaderStyle"> <view class="card-header" :style="dashboardCardHeaderStyle">
<view class="header-surface" :style="dashboardHeaderSurfaceStyle"> <view class="header-surface" :style="dashboardHeaderSurfaceStyle">
...@@ -51,7 +55,8 @@ ...@@ -51,7 +55,8 @@
:metrics-visible="performanceMetricsVisible" :metrics-visible="performanceMetricsVisible"
/> />
</view> </view>
</scroll-view> <!-- </scroll-view> -->
</layout-root>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
...@@ -61,6 +66,7 @@ import CardOutputValue from '../cards/CardOutputValue.uvue' ...@@ -61,6 +66,7 @@ import CardOutputValue from '../cards/CardOutputValue.uvue'
import CardMonthValue from '../cards/CardMonthValue.uvue' import CardMonthValue from '../cards/CardMonthValue.uvue'
import type { CompareRow, OutputSummary } from '../types/reception-output-types.uts' import type { CompareRow, OutputSummary } from '../types/reception-output-types.uts'
import { cssClassRef } from "@/services/adapter"; import { cssClassRef } from "@/services/adapter";
import pageVars from '../styles/index.vars'
// 导入样式变量 // 导入样式变量
import { import {
getReceptionPortraitDashboardConfig, getReceptionPortraitDashboardConfig,
...@@ -243,7 +249,8 @@ const progressWidth = computed((): string => { ...@@ -243,7 +249,8 @@ const progressWidth = computed((): string => {
}) })
</script> </script>
<style> <style scoped lang="scss">
@import "../styles/common.scss";
.dashboard-scroll-view { .dashboard-scroll-view {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
......
<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!