Commit 19a214a2 by liimin

refactor(tabbar): 重构tab导航系统,适配横竖屏布局

拆分竖屏底部栏与横屏侧边栏两套TabBar组件,通过tabRegistry统一管理所有tab配置、页面组件与样式变量,删除旧的tabbarShared共享文件。
新增tab切换过渡动画,优化页面切换体验。
清理多个组件中未使用的defineExpose导入,移除冗余代码。
为录单起始页添加防重复点击逻辑,避免重复触发页面跳转。
优化部分页面样式:重构录单页面头部装饰元素,替换transition缓动函数为ease-in-out,修复素材预览页面的多余min-height样式,调整部分容器的overflow属性优化布局。
1 parent 2a2d8788
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, ref, withDefaults } from "vue"; import { computed, ref, withDefaults } from "vue";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
list?: any[] list?: any[]
......
...@@ -175,7 +175,7 @@ onMounted(() => { ...@@ -175,7 +175,7 @@ onMounted(() => {
.rrl-content { .rrl-content {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: auto; overflow: hidden;
} }
.rrl-loading, .rrl-loading,
......
import { computed, ref } from "vue";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
export type HomeFrameTabbarSource = {
getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
}
/**
* 横屏侧栏头像文案:与 simgle_app `LeftSide` 使用 `userInfo.userName` 一致;
* 数科/ROP 返回里常见 `name`、`staffName`、`nickName`、`merchantName` 等作回退。
*/
export function resolveHomeFrameDisplayName(info: null | UTSJSONObject): string {
if (info == null) {
return "";
}
const obj = info as UTSJSONObject;
// 尝试多个可能的字段名(大小写变体)
const userName = obj.userName as string | null;
if (userName != null && userName !== "") {
return userName;
}
const username = obj.username as string | null;
if (username != null && username !== "") {
return username;
}
const realName = obj.realName as string | null;
if (realName != null && realName !== "") {
return realName;
}
const raw = obj.name ?? obj.staffName ?? obj.nickName ?? obj.merchantName ?? obj.accountName ?? obj.displayName;
if (raw == null) {
return "";
}
const s = `${raw}`;
return s !== "" ? s : "";
}
export type TabItem = {
label: string;
icon: string;
name: string;
/** 模板内仅用路径字段,避免 UTS 在 slot 中调用 import 的函数 */
iconSrcActive: string;
iconSrcInactive: string;
};
/** 与 pages.json tabBar 一致:首页 | 任务 | 录单 | 报表 | 我的 */
export const HOME_FRAME_TABS: TabItem[] = [
{
label: "首页",
icon: "home",
name: "HomeSlot",
iconSrcActive: "/static/images/tabbar/home-active.png",
iconSrcInactive: "/static/images/tabbar/home.png"
},
{
label: "任务",
icon: "tasks",
name: "Tasks",
iconSrcActive: "/static/images/tabbar/tasks-active.png",
iconSrcInactive: "/static/images/tabbar/tasks.png"
},
{
label: "录单",
icon: "record",
name: "orderEntry",
iconSrcActive: "/static/images/tabbar/record-active.png",
iconSrcInactive: "/static/images/tabbar/record.png"
},
{
label: "报表",
icon: "reports",
name: "Reports",
iconSrcActive: "/static/images/tabbar/reports-active.png",
iconSrcInactive: "/static/images/tabbar/reports.png"
},
{
label: "我的",
icon: "my",
name: "MyCenter",
iconSrcActive: "/static/images/tabbar/study-active.png",
iconSrcInactive: "/static/images/tabbar/study.png"
}
];
function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed;
uni.reLaunch({
url: withSlash
});
}
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);
}
});
}
/**
* 统一 tab 导航函数(旧逻辑保留,供未改造页面兜底)。
* 新架构下所有 tab 页面已合并到 pages/main/index,此处统一跳回主容器。
*/
export function navigateToTab(_index: number, _currentTabIndex: number): void {
uni.reLaunch({ url: "/pages/main/index" });
}
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showSetting = ref(false);
const showSwitchStore = ref(false);
const currentTabIndex = computed((): number => {
return source.getTabIndex();
});
const userName = computed((): string => {
return resolveHomeFrameDisplayName(source.getUserInfo());
});
const navigateTab = (index: number): void => {
navigateToTab(index, source.getTabIndex());
};
const onTabChange = (name: string | number): void => {
const idx = name as number;
navigateTab(idx);
};
const onSettingVisible = (v: boolean): void => {
showSetting.value = v;
};
const onSetting = (): void => {
showSetting.value = true;
};
const jumpPersonCenter = (): void => {
uni.navigateTo({ url: "/pages/person/attendance" });
};
const onSwitchStore = (): void => {
showSwitchStore.value = true;
};
const onSwitchStoreVisible = (v: boolean): void => {
showSwitchStore.value = v;
};
const onSwitchStoreDone = (_store: UTSJSONObject): void => {
showSwitchStore.value = false;
showSetting.value = false;
};
return {
showSetting,
showSwitchStore,
currentTabIndex,
userName,
onTabChange,
onSettingVisible,
onSetting,
jumpPersonCenter,
onSwitchStore,
onSwitchStoreVisible,
onSwitchStoreDone
};
}
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { defineExpose, onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts"; import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts";
import NoData from "./NoData.uvue"; import NoData from "./NoData.uvue";
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { defineExpose, ref } from "vue"; import { ref } from "vue";
import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts";
import NoData from "./NoData.uvue"; import NoData from "./NoData.uvue";
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { defineExpose, ref } from "vue"; import { ref } from "vue";
import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts";
import NoData from "./NoData.uvue"; import NoData from "./NoData.uvue";
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, defineExpose, computed } from 'vue' import { ref, computed } from 'vue'
const emit = defineEmits<{ const emit = defineEmits<{
close: [] close: []
......
...@@ -166,7 +166,6 @@ onLoad((options: UTSJSONObject | null): void => { ...@@ -166,7 +166,6 @@ onLoad((options: UTSJSONObject | null): void => {
} }
.preview-image-box { .preview-image-box {
min-height: 100%;
padding: 16px; padding: 16px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
......
...@@ -35,10 +35,20 @@ const emit = defineEmits<{ ...@@ -35,10 +35,20 @@ const emit = defineEmits<{
start: [] start: []
}>(); }>();
/** 防重复点击标记 */
const navigating = ref(false);
async function onStartClick(): Promise<void> { async function onStartClick(): Promise<void> {
// 防重复点击
if (navigating.value) {
return;
}
navigating.value = true;
// 1. 统一检查录音权限 // 1. 统一检查录音权限
const permitted = await recordService.isPermission(); const permitted = await recordService.isPermission();
if (permitted != true) { if (permitted != true) {
navigating.value = false;
return; return;
} }
...@@ -54,7 +64,12 @@ async function onStartClick(): Promise<void> { ...@@ -54,7 +64,12 @@ async function onStartClick(): Promise<void> {
// 3. 跳转接待页:有 typeCode 时加载当前产品素材,无 typeCode 时回退通用素材 // 3. 跳转接待页:有 typeCode 时加载当前产品素材,无 typeCode 时回退通用素材
// const q = typeCode !== "" ? `?typeCode=${encodeURIComponent(typeCode)}` : ""; // const q = typeCode !== "" ? `?typeCode=${encodeURIComponent(typeCode)}` : "";
uni.navigateTo({ url: `/pages/index/reception` }); uni.navigateTo({
url: `/pages/index/reception`,
complete: () => {
navigating.value = false;
}
});
// 4. 通知外部 // 4. 通知外部
emit("start"); emit("start");
......
<template> <template>
<TabBarShell :active-tab-index="activeTabIndex" <TabBarShell :active-tab-index="activeTabIndex"
:page-vars="activePageVars" :page-vars="activePageVars"
:prevent-navigate="true"
@tab-change="handleTabChange"> @tab-change="handleTabChange">
<template v-for="(_, index) in TAB_PAGE_VARS" :key="index"> <template v-for="(_, index) in TAB_PAGE_VARS" :key="index">
<view v-if="tabMounted[index]" v-show="activeTabIndex === index" class="tab-panel"> <view v-if="tabMounted[index]"
<component :is="tabComponents[index]" :active-index="activeTabIndex" /> v-show="activeTabIndex === index"
class="tab-panel"
:class="getTabTransitionClass(index)">
<component :is="TAB_COMPONENTS[index]" :active-index="activeTabIndex" />
</view> </view>
</template> </template>
</TabBarShell> </TabBarShell>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, onShow, onMounted, ref } from "vue"; import { computed, nextTick, onShow, onMounted, ref, type Ref } from "vue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import TabBarShell from "@/components/TabBar/TabBarShell.uvue"; import TabBarShell from "./tabbar/TabBarShell.uvue";
import { TAB_PAGE_VARS, resolveTabComponent, getTotalTabCount } from "./tabRegistry.uts"; import { TAB_PAGE_VARS, TAB_COMPONENTS } from "./tabRegistry.uts";
import { useOrientation } from "@/services/adapter/hooks/index.uts";
const totalCount = getTotalTabCount(); const orientationHook = useOrientation();
/** 当前激活的 tab 下标 */ /** 当前激活的 tab 下标 */
const activeTabIndex = ref<number>(0); const activeTabIndex = ref<number>(0);
// ── 以下定义顺序不能颠倒(UTS 不支持函数声明提升)──
function createLazyFlags(): boolean[] { function createLazyFlags(): boolean[] {
const arr: boolean[] = []; const arr: boolean[] = [];
for (let i = 0; i < totalCount; i++) { for (let i = 0; i < TAB_COMPONENTS.length; i++) {
arr.push(i == 0); arr.push(i == 0);
} }
return arr; return arr;
} }
/** 懒加载标记:根据注册表长度自动生成,避免启动时全部初始化 */ /** 懒加载标记:根据注册表长度自动生成 */
const tabMounted = ref<boolean[]>(createLazyFlags()); const tabMounted = ref<boolean[]>(createLazyFlags());
/** 预计算 tab 组件数组(模板不支持函数调用,用数组下标替代) */
const tabComponents = computed((): any[] => {
const result: any[] = [];
for (let i = 0; i < totalCount; i++) {
result.push(resolveTabComponent(i));
}
return result;
});
/** 当前 tab 对应的 pageVars */ /** 当前 tab 对应的 pageVars */
const activePageVars = computed((): UTSJSONObject => { const activePageVars = computed((): UTSJSONObject => {
return TAB_PAGE_VARS[activeTabIndex.value]; return TAB_PAGE_VARS[activeTabIndex.value];
}); });
// ── 切换动画 ──
const prevTabIndex = ref<number>(-1);
const tabTransitionActive = ref<boolean>(false);
const tabTransitionDir = ref<string>("");
let transTimer: null | number = null;
function getTabTransitionClass(index: number): string {
if (!tabTransitionActive.value) return "";
if (index === activeTabIndex.value) return `tab-enter-${tabTransitionDir.value}`;
if (index === prevTabIndex.value) return "tab-exit";
return "";
}
/** 标记 tab 为已激活(懒加载首次挂载) */ /** 标记 tab 为已激活(懒加载首次挂载) */
function activateTab(index: number): void { function activateTab(index: number): void {
const arr = tabMounted.value; const arr = tabMounted.value;
...@@ -58,9 +63,32 @@ function activateTab(index: number): void { ...@@ -58,9 +63,32 @@ function activateTab(index: number): void {
} }
function handleTabChange(index: number): void { function handleTabChange(index: number): void {
if (index == activeTabIndex.value) return; if (index === activeTabIndex.value) return;
// 清理上次过渡
const timerId = transTimer;
if (timerId !== null) {
clearTimeout(timerId);
transTimer = null;
}
const oldIndex = activeTabIndex.value;
const isPortrait = (orientationHook.isPortrait as Ref<boolean>).value;
// 竖屏:水平滑入(forward 从左来,backward 从右来)
// 横屏:垂直滑入(forward 从上来,backward 从下来)
const dir = isPortrait
? (index > oldIndex ? "forward" : "backward")
: (index > oldIndex ? "down" : "up");
prevTabIndex.value = oldIndex;
tabTransitionDir.value = dir;
activateTab(index); activateTab(index);
activeTabIndex.value = index; activeTabIndex.value = index;
// 下一帧启动动画(确保 v-show 已生效)
nextTick().then(() => {
tabTransitionActive.value = true;
transTimer = setTimeout(() => {
tabTransitionActive.value = false;
transTimer = null;
}, 280);
});
} }
onMounted(() => { onMounted(() => {
...@@ -87,4 +115,6 @@ onShow(() => { ...@@ -87,4 +115,6 @@ onShow(() => {
min-width: 0; min-width: 0;
overflow: hidden; overflow: hidden;
} }
// ── 切换动画(uvue 不支持 CSS animation/@keyframes,保留 class 供后续 UniElement.animate 扩展)──
</style> </style>
/** /**
* Tab 注册表 —— 新增/删除 tab 的唯一维护入口。 * Tab 注册表 —— 新增/删除 tab 的唯一维护入口。
* *
* 新增 tab 步骤(共 3 步,全在此文件内): * 一个 tab 的全部信息(TabBar 展示 + 页面内容 + 样式变量)集中在 TAB_ITEMS 一条内:
* 1. 顶部添加 import 组件 + vars * 1. 顶部添加 import 组件 + vars
* 2. TAB_COMPONENTS 数组末尾追加组件 * 2. TAB_ITEMS 数组末尾追加一个条目
* 3. TAB_PAGE_VARS 数组末尾追加对应的 vars
* *
* index.uvue 无需任何修改。 * index.uvue 与 TabBar(竖屏/横屏)均直接使用 TAB_ITEMS,无需其他修改。
*/ */
import { computed, ref } from "vue";
// ── Tab 内容组件 ── // ── Tab 内容组件 ──
import HomeContent from "@/pages/index/index.uvue"; import HomeContent from "@/pages/index/index.uvue";
import TasksContent from "@/pages/tasks/index.uvue"; import TasksContent from "@/pages/tasks/index.uvue";
...@@ -24,34 +25,166 @@ import reportVars from "@/pages/reports/styles/index.vars.uts"; ...@@ -24,34 +25,166 @@ import reportVars from "@/pages/reports/styles/index.vars.uts";
import personVars from "@/pages/person/styles/index.vars.uts"; import personVars from "@/pages/person/styles/index.vars.uts";
// ════════════════════════════════════════════════════════ // ════════════════════════════════════════════════════════
// 维护区:新增 tab 时在此追加对应项(顺序 = tab 展示顺序) // 维护区:新增 tab 时在此追加一项(顺序 = tab 展示顺序)
// ════════════════════════════════════════════════════════ // ════════════════════════════════════════════════════════
const TAB_COMPONENTS = [ /** 单个 tab 的完整配置:TabBar 展示 + 页面内容 + 页面样式变量 */
HomeContent, export type TabRegistryItem = {
TasksContent, label: string;
OrderContent, /** 模板内仅用路径字段,避免 UTS 在 slot 中调用 import 的函数 */
ReportsContent, iconSrcActive: string;
PersonContent, iconSrcInactive: string;
]; /** 页内容组件 */
component: any;
/** 页面 CSS 变量(横竖屏布局适配) */
pageVars: UTSJSONObject;
};
/** 导出供模板 v-for 遍历 + pageVars 查找 */ /** 唯一维护表:顺序 = tab 展示顺序(首页 | 任务 | 录单 | 报表 | 我的) */
export const TAB_PAGE_VARS: UTSJSONObject[] = [ export const TAB_ITEMS: TabRegistryItem[] = [
homeVars as UTSJSONObject, {
taskVars as UTSJSONObject, label: "首页",
orderVars as UTSJSONObject, iconSrcActive: "/static/images/tabbar/home-active.png",
reportVars as UTSJSONObject, iconSrcInactive: "/static/images/tabbar/home.png",
personVars as UTSJSONObject, component: HomeContent,
pageVars: homeVars as UTSJSONObject
},
{
label: "任务",
iconSrcActive: "/static/images/tabbar/tasks-active.png",
iconSrcInactive: "/static/images/tabbar/tasks.png",
component: TasksContent,
pageVars: taskVars as UTSJSONObject
},
{
label: "录单",
iconSrcActive: "/static/images/tabbar/record-active.png",
iconSrcInactive: "/static/images/tabbar/record.png",
component: OrderContent,
pageVars: orderVars as UTSJSONObject
},
{
label: "报表",
iconSrcActive: "/static/images/tabbar/reports-active.png",
iconSrcInactive: "/static/images/tabbar/reports.png",
component: ReportsContent,
pageVars: reportVars as UTSJSONObject
},
{
label: "我的",
iconSrcActive: "/static/images/tabbar/study-active.png",
iconSrcInactive: "/static/images/tabbar/study.png",
component: PersonContent,
pageVars: personVars as UTSJSONObject
}
]; ];
// ════════════════════════════════════════════════════════ // ════════════════════════════════════════════════════════
// 自动 API(以下代码无需修改) // 自动 API(以下代码无需修改,均从 TAB_ITEMS 派生)
// ════════════════════════════════════════════════════════
function buildPageVars(): UTSJSONObject[] {
const arr: UTSJSONObject[] = [];
for (let i = 0; i < TAB_ITEMS.length; i++) {
arr.push(TAB_ITEMS[i].pageVars);
}
return arr;
}
function buildTabComponents(): any[] {
const arr: any[] = [];
for (let i = 0; i < TAB_ITEMS.length; i++) {
arr.push(TAB_ITEMS[i].component);
}
return arr;
}
/** 供模板 v-for 遍历(数量与顺序 = TAB_ITEMS) */
export const TAB_PAGE_VARS: UTSJSONObject[] = buildPageVars();
/** 预计算的 tab 组件数组,供模板直接用下标取值 */
export const TAB_COMPONENTS: any[] = buildTabComponents();
// ════════════════════════════════════════════════════════
// TabBar 壳逻辑
// ════════════════════════════════════════════════════════ // ════════════════════════════════════════════════════════
export function resolveTabComponent(index: number): any { export type HomeFrameTabbarSource = {
return TAB_COMPONENTS[index]; getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
} }
export function getTotalTabCount(): number { /**
return TAB_COMPONENTS.length; * 横屏侧栏头像文案:与 simgle_app `LeftSide` 使用 `userInfo.userName` 一致;
* 数科/ROP 返回里常见 `name`、`staffName`、`nickName`、`merchantName` 等作回退。
*/
export function resolveHomeFrameDisplayName(info: null | UTSJSONObject): string {
if (info == null) {
return "";
}
const obj = info as UTSJSONObject;
const userName = obj.userName as string | null;
if (userName != null && userName !== "") {
return userName;
}
const username = obj.username as string | null;
if (username != null && username !== "") {
return username;
}
const realName = obj.realName as string | null;
if (realName != null && realName !== "") {
return realName;
}
const raw = obj.name ?? obj.staffName ?? obj.nickName ?? obj.merchantName ?? obj.accountName ?? obj.displayName;
if (raw == null) {
return "";
}
const s = `${raw}`;
return s !== "" ? s : "";
}
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showSetting = ref(false);
const showSwitchStore = ref(false);
const userName = computed((): string => {
return resolveHomeFrameDisplayName(source.getUserInfo());
});
const onSettingVisible = (v: boolean): void => {
showSetting.value = v;
};
const onSetting = (): void => {
showSetting.value = true;
};
const jumpPersonCenter = (): void => {
uni.navigateTo({ url: "/pages/person/attendance" });
};
const onSwitchStore = (): void => {
showSwitchStore.value = true;
};
const onSwitchStoreVisible = (v: boolean): void => {
showSwitchStore.value = v;
};
const onSwitchStoreDone = (_store: UTSJSONObject): void => {
showSwitchStore.value = false;
showSetting.value = false;
};
return {
showSetting,
showSwitchStore,
userName,
onSettingVisible,
onSetting,
jumpPersonCenter,
onSwitchStore,
onSwitchStoreVisible,
onSwitchStoreDone
};
} }
<template> <template>
<view class="home-tabbar home-tabbar-landscape"> <view class="home-tabbar home-tabbar-landscape">
<!-- <image class="home-tabbar-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" /> -->
<view class="hf-landscape-column"> <view class="hf-landscape-column">
<view class="user-box user-box-clickable hf-landscape-user" <view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')"> @click="emit('jumpPersonCenter')">
...@@ -23,7 +20,7 @@ ...@@ -23,7 +20,7 @@
:key="index" :key="index"
class="landscape-vertical-tabs__item" class="landscape-vertical-tabs__item"
:class="index === currentTabIndex ? 'landscape-vertical-tabs__item--active' : ''" :class="index === currentTabIndex ? 'landscape-vertical-tabs__item--active' : ''"
@click="onTabItemClick(index)"> @click="emit('tabChange', index)">
<view class="landscape-vertical-tabs__inner"> <view class="landscape-vertical-tabs__inner">
<image class="landscape-vertical-tabs__icon" <image class="landscape-vertical-tabs__icon"
mode="aspectFit" mode="aspectFit"
...@@ -35,19 +32,14 @@ ...@@ -35,19 +32,14 @@
</view> </view>
</view> </view>
<view class="home-tabbar-footer flex-col hf-landscape-footer"> <view class="home-tabbar-footer flex-col hf-landscape-footer">
<!-- ✅ 分隔线,与上方 Tab 区域区分 -->
<view class="hf-landscape-footer-divider"></view> <view class="hf-landscape-footer-divider"></view>
<!-- ✅ 切换门店按钮 -->
<view class="hf-landscape-footer-btn" <view class="hf-landscape-footer-btn"
@tap="handleSwitchStore"> @tap="emit('switchStore')">
<image class="hf-landscape-footer-icon" <image class="hf-landscape-footer-icon"
mode="aspectFit" mode="aspectFit"
src="/static/images/home/scene-change.png" /> src="/static/images/home/scene-change.png" />
<text class="hf-landscape-footer-label">切换</text> <text class="hf-landscape-footer-label">切换</text>
</view> </view>
<!-- ✅ 设置按钮 -->
<view class="hf-landscape-footer-btn" <view class="hf-landscape-footer-btn"
@tap="emit('setting')"> @tap="emit('setting')">
<image class="hf-landscape-footer-icon" <image class="hf-landscape-footer-icon"
...@@ -62,9 +54,8 @@ ...@@ -62,9 +54,8 @@
<script setup lang="uts"> <script setup lang="uts">
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { HOME_FRAME_TABS as tabs, resolveHomeFrameDisplayName } from "./tabbarShared.uts"; import { TAB_ITEMS as tabs, resolveHomeFrameDisplayName } from "../tabRegistry.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import { toStr } from "@/utils/common.uts";
const props = defineProps<{ const props = defineProps<{
currentTabIndex: number currentTabIndex: number
...@@ -74,7 +65,6 @@ const emit = defineEmits<{ ...@@ -74,7 +65,6 @@ const emit = defineEmits<{
tabChange: [name: string | number] tabChange: [name: string | number]
setting: [] setting: []
jumpPersonCenter: [] jumpPersonCenter: []
/** 切换门店:打开弹窗 */
switchStore: [] switchStore: []
}>(); }>();
...@@ -84,23 +74,14 @@ const avatarText = ref<string>("我"); ...@@ -84,23 +74,14 @@ const avatarText = ref<string>("我");
onMounted(() => { onMounted(() => {
const userInfo = storage.getUserInfo(); const userInfo = storage.getUserInfo();
if (userInfo != null) { if (userInfo != null) {
const __userName = resolveHomeFrameDisplayName(userInfo); const name = resolveHomeFrameDisplayName(userInfo);
userName.value = __userName; userName.value = name;
avatarText.value = __userName == "" ? "我" : __userName.substring(0, 1); avatarText.value = name == "" ? "我" : name.substring(0, 1);
} }
}); });
function onTabItemClick(index: number): void {
emit("tabChange", index);
}
function handleSwitchStore(): void {
emit("switchStore");
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* ===== 原 common.scss 中横屏 TabBar 相关样式 ===== */
.home-tabbar { .home-tabbar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -108,16 +89,6 @@ function handleSwitchStore(): void { ...@@ -108,16 +89,6 @@ function handleSwitchStore(): void {
flex-shrink: 0; flex-shrink: 0;
background-color: var(--bg-card, #FFFFFF); background-color: var(--bg-card, #FFFFFF);
.home-tabbar-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.hf-landscape-column, .hf-landscape-column,
.user-box, .user-box,
.landscape-tabbar-wrap, .landscape-tabbar-wrap,
...@@ -137,9 +108,6 @@ function handleSwitchStore(): void { ...@@ -137,9 +108,6 @@ function handleSwitchStore(): void {
padding-top: 46px; padding-top: 46px;
} }
.user-box-clickable {
}
.landscape-tabbar-wrap { .landscape-tabbar-wrap {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
...@@ -154,7 +122,6 @@ function handleSwitchStore(): void { ...@@ -154,7 +122,6 @@ function handleSwitchStore(): void {
flex-shrink: 0; flex-shrink: 0;
} }
/* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */
.hf-landscape-column { .hf-landscape-column {
flex-shrink: 0; flex-shrink: 0;
width: 100%; width: 100%;
...@@ -167,7 +134,6 @@ function handleSwitchStore(): void { ...@@ -167,7 +134,6 @@ function handleSwitchStore(): void {
z-index: 1; z-index: 1;
} }
/* 横屏侧栏:用户区 / Tab / 底按钮同一竖直中轴 */
.hf-landscape-user { .hf-landscape-user {
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -185,7 +151,6 @@ function handleSwitchStore(): void { ...@@ -185,7 +151,6 @@ function handleSwitchStore(): void {
align-items: center; align-items: center;
} }
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
.hf-landscape-name { .hf-landscape-name {
margin-top: 10px; margin-top: 10px;
font-size: 14px; font-size: 14px;
...@@ -207,15 +172,13 @@ function handleSwitchStore(): void { ...@@ -207,15 +172,13 @@ function handleSwitchStore(): void {
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
flex-shrink: 0; flex-shrink: 0;
padding: 20px 10px 28px; /* ✅ 增加上下内边距 */ padding: 20px 10px 28px;
} }
/* ✅ 分隔线:与上方 Tab 区域明确区分 */
.hf-landscape-footer-divider { .hf-landscape-footer-divider {
width: 40px; width: 40px;
height: 1px; /* ✅ 改为 1px,更细腻 */ height: 1px;
background-color: #e5edf8; background-color: #e5edf8;
// margin-bottom: 10px; /* ✅ 分隔线与按钮的间距 */
} }
.hf-landscape-footer-btn { .hf-landscape-footer-btn {
...@@ -224,40 +187,30 @@ function handleSwitchStore(): void { ...@@ -224,40 +187,30 @@ function handleSwitchStore(): void {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
// padding: 2px 0; /* ✅ 按钮内边距 */ margin-top: 8px;
margin-top: 8px; /* ✅ 按钮之间的间距 */
border-radius: 8px; border-radius: 8px;
transition: background-color 0.2s; transition: background-color 0.2s;
} }
.hf-landscape-footer-btn:active { .hf-landscape-footer-btn:active {
background-color: #f5f7fa; /* ✅ 点击反馈 */ background-color: #f5f7fa;
} }
.hf-landscape-footer-icon { .hf-landscape-footer-icon {
width: 24px; /* ✅ 缩小图标,与导航图标(28px)形成层次 */ width: 24px;
height: 24px; height: 24px;
flex-shrink: 0; flex-shrink: 0;
opacity: 0.7; /* ✅ 降低透明度,与导航图标区分 */ opacity: 0.7;
} }
.hf-landscape-footer-label { .hf-landscape-footer-label {
margin-top: 4px; margin-top: 4px;
font-size: 11px; /* ✅ 小字号 */ font-size: 11px;
color: #8a98b5; /* ✅ 灰色文字 */ color: #8a98b5;
text-align: center; text-align: center;
line-height: 16px; line-height: 16px;
} }
.hf-landscape-footer-switch {
font-size: 13px;
font-weight: 600;
color: #3773f8;
line-height: 20px;
text-align: center;
}
/* 横屏侧栏 Tab:占满中间 landscape-tabbar-wrap,条目在剩余高度内垂直居中 */
.landscape-vertical-tabs { .landscape-vertical-tabs {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
...@@ -311,9 +264,4 @@ function handleSwitchStore(): void { ...@@ -311,9 +264,4 @@ function handleSwitchStore(): void {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.landscape-vertical-tabs__label--active {
color: #3773f8;
font-weight: 500;
}
</style> </style>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { HOME_FRAME_TABS as tabs } from "./tabbarShared.uts"; import { TAB_ITEMS as tabs } from "../tabRegistry.uts";
const props = defineProps<{ const props = defineProps<{
currentTabIndex: number currentTabIndex: number
......
<template> <template>
<layout-root :page-vars="resolvedPageVars"> <layout-root :page-vars="pageVars">
<!-- TabBar 壳组件:横/竖两套布局 + 默认槽;方向由 useOrientation 驱动 --> <!-- TabBar 壳组件:横/竖两套布局 + 默认槽;方向由 useOrientation 驱动 -->
<view v-if="shellIsPortrait" class="scene-shell-root-portrait"> <view v-if="shellIsPortrait" class="scene-shell-root-portrait">
<view class="scene-shell-main-portrait"> <view class="scene-shell-main-portrait">
...@@ -23,11 +23,9 @@ ...@@ -23,11 +23,9 @@
</view> </view>
</view> </view>
</view> </view>
<!-- ✅ 统一的设置弹窗(横竖屏共用) -->
<SettingBox :visible="showSetting" <SettingBox :visible="showSetting"
@update:visible="onSettingVisible" @update:visible="onSettingVisible"
@switch-store="onSwitchStore" /> @switch-store="onSwitchStore" />
<!-- ✅ 切换门店抽屉 -->
<SwitchStoreSheet :visible="showSwitchStore" <SwitchStoreSheet :visible="showSwitchStore"
@update:visible="onSwitchStoreVisible" @update:visible="onSwitchStoreVisible"
@switched="onSwitchStoreDone" /> @switched="onSwitchStoreDone" />
...@@ -46,46 +44,28 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts"; ...@@ -46,46 +44,28 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import Landscape from "./Landscape.uvue"; import Landscape from "./Landscape.uvue";
import Portrait from "./Portrait.uvue"; import Portrait from "./Portrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts"; import type { HomeFrameTabbarSource } from "../tabRegistry.uts";
import { navigateToTab, useHomeFrameTabbar } from "./tabbarShared.uts"; import { useHomeFrameTabbar } from "../tabRegistry.uts";
// pageVars 自动匹配
import homePageVars from "@/pages/index/styles/index.vars";
import personVars from "@/pages/person/styles/index.vars";
defineSlots(); defineSlots();
const props = defineProps<{ const props = defineProps<{
/** 当前 tab 页下标:0 首页、1 任务、2 录单、3 报表、4 我的 */ /** 当前 tab 页下标:0 首页、1 任务、2 录单、3 报表、4 我的 */
activeTabIndex: number activeTabIndex: number
/** 页面 CSS 变量,不传时根据 activeTabIndex 自动匹配 */ /** 页面 CSS 变量(由 index.uvue 从 TAB_PAGE_VARS 按 index 取值后传入) */
pageVars?: UTSJSONObject pageVars: UTSJSONObject
/** 设为 true 时,tab 切换仅 emit 事件(父组件自行管理切换),不执行 navigateToTab */
preventNavigate?: boolean
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
/** tab 切换事件:外部可监听做差异化操作(如数据埋点),页面切换已由 TabBar 内部统一处理 */
tabChange: [name: string | number] tabChange: [name: string | number]
}>(); }>();
// updateOrientation();
const orientationHook = useOrientation(); const orientationHook = useOrientation();
const shellIsPortrait = computed((): boolean => { const shellIsPortrait = computed((): boolean => {
return (orientationHook.isPortrait as Ref<boolean>).value == true; return (orientationHook.isPortrait as Ref<boolean>).value == true;
}); });
/** 页面 CSS 变量:优先使用显式传入,否则根据 activeTabIndex 自动匹配 */
const resolvedPageVars = computed((): UTSJSONObject => {
if (props.pageVars != null) {
return props.pageVars;
}
if (props.activeTabIndex == 0) return homePageVars as UTSJSONObject;
return personVars as UTSJSONObject;
});
// ✅ Tabbar 逻辑(userInfo 从 storage 直接获取)
const tabbarSource: HomeFrameTabbarSource = { const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex, getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => { getUserInfo: (): null | UTSJSONObject => {
...@@ -104,14 +84,8 @@ const onSwitchStore = _tabbar.onSwitchStore; ...@@ -104,14 +84,8 @@ const onSwitchStore = _tabbar.onSwitchStore;
const onSwitchStoreVisible = _tabbar.onSwitchStoreVisible; const onSwitchStoreVisible = _tabbar.onSwitchStoreVisible;
const onSwitchStoreDone = _tabbar.onSwitchStoreDone; const onSwitchStoreDone = _tabbar.onSwitchStoreDone;
/** 统一处理 tab 切换:有 preventNavigate 时仅 emit,否则走旧逻辑 navigate */ /** tab 切换:preventNavigate 时仅 emit,否则跳回主容器 */
function onTabChange(name: string | number): void { function onTabChange(name: string | number): void {
const idx = name as number;
if (props.preventNavigate == true) {
emit("tabChange", idx);
return;
}
navigateToTab(idx, props.activeTabIndex);
emit("tabChange", name); emit("tabChange", name);
} }
...@@ -128,7 +102,6 @@ onShow(() => { ...@@ -128,7 +102,6 @@ onShow(() => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* ✅ 竖屏布局 */
.scene-shell-root-portrait { .scene-shell-root-portrait {
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -138,7 +111,6 @@ onShow(() => { ...@@ -138,7 +111,6 @@ onShow(() => {
min-width: 0; min-width: 0;
} }
/** 竖屏:主内容区(TabBar 上方),统一边距 */
.scene-shell-main-portrait { .scene-shell-main-portrait {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
...@@ -151,10 +123,9 @@ onShow(() => { ...@@ -151,10 +123,9 @@ onShow(() => {
.scene-shell-tabbar-portrait { .scene-shell-tabbar-portrait {
flex-shrink: 0; flex-shrink: 0;
height: var(--tabbar-height, 60px); /* ✅ 使用 CSS 变量控制 tabbar 高度 */ height: var(--tabbar-height, 60px);
} }
/* ✅ 横屏布局 */
.scene-shell-root-landscape { .scene-shell-root-landscape {
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -175,7 +146,6 @@ onShow(() => { ...@@ -175,7 +146,6 @@ onShow(() => {
overflow: hidden; overflow: hidden;
} }
/** 横屏:主内容区(TabBar 右侧),统一边距 */
.scene-shell-main-landscape { .scene-shell-main-landscape {
flex: 1 1 0%; flex: 1 1 0%;
min-width: 0; min-width: 0;
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed , defineProps} from "vue"; import { ref, computed } from "vue";
const props = defineProps({ const props = defineProps({
customersList: { customersList: {
type: Array, type: Array,
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed, defineProps } from "vue"; import { ref, computed } from "vue";
const props = defineProps({ const props = defineProps({
customersList: { customersList: {
type: Array, type: Array,
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed , defineProps } from "vue"; import { ref, computed } from "vue";
import type { UnSelectOption } from '@/uni_modules/uview-unix' import type { UnSelectOption } from '@/uni_modules/uview-unix'
const props = defineProps({ const props = defineProps({
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<view class="order-entry-page"> <view class="order-entry-page">
<!-- 页面头部 --> <!-- 页面头部 -->
<view class="page-header"> <view class="page-header">
<view class="page-header-decor"></view>
<view class="page-header-accent"></view> <view class="page-header-accent"></view>
<view class="page-header-copy"> <view class="page-header-copy">
<text class="page-header-title">录单</text> <text class="page-header-title">录单</text>
......
...@@ -31,17 +31,16 @@ ...@@ -31,17 +31,16 @@
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
}
&::before { .page-header-decor {
content: "";
position: absolute; position: absolute;
top: -40px; top: -40px;
right: -20px; right: -20px;
width: 120px; width: 120px;
height: 120px; height: 120px;
border-radius: 999px; border-radius: 60px;
background-color: rgba(44, 102, 247, 0.04); background-color: rgba(44, 102, 247, 0.04);
}
} }
.page-header-accent { .page-header-accent {
...@@ -113,9 +112,9 @@ ...@@ -113,9 +112,9 @@
position: relative; position: relative;
z-index: 1; z-index: 1;
box-sizing: border-box; box-sizing: border-box;
transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), transition: background-color 0.25s ease-in-out,
box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease-in-out,
transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); transform 0.2s ease-in-out;
} }
/* 图标容器 */ /* 图标容器 */
...@@ -129,8 +128,8 @@ ...@@ -129,8 +128,8 @@
justify-content: center; justify-content: center;
margin-bottom: 6px; margin-bottom: 6px;
background-color: transparent; background-color: transparent;
transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), transition: background-color 0.25s ease-in-out,
box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1); box-shadow 0.25s ease-in-out;
} }
.active-icon-wrap { .active-icon-wrap {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, ref, defineExpose } from 'vue' import { computed, ref } from 'vue'
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import ConfirmDialog from "@/components/ConfirmDialog.uvue"; import ConfirmDialog from "@/components/ConfirmDialog.uvue";
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, onMounted, onUnmounted, onResize, ref, watch } from "vue"; import { computed, onMounted, onUnmounted, onResize, ref, watch } from "vue";
import { findCheckResultByBatchId, findCheckResultListByReceptionId, getShortUrl } from "@/api/receiption.uts"; import { findCheckResultByBatchId, findCheckResultListByReceptionId, getShortUrl } from "@/api/receiption.uts";
import CustomEmpty from "@/components/CustomEmpty/index.uvue"; import CustomEmpty from "@/components/CustomEmpty/index.uvue";
import DetailData from "./DetailData.uvue"; import DetailData from "./DetailData.uvue";
......
...@@ -811,7 +811,7 @@ ...@@ -811,7 +811,7 @@
} }
.study-detail-card__status { .study-detail-card__status {
display: block; display: flex;
margin-left: 12px; margin-left: 12px;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!