Commit 71e14a30 by Lin

refactor(reception): 清理接待中心页面代码和样式

- 移除冗余的注释和未使用的样式,提升代码可读性
- 简化组件导入,优化类型导入方式
- 更新横竖屏适配逻辑,确保在不同设备方向下的表现一致
- 调整样式变量和计算逻辑,增强响应式设计的灵活性
1 parent 058eb04b
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
<text class="test-orientation-text">hooks:{{ hookOrientation }} {{ hookOrientation=='landscape'?'横屏':'竖屏'}} {{ isLandscape }}</text> <text class="test-orientation-text">hooks:{{ hookOrientation }} {{ hookOrientation=='landscape'?'横屏':'竖屏'}} {{ isLandscape }}</text>
</view> --> </view> -->
<view class="reception-center-page"> <view class="reception-center-page">
<!-- <un-navbar title="接待中心" left-icon="" /> -->
<!-- <view class="reception-navbar-spacer"></view> -->
<!-- Tab 切换 --> <!-- Tab 切换 -->
<view v-if="isLandscape != true" <view v-if="isLandscape != true"
class="reception-tabs-container" class="reception-tabs-container"
...@@ -30,7 +27,6 @@ ...@@ -30,7 +27,6 @@
@change="onMainTabChange"> @change="onMainTabChange">
</un-tabs> </un-tabs>
</view> </view>
<!-- Tab 内容区域 --> <!-- Tab 内容区域 -->
<view class="reception-content-container"> <view class="reception-content-container">
<!-- 竖屏:保持原逻辑(Tabs 切换展示) --> <!-- 竖屏:保持原逻辑(Tabs 切换展示) -->
...@@ -171,54 +167,37 @@ ...@@ -171,54 +167,37 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import type { UnPickerColumn, UnPickerColumnItem, UnPickerConfirmEvent, UnTabItem } from "@/uni_modules/uview-unix"; import { type ComponentPublicInstance, type Ref, computed, onMounted, onResize, onUnmounted, ref, watch } from "vue";
import { type UnPickerColumn, type UnPickerColumnItem, type UnPickerConfirmEvent, type UnTabItem } from "@/uni_modules/uview-unix";
import type { ComponentPublicInstance, Ref } from "vue";
import type { ReceptionPortraitMainTabsConfig } from "./styles/portrait.uts";
import type { CompareRow, OutputSummary } from "./types/reception-output-types.uts";
// 接待中心 Tab 聚合页
import { computed, onMounted, onResize, onUnmounted, ref, watch } from "vue";
import { getCustomerFileList, getMerchantPerformance, getReceptionList } from "@/api/receiption.uts"; import { getCustomerFileList, getMerchantPerformance, getReceptionList } from "@/api/receiption.uts";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue"; import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import { cssClassRef } from "@/services/adapter"; import { cssClassRef } from "@/services/adapter";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts"; import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import FormDetail from "./forms/FormDetail.uvue"; import FormDetail from "./forms/FormDetail.uvue";
import ReceptionDetail from "./receptionDetail.uvue"; import ReceptionDetail from "./receptionDetail.uvue";
import pageVars from "./styles/index.vars"; import pageVars from "./styles/index.vars";
// 导入样式变量 import { getReceptionPortraitMainTabsConfig, type ReceptionPortraitMainTabsConfig } from "./styles/portrait.uts";
import {
getPortraitConfig,
getReceptionPortraitMainTabsConfig
} from "./styles/portrait.uts";
import ReceptionCustomerListTab from "./tabs/ReceptionCustomerListTab.uvue"; import ReceptionCustomerListTab from "./tabs/ReceptionCustomerListTab.uvue";
import ReceptionDashboardTab from "./tabs/ReceptionDashboardTab.uvue"; import ReceptionDashboardTab from "./tabs/ReceptionDashboardTab.uvue";
import { getCurrentMonthRange, getMockPerformanceData, getNum, getStr, getTodayDayRangeStrings, mergeByKey, resolveHasMore } from "./types/reception-center-helpers.uts"; import { getCurrentMonthRange, getMockPerformanceData, getNum, getStr, getTodayDayRangeStrings, mergeByKey, resolveHasMore } from "./types/reception-center-helpers.uts";
import type { CompareRow, OutputSummary } from "./types/reception-output-types.uts";
const shellRef = ref(null); const shellRef = ref(null);
onShow(() => { onShow(() => {
// 页面每次「显示」时,让外壳组件从本地缓存里刷新用户信息。
if (shellRef.value != null) { if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp"); (shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
} }
}); });
const isPortrait768x1174 = computed((): boolean => { const isPortrait768x1174 = computed((): boolean => {
// 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位 // 仅在 768x1174 分辨率(竖屏适配类名)下展示顶部安全区占位
return cssClassRef.value.indexOf("layout-portrait-768x1174") >= 0; return cssClassRef.value.indexOf("layout-portrait-768x1174") >= 0;
}); });
/** useOrientation 全局状态,配合 updateOrientation 在 onMounted / onResize 刷新后展示 */
const receptionOrientationHook = useOrientation(); const receptionOrientationHook = useOrientation();
const hookOrientation = computed((): string => { const hookOrientation = computed((): string => {
return (receptionOrientationHook.orientationKey as Ref<string>).value; return (receptionOrientationHook.orientationKey as Ref<string>).value;
}); });
/** /**
* 固定页面可用高度,避免出现“整页上下滑 + 内部列表滚动”的双滚动/溢出问题。 * 固定页面可用高度,避免出现“整页上下滑 + 内部列表滚动”的双滚动/溢出问题。
* 说明: * 说明:
...@@ -248,24 +227,6 @@ const mainTabs: UnTabItem[] = [ ...@@ -248,24 +227,6 @@ const mainTabs: UnTabItem[] = [
{ name: "业绩看板" } as UnTabItem, { name: "业绩看板" } as UnTabItem,
{ name: "客户列表" } as UnTabItem { name: "客户列表" } as UnTabItem
]; ];
// 动态样式 - 根据分辨率返回不同的样式
// 动态样式 - 根据分辨率返回不同的样式
const dynamicModuleBoxStyle = computed((): any => {
// 使用 cssClassRef.value 确保响应式
const adapterCls = cssClassRef.value;
if (adapterCls.indexOf("layout-portrait-768x1174") >= 0) {
const cfg = getPortraitConfig(adapterCls);
return cfg != null ? ({ ...cfg } as UTSJSONObject) : ({} as UTSJSONObject);
}
// computed 返回值不能为 null(UTS 中 Any? -> Any 会触发类型不匹配)
return {} as UTSJSONObject;
});
/** 仅 layout-portrait-768x1174 有值;其它分辨率为 null,主 Tab 保持模板 + scss 原样式 */ /** 仅 layout-portrait-768x1174 有值;其它分辨率为 null,主 Tab 保持模板 + scss 原样式 */
const receptionPortraitMainTabsOverride = computed((): null | ReceptionPortraitMainTabsConfig => { const receptionPortraitMainTabsOverride = computed((): null | ReceptionPortraitMainTabsConfig => {
return getReceptionPortraitMainTabsConfig(cssClassRef.value); return getReceptionPortraitMainTabsConfig(cssClassRef.value);
...@@ -278,7 +239,6 @@ const receptionTabsContainerStyle = computed((): UTSJSONObject => { ...@@ -278,7 +239,6 @@ const receptionTabsContainerStyle = computed((): UTSJSONObject => {
} }
return { return {
padding: c.containerPadding, padding: c.containerPadding,
// 仅 768x1174 竖屏需要额外顶距,其它分辨率强制为 0(避免顶部出现多余空隙)
marginTop: "30px", marginTop: "30px",
} as UTSJSONObject; } as UTSJSONObject;
}); });
...@@ -1307,11 +1267,6 @@ onUnmounted(() => { ...@@ -1307,11 +1267,6 @@ onUnmounted(() => {
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
} }
.reception-navbar-spacer {
height: 44px;
flex-shrink: 0;
}
.reception-route-body { .reception-route-body {
flex: 1; flex: 1;
width: 100%; width: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!