Commit 11bad5f5 by 岑成威

feat: 添加接待中心和个人中心页面,增强首页组件功能

- 新增接待中心和个人中心页面,支持独立路由
- 在首页组件中集成动态布局,优化用户体验
- 引入新的产品介绍轮播组件,提升内容展示效果
- 更新环境配置逻辑,确保不同环境下的正确性
- 移除未使用的样式和组件,清理代码结构
1 parent 8554362b
......@@ -2,7 +2,7 @@
"version" : "1.0",
"configurations" : [
{
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
......
{
"permission": {
"edit": {
"*": "allow"
}
}
}
......@@ -151,15 +151,34 @@ const PATH_ENUM = {
staffMiniprogram: "/rop-dj-staff-miniprogram/"
};
const currentTarget = TARGET_OPTIONS[TARGET_INDEX];
const rawTarget = TARGET_OPTIONS[TARGET_INDEX] as string | null;
const currentTarget = rawTarget != null ? rawTarget : "test";
export const secretKey: SecretKeyMap = secretKeyMap[currentTarget] as SecretKeyMap;
export const domain: string = domainMap[currentTarget] as string;
export const evaluationDomain: string = evaluationDomainMap[currentTarget] as string;
export const djDomain: string = djDomainMap[currentTarget] as string;
export const merchantDomain: string = merchantDomainMap[currentTarget] as string;
export const djSecretKey: SecretKeyItem = djSecretKeyMap[currentTarget] as SecretKeyItem;
export const signSecretKey: SignSecretKeyItem = signSecretKeyMap[currentTarget] as SignSecretKeyItem;
function pickEnvObject(source: UTSJSONObject): UTSJSONObject {
const currentValue = source[currentTarget] as UTSJSONObject | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as UTSJSONObject | null;
return fallbackValue != null ? fallbackValue : {} as UTSJSONObject;
}
function pickEnvString(source: UTSJSONObject): string {
const currentValue = source[currentTarget] as string | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as string | null;
return fallbackValue != null ? fallbackValue : "";
}
export const secretKey: SecretKeyMap = pickEnvObject(secretKeyMap) as SecretKeyMap;
export const domain: string = pickEnvString(domainMap);
export const evaluationDomain: string = pickEnvString(evaluationDomainMap);
export const djDomain: string = pickEnvString(djDomainMap);
export const merchantDomain: string = pickEnvString(merchantDomainMap);
export const djSecretKey: SecretKeyItem = pickEnvObject(djSecretKeyMap) as SecretKeyItem;
export const signSecretKey: SignSecretKeyItem = pickEnvObject(signSecretKeyMap) as SignSecretKeyItem;
export const pathEnum: UTSJSONObject = PATH_ENUM;
export const pathEnumExport: UTSJSONObject = PATH_ENUM;
// env 仅用于区分当前环境标签,这里直接按 TARGET_INDEX 映射为字符串
......
......@@ -79,8 +79,9 @@
import { computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { storage } from "@/utils/storage.uts";
import { cssClassRef } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import { storage } from "@/utils/storage.uts";
import SettingBox from "@/pages/person/SettingBox.uvue";
......@@ -89,20 +90,17 @@ import { getLandscapeConfig } from "./styles/landscape.uts";
import { getPortraitConfig, PORTRAIT_COMMON } from "./styles/portrait.uts";
const props = defineProps<{
isPortrait?: boolean
adapterClass?: string
tabIndex?: number
userInfo?: null | UTSJSONObject
}>();
const emit = defineEmits<{
changeTab: [index: number]
}>();
const showScenePopup = ref(false);
const showSetting = ref(false);
const isPortraitMode = computed((): boolean => {
return props.isPortrait === true;
const modeRef = layoutService.getCurrentMode();
return modeRef.value == "portrait";
});
const adapterClassName = computed((): string => {
......@@ -258,13 +256,63 @@ const userName = computed((): string => {
return s !== "" ? s : "";
});
function resolveMainHomeUrl(): string {
const raw = storage.get("userInfo");
let sceneType = 1;
if (raw != null) {
const st = (raw as UTSJSONObject).sceneType as null | number;
if (st != null) {
sceneType = st;
}
}
let url = "/pages/boutique/index";
if (sceneType == 0) {
url = "/pages/equity/index";
} else if (sceneType == 7) {
url = "/pages/usedCar/index";
}
return url;
}
/** 与 pages.json 的 path 一致(不含前导 /);失败时再试无前导 /,兼容部分运行时装载表差异 */
function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed;
uni.reLaunch({
url: withSlash,
fail: (_err: any) => {
uni.reLaunch({ url: trimmed });
}
});
}
function navigateToTab(index: number): void {
const cur = props.tabIndex != null ? (props.tabIndex as number) : 0;
if (index == cur) {
return;
}
if (index == 0) {
uni.reLaunch({ url: resolveMainHomeUrl() });
return;
}
if (index == 1) {
// 放在 pages 根目录短路径,避免深层目录在部分构建里未进路由表(reLaunch errCode 4)
reLaunchPage("pages/receptionShell");
return;
}
if (index == 2) {
reLaunchPage("pages/personMyShell");
return;
}
}
function onChangeTab(index: number): void {
emit("changeTab", index);
navigateToTab(index);
}
function onPortraitTabChange(name: string | number): void {
const idx = name as number;
emit("changeTab", idx);
navigateToTab(idx);
}
function onScenePopupVisible(v: boolean): void {
......
<template>
<view v-if="!loadComplete" class="intro-swiper-loading">
<BannerSkeleton />
</view>
<view v-else-if="modules.length > 0" class="intro-swiper-custom-wrap fade-in">
<view class="intro-swiper-custom-content">
<view class="intro-hero-head">
<view class="intro-hero-title-wrap">
<text class="intro-hero-eyebrow">{{ eyebrow }}</text>
<text class="intro-hero-title">{{ heroTitle }}</text>
</view>
<view class="intro-hero-indicator-pill">
<text class="intro-hero-indicator-text">{{ currentSwiperIndex + 1 }}/{{ modules.length }}</text>
</view>
</view>
<view class="intro-swiper-stack">
<un-swiper
class="intro-swiper"
:list="swiperList"
:autoplay="modules.length > 1"
:circular="modules.length > 1"
:indicator="false"
:height="swiperHeight"
@change="(e: any) => onSwiperChangeFromEvent(e)"
@click="(idx: any) => onSlideTapFromEvent(idx)"
></un-swiper>
<view v-if="hasDotsOverlay" class="intro-swiper-overlay">
<view class="intro-swiper-dots">
<view v-for="(_, i) in modules"
:key="i"
class="intro-dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
</view>
</view>
</view>
<view v-else class="intro-swiper-empty fade-in">
<view class="intro-empty-card">
<text class="intro-empty-title">{{ emptyTitle }}</text>
<text class="intro-empty-text">{{ emptyText }}</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, ref, watch } from "vue";
import BannerSkeleton from "@/components/Skeleton/BannerSkeleton.uvue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{
loadComplete: boolean
swiperList: UnSwiperItem[]
modules: any[]
eyebrow: string
emptyTitle: string
emptyText: string
swiperHeight: number
}>();
const emit = defineEmits<{
swiperChange: [index: number]
slideTap: [index: number]
}>();
const currentSwiperIndex = ref<number>(0);
watch((): number => props.modules.length, (_len: number) => {
currentSwiperIndex.value = 0;
});
function moduleTitleAt(item: any): string {
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
const value =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.title as null | string)
?? (obj.name as null | string)
?? "";
return value;
}
const heroTitle = computed((): string => {
const list = props.modules;
if (list.length == 0) {
return "";
}
const idx = currentSwiperIndex.value;
if (idx < 0 || idx >= list.length) {
return "";
}
return moduleTitleAt(list[idx]);
});
const hasDotsOverlay = computed((): boolean => {
const list = props.modules;
const idx = currentSwiperIndex.value;
return list.length > 0 && idx >= 0 && idx < list.length;
});
function parseSwiperEventIndex(e: number | UniSwiperChangeEvent | null): number {
if (e == null) {
return 0;
}
if (typeof e === "number") {
return e as number;
}
return e.detail.current;
}
function onSwiperChange(e: number | UniSwiperChangeEvent): void {
const idx = parseSwiperEventIndex(e);
currentSwiperIndex.value = idx;
emit("swiperChange", idx);
}
function onSlideTap(index: number): void {
emit("slideTap", index);
}
/** 模板里必须写成函数调用;事件类型用 any 收口再收窄 */
function onSwiperChangeFromEvent(e: any): void {
onSwiperChange(e as number | UniSwiperChangeEvent);
}
function onSlideTapFromEvent(idx: any): void {
const n = typeof idx === "number" ? (idx as number) : 0;
onSlideTap(n);
}
</script>
<style scoped lang="scss">
.intro-swiper-loading {
width: 100%;
height: 100%;
padding: 12px;
box-sizing: border-box;
}
.intro-swiper-custom-wrap {
width: 100%;
height: 100%;
position: relative;
padding: 0;
box-sizing: border-box;
}
.intro-swiper-custom-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
border-radius: 16px;
background: rgba(255, 255, 255, 0.86);
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
overflow: hidden;
}
.intro-hero-head {
width: 100%;
height: 40px;
padding: 0 10px;
box-sizing: border-box;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgba(226, 236, 248, 0.8);
background: linear-gradient(135deg, rgba(248, 251, 255, 0.95) 0%, rgba(240, 246, 255, 0.95) 100%);
}
.intro-hero-title-wrap {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.intro-hero-eyebrow {
font-size: 10px;
color: #8ea0ba;
line-height: 12px;
}
.intro-hero-title {
margin-top: 0;
font-size: 14px;
font-weight: 700;
color: #1e293b;
line-height: 18px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.intro-hero-indicator-pill {
height: 22px;
min-width: 44px;
padding: 0 8px;
border-radius: 13px;
background: #e9f1ff;
border: 1px solid #cfe0f8;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.intro-hero-indicator-text {
font-size: 11px;
font-weight: 600;
color: #2a5ecf;
}
.intro-swiper-stack {
flex: 1;
width: 100%;
min-height: 0;
position: relative;
padding: 0;
box-sizing: border-box;
}
.intro-swiper {
width: 100%;
height: 100%;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}
.intro-swiper-overlay {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 10;
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: flex-end;
background-image: linear-gradient(to top, rgba(30, 58, 138, 0.56) 0%, rgba(30, 58, 138, 0.0) 26%);
border-radius: 10px;
}
.intro-swiper-dots {
position: absolute;
left: 0;
right: 0;
bottom: 2px;
display: flex;
flex-direction: row;
justify-content: center;
padding: 0;
}
.intro-dot {
width: 5px;
height: 5px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.42);
margin: 0 3px;
transition: all 0.3s ease;
}
.intro-dot.active {
width: 14px;
background: rgba(255, 255, 255, 0.95);
}
.intro-swiper-empty {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.intro-empty-card {
margin: auto;
width: 70%;
min-height: 118px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.86);
box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
border: 1px solid #e3ecf8;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.intro-empty-title {
font-size: 16px;
font-weight: 600;
color: #1e293b;
margin-bottom: 6px;
}
.intro-empty-text {
font-size: 13px;
color: #94a3b8;
}
</style>
<template>
<view class="home-frame-container"
:key="adapterClass"
:class="[modeClass, resolutionClass, adapterClass]">
<view class="home-content">
<view class="right-side">
<slot :user-info="userInfo"></slot>
</view>
<HomeFrameLeftSide :adapter-class="adapterClass"
:tab-index="activeTabIndex"
:user-info="userInfo" />
</view>
</view>
</template>
<script setup lang="uts">
import { computed, defineExpose, ref } from "vue";
import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue";
type SceneShellSlotProps = {
userInfo: UTSJSONObject
};
type SceneShellSlots = {
default(props: SceneShellSlotProps): any
};
const props = defineProps<{
/** 与当前路由对应:0 首页场景、1 接待中心、2 我的 */
activeTabIndex: number
}>();
defineSlots<SceneShellSlots>();
useResolutionConfig();
const adapterClass = computed((): string => {
const cls = cssClassRef.value;
return cls != null ? (cls as string) : "";
});
const modeClass = computed((): string => {
const modeRef = layoutService.getCurrentMode();
const m = modeRef.value;
return m == "portrait" ? "mode-portrait" : "mode-landscape";
});
const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket();
return `res-${bucket}`;
});
const userInfo = ref<UTSJSONObject>({});
function updateApp(): void {
const info = storage.get("userInfo");
if (info != null) {
userInfo.value = info as UTSJSONObject;
}
}
onLoad((_options) => {
requestRecordPermission();
});
defineExpose({
updateApp
});
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
<template>
<view class="my-center-wrap">
<MyCenter :user-info="resolvedUserInfo" />
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import MyCenter from "@/pages/person/myCenter.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
const resolvedUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
.my-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
}
</style>
<template>
<view class="hf-reception-stack">
<view class="reception-center-inner">
<ReceptionCenter @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from "vue";
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>
<style scoped lang="scss">
.hf-reception-stack {
flex: 1;
width: 100%;
height: 100%;
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;
flex-direction: column;
}
</style>
......@@ -23,19 +23,13 @@
overflow: hidden;
}
.home-content-pad {
flex-direction: row;
}
.home-content-portrait {
// 与容器 modeClass(mode-portrait / mode-landscape)对齐,避免脚本里再算横竖屏
.mode-portrait .home-content {
flex-direction: column;
}
.detail-content {
flex: 1;
width: 100%;
height: 100%;
overflow: hidden;
.mode-landscape .home-content {
flex-direction: row;
}
.right-side {
......
......@@ -31,6 +31,18 @@
}
},
{
"path": "pages/receptionShell",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/personMyShell",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/test/index",
"style": {
"navigationStyle": "custom"
......
......@@ -3,49 +3,14 @@
<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">
<template #swiperCustom>
<view v-if="!logic.loadComplete.value" class="content-wrap">
<scroll-view class="pkg-scroll"
direction="vertical"
:show-scrollbar="true">
<view v-if="logic.packageList.value.length > 0" class="pkg-list">
<view v-for="(item, idx) in logic.packageList.value"
:key="idx"
class="pkg-card"
@tap="toDetail(idx)">
<image v-if="logic.getPkg(item, 'bannerImg')"
class="pkg-cover"
mode="aspectFill"
:src="logic.getPkg(item, 'bannerImg')" />
<view class="pkg-main">
<view class="pkg-name">
{{ logic.getPkg(item, "name") }}
</view>
<view class="pkg-brief">
{{ logic.getPkg(item, "briefIntroduction") }}
</view>
<view class="pkg-price-row">
<text class="label">市场价</text>
<text class="value">¥{{ logic.getPkg(item, "marketPrice") }}</text>
<text class="label">套餐价</text>
<text class="value strong">¥{{ logic.getPkg(item, "packagePrice") }}</text>
</view>
</view>
</view>
</view>
<view v-else class="pkg-empty">
<text class="empty-text">{{ logic.swiperNoDataObject.text }}</text>
</view>
</scroll-view>
</view>
<view v-else class="loading-wrap">
<un-skeleton :animate="true"
:loading="true"
rows="8">
</un-skeleton>
</view>
</template>
</HomeFrame>
<CenterPopup ref="customerTypeRef"
......@@ -80,17 +45,52 @@
<script setup lang="uts">
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, ref } from "vue";
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);
......@@ -117,6 +117,10 @@ function toDetail(index: number): void {
}
}
function onIntroSlideTap(index: number): void {
toDetail(index);
}
function closePackageDetail(): void {
logic.chooseItem.value = {};
}
......@@ -137,90 +141,7 @@ defineExpose({
height: 100%;
}
.loading-wrap {
padding: 24px;
}
.content-wrap {
width: 100%;
height: 100%;
}
.pkg-scroll {
width: 100%;
height: 100%;
}
.pkg-list {
padding: 24px;
display: flex;
flex-direction: column;
}
.pkg-card {
background: #ffffff;
border-radius: 16px;
overflow: hidden;
margin-bottom: 20px;
}
.pkg-cover {
width: 100%;
height: 180px;
}
.pkg-main {
padding: 16px;
display: flex;
flex-direction: column;
}
.pkg-name {
font-size: 18px;
font-weight: 600;
color: #111111;
}
.pkg-brief {
margin-top: 8px;
font-size: 14px;
color: #666666;
}
.pkg-price-row {
margin-top: 12px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
}
.label {
font-size: 12px;
color: #999999;
margin-right: 6px;
}
.value {
font-size: 14px;
color: #333333;
margin-right: 14px;
}
.strong {
color: #e53935;
font-weight: 600;
}
.pkg-empty {
padding: 48px 24px;
display: flex;
flex-direction: row;
justify-content: center;
}
.empty-text {
color: #999999;
font-size: 14px;
.container {
position: relative;
}
</style>
......@@ -96,16 +96,7 @@ export function useBoutiqueLogic(): BoutiqueLogic {
dispatch("clearReceptionTrack");
};
const callExposedMethod = (comp: any, methodName: string): void => {
if (comp == null) return;
const obj = comp as UTSJSONObject;
const fn = obj[methodName];
if (fn != null && typeof fn === "function") {
(fn as () => void)();
}
};
const jumpPage = (homeFrameRef: any, pid: string): void => {
const jumpPage = (_homeFrameRef: any, pid: string): void => {
const list = carBannerList.value;
let carIndex = list.findIndex((e: any) => (e as UTSJSONObject).carModelId == defaultCarId.value);
if (list.length == 1 || carIndex < 0) carIndex = 0;
......@@ -123,12 +114,7 @@ export function useBoutiqueLogic(): BoutiqueLogic {
currentCarId.value = "";
}
// 通知 HomeFrame 进入详情(具体 id/type 等仍在横屏组件内维护)
if (homeFrameRef != null) {
const h = homeFrameRef as UTSJSONObject;
h["__boutique_pid"] = idStr;
callExposedMethod(h, "showDetailPage");
}
// 原 HomeFrame 内嵌详情层已移除;套餐详情走 PackageDetailPopup 等页面内能力
};
const chooseCustomerType = (homeFrameRef: any, index: number): void => {
......
......@@ -4,56 +4,13 @@
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
:intro-load-complete="loadComplete"
:intro-swiper-list="equitySwiperList"
:intro-modules="moduleList"
intro-eyebrow="权益中心"
intro-empty-title="权益配置中"
@intro-slide-tap="onIntroSlideTap"
@start="handleStart">
<template #swiperCustom>
<view v-if="!loadComplete" class="swiper-loading">
<BannerSkeleton />
</view>
<view v-else-if="moduleList.length > 0" class="swiper-custom-wrap fade-in">
<view class="swiper-custom-content">
<view class="equity-hero-head">
<view class="hero-title-wrap">
<text class="hero-eyebrow">权益中心</text>
<text class="hero-title">{{ getCurrentModuleTitle() }}</text>
</view>
<view class="hero-indicator-pill">
<text class="hero-indicator-text">{{ currentSwiperIndex + 1 }}/{{ moduleList.length }}</text>
</view>
</view>
<view class="equity-swiper-stack">
<un-swiper
class="equity-swiper"
:list="equitySwiperList"
:autoplay="moduleList.length > 1"
:circular="moduleList.length > 1"
:indicator="false"
:height="equitySwiperHeight"
@change="(e: number) => onSwiperChange(e)"
@click="(e: number) => onEquitySlideTap(e)"
></un-swiper>
<view v-if="hasEquityOverlay()" class="equity-swiper-overlay">
<view class="swiper-dots">
<view v-for="(_, i) in moduleList"
:key="i"
class="dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
</view>
</view>
</view>
<view v-else class="swiper-empty fade-in">
<view class="empty-card">
<text class="empty-title">权益配置中</text>
<text class="empty-text">敬请期待</text>
</view>
</view>
</template>
<template #detail>
<view class="detail-content">
</view>
</template>
</HomeFrame>
</view>
</layout-root>
......@@ -65,9 +22,7 @@ import { UnSwiperItem } from '@/uni_modules/uview-unix';
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
import { getMockData, getSoureData } from "@/api/system-api.uts";
import BannerSkeleton from "@/components/Skeleton/BannerSkeleton.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { layoutService } from "@/services/LayoutService.uts";
import { dispatch, state } from "@/store/index.uts";
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from "@/utils/storage.uts";
......@@ -78,15 +33,9 @@ const loadComplete = ref<boolean>(false);
const moduleList = ref<Array<any>>([]);
const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>("");
const currentSwiperIndex = ref<number>(0);
const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp";
const equitySwiperHeight = computed((): number => {
const isLandscape = !layoutService.isMode("portrait");
return isLandscape && layoutService.getResolutionBucket() == "1920" ? 320 : 220;
});
function normalizeModuleItem(item: any): UTSJSONObject {
const obj = item as UTSJSONObject;
const detailTitle =
......@@ -188,7 +137,6 @@ function setViewInfo(data: any): void {
const dataObj = normalizeViewData(data);
moduleList.value = dataObj.moduleList as Array<any>;
toolList.value = dataObj.toolList as Array<any>;
currentSwiperIndex.value = 0;
const idValue = dataObj.id;
mediaId.value = typeof idValue === "number" ? idValue.toString() : (idValue as string) ?? "";
loadComplete.value = true;
......@@ -224,31 +172,6 @@ function handleStart(): void {
}
function getModuleName(item: any): string {
const obj = item as UTSJSONObject;
const value =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.name as null | string)
?? (obj.title as null | string)
?? "";
return value;
}
function getModuleDesc(item: any): string {
const obj = item as UTSJSONObject;
const value =
(obj.briefIntroduction as null | string)
?? (obj.materialIntroduction as null | string)
?? (obj.productIntroduction as null | string)
?? (obj.introduction as null | string)
?? (obj.desc as null | string)
?? "";
return value;
}
function getReceptionCover(obj: UTSJSONObject): string {
const source = obj.receptionSourceDetailList;
if (source == null) {
......@@ -330,59 +253,6 @@ const equitySwiperList = computed((): UnSwiperItem[] => {
return out;
});
function hasEquityOverlay(): boolean {
const list = moduleList.value;
const idx = currentSwiperIndex.value;
return list.length > 0 && idx >= 0 && idx < list.length;
}
function equityOverlayName(): string {
const list = moduleList.value;
const idx = currentSwiperIndex.value;
if (idx < 0 || idx >= list.length) {
return "";
}
const item = list[idx];
if (item == null) {
return "";
}
return getModuleName(item);
}
function equityOverlayDesc(): string {
const list = moduleList.value;
const idx = currentSwiperIndex.value;
if (idx < 0 || idx >= list.length) {
return "";
}
const item = list[idx];
if (item == null) {
return "";
}
return getModuleDesc(item);
}
function getCurrentModuleTitle(): string {
const list = moduleList.value;
if (list.length == 0) {
return "";
}
const item = list[currentSwiperIndex.value];
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
const value =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.title as null | string)
?? (obj.name as null | string)
?? "";
return value;
}
function toPreview(item: any): void {
const obj = item as UTSJSONObject;
const id = obj.id as null | number | string;
......@@ -390,21 +260,7 @@ function toPreview(item: any): void {
uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` });
}
function parseSwiperEventIndex(e: number | UniSwiperChangeEvent | null): number {
if (e == null) {
return 0;
}
if (typeof e === "number") {
return e as number;
}
return e.detail.current;
}
function onSwiperChange(e: number | UniSwiperChangeEvent): void {
currentSwiperIndex.value = parseSwiperEventIndex(e);
}
function onEquitySlideTap(index: number): void {
function onIntroSlideTap(index: number): void {
const list = moduleList.value;
if (index >= 0 && index < list.length) {
toPreview(list[index]);
......
<template>
<layout-root>
<view class="page-container my-route-page">
<SceneShell ref="shellRef" :active-tab-index="2">
<template #default="{ userInfo }">
<MyCenterTab :user-info="userInfo" />
</template>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import MyCenterTab from "@/components/HomeFrame/presets/MyCenterTab.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
</style>
<template>
<layout-root>
<view class="page-container reception-route-page">
<SceneShell ref="shellRef" :active-tab-index="1">
<view class="reception-route-body">
<ReceptionStack />
</view>
</SceneShell>
</view>
</layout-root>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue";
import SceneShell from "@/components/HomeFrame/SceneShell.uvue";
import ReceptionStack from "@/components/HomeFrame/presets/ReceptionStack.uvue";
const shellRef = ref(null);
onShow(() => {
if (shellRef.value != null) {
(shellRef.value as ComponentPublicInstance).$callMethod("updateApp");
}
});
</script>
<style scoped lang="scss">
.page-container {
width: 100%;
height: 100%;
}
.reception-route-body {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
position: relative;
}
</style>
......@@ -21,12 +21,6 @@
</view>
</view>
</template>
<template #detail>
<view class="detail-content">
<text class="detail-title">详情页</text>
</view>
</template>
</HomeFrame>
</view>
......@@ -35,7 +29,7 @@
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
import { ComponentPublicInstance, computed, ref } from "vue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { useReception } from "@/composables/useReception";
......@@ -152,18 +146,4 @@ onShow(() => {
color: #333;
font-weight: 500;
}
.detail-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.detail-title {
font-size: 24px;
color: #333;
}
</style>
......@@ -11,7 +11,7 @@ type SubPackage = {
pages: Page[];
};
export type TabBarItem = {
type TabBarItem = {
text?: string;
pagePath: string;
iconPath?: string;
......@@ -19,7 +19,7 @@ export type TabBarItem = {
visible?: boolean;
};
export type TabBar = {
type TabBar = {
custom?: boolean;
color?: string;
selectedColor?: string;
......@@ -37,7 +37,7 @@ export type TabBar = {
redDotColor?: string;
};
export type Ctx = {
type Ctx = {
appid: string;
globalStyle: UTSJSONObject;
pages: Page[];
......@@ -49,18 +49,18 @@ export type Ctx = {
color: UTSJSONObject;
};
// 初始化 ctx 对象,不可修改!!
export const ctx = parse<Ctx>({})!;
// Android 端模块静态初始化时,空对象走 parsePt 的泛型回退会触发 toGenericType NPE。
// 这里保留 null,并在后续显式判空,避免在 clinit 阶段构造空壳 Ctx。
const ctx = parse<Ctx>({});
// PAGES 用于存储所有页面的路径及样式信息
export let PAGES: Page[] = [];
if (isArray(ctx.pages)) {
if (ctx != null && isArray(ctx.pages)) {
PAGES = [...ctx.pages];
}
console.log(ctx);
// 遍历 ctx.subPackages,将所有子包下的页面信息合并到 PAGES 中
if (isArray(ctx.subPackages)) {
if (ctx != null && isArray(ctx.subPackages)) {
ctx.subPackages.forEach((a) => {
a.pages.forEach((b) => {
PAGES.push({
......@@ -82,10 +82,11 @@ PAGES.forEach((e) => {
// TABS 用于存储 tabBar 配置项
export let TABS: TabBarItem[] = [];
// Android 端静态初始化阶段,tabBar 可能为空,需先判空再访问 list
const tabBar = ctx.tabBar;
if (tabBar != null && tabBar.list != null) {
TABS = [...tabBar.list];
// Android 端静态初始化阶段,tabBar 可能为空;list 为可变属性,需读到局部变量再展开,否则无法 smart cast
const tabBar = ctx != null ? ctx.tabBar : null;
const tabBarList = tabBar != null ? tabBar.list : null;
if (tabBarList != null) {
TABS = [...tabBarList];
// 确保每个 tabBar 页面的路径都以 "/" 开头
TABS.forEach((e) => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!