Commit 55145dca by chenwq1

fix: 优化开始接待数据显示

1 parent d8660e73
......@@ -155,6 +155,7 @@ export async function getSoureData(
} catch {
configList = storage.get("findReceptionpriproConfigList") as Array<any>;
}
console.log("[equity] findReceptionpriproConfigList:", configList);
const toolOtherList = (configList as Array<any>).map((i: any) => {
return {
......@@ -167,19 +168,28 @@ export async function getSoureData(
toolList = toolList.concat(toolOtherList);
const moduleOtherList = (configList as Array<any>).map((i: any) => {
const iObj = i as UTSJSONObject;
const productIntro =
(iObj.briefIntroduction as null | string)
?? (iObj.productIntroduction as null | string)
?? (iObj.introduction as null | string)
?? (iObj.desc as null | string)
?? "";
return {
id: ((hasEquity as UTSJSONObject).id as number) + 100 + ((i as UTSJSONObject).id as number),
title: (i as UTSJSONObject).productName,
shortTitleUrl: (i as UTSJSONObject).procuctLog,
productPoster: (i as UTSJSONObject).productPoster,
id: ((hasEquity as UTSJSONObject).id as number) + 100 + (iObj.id as number),
title: iObj.productName,
shortTitleUrl: iObj.procuctLog,
productPoster: iObj.productPoster,
briefIntroduction: productIntro,
showAlt: false,
componentName: "CaseCenter",
receptionpriproCusCaseList: (i as UTSJSONObject).receptionpriproCusCaseList,
receptionpriproCusCaseList: iObj.receptionpriproCusCaseList,
hide: true,
detailTitle: (i as UTSJSONObject).productName,
detailTitle: iObj.productName,
thumbnail: "https://img02.glsx.com.cn/weapp/resource/app-tape/common/qsyw.webp"
} as UTSJSONObject;
});
console.log("[equity] moduleOtherList:", moduleOtherList);
materialInfoList = materialInfoList.concat(moduleOtherList);
}
......
......@@ -110,11 +110,9 @@
<view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" />
</view>
<transition name="reception-detail-right-slide">
<view v-if="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</transition>
<view v-if="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view>
</view>
</view>
......@@ -444,23 +442,6 @@ defineExpose({
flex-direction: column;
}
/* 接待详情:向右滑动进出动画 */
.reception-detail-right-slide-enter-active,
.reception-detail-right-slide-leave-active {
transition: transform 260ms ease;
will-change: transform;
}
.reception-detail-right-slide-enter-from,
.reception-detail-right-slide-leave-to {
transform: translateX(100%);
}
.reception-detail-right-slide-enter-to,
.reception-detail-right-slide-leave-from {
transform: translateX(0);
}
/* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */
.store-addr {
position: absolute;
......
......@@ -147,10 +147,13 @@ export function useBoutiqueLogic(): BoutiqueLogic {
};
const onSwiperChange = (e: any): void => {
const detail = (e as UTSJSONObject).detail as null | UTSJSONObject;
if (detail != null) {
const cur = detail.current as null | number;
if (cur != null) currentSwiperIndex.value = cur;
if (e == null) return;
const eventObj = e as UTSJSONObject;
const detail = eventObj["detail"] as null | UTSJSONObject;
if (detail == null) return;
const currentValue = detail["current"];
if (typeof currentValue === "number") {
currentSwiperIndex.value = currentValue;
}
};
......
......@@ -127,7 +127,8 @@ function getSceneArr(shopMerchantId: string): Promise<number[]> {
resolve([]);
return;
}
const yqMerchantId = (currentUserInfo.subLoginUser as null | UTSJSONObject)?.merchantId ?? currentUserInfo.merchantId;
// 对齐老项目:优先使用子账号所属的 yqMerchantId
const yqMerchantId = (currentUserInfo.subLoginUser as null | UTSJSONObject)?.merchantId;
const yqId = yqMerchantId != null ? `${yqMerchantId}` : "";
const params: UTSJSONObject = {
......
<template>
<layout-root>
<view class="page-container">
<HomeFrame ref="homeRef" :show-footer="true">
<template #home>
<view class="home-content">
<view class="header">
<text class="title">
会员权益场景
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
@start="handleStart">
<template #swiperCustom>
<view v-if="loadComplete" class="swiper-custom-wrap">
<view v-if="moduleList.length > 0" class="swiper-custom-content">
<swiper class="equity-swiper"
:current="currentSwiperIndex"
:circular="moduleList.length > 1"
:autoplay="moduleList.length > 1"
:interval="5000"
:duration="400"
@change="onSwiperChange">
<swiper-item v-for="(item, idx) in moduleList" :key="idx" @tap="toPreview(item)">
<view class="swiper-card">
<image v-if="getModuleCover(item) != ''"
class="swiper-bg"
mode="aspectFill"
:src="getModuleCover(item)" />
<text class="swiper-name">
{{ getModuleName(item) }}
</text>
<text class="swiper-desc">
{{ getModuleDesc(item) }}
</text>
</view>
</swiper-item>
</swiper>
<text class="module-title">
{{ getCurrentModuleTitle() }}
</text>
<text class="subtitle">
Member Equity
</text>
</view>
<view class="action-area">
<view class="start-btn" @click="handleStart">
<text class="btn-text">
开始接待
</text>
<view class="swiper-dots">
<view v-for="(_, i) in moduleList"
:key="i"
class="dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
<view v-else class="swiper-empty">
<text class="empty-text">敬请期待</text>
</view>
</view>
<view v-else class="swiper-loading">
<un-skeleton :loading="true" :animate="true" title avatar rows="6"></un-skeleton>
</view>
</template>
......@@ -48,14 +74,36 @@ 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);
function setViewInfo(data: any): void {
const dataObj = data as UTSJSONObject;
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;
console.log("[equity] setViewInfo data:", dataObj);
console.log("[equity] setViewInfo moduleList:", moduleList.value);
if (moduleList.value.length > 0) {
console.log("[equity] setViewInfo first module:", moduleList.value[0]);
const firstObj = moduleList.value[0] as UTSJSONObject;
const firstCover =
(firstObj.bannerImg as null | string)
?? (firstObj.contentPicUrl as null | string)
?? (firstObj.homeEntranceCover as null | string)
?? (firstObj.imageUrl as null | string)
?? (firstObj.imgUrl as null | string)
?? (firstObj.coverUrl as null | string)
?? (firstObj.coverImg as null | string)
?? (firstObj.productPoster as null | string)
?? (firstObj.detailUrl as null | string)
?? (firstObj.thumbnailUrl as null | string)
?? (firstObj.thumbnail as null | string)
?? "";
console.log("[equity] setViewInfo first module cover:", firstCover);
}
// 直接将数据属性设置到 state.user 上
// const userState = state.user as UserStateType;
......@@ -80,6 +128,71 @@ function handleStart(): void {
uni.navigateTo({ url: `/pages/equity/detail/index` });
}
function getModuleName(item: any): string {
const obj = item as UTSJSONObject;
const value = (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.productIntroduction as null | string)
?? (obj.introduction as null | string)
?? (obj.desc as null | string)
?? "";
return value;
}
function getModuleCover(item: any): string {
const obj = item as UTSJSONObject;
const value =
(obj.bannerImg as null | string)
?? (obj.contentPicUrl as null | string)
?? (obj.homeEntranceCover as null | string)
?? (obj.imageUrl as null | string)
?? (obj.imgUrl as null | string)
?? (obj.coverUrl as null | string)
?? (obj.coverImg as null | string)
?? (obj.productPoster as null | string)
?? (obj.detailUrl as null | string)
?? (obj.thumbnailUrl as null | string)
?? (obj.thumbnail as null | string)
?? "";
return value;
}
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.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;
if (id == null) return;
uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` });
}
function onSwiperChange(e: UniSwiperChangeEvent): void {
const currentValue = e.detail.current;
currentSwiperIndex.value = currentValue;
}
async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> {
const userInfo = storage.get("userInfo") as UTSJSONObject;
const shopMerchantId: string = (userInfo.shopMerchantId as string) ?? "";
......@@ -105,6 +218,7 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis
brandIdList,
subBrandIdList
});
console.log("[equity] getSoureData response:", requestData);
if (requestData != null) {
setViewInfo(requestData as UTSJSONObject);
} else {
......@@ -169,7 +283,7 @@ function get_Vehicle_Sales_Data(): void {
const idStr: number = (eObj.id as number);
brandIdList.push(idStr);
});
// getSoure(brandIdList, subBrandIdList);
getSoure(brandIdList, subBrandIdList);
dispatch("setCarBrandsList", carBrandList);
storage.set("carBrandList", carBrandList, 0);
if (carBrandList.length > 0) {
......@@ -239,56 +353,96 @@ onShow(() => {
height: 100%;
}
.home-content {
.swiper-custom-wrap {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
position: relative;
}
.header {
.swiper-custom-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48px;
}
.title {
font-size: 32px;
font-weight: 600;
.equity-swiper {
flex: 1;
width: 100%;
}
.swiper-card {
position: relative;
width: 100%;
height: 100%;
}
.swiper-bg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 0;
}
.swiper-name {
position: relative;
z-index: 1;
padding-top: var(--l-spacing-lg);
text-indent: 40px;
color: #333;
margin-bottom: 8px;
font-size: var(--l-font-base);
font-weight: 500;
}
.subtitle {
font-size: 16px;
color: #999;
.swiper-desc {
position: relative;
z-index: 1;
margin: var(--l-spacing-md) var(--l-spacing-xl) 0;
color: #666;
font-size: 12px;
line-height: 20px;
}
.action-area {
.swiper-dots {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32px;
flex-direction: row;
justify-content: center;
padding: var(--l-spacing-sm) 0;
}
.module-title {
color: #333;
font-size: 14px;
text-align: center;
padding-top: 8px;
}
.dot {
width: 8px;
height: 8px;
border-radius: 4px;
background: #ccc;
margin: 0 4px;
}
.start-btn {
width: 200px;
height: 60px;
background-color: #4673ff;
border-radius: 30px;
.dot.active {
background: #4673ff;
}
.swiper-empty,
.swiper-loading {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.btn-text {
font-size: 18px;
color: #fff;
font-weight: 500;
.empty-text {
font-size: var(--l-font-sm);
color: #999;
}
.detail-content {
......
......@@ -12,13 +12,7 @@
</view>
<view class="action-area">
<view class="start-btn" @click="handleStart">
<text class="btn-text">开始接待</text>
</view>
<view v-if="isRecording" class="status-info">
<text class="status-text">录音中...</text>
</view>
<text class="status-text">二手车场景不支持开始接待跳转</text>
</view>
<view class="info-panel">
......@@ -41,25 +35,15 @@
</template>
<script setup lang="uts">
import type { Ref } from "vue";
import { ComponentPublicInstance, computed, ref } from "vue";
import HomeFrame from "@/components/HomeFrame/index.uvue";
import { usePermission } from "@/composables/usePermission";
import { useReception } from "@/composables/useReception";
import { useRecorder } from "@/composables/useRecorder";
import { useUploader } from "@/composables/useUploader";
// import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from "@/utils/storage.uts";
const homeRef = ref(null);
const loadComplete = ref<boolean>(true);
const recorder = useRecorder();
const isRecording = (recorder as UTSJSONObject).isRecording as Ref<boolean>;
const uploader = useUploader();
const permission = usePermission();
const reception = useReception();
type RefWithValue = { value: number }
......@@ -75,42 +59,6 @@ const receptionStatusText = computed((): string => {
}
});
async function handleStart(): Promise<void> {
const checkMic = (permission as UTSJSONObject).checkMicrophonePermission as () => Promise<boolean>;
const hasPermission = await checkMic();
if (hasPermission == false) {
uni.showToast({
title: "需要麦克风权限",
icon: "none"
});
return;
}
const clearHist = (reception as UTSJSONObject).clearHistory as () => void;
clearHist();
const startAud = (recorder as UTSJSONObject).startAudio as () => void;
startAud();
const startRec = (reception as UTSJSONObject).startReception as () => void;
startRec();
uni.showToast({
title: "开始接待",
icon: "success"
});
}
function handleFinish(): void {
const stopAud = (recorder as UTSJSONObject).stopAudio as () => void;
stopAud();
const finishRec = (reception as UTSJSONObject).finishReception as () => void;
finishRec();
uni.showToast({
title: "完成接待",
icon: "success"
});
}
onLoad((options: OnLoadOptions) => {
uni.hideLoading();
});
......@@ -183,26 +131,6 @@ onShow(() => {
margin-bottom: 32px;
}
.start-btn {
width: 200px;
height: 60px;
background-color: #4673ff;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
}
.btn-text {
font-size: 18px;
color: #fff;
font-weight: 500;
}
.status-info {
margin-top: 16px;
}
.status-text {
font-size: 14px;
color: #ff4747;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!