Commit 55145dca by chenwq1

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

1 parent d8660e73
...@@ -155,6 +155,7 @@ export async function getSoureData( ...@@ -155,6 +155,7 @@ export async function getSoureData(
} catch { } catch {
configList = storage.get("findReceptionpriproConfigList") as Array<any>; configList = storage.get("findReceptionpriproConfigList") as Array<any>;
} }
console.log("[equity] findReceptionpriproConfigList:", configList);
const toolOtherList = (configList as Array<any>).map((i: any) => { const toolOtherList = (configList as Array<any>).map((i: any) => {
return { return {
...@@ -167,19 +168,28 @@ export async function getSoureData( ...@@ -167,19 +168,28 @@ export async function getSoureData(
toolList = toolList.concat(toolOtherList); toolList = toolList.concat(toolOtherList);
const moduleOtherList = (configList as Array<any>).map((i: any) => { 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 { return {
id: ((hasEquity as UTSJSONObject).id as number) + 100 + ((i as UTSJSONObject).id as number), id: ((hasEquity as UTSJSONObject).id as number) + 100 + (iObj.id as number),
title: (i as UTSJSONObject).productName, title: iObj.productName,
shortTitleUrl: (i as UTSJSONObject).procuctLog, shortTitleUrl: iObj.procuctLog,
productPoster: (i as UTSJSONObject).productPoster, productPoster: iObj.productPoster,
briefIntroduction: productIntro,
showAlt: false, showAlt: false,
componentName: "CaseCenter", componentName: "CaseCenter",
receptionpriproCusCaseList: (i as UTSJSONObject).receptionpriproCusCaseList, receptionpriproCusCaseList: iObj.receptionpriproCusCaseList,
hide: true, hide: true,
detailTitle: (i as UTSJSONObject).productName, detailTitle: iObj.productName,
thumbnail: "https://img02.glsx.com.cn/weapp/resource/app-tape/common/qsyw.webp" thumbnail: "https://img02.glsx.com.cn/weapp/resource/app-tape/common/qsyw.webp"
} as UTSJSONObject; } as UTSJSONObject;
}); });
console.log("[equity] moduleOtherList:", moduleOtherList);
materialInfoList = materialInfoList.concat(moduleOtherList); materialInfoList = materialInfoList.concat(moduleOtherList);
} }
......
...@@ -110,11 +110,9 @@ ...@@ -110,11 +110,9 @@
<view v-show="!showReceptionDetail" class="reception-center-inner"> <view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" /> <ReceptionCenterCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" />
</view> </view>
<transition name="reception-detail-right-slide">
<view v-if="showReceptionDetail" class="reception-detail-inner"> <view v-if="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" /> <ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view> </view>
</transition>
</view> </view>
</view> </view>
...@@ -444,23 +442,6 @@ defineExpose({ ...@@ -444,23 +442,6 @@ defineExpose({
flex-direction: column; 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 一致:居中、无通栏背景、两侧渐变线 */
.store-addr { .store-addr {
position: absolute; position: absolute;
......
...@@ -147,10 +147,13 @@ export function useBoutiqueLogic(): BoutiqueLogic { ...@@ -147,10 +147,13 @@ export function useBoutiqueLogic(): BoutiqueLogic {
}; };
const onSwiperChange = (e: any): void => { const onSwiperChange = (e: any): void => {
const detail = (e as UTSJSONObject).detail as null | UTSJSONObject; if (e == null) return;
if (detail != null) { const eventObj = e as UTSJSONObject;
const cur = detail.current as null | number; const detail = eventObj["detail"] as null | UTSJSONObject;
if (cur != null) currentSwiperIndex.value = cur; 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[]> { ...@@ -127,7 +127,8 @@ function getSceneArr(shopMerchantId: string): Promise<number[]> {
resolve([]); resolve([]);
return; 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 yqId = yqMerchantId != null ? `${yqMerchantId}` : "";
const params: UTSJSONObject = { const params: UTSJSONObject = {
......
<template> <template>
<layout-root> <layout-root>
<view class="page-container"> <view class="page-container">
<HomeFrame ref="homeRef" :show-footer="true"> <HomeFrame ref="homeRef"
<template #home> :show-footer="true"
<view class="home-content"> :swiper-custom="true"
<view class="header"> @start="handleStart">
<text class="title"> <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>
<text class="subtitle"> <text class="swiper-desc">
Member Equity {{ getModuleDesc(item) }}
</text> </text>
</view> </view>
</swiper-item>
<view class="action-area"> </swiper>
<view class="start-btn" @click="handleStart"> <text class="module-title">
<text class="btn-text"> {{ getCurrentModuleTitle() }}
开始接待
</text> </text>
<view class="swiper-dots">
<view v-for="(_, i) in moduleList"
:key="i"
class="dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view> </view>
<view v-else class="swiper-empty">
<text class="empty-text">敬请期待</text>
</view> </view>
</view> </view>
<view v-else class="swiper-loading">
<un-skeleton :loading="true" :animate="true" title avatar rows="6"></un-skeleton>
</view>
</template> </template>
<template #detail> <template #detail>
...@@ -48,14 +74,36 @@ const loadComplete = ref<boolean>(false); ...@@ -48,14 +74,36 @@ const loadComplete = ref<boolean>(false);
const moduleList = ref<Array<any>>([]); const moduleList = ref<Array<any>>([]);
const toolList = ref<Array<any>>([]); const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>(""); const mediaId = ref<number | string>("");
const currentSwiperIndex = ref<number>(0);
function setViewInfo(data: any): void { function setViewInfo(data: any): void {
const dataObj = data as UTSJSONObject; const dataObj = data as UTSJSONObject;
moduleList.value = dataObj.moduleList as Array<any>; moduleList.value = dataObj.moduleList as Array<any>;
toolList.value = dataObj.toolList as Array<any>; toolList.value = dataObj.toolList as Array<any>;
currentSwiperIndex.value = 0;
const idValue = dataObj.id; const idValue = dataObj.id;
mediaId.value = typeof idValue === "number" ? idValue.toString() : (idValue as string) ?? ""; mediaId.value = typeof idValue === "number" ? idValue.toString() : (idValue as string) ?? "";
loadComplete.value = true; 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 上 // 直接将数据属性设置到 state.user 上
// const userState = state.user as UserStateType; // const userState = state.user as UserStateType;
...@@ -80,6 +128,71 @@ function handleStart(): void { ...@@ -80,6 +128,71 @@ function handleStart(): void {
uni.navigateTo({ url: `/pages/equity/detail/index` }); 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> { async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> {
const userInfo = storage.get("userInfo") as UTSJSONObject; const userInfo = storage.get("userInfo") as UTSJSONObject;
const shopMerchantId: string = (userInfo.shopMerchantId as string) ?? ""; const shopMerchantId: string = (userInfo.shopMerchantId as string) ?? "";
...@@ -105,6 +218,7 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis ...@@ -105,6 +218,7 @@ async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promis
brandIdList, brandIdList,
subBrandIdList subBrandIdList
}); });
console.log("[equity] getSoureData response:", requestData);
if (requestData != null) { if (requestData != null) {
setViewInfo(requestData as UTSJSONObject); setViewInfo(requestData as UTSJSONObject);
} else { } else {
...@@ -169,7 +283,7 @@ function get_Vehicle_Sales_Data(): void { ...@@ -169,7 +283,7 @@ function get_Vehicle_Sales_Data(): void {
const idStr: number = (eObj.id as number); const idStr: number = (eObj.id as number);
brandIdList.push(idStr); brandIdList.push(idStr);
}); });
// getSoure(brandIdList, subBrandIdList); getSoure(brandIdList, subBrandIdList);
dispatch("setCarBrandsList", carBrandList); dispatch("setCarBrandsList", carBrandList);
storage.set("carBrandList", carBrandList, 0); storage.set("carBrandList", carBrandList, 0);
if (carBrandList.length > 0) { if (carBrandList.length > 0) {
...@@ -239,56 +353,96 @@ onShow(() => { ...@@ -239,56 +353,96 @@ onShow(() => {
height: 100%; height: 100%;
} }
.home-content { .swiper-custom-wrap {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; position: relative;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
} }
.header { .swiper-custom-content {
width: 100%;
height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
margin-bottom: 48px;
} }
.title { .equity-swiper {
font-size: 32px; flex: 1;
font-weight: 600; 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; color: #333;
margin-bottom: 8px; font-size: var(--l-font-base);
font-weight: 500;
} }
.subtitle { .swiper-desc {
font-size: 16px; position: relative;
color: #999; 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; display: flex;
flex-direction: column; flex-direction: row;
align-items: center; justify-content: center;
margin-bottom: 32px; 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 { .dot.active {
width: 200px; background: #4673ff;
height: 60px; }
background-color: #4673ff;
border-radius: 30px; .swiper-empty,
.swiper-loading {
width: 100%;
height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.btn-text { .empty-text {
font-size: 18px; font-size: var(--l-font-sm);
color: #fff; color: #999;
font-weight: 500;
} }
.detail-content { .detail-content {
......
...@@ -12,13 +12,7 @@ ...@@ -12,13 +12,7 @@
</view> </view>
<view class="action-area"> <view class="action-area">
<view class="start-btn" @click="handleStart"> <text class="status-text">二手车场景不支持开始接待跳转</text>
<text class="btn-text">开始接待</text>
</view>
<view v-if="isRecording" class="status-info">
<text class="status-text">录音中...</text>
</view>
</view> </view>
<view class="info-panel"> <view class="info-panel">
...@@ -41,25 +35,15 @@ ...@@ -41,25 +35,15 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import type { Ref } from "vue";
import { ComponentPublicInstance, computed, ref } from "vue"; import { ComponentPublicInstance, computed, ref } from "vue";
import HomeFrame from "@/components/HomeFrame/index.uvue"; import HomeFrame from "@/components/HomeFrame/index.uvue";
import { usePermission } from "@/composables/usePermission";
import { useReception } from "@/composables/useReception"; import { useReception } from "@/composables/useReception";
import { useRecorder } from "@/composables/useRecorder";
import { useUploader } from "@/composables/useUploader";
// import { onLoad, onShow } from '@dcloudio/uni-app' // import { onLoad, onShow } from '@dcloudio/uni-app'
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
const homeRef = ref(null); 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(); const reception = useReception();
type RefWithValue = { value: number } type RefWithValue = { value: number }
...@@ -75,42 +59,6 @@ const receptionStatusText = computed((): string => { ...@@ -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) => { onLoad((options: OnLoadOptions) => {
uni.hideLoading(); uni.hideLoading();
}); });
...@@ -183,26 +131,6 @@ onShow(() => { ...@@ -183,26 +131,6 @@ onShow(() => {
margin-bottom: 32px; 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 { .status-text {
font-size: 14px; font-size: 14px;
color: #ff4747; color: #ff4747;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!