Commit f03ab605 by liimin

Merge branch 'feature/rework' of http://192.168.3.233:8090/monorepo/venus into feature/rework

2 parents 419a1ab0 1d661826
Showing 40 changed files with 2142 additions and 81 deletions
...@@ -90,6 +90,36 @@ export async function findVisitsInfo(params: UTSJSONObject): Promise<any> { ...@@ -90,6 +90,36 @@ export async function findVisitsInfo(params: UTSJSONObject): Promise<any> {
} }
return await http.fetch("dj.api.smartcarlife.customervisits.findVisitsInfo", data, true, "dj") return await http.fetch("dj.api.smartcarlife.customervisits.findVisitsInfo", data, true, "dj")
} }
export async function findCheckResultByBatchId(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'pad',
...params
}
return await http.fetch("dj.pad.api.reception.findCheckResultByBatchId", data, true, "dj")
}
export async function getShortUrl(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.car.boutique.inspection.batch.file.short.url", data, true, "dj")
}
export async function getAiagent(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'pad',
...params
}
return await http.fetch("dj.pad.api.aiagent.get.special.agent", data, true, "dj")
}
// /**获取智能体 */
// getAiagent (data = {}) {
// return http.post({
// method: 'dj.pad.api.aiagent.get.special.agent',
// projectName: 'pad',
// ...data
// })
// }
// /** // /**
// * 查询对话内容 // * 查询对话内容
// */ // */
......
...@@ -142,6 +142,27 @@ export async function getSoureData( ...@@ -142,6 +142,27 @@ export async function getSoureData(
if (dataObj.materialInfoList != null) { if (dataObj.materialInfoList != null) {
materialInfoList = dataObj.materialInfoList as Array<any>; materialInfoList = dataObj.materialInfoList as Array<any>;
} }
if (toolList.length == 0 && materialInfoList.length > 0) {
toolList = materialInfoList.map((item: any) => {
const obj = item as UTSJSONObject;
const shortTitle =
(obj.materialTitle as null | string)
?? (obj.detailTitle as null | string)
?? (obj.materialName as null | string)
?? "";
const shortTitleUrl =
(obj.thumbnail as null | string)
?? (obj.thumbnailUrl as null | string)
?? (obj.homeEntranceCover as null | string)
?? (obj.contentPicUrl as null | string)
?? "";
return {
id: obj.id,
shortTitle,
shortTitleUrl
} as UTSJSONObject;
});
}
const insurance = (materialInfoList as Array<any>).find((e: any) => (e as UTSJSONObject).componentName == "insurance"); const insurance = (materialInfoList as Array<any>).find((e: any) => (e as UTSJSONObject).componentName == "insurance");
const hasEquity = (toolList as Array<any>).find((e: any) => (e as UTSJSONObject).id == (insurance as UTSJSONObject).id); const hasEquity = (toolList as Array<any>).find((e: any) => (e as UTSJSONObject).id == (insurance as UTSJSONObject).id);
...@@ -264,6 +285,14 @@ async function imgTransformBase64(imgList: Array<any>= [], keyList: string[]): P ...@@ -264,6 +285,14 @@ async function imgTransformBase64(imgList: Array<any>= [], keyList: string[]): P
/** 转 base64 */ /** 转 base64 */
async function getBase64(url: string): Promise<string> { async function getBase64(url: string): Promise<string> {
function isProbablyBase64(raw: string): boolean {
if (raw == null || raw == "") return false;
const cleaned = raw.replace(/\s/g, "");
if (cleaned.length < 16) return false;
if ((cleaned.length % 4) != 0) return false;
return /^[A-Za-z0-9+/=]+$/.test(cleaned);
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url, url,
...@@ -281,15 +310,28 @@ async function getBase64(url: string): Promise<string> { ...@@ -281,15 +310,28 @@ async function getBase64(url: string): Promise<string> {
} }
if (typeof data === "string") { if (typeof data === "string") {
base64 = `data:image/png;base64,${data}`; const strData = (data as string).trim();
if (strData.startsWith("data:image/")) {
// 已是 data URI,直接返回
resolve(strData);
return;
}
const cleaned = strData.replace(/\s/g, "");
if (isProbablyBase64(cleaned)) {
base64 = `data:image/png;base64,${cleaned}`;
} else {
// 某些端会回二进制乱码字符串(如 "�PNG..."),该值不可直接作为 base64
resolve(url);
return;
}
} else { } else {
base64 = `data:image/png;base64,${uni.arrayBufferToBase64(data as ArrayBuffer)}`; base64 = `data:image/png;base64,${uni.arrayBufferToBase64(data as ArrayBuffer)}`;
} }
// console.log("转换后的 base64:", `${base64.slice(0, 50) }...`); console.log("转换后的 base64:", `${base64.slice(0, 50) }...`);
resolve(base64); resolve(base64);
} catch (error) { } catch (error) {
// console.error("转换 base64 失败:", error, "res.data:", res.data); console.error("转换 base64 失败:", error, "res.data:", res.data);
resolve(url); resolve(url);
} }
}, },
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
/* Flexbox 布局 - uni-app x 默认 flex-direction: column */ /* Flexbox 布局 - uni-app x 默认 flex-direction: column */
.flex { .flex {
display: flex; display: flex;
flex-direction: row;
} }
.flex-row { .flex-row {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<text class="close-icon">×</text> <text class="close-icon">×</text>
</view> </view>
</view> </view>
<scroll-view class="popup-content" direction="vertical"> <view class="popup-content">
<view v-for="(item, index) in list" <view v-for="(item, index) in list"
:key="index" :key="index"
class="popup-item" class="popup-item"
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<text class="item-describe">{{ (item as UTSJSONObject).describe ?? '' }}</text> <text class="item-describe">{{ (item as UTSJSONObject).describe ?? '' }}</text>
</view> </view>
</view> </view>
</scroll-view> </view>
</view> </view>
</view> </view>
</template> </template>
...@@ -48,12 +48,13 @@ const emit = defineEmits<{ ...@@ -48,12 +48,13 @@ const emit = defineEmits<{
const internalVisible = ref(false); const internalVisible = ref(false);
const popupStyle = computed((): UTSJSONObject => { const popupStyle = computed((): UTSJSONObject => {
const info = uni.getWindowInfo(); const info = uni.getWindowInfo();
const winH = info.windowHeight > 0 ? info.windowHeight : 768; const winW = info.windowWidth > 0 ? info.windowWidth : 375;
const heightPx = Math.round(winH * 0.8); const sideGapPx = 32;
const minHeightPx = Math.round(winH * 0.32); const maxPanelWidthPx = 700;
const widthByWindow = winW - sideGapPx;
const widthPx = Math.max(280, Math.min(maxPanelWidthPx, widthByWindow));
return { return {
height: `${heightPx}px`, width: `${widthPx}px`
minHeight: `${minHeightPx}px`
} as UTSJSONObject; } as UTSJSONObject;
}); });
...@@ -96,12 +97,14 @@ defineExpose({ ...@@ -96,12 +97,14 @@ defineExpose({
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
z-index: 99; z-index: 99;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.popup-box { .popup-box {
width: 700px; width: 700px;
max-width: calc(100vw - 32px);
background: #ffffff; background: #ffffff;
border-radius: var(--l-radius-xl); border-radius: var(--l-radius-xl);
overflow: hidden; overflow: hidden;
...@@ -140,16 +143,28 @@ defineExpose({ ...@@ -140,16 +143,28 @@ defineExpose({
.popup-title-text { .popup-title-text {
font-weight: 500; font-weight: 500;
font-size: var(--l-font-xl); font-size: 26px;
color: #1a1a1a; color: #1a1a1a;
text-align: center;
width: 100%;
padding: 0 56px;
box-sizing: border-box;
} }
.popup-close { .popup-close {
position: absolute; position: absolute!important;
right: var(--l-spacing-lg); right: 12px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
padding: var(--l-spacing-sm); z-index: 2;
width: 36px;
height: 36px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0;
box-sizing: border-box;
} }
.close-icon { .close-icon {
...@@ -159,10 +174,11 @@ defineExpose({ ...@@ -159,10 +174,11 @@ defineExpose({
} }
.popup-content { .popup-content {
flex: 1; width: 100%;
padding: var(--l-spacing-lg); padding: var(--l-spacing-lg);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box;
} }
.popup-item { .popup-item {
......
...@@ -33,8 +33,9 @@ ...@@ -33,8 +33,9 @@
type PresetTypesMap = { type PresetTypesMap = {
base: EmptyTypeConfig base: EmptyTypeConfig
home: EmptyTypeConfig home: EmptyTypeConfig
common: EmptyTypeConfig
contract: EmptyTypeConfig contract: EmptyTypeConfig
function:EmptyTypeConfig function: EmptyTypeConfig
} }
const TYPE_ICON_BASE_PATH: string = '/static/empty/' const TYPE_ICON_BASE_PATH: string = '/static/empty/'
...@@ -49,10 +50,10 @@ ...@@ -49,10 +50,10 @@
icon: 'icon-home-empty.png', icon: 'icon-home-empty.png',
title: '暂无数据' title: '暂无数据'
}, },
common: { common: {
icon: 'icon-common-empty.png', icon: 'icon-common-empty.png',
title: '暂无数据' title: '暂无数据'
}, },
contract: { contract: {
icon: 'icon-contract-empty.png', icon: 'icon-contract-empty.png',
title: '请先选择合同,签约个人信息自动带出' title: '请先选择合同,签约个人信息自动带出'
......
...@@ -358,6 +358,7 @@ defineExpose({ ...@@ -358,6 +358,7 @@ defineExpose({
bottom: 0; bottom: 0;
z-index: 999; z-index: 999;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
...@@ -509,6 +510,7 @@ defineExpose({ ...@@ -509,6 +510,7 @@ defineExpose({
position: absolute; position: absolute;
padding: 8px; padding: 8px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -563,6 +565,7 @@ defineExpose({ ...@@ -563,6 +565,7 @@ defineExpose({
flex: 1; flex: 1;
height: 44px; height: 44px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 8px; border-radius: 8px;
......
...@@ -171,7 +171,7 @@ type TabItem = { ...@@ -171,7 +171,7 @@ type TabItem = {
const tabs: TabItem[] = [ const tabs: TabItem[] = [
{ label: "首页", icon: "home", name: "HomeSlot" }, { label: "首页", icon: "home", name: "HomeSlot" },
{ label: "接待中心", icon: "record", name: "ReceptionCenter" }, { label: "接待中心", icon: "record", name: "ReceptionCenter" },
{ label: "学习中心", icon: "study", name: "StudyCenter" }, { label: "我的", icon: "my", name: "MyCenter" },
// { label: "场景集市", icon: "scene", name: "SceneMarket" }, // { label: "场景集市", icon: "scene", name: "SceneMarket" },
// { label: "活动中心", icon: "activity", name: "ActivityCenter" } // { label: "活动中心", icon: "activity", name: "ActivityCenter" }
]; ];
...@@ -186,6 +186,9 @@ function getTabIconSrc(icon: string, active: boolean): string { ...@@ -186,6 +186,9 @@ function getTabIconSrc(icon: string, active: boolean): string {
if (icon === "study") { if (icon === "study") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png"; return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
} }
if (icon === "my") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
}
return "/static/images/tabbar/home.png"; return "/static/images/tabbar/home.png";
} }
...@@ -401,6 +404,7 @@ function jumpPersonCenter(): void { ...@@ -401,6 +404,7 @@ function jumpPersonCenter(): void {
width: 52px; /* toRpx(104) / 2 */ width: 52px; /* toRpx(104) / 2 */
height: 52px; /* toRpx(104) / 2 */ height: 52px; /* toRpx(104) / 2 */
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 26px; /* toRpx(52) / 2 */ border-radius: 26px; /* toRpx(52) / 2 */
......
<template>
<view class="my-center">
<scroll-view class="my-scroll" :scroll-y="true" :show-scrollbar="false">
<view class="my-content">
<view class="profile-head">
<un-avatar :text="avatarText"
shape="circle"
size="52"
bgColor="#2f6af7"
color="#ffffff"
fontSize="20" />
<text class="name">{{ userName }}</text>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-block">
<un-cell-group title="账号信息" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="姓名"
:value="userName"
icon="account-fill" />
<un-cell title="门店"
:value="shopName"
icon="home-fill" />
<un-cell title="手机号"
:value="plainPhone"
icon="phone-fill" />
<un-cell title="当前场景"
:value="currentSceneTitle"
icon="grid-fill" />
</un-cell-group>
</view>
<un-gap height="12" bg-color="transparent"></un-gap>
<view class="section-block">
<un-cell-group title="常用功能" :border="false" round="14" backgroundColor="#ffffff">
<un-cell title="切换场景"
:value="currentSceneTitle"
icon="grid-fill"
isLink
clickable
@click="onSceneChange" />
<un-cell title="个人考勤"
icon="clock-fill"
isLink
clickable
@click="goAttendance" />
<un-cell title="系统设置"
icon="setting-fill"
isLink
clickable
@click="onSetting" />
</un-cell-group>
</view>
</view>
</scroll-view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="onChooseScene"
@update:visible="onScenePopupVisible" />
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
</template>
<script setup lang="uts">
import { computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import { storage } from "@/utils/storage.uts";
import SettingBox from "./SettingBox.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
type SceneTypeItem = { title: string; describe: string; icon: string; };
const showScenePopup = ref(false);
const showSetting = ref(false);
function getSceneTypeItem(sceneId: number): null | SceneTypeItem {
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" };
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
const sceneTypeIdList = computed((): number[] => {
const info = props.userInfo;
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const result: number[] = [];
for (const e of openArr) {
if (e == 1 || e == 0 || e == 7) {
result.push(e);
}
}
return result.length > 0 ? result : [1, 0, 7];
});
const sceneTypeList = computed((): UTSJSONObject[] => {
const result: UTSJSONObject[] = [];
for (const id of sceneTypeIdList.value) {
const item = getSceneTypeItem(id);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
return result;
});
const userName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
return raw != null ? `${raw}` : "";
});
const shopName = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.shopMerchantName ?? obj.merchantName ?? "";
return raw != null ? `${raw}` : "";
});
const phoneText = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null && `${raw}` != "" ? `手机号:${raw}` : "";
});
const plainPhone = computed((): string => {
const info = props.userInfo;
if (info == null) return "";
const obj = info as UTSJSONObject;
const raw = obj.phone ?? obj.mobile ?? "";
return raw != null ? `${raw}` : "";
});
const avatarText = computed((): string => {
const name = userName.value;
if (name == "") return "我";
return name.slice(0, 1);
});
const currentSceneTitle = computed((): string => {
const info = props.userInfo;
if (info == null) return "未知";
const sceneType = (info as UTSJSONObject).sceneType as null | number;
if (sceneType == null) return "未知";
const item = getSceneTypeItem(sceneType);
return item != null ? item.title : "未知";
});
function onScenePopupVisible(v: boolean): void {
showScenePopup.value = v;
}
function onSettingVisible(v: boolean): void {
showSetting.value = v;
}
function onSceneChange(): void {
showScenePopup.value = true;
}
function onSetting(): void {
showSetting.value = true;
}
function onChooseScene(index: number): void {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) return;
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) return;
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) return;
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
let url = "/pages/boutique/index";
if (sceneType == 0) url = "/pages/equity/index";
else if (sceneType == 7) url = "/pages/usedCar/index";
uni.reLaunch({ url });
}
function goAttendance(): void {
uni.navigateTo({ url: "/pages/person/attendance" });
}
</script>
<style scoped lang="scss">
.my-center {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #eef4ff 0%, #f7f9fc 36%, #f7f9fc 100%);
}
.my-scroll {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
padding: 24px;
box-sizing: border-box;
}
.my-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.section-block {
width: 100%;
}
.profile-row {
display: flex;
flex-direction: row;
align-items: center;
}
.profile-head {
display: flex;
flex-direction: row;
align-items: center;
padding: 10px 6px 2px;
}
.profile-main {
margin-left: 14px;
display: flex;
flex-direction: column;
flex: 1;
}
.name {
margin-left: 12px;
font-size: 20px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
}
.meta {
margin-top: 4px;
font-size: 13px;
color: #808b9c;
}
.scene-tag {
margin-top: 10px;
}
</style>
...@@ -45,7 +45,7 @@ const rootClass = computed((): string => { ...@@ -45,7 +45,7 @@ const rootClass = computed((): string => {
background-color: rgba(255, 255, 255, 0.7); background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4); border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
border-radius: 32px; border-radius: 16px;
flex-direction: column; flex-direction: column;
} }
......
<template>
<view class="detail-info-container">
<view class="detail-info-item">
<view class="item-title">
<image class="detail-info-item-img" src="@/assets/images/reception/icon-pen.png" mode="aspectFit" />
<text class="detail-info-item-text">话术标签</text>
</view>
<view class="item-content">
<view
class="speech-tag-item"
:class="idx % 3 == 2 ? 'speech-tag-item-row-end' : ''"
v-for="(tag, idx) in speechTagList"
:key="idx"
>
<text class="speech-tag-text">{{ tag }}</text>
</view>
</view>
</view>
<view class="detail-info-item">
<view class="item-title">
<image class="detail-info-item-img" src="@/assets/images/reception/icon-title-tag.png" mode="aspectFit" />
<text class="detail-info-item-text">质检明细</text>
</view>
<view class="item-content item-content-quality-table">
<view class="quality-table-wrap">
<view class="quality-table-header">
<view class="quality-th quality-th-col1">
<text class="quality-th-text">一级分类</text>
</view>
<view class="quality-th quality-th-col2">
<text class="quality-th-text">质检得分</text>
</view>
<view class="quality-th quality-th-col3">
<text class="quality-th-text">命中文本</text>
</view>
</view>
<view class="quality-table-body">
<view
class="quality-table-row"
v-for="(row, rIdx) in qualityDetailList"
:key="rIdx"
>
<view class="quality-td quality-td-col1">
<text class="quality-td-text">{{ row.category }}</text>
</view>
<view class="quality-td quality-td-col2">
<text class="quality-td-text">{{ row.score }}</text>
</view>
<view class="quality-td quality-td-col3">
<text class="quality-td-text">{{ row.matchedText }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
const props = defineProps<{
qualityRows?: UTSJSONObject[]
}>();
const speechTagList: string[] = [
"场景塑造-优秀",
"逼单技巧-薄弱",
"场景塑造-优秀",
"场景塑造-优秀",
"场景塑造-优秀",
"场景塑造-薄弱",
"场景塑造-优秀",
"场景塑造-优秀",
];
type QualityDetailRow = {
category: string;
score: string;
matchedText: string;
};
function dimTagGroupName(dim: UTSJSONObject | null): string {
if (dim == null) {
return "";
}
const v = dim["tagGroupName"] as string | null;
return v != null ? v : "";
}
function dimFormatScore(dim: UTSJSONObject | null): string {
if (dim == null) {
return "";
}
const format = dim["formatScore"] as string | null;
if (format != null && format != "") {
return format;
}
const score = dim["score"];
const sumScore = dim["sumScore"];
if (score != null && sumScore != null) {
return `${score}/${sumScore}`;
}
return "";
}
function parseStringArray(rawValue: any | null): string[] {
const out: string[] = [];
if (rawValue == null) {
return out;
}
if (rawValue instanceof Array) {
const arr = rawValue as any[];
let i = 0;
while (i < arr.length) {
const item = arr[i];
if (item != null) {
const s = `${item}`.trim();
if (s != "") {
out.push(s);
}
}
i++;
}
return out;
}
const text = `${rawValue}`.trim();
if (text == "" || text == "[]") {
return out;
}
if (text.substring(0, 1) == "[" && text.substring(text.length - 1, text.length) == "]") {
try {
const parsed = JSON.parse(text) as any;
if (parsed != null && parsed instanceof Array) {
const arr = parsed as any[];
let i = 0;
while (i < arr.length) {
const item = arr[i];
if (item != null) {
const s = `${item}`.trim();
if (s != "") {
out.push(s);
}
}
i++;
}
return out;
}
} catch (e) {
if (`${e}` == "") {
// 占位分支:显式消费异常对象,规避 UTS 未使用告警
}
}
}
out.push(text);
return out;
}
const qualityDetailList = computed((): QualityDetailRow[] => {
const sourceRows = props.qualityRows != null ? props.qualityRows : [];
const out: QualityDetailRow[] = [];
let i = 0;
while (i < sourceRows.length) {
const row = sourceRows[i];
const hitTextList = parseStringArray(row["hitText"]);
out.push({
category: dimTagGroupName(row),
score: dimFormatScore(row),
matchedText: hitTextList.length > 0 ? hitTextList.join(";") : "--"
});
i++;
}
return out;
});
</script>
<style>
.detail-info-container {
display: flex;
flex-direction: column;
width: 100%;
height: auto;
box-sizing: border-box;
padding: 14px 14px;
border-radius: 16.1px;
opacity: 1;
background: #ffffff;
}
.detail-info-item {
display: flex;
flex-direction: column;
}
.item-title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
height: 20px;
}
.detail-info-item-img {
width: 18px;
height: 18px;
flex-shrink: 0;
}
.detail-info-item-text {
margin-left: 6px;
color: #333333;
font-size: 16px;
font-weight: 500;
line-height: 20px;
}
.item-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
width: 100%;
min-width: 0;
margin-top: 12px;
}
.speech-tag-item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 31%;
width: 31%;
min-width: 0;
box-sizing: border-box;
margin-right: 3.5%;
margin-bottom: 8px;
padding: 6px 6px;
border-radius: 8px;
opacity: 1;
background: #edf3ff;
}
.speech-tag-item-row-end {
margin-right: 0;
}
.speech-tag-text {
color: #4673ff;
font-size: 14px;
font-weight: 400;
text-align: center;
}
.item-content-quality-table {
flex-direction: column;
flex-wrap: nowrap;
}
.quality-table-wrap {
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
border-radius: 8px;
overflow: hidden;
border-width: 1px;
border-style: solid;
border-color: #e8ecf2;
}
.quality-table-header {
display: flex;
flex-direction: row;
flex-shrink: 0;
width: 100%;
min-width: 0;
background-color: #edf3ff;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #dce6ff;
}
.quality-th {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 24rpx;
padding-right: 24rpx;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #dce6ff;
}
.quality-th-col1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
.quality-th-col2 {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 176rpx;
}
.quality-th-col3 {
flex-grow: 2;
flex-shrink: 1;
flex-basis: 0;
border-right-width: 0;
}
.quality-th-text {
color: #333333;
font-size: 13px;
font-weight: 700;
text-align: center;
line-height: 18px;
}
.quality-table-body {
display: flex;
flex-direction: column;
flex-shrink: 0;
width: 100%;
min-width: 0;
background-color: #f7f8fa;
}
.quality-table-row {
display: flex;
flex-direction: row;
width: 100%;
min-width: 0;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #ebecef;
}
.quality-td {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 24rpx;
padding-right: 24rpx;
background-color: #f7f8fa;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #ebecef;
}
.quality-td-col1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
.quality-td-col2 {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 176rpx;
}
.quality-td-col3 {
flex-grow: 2;
flex-shrink: 1;
flex-basis: 0;
border-right-width: 0;
align-items: flex-start;
justify-content: flex-start;
}
.quality-td-text {
color: #333333;
font-size: 13px;
font-weight: 400;
line-height: 18px;
text-align: center;
}
.quality-td-col3 .quality-td-text {
text-align: left;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -778,6 +778,7 @@ async function handleSubmit(): Promise<void> { ...@@ -778,6 +778,7 @@ async function handleSubmit(): Promise<void> {
.btn { .btn {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 44px; height: 44px;
......
...@@ -45,9 +45,11 @@ ...@@ -45,9 +45,11 @@
<view class="form-detail-goods-head"> <view class="form-detail-goods-head">
<text class="form-detail-goods-title">商品套餐</text> <text class="form-detail-goods-title">商品套餐</text>
</view> </view>
<view v-if="goodsRowPairs.length == 0" class="goods-empty-wrap"> <CustomEmpty
<text class="goods-empty-text">暂无商品套餐</text> v-if="goodsRowPairs.length == 0"
</view> type="base"
title="暂无商品套餐"
/>
<view <view
v-else v-else
v-for="(row, goodsRowIndex) in goodsRowPairs" v-for="(row, goodsRowIndex) in goodsRowPairs"
...@@ -80,6 +82,7 @@ import { ref, computed, onMounted, nextTick, watch } from 'vue' ...@@ -80,6 +82,7 @@ import { ref, computed, onMounted, nextTick, watch } from 'vue'
import { findVisitsInfo } from '@/api/receiption.uts' import { findVisitsInfo } from '@/api/receiption.uts'
import { getMaterialResponsePage } from '@/api/customer-api.uts' import { getMaterialResponsePage } from '@/api/customer-api.uts'
import { storage } from '@/utils/storage.uts' import { storage } from '@/utils/storage.uts'
import CustomEmpty from '@/components/CustomEmpty/index.uvue'
const GOODS_PLACEHOLDER_IMAGE = 'https://dummyimage.com/320x200/f3f6ff/94a3b8.png&text=%E6%9A%82%E6%97%A0%E5%9B%BE' const GOODS_PLACEHOLDER_IMAGE = 'https://dummyimage.com/320x200/f3f6ff/94a3b8.png&text=%E6%9A%82%E6%97%A0%E5%9B%BE'
...@@ -859,17 +862,6 @@ function handleClose(): void { ...@@ -859,17 +862,6 @@ function handleClose(): void {
color: #1e293b; color: #1e293b;
} }
.goods-empty-wrap {
width: 100%;
padding: 16px 0 8px;
box-sizing: border-box;
}
.goods-empty-text {
font-size: 14px;
color: #94a3b8;
}
/* 每行 list-item 内横向两张卡 */ /* 每行 list-item 内横向两张卡 */
.goods-row-2 { .goods-row-2 {
display: flex; display: flex;
......
...@@ -360,6 +360,7 @@ watch( ...@@ -360,6 +360,7 @@ watch(
height: 32px; height: 32px;
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-bottom: 8px; margin-bottom: 8px;
......
<template>
<!-- 客户录入列表:与 customervisits.customerInfoPage 字段对齐(ownerPhone / brandModel / customerTagName / arrivalDate / ownerName) -->
<view class="customer-entry-list">
<view
v-for="item in customerList"
:key="getStr(item, 'id')"
class="list-card list-card-entry glass-card"
@click="onEntryCardClick(item)"
@longpress="onEntryCardLongPress(item)"
>
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'ownerName') }}</text>
<text class="card-car">{{ getStr(item, 'brandModel') }}</text>
</view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">车主电话</text><text class="info-value">{{ formatPhone(getStr(item, 'ownerPhone')) }}</text></view>
<view class="info-row"><text class="info-label">品牌车型</text><text class="info-value">{{ getStr(item, 'brandModel') }}</text></view>
<view class="info-row"><text class="info-label">客户标签</text><text class="info-value">{{ getStr(item, 'customerTagName') }}</text></view>
<view class="info-row"><text class="info-label">到店日期</text><text class="info-value">{{ formatArrivalDateOnly(getArrivalTsForEntry(item)) }}</text></view>
</view>
<view
v-if="isEntryCardMaskVisible(item)"
class="entry-card-mask"
@click.stop="onEntryCardMaskAbsorbTap"
>
<view class="entry-mask-header">
<view class="entry-mask-close-btn" @click.stop="closeEntryCardMask">
<un-icon name="close" color="#ffffff" size="22"></un-icon>
</view>
</view>
<view class="entry-mask-actions-row">
<view class="entry-mask-action" @click.stop="onEntryCardMaskEdit(item)">
<un-icon name="edit-pen" color="#ffffff" size="28"></un-icon>
<text class="entry-mask-action-text">编辑</text>
</view>
<view class="entry-mask-action" @click.stop="onEntryCardMaskDelete(item)">
<un-icon name="trash" color="#fecaca" size="28"></un-icon>
<text class="entry-mask-action-text entry-mask-action-text-delete">删除</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, watch } from 'vue'
const props = defineProps<{
/** 客户档案列表(由父级拉取并传入) */
customerList: UTSJSONObject[]
/** 与父级「今日到店 / 全部客户」分段器同步;切换时关闭长按遮罩 */
entryFilterIndex: number
}>()
const emit = defineEmits<{
/** 点击卡片:打开客户档案详情 */
'entry-click': [item: UTSJSONObject]
/** 遮罩内编辑:父级打开预录表单并回显 */
'entry-edit': [item: UTSJSONObject]
/** 遮罩内删除:父级从列表移除该项 */
'entry-delete': [item: UTSJSONObject]
}>()
/** 长按展开的操作遮罩:按条目 id 匹配 */
const entryOverlayEntryId = ref('')
watch(
(): number => props.entryFilterIndex,
(_newIdx: number): void => {
entryOverlayEntryId.value = ''
}
)
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) {
return ''
}
return `${v}`
}
function getTs(data: UTSJSONObject, key: string): number | null {
const v = data[key]
if (v == null) {
return null
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? null : n
}
function parseArrivalDateFieldToTs(v: any | null): number | null {
if (v == null) {
return null
}
if (typeof v == 'number') {
if (v > 0) {
return v
}
return null
}
const s = `${v}`.trim()
if (s == '') {
return null
}
let allDigits = true
let j = 0
while (j < s.length) {
const c = s.charCodeAt(j) ?? -1
if (c < 48 || c > 57) {
allDigits = false
break
}
j++
}
if (allDigits && s.length >= 10) {
const n = parseFloat(s)
if (!isNaN(n) && n > 0) {
return n
}
}
const head = s.length >= 10 ? s.substring(0, 10) : ''
if (head.length == 10) {
const parts = head.split('-')
if (parts.length == 3) {
const y = parseInt(parts[0], 10)
const mo = parseInt(parts[1], 10) - 1
const d = parseInt(parts[2], 10)
if (!isNaN(y) && !isNaN(mo) && !isNaN(d)) {
return new Date(y, mo, d, 12, 0, 0).getTime()
}
}
}
return null
}
function getArrivalTsForEntry(item: UTSJSONObject): number | null {
const fromAd = parseArrivalDateFieldToTs(item['arrivalDate'])
if (fromAd != null && fromAd > 0) {
return fromAd
}
return getTs(item, 'arrivalTime')
}
function formatPhone(phone: string): string {
if (phone == null || phone == '') {
return ''
}
const s = phone.replace(/\s/g, '')
if (s.length >= 11) {
return s.substring(0, 3) + ' ' + s.substring(3, 7) + ' ' + s.substring(7, 11)
}
return phone
}
function formatArrivalDateOnly(ts: number | null): string {
if (ts == null || ts <= 0) {
return ''
}
const d = new Date(ts)
const y = d.getFullYear()
const m = (d.getMonth() + 1).toString().padStart(2, '0')
const day = d.getDate().toString().padStart(2, '0')
return `${y}-${m}-${day}`
}
function onEntryCardClick(item: UTSJSONObject): void {
entryOverlayEntryId.value = ''
emit('entry-click', item)
}
function onEntryCardLongPress(item: UTSJSONObject): void {
entryOverlayEntryId.value = getStr(item, 'id')
}
function closeEntryCardMask(): void {
entryOverlayEntryId.value = ''
}
function onEntryCardMaskAbsorbTap(): void {}
function isEntryCardMaskVisible(item: UTSJSONObject): boolean {
const idStr = getStr(item, 'id')
return entryOverlayEntryId.value != '' && idStr == entryOverlayEntryId.value
}
function onEntryCardMaskEdit(item: UTSJSONObject): void {
closeEntryCardMask()
emit('entry-edit', item)
}
function onEntryCardMaskDelete(item: UTSJSONObject): void {
closeEntryCardMask()
emit('entry-delete', item)
}
</script>
<style scoped lang="scss">
.customer-entry-list {
flex-direction: column;
width: 100%;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
border-radius: 16px;
flex-direction: column;
}
.list-card {
padding: 20px;
border-radius: 24px;
margin-bottom: 16px;
}
.list-card-entry {
position: relative;
overflow: hidden;
}
.entry-card-mask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: 24px;
background-color: rgba(15, 23, 42, 0.78);
flex-direction: column;
z-index: 10;
}
.entry-mask-header {
flex-direction: row;
justify-content: flex-end;
padding-top: 4px;
padding-right: 4px;
padding-left: 8px;
}
.entry-mask-close-btn {
padding: 8px;
flex-direction: row;
align-items: center;
justify-content: center;
}
.entry-mask-actions-row {
flex: 1;
flex-direction: row;
align-items: center;
justify-content: center;
padding-bottom: 16px;
}
.entry-mask-action {
flex-direction: column;
align-items: center;
margin-left: 28px;
margin-right: 28px;
}
.entry-mask-action-text {
font-size: 13px;
color: #ffffff;
margin-top: 8px;
text-align: center;
}
.entry-mask-action-text-delete {
color: #fecaca;
}
.card-header-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 16px;
}
.card-title-box {
flex-direction: column;
}
.card-name {
font-size: 18px;
font-weight: bold;
color: #1e293b;
}
.card-car {
font-size: 14px;
font-weight: bold;
color: #0055ff;
margin-top: 4px;
}
.card-info-list {
flex-direction: column;
}
.info-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 10px;
}
.info-label {
font-size: 12px;
color: #64748b;
}
.info-value {
font-size: 12px;
color: #334155;
}
</style>
<template>
<!-- 接待复盘记录列表:与接待接口字段对齐,数据由父级拉取后传入 -->
<view class="reception-record-list">
<view
v-for="(item, idx) in receptionRecordList"
:key="getStr(item, 'batchId') != '' ? getStr(item, 'batchId') + '-' + idx : 'recv-' + idx"
class="list-card glass-card"
@click="onCardClick(item)"
>
<view class="card-header-row">
<view class="card-title-box">
<text class="card-name">{{ getStr(item, 'customerName') }}</text>
<text class="card-car">{{ getStr(item, 'carBrand') }}</text>
</view>
<view class="card-status-box">
<view class="status-badge bg-slate-100">
<text class="status-text text-slate-400">{{ getReviewFlagText(item) }}</text>
</view>
<view
v-if="shouldShowOrderFinishBadge(item)"
:class="orderFinishFlagIsSuccess(item) ? 'status-badge bg-green-50' : 'status-badge bg-red-50'"
>
<text :class="orderFinishFlagIsSuccess(item) ? 'status-text text-green-400' : 'status-text text-red-400'">{{ getOrderFinishResultLabel(item) }}</text>
</view>
</view>
</view>
<view class="card-info-list">
<view class="info-row"><text class="info-label">客户电话</text><text class="info-value">{{ formatPhone(getStr(item, 'phoneNumber')) }}</text></view>
<view class="info-row"><text class="info-label">销售姓名</text><text class="info-value">{{ getReceptionSalesDisplay(item) }}</text></view>
<view class="info-row"><text class="info-label">接待时长</text><text class="info-value">{{ formatReceptionDuration(item) }}</text></view>
<view class="info-row"><text class="info-label">开始接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionStartTime')) }}</text></view>
<view class="info-row info-row-last"><text class="info-label">结束接待</text><text class="info-value">{{ formatTimestamp(getTs(item, 'receptionEndTime')) }}</text></view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps<{
/** 接待记录列表(由父级拉取并传入) */
receptionRecordList: UTSJSONObject[]
}>()
const emit = defineEmits<{
/** 点击卡片:父级根据 filterTabIndex 等处理详情或 toast */
'reception-click': [item: UTSJSONObject]
}>()
function getStr(data: UTSJSONObject, key: string): string {
const v = data[key]
if (v == null) {
return ''
}
return `${v}`
}
function getTs(data: UTSJSONObject, key: string): number | null {
const v = data[key]
if (v == null) {
return null
}
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
return isNaN(n) ? null : n
}
function getReviewFlagText(data: UTSJSONObject): string {
const v = data['reviewFlag']
if (v == null) {
return '未复盘'
}
if (typeof v == 'number') {
return v == 0 ? '已复盘' : '未复盘'
}
const n = parseFloat(`${v}`)
if (isNaN(n)) {
return '未复盘'
}
return n == 0 ? '已复盘' : '未复盘'
}
/** orderFinishFlag:false/0 为战败,true/非 0 为成功;未知则不展示角标(兼容接口 0/1) */
function getOrderFinishFlagOutcome(item: UTSJSONObject): number {
const v = item['orderFinishFlag']
if (v == null) {
return -1
}
if (typeof v == 'boolean') {
return v == true ? 1 : 0
}
if (typeof v == 'number') {
return v == 0 ? 0 : 1
}
const s = `${v}`.trim().toLowerCase()
if (s == 'false' || s == '0') {
return 0
}
if (s == 'true' || s == '1') {
return 1
}
return -1
}
function shouldShowOrderFinishBadge(item: UTSJSONObject): boolean {
return getOrderFinishFlagOutcome(item) >= 0
}
function orderFinishFlagIsSuccess(item: UTSJSONObject): boolean {
return getOrderFinishFlagOutcome(item) == 1
}
function getOrderFinishResultLabel(item: UTSJSONObject): string {
const o = getOrderFinishFlagOutcome(item)
if (o == 1) {
return '成功'
}
if (o == 0) {
return '战败'
}
return ''
}
function getReceptionSalesDisplay(item: UTSJSONObject): string {
const sales = getStr(item, 'salesName')
if (sales != '') {
return sales
}
return getStr(item, 'staffName')
}
function formatPhone(phone: string): string {
if (phone == null || phone == '') {
return ''
}
const s = phone.replace(/\s/g, '')
if (s.length >= 11) {
return s.substring(0, 3) + ' ' + s.substring(3, 7) + ' ' + s.substring(7, 11)
}
return phone
}
function formatTimestamp(ts: number | null): string {
if (ts == null || ts <= 0) {
return ''
}
const d = new Date(ts)
const y = d.getFullYear()
const m = (d.getMonth() + 1).toString().padStart(2, '0')
const day = d.getDate().toString().padStart(2, '0')
const h = d.getHours().toString().padStart(2, '0')
const min = d.getMinutes().toString().padStart(2, '0')
const sec = d.getSeconds().toString().padStart(2, '0')
return `${y}.${m}.${day} ${h}:${min}:${sec}`
}
function formatReceptionDuration(item: UTSJSONObject): string {
let startMs = getTs(item, 'receptionStartTime')
if (startMs == null || startMs <= 0) {
startMs = getTs(item, 'startTime')
}
let endMs = getTs(item, 'receptionEndTime')
if (endMs == null || endMs <= 0) {
endMs = getTs(item, 'endTime')
}
if (startMs == null || endMs == null || startMs <= 0 || endMs <= 0) {
return ''
}
const diffSec = Math.floor((endMs - startMs) / 1000)
if (diffSec < 0) {
return ''
}
const min = Math.floor(diffSec / 60)
const sec = diffSec % 60
return `${min}分${sec}秒`
}
function onCardClick(item: UTSJSONObject): void {
emit('reception-click', item)
}
</script>
<style scoped lang="scss">
.reception-record-list {
flex-direction: column;
width: 100%;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
border-radius: 32px;
flex-direction: column;
}
.list-card {
padding: 20px;
border-radius: 24px;
margin-bottom: 16px;
}
.card-header-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 16px;
}
.card-title-box {
flex-direction: column;
}
.card-name {
font-size: 18px;
font-weight: bold;
color: #1e293b;
}
.card-car {
font-size: 14px;
font-weight: bold;
color: #0055ff;
margin-top: 4px;
}
.card-status-box {
flex-direction: row;
align-items: flex-start;
}
.status-badge {
padding-top: 2px;
padding-bottom: 2px;
padding-left: 6px;
padding-right: 6px;
border-radius: 4px;
margin-left: 4px;
justify-content: center;
align-items: center;
flex-direction: row;
}
.bg-slate-100 {
background-color: #f1f5f9;
}
.bg-red-50 {
background-color: #fef2f2;
}
.bg-green-50 {
background-color: #f0fdf4;
}
.status-text {
font-size: 10px;
}
.text-slate-400 {
color: #94a3b8;
}
.text-red-400 {
color: #f87171;
}
.text-green-400 {
color: #4ade80;
}
.card-info-list {
flex-direction: column;
}
.info-row {
flex-direction: row;
justify-content: space-between;
margin-bottom: 10px;
}
.info-row-last {
margin-bottom: 0;
}
.info-label {
font-size: 12px;
color: #64748b;
}
.info-value {
font-size: 12px;
color: #334155;
}
</style>
...@@ -19,5 +19,34 @@ export type OutputSummary = { ...@@ -19,5 +19,34 @@ export type OutputSummary = {
ringComparePercent: number ringComparePercent: number
} }
/** 智能体信息条目:getAiagent 业务字段 */
export type AiAgentInfo = {
id?: number | null
entryName?: string | null
entryLogoUrl?: string | null
agentCode?: string | null
agentName?: string | null
agentUrl?: string | null
presuppositionProblem?: string | null
preEntryName?: string | null
accountPhone?: string | null
ownerPost?: string | null
domainName?: string | null
questionConfigList?: UTSJSONObject[] | null
ownerShipType?: number | null
tipShowFlag?: number | null
taskStatus?: string | number | null
checkDate?: string | null
sopTaskDetailInfoDTO?: UTSJSONObject | null
}
/** 智能体接口常见包裹结构 */
export type AiAgentResponseBody = {
code?: string | number | null
errId?: any | null
message?: string | null
data?: any | null
}
// NOTE: 该文件原先包含 CarBrandSelect(品牌-车型两步选择组件)相关类型。 // NOTE: 该文件原先包含 CarBrandSelect(品牌-车型两步选择组件)相关类型。
// 本次移除该组件后,这些类型不再被其它代码引用,因此删除以避免维护负担。 // 本次移除该组件后,这些类型不再被其它代码引用,因此删除以避免维护负担。
import { get } from "@/utils/common.uts";
export function toTrimmedString(raw: any | null): string {
if (raw == null) {
return "";
}
return `${raw}`.trim();
}
export function parseNumberValue(raw: any | null): number | null {
if (raw == null) {
return null;
}
if (typeof raw == "number") {
return raw as number;
}
const s = toTrimmedString(raw);
if (s == "") {
return null;
}
const n = parseFloat(s);
return isNaN(n) ? null : n;
}
export function parseIntValue(raw: any | null): number | null {
if (raw == null) {
return null;
}
if (typeof raw == "number") {
return raw as number;
}
const s = toTrimmedString(raw);
if (s == "") {
return null;
}
const n = parseInt(s);
return isNaN(n) ? null : n;
}
export function isSuccessCode(codeRaw: any | null): boolean {
const code = toTrimmedString(codeRaw);
return code == "" || code == "0";
}
export function formatPhoneDisplay(phone: string): string {
if (phone == null || phone == "") {
return "";
}
const s = phone.replace(/\s/g, "");
if (s.length >= 11) {
return s.substring(0, 3) + " " + s.substring(3, 7) + " " + s.substring(7, 11);
}
return phone;
}
export function getOrderFinishFlagOutcomeForItem(item: UTSJSONObject | null | undefined): number {
if (item == null) {
return -1;
}
const v = get(item, "orderFinishFlag");
if (v == null) {
return -1;
}
if (typeof v == "boolean") {
return v == true ? 1 : 0;
}
if (typeof v == "number") {
return v == 0 ? 0 : 1;
}
const s = `${v}`.trim().toLowerCase();
if (s == "false" || s == "0") {
return 0;
}
if (s == "true" || s == "1") {
return 1;
}
return -1;
}
export function formatReceptionScore(item: UTSJSONObject | null | undefined): string {
if (item == null) {
return "-";
}
const scoreRaw = get(item, "score");
if (scoreRaw == null) {
return "-";
}
const score = parseFloat(`${scoreRaw}`.trim());
if (isNaN(score)) {
return "-";
}
const outcome = getOrderFinishFlagOutcomeForItem(item);
if (outcome < 0) {
return "-";
}
const orderFinishFlag = outcome == 1;
if (score >= 85 && orderFinishFlag) {
return "A+";
}
if (score >= 60 && score < 85 && orderFinishFlag) {
return "A";
}
if (score < 60 && orderFinishFlag) {
return "B";
}
if (score >= 85 && !orderFinishFlag) {
return "B+";
}
if (score >= 60 && score < 85 && !orderFinishFlag) {
return "B";
}
if (score < 60 && !orderFinishFlag) {
return "C";
}
return "-";
}
export function formatShareDate(ts: number | null): string {
if (ts == null || ts <= 0) {
return "--";
}
const d = new Date(ts);
const to2 = (n: number): string => (n < 10 ? `0${n}` : `${n}`);
const y = d.getFullYear();
const m = to2(d.getMonth() + 1);
const day = to2(d.getDate());
const h = to2(d.getHours());
const min = to2(d.getMinutes());
const sec = to2(d.getSeconds());
return `${y}年${m}月${day}日 ${h}:${min}:${sec}`;
}
export function formatShareDurationText(directText: string, start: number | null, end: number | null): string {
const direct = toTrimmedString(directText);
if (direct != "") {
return direct;
}
if (start == null || end == null || start <= 0 || end <= 0) {
return "--";
}
const diffSec = Math.floor((end - start) / 1000);
if (diffSec < 0) {
return "--";
}
const min = Math.floor(diffSec / 60);
const sec = diffSec % 60;
return `${min}分${sec}秒`;
}
export function formatReceptionStatusTextByRaw(raw: any | null): string {
const statusNum = parseIntValue(raw);
if (statusNum == 1) {
return "成交";
}
if (statusNum == 2) {
return "战败";
}
return "未知";
}
function parseShortUrlFromData(raw: any | null): string {
if (raw == null) {
return "";
}
if (typeof raw == "string") {
return raw.trim();
}
const obj = raw as UTSJSONObject;
const keyList = ["shortUrl", "shortURL", "url", "link", "batchFileShortUrl", "fileShortUrl", "shortLink"];
let i = 0;
while (i < keyList.length) {
const v = obj[keyList[i]];
if (v != null) {
const s = `${v}`.trim();
if (s != "") {
return s;
}
}
i++;
}
return "";
}
export function parseShortUrlFromResponse(res: any): string {
if (res == null) {
return "";
}
const direct = parseShortUrlFromData(res);
if (direct != "") {
return direct;
}
const body = res as UTSJSONObject;
if (!isSuccessCode(body["code"])) {
return "";
}
return parseShortUrlFromData(body["data"]);
}
export function pickQualityRowsFromResponse(res: any): UTSJSONObject[] {
if (res == null) {
return [];
}
if (res instanceof Array) {
return res as UTSJSONObject[];
}
const body = res as UTSJSONObject;
const data = body["data"];
if (data != null && data instanceof Array) {
return data as UTSJSONObject[];
}
if (data != null) {
const dataObj = data as UTSJSONObject;
const list = dataObj["list"];
if (list != null && list instanceof Array) {
return list as UTSJSONObject[];
}
}
const list = body["list"];
if (list != null && list instanceof Array) {
return list as UTSJSONObject[];
}
return [];
}
...@@ -84,6 +84,7 @@ defineExpose({ ...@@ -84,6 +84,7 @@ defineExpose({
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
z-index: 99; z-index: 99;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -98,6 +99,7 @@ defineExpose({ ...@@ -98,6 +99,7 @@ defineExpose({
.setting-header { .setting-header {
height: 80px; height: 80px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" /> <ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view> </view>
</view> </view>
<view v-else-if="tabIndex == 2" class="my-center-wrap">
<MyCenter :user-info="userInfo" />
</view>
</view> </view>
<view v-else class="right-side"> <view v-else class="right-side">
...@@ -114,6 +117,9 @@ ...@@ -114,6 +117,9 @@
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" /> <ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
</view> </view>
</view> </view>
<view v-else-if="tabIndex == 2" class="my-center-wrap">
<MyCenter :user-info="userInfo" />
</view>
</view> </view>
<!-- 竖屏:底部 TabBar;横屏:左侧栏 --> <!-- 竖屏:底部 TabBar;横屏:左侧栏 -->
...@@ -153,6 +159,7 @@ import { storage } from "@/utils/storage.uts"; ...@@ -153,6 +159,7 @@ import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue"; import HomeFrameLeftSide from "./LeftSide.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue"; import HomeFrameMessageIndex from "./MessageIndex.uvue";
import MyCenter from "./MyCenter.uvue";
import ReceptionCenter from "./ReceptionCenter/center.uvue"; import ReceptionCenter from "./ReceptionCenter/center.uvue";
import ReceptionDetail from "./ReceptionCenter/receptionDetail.uvue"; import ReceptionDetail from "./ReceptionCenter/receptionDetail.uvue";
...@@ -213,6 +220,10 @@ function hideDetailPage(): void { ...@@ -213,6 +220,10 @@ function hideDetailPage(): void {
function onChangeTab(index: number): void { function onChangeTab(index: number): void {
console.log('onChangeTabAACCC', index); console.log('onChangeTabAACCC', index);
tabIndex.value = index; tabIndex.value = index;
if (index != 1) {
showReceptionDetail.value = false;
receptionDetailItem.value = {};
}
} }
function onShowReceptionDetail(item: UTSJSONObject): void { function onShowReceptionDetail(item: UTSJSONObject): void {
...@@ -255,6 +266,7 @@ defineExpose({ ...@@ -255,6 +266,7 @@ defineExpose({
position: relative; position: relative;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: row;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
...@@ -308,6 +320,7 @@ defineExpose({ ...@@ -308,6 +320,7 @@ defineExpose({
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
padding-top: 36px; padding-top: 36px;
...@@ -322,6 +335,7 @@ defineExpose({ ...@@ -322,6 +335,7 @@ defineExpose({
position: relative; position: relative;
z-index: 1; z-index: 1;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0; padding: 0;
...@@ -381,6 +395,7 @@ defineExpose({ ...@@ -381,6 +395,7 @@ defineExpose({
.common-title { .common-title {
height: var(--l-common-title-height); height: var(--l-common-title-height);
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
padding-left: var(--l-spacing-lg); padding-left: var(--l-spacing-lg);
} }
...@@ -401,6 +416,7 @@ defineExpose({ ...@@ -401,6 +416,7 @@ defineExpose({
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -443,6 +459,13 @@ defineExpose({ ...@@ -443,6 +459,13 @@ defineExpose({
flex-direction: column; flex-direction: column;
} }
.my-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
}
/* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */ /* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */
.store-addr { .store-addr {
position: absolute; position: absolute;
......
...@@ -167,7 +167,6 @@ defineExpose({ open, close, hide }); ...@@ -167,7 +167,6 @@ defineExpose({ open, close, hide });
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 100vw;
box-sizing: border-box; box-sizing: border-box;
.tips-content { .tips-content {
width: 100%; width: 100%;
......
...@@ -44,6 +44,7 @@ defineExpose({ ...@@ -44,6 +44,7 @@ defineExpose({
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 9999; z-index: 9999;
......
...@@ -200,6 +200,7 @@ function handleTabClick(index: number): void { ...@@ -200,6 +200,7 @@ function handleTabClick(index: number): void {
.tab-item .text-wrap { .tab-item .text-wrap {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -291,6 +292,7 @@ function handleTabClick(index: number): void { ...@@ -291,6 +292,7 @@ function handleTabClick(index: number): void {
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #eef4fe; background-color: #eef4fe;
......
...@@ -128,6 +128,7 @@ const tabClick = (index: number, item: any) => { ...@@ -128,6 +128,7 @@ const tabClick = (index: number, item: any) => {
.type-scroll-content { .type-scroll-content {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
flex-wrap: nowrap; flex-wrap: nowrap;
} }
...@@ -144,6 +145,7 @@ const tabClick = (index: number, item: any) => { ...@@ -144,6 +145,7 @@ const tabClick = (index: number, item: any) => {
padding: 0 32px; padding: 0 32px;
transition: all 0.15s; transition: all 0.15s;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -169,6 +171,7 @@ const tabClick = (index: number, item: any) => { ...@@ -169,6 +171,7 @@ const tabClick = (index: number, item: any) => {
.flex { .flex {
display: flex; display: flex;
flex-direction: row;
} }
.justify-center { .justify-center {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"versionName": "1.0.0", "versionName": "1.0.0",
"versionCode": "126", "versionCode": "126",
"uni-app-x": { "uni-app-x": {
"flex-direction": "row"
}, },
/* 快应用特有相关 */ /* 快应用特有相关 */
"quickapp": {}, "quickapp": {},
......
...@@ -229,6 +229,7 @@ defineExpose({ ...@@ -229,6 +229,7 @@ defineExpose({
font-size: var(--l-font-base); font-size: var(--l-font-base);
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
...@@ -244,6 +245,7 @@ defineExpose({ ...@@ -244,6 +245,7 @@ defineExpose({
font-size: var(--l-font-lg); font-size: var(--l-font-lg);
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
...@@ -261,6 +263,7 @@ defineExpose({ ...@@ -261,6 +263,7 @@ defineExpose({
font-size: 22px; font-size: 22px;
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
...@@ -308,6 +311,7 @@ defineExpose({ ...@@ -308,6 +311,7 @@ defineExpose({
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -321,6 +325,7 @@ defineExpose({ ...@@ -321,6 +325,7 @@ defineExpose({
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -422,6 +427,7 @@ defineExpose({ ...@@ -422,6 +427,7 @@ defineExpose({
font-size: var(--l-font-base); font-size: var(--l-font-base);
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
.price-1 .unit { .price-1 .unit {
...@@ -436,6 +442,7 @@ defineExpose({ ...@@ -436,6 +442,7 @@ defineExpose({
font-size: var(--l-font-lg); font-size: var(--l-font-lg);
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
...@@ -452,6 +459,7 @@ defineExpose({ ...@@ -452,6 +459,7 @@ defineExpose({
font-size: 22px; font-size: 22px;
font-weight: 700; font-weight: 700;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
.price-3 .unit { .price-3 .unit {
...@@ -497,6 +505,7 @@ defineExpose({ ...@@ -497,6 +505,7 @@ defineExpose({
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -509,6 +518,7 @@ defineExpose({ ...@@ -509,6 +518,7 @@ defineExpose({
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
......
...@@ -192,6 +192,7 @@ defineExpose({ ...@@ -192,6 +192,7 @@ defineExpose({
.pkg-price-row { .pkg-price-row {
margin-top: 12px; margin-top: 12px;
display: flex; display: flex;
flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
} }
...@@ -216,6 +217,7 @@ defineExpose({ ...@@ -216,6 +217,7 @@ defineExpose({
.pkg-empty { .pkg-empty {
padding: 48px 24px; padding: 48px 24px;
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
} }
......
...@@ -58,6 +58,7 @@ defineExpose({ ...@@ -58,6 +58,7 @@ defineExpose({
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
z-index: 99; z-index: 99;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
......
...@@ -211,6 +211,7 @@ const chooseMerchant = (userInfo: any): void => { ...@@ -211,6 +211,7 @@ const chooseMerchant = (userInfo: any): void => {
width: 48px; width: 48px;
height: 48px; height: 48px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -219,11 +220,13 @@ const chooseMerchant = (userInfo: any): void => { ...@@ -219,11 +220,13 @@ const chooseMerchant = (userInfo: any): void => {
.step-box { .step-box {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.step-item { .step-item {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
margin-right: 81.5px; margin-right: 81.5px;
...@@ -255,6 +258,7 @@ const chooseMerchant = (userInfo: any): void => { ...@@ -255,6 +258,7 @@ const chooseMerchant = (userInfo: any): void => {
background: #b1b1b1; background: #b1b1b1;
border-radius: 12px; border-radius: 12px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
...@@ -311,6 +315,7 @@ const chooseMerchant = (userInfo: any): void => { ...@@ -311,6 +315,7 @@ const chooseMerchant = (userInfo: any): void => {
.input { .input {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
height: 100%; height: 100%;
width: 100%; width: 100%;
...@@ -348,6 +353,7 @@ const chooseMerchant = (userInfo: any): void => { ...@@ -348,6 +353,7 @@ const chooseMerchant = (userInfo: any): void => {
padding: 0 1px; padding: 0 1px;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
} }
} }
......
...@@ -434,6 +434,7 @@ onMounted(() => { ...@@ -434,6 +434,7 @@ onMounted(() => {
.right { .right {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
margin-right: 14px; margin-right: 14px;
...@@ -442,6 +443,7 @@ onMounted(() => { ...@@ -442,6 +443,7 @@ onMounted(() => {
height: 48px; height: 48px;
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
......
...@@ -301,6 +301,7 @@ defineExpose({ ...@@ -301,6 +301,7 @@ defineExpose({
.box { .box {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0 var(--l-spacing-lg); padding: 0 var(--l-spacing-lg);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<text class="title">登录</text> <text class="title">登录</text>
<text class="sub-title">手机号码登录</text> <text class="sub-title">手机号码登录</text>
<view class="input"> <view class="input flex-col">
<input v-model="mobile" <input v-model="mobile"
class="input-control" class="input-control"
auto-blur auto-blur
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
} }
.input { .input {
flex-direction: row;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -54,6 +55,7 @@ ...@@ -54,6 +55,7 @@
.icon { .icon {
display: flex; display: flex;
flex-direction: row;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
height: 100%; height: 100%;
...@@ -80,6 +82,7 @@ ...@@ -80,6 +82,7 @@
.btn { .btn {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 400px; width: 400px;
...@@ -104,6 +107,7 @@ ...@@ -104,6 +107,7 @@
.autoLogin { .autoLogin {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
margin-right: 10px; margin-right: 10px;
margin-bottom: 19px; margin-bottom: 19px;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="reception"> <view class="reception">
<scroll-view class="reception-scroll" <scroll-view class="reception-scroll"
:scroll-y="true"> :scroll-y="true">
<image :src="(props.views as UTSJSONObject).detailUrl" <image :src="getViewImageUrl()"
class="reception-image" class="reception-image"
mode="widthFix"> mode="widthFix">
</image> </image>
...@@ -10,14 +10,174 @@ ...@@ -10,14 +10,174 @@
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { state } from "@/store/index.uts";
const props = defineProps({ const props = defineProps({
views: { views: {
type: UTSJSONObject, type: [UTSJSONObject, Array],
default: (): UTSJSONObject => ({} as UTSJSONObject) default: (): UTSJSONObject => ({} as UTSJSONObject)
}, },
title: String, title: String,
show: Boolean show: Boolean
}); });
function getStringValue(value: any | null): string {
if (value != null && typeof value === "string") {
const str = value as string;
if (str != "") {
return str;
}
}
return "";
}
function isRenderableImage(value: string): boolean {
if (value == null || value == "") {
return false;
}
if (
value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("file://")
|| value.startsWith("content://")
|| value.startsWith("/")
|| value.startsWith("./")
|| value.startsWith("../")
) {
return true;
}
if (value.startsWith("data:image/")) {
const marker = "base64,";
const markerIndex = value.indexOf(marker);
if (markerIndex < 0) {
return false;
}
const raw = value.slice(markerIndex + marker.length).replace(/\s/g, "");
if (raw == "" || raw.length < 16) {
return false;
}
if (raw.indexOf("�") >= 0) {
return false;
}
return /^[A-Za-z0-9+/=]+$/.test(raw);
}
return false;
}
function getPreferredObjectImage(obj: UTSJSONObject): string {
const thumbnail = getStringValue(obj["thumbnail"] as any | null);
if (thumbnail != "" && isRenderableImage(thumbnail)) {
return thumbnail;
}
const thumbnailUrl = getStringValue(obj["thumbnailUrl"] as any | null);
if (thumbnailUrl != "" && isRenderableImage(thumbnailUrl)) {
return thumbnailUrl;
}
const detailUrl = getStringValue(obj["detailUrl"] as any | null);
if (detailUrl != "" && isRenderableImage(detailUrl)) {
return detailUrl;
}
return "";
}
function getImageFromArray(list: Array<any>): string {
const customerInfo = state.user.customerInfo as UTSJSONObject;
const carModelId = customerInfo != null ? customerInfo["carModelId"] : null;
if (carModelId != null) {
for (const item of list) {
if (item == null || typeof item !== "object") {
continue;
}
const itemObj = item as UTSJSONObject;
if (itemObj["carModelId"] == carModelId) {
const matchedUrl = getPreferredObjectImage(itemObj);
if (matchedUrl != "") {
return matchedUrl;
}
}
}
}
for (const item of list) {
if (item == null) {
continue;
}
if (typeof item === "string") {
const directUrl = getStringValue(item);
if (directUrl != "") {
return directUrl;
}
continue;
}
const itemObj = item as UTSJSONObject;
const url = getPreferredObjectImage(itemObj);
if (url != "") {
return url;
}
}
return "";
}
function getImageFromObject(obj: UTSJSONObject): string {
const directUrl = getPreferredObjectImage(obj);
if (directUrl != "") {
return directUrl;
}
const customerInfo = state.user.customerInfo as UTSJSONObject;
if (customerInfo != null) {
const carModelId = customerInfo["carModelId"];
if (carModelId != null) {
const modelValue: any | null = obj[`${carModelId}`];
if (typeof modelValue === "string") {
const modelUrl = getStringValue(modelValue);
if (modelUrl != "") {
return modelUrl;
}
} else if (modelValue != null && typeof modelValue === "object") {
const modelObj = modelValue as UTSJSONObject;
const modelUrl = getPreferredObjectImage(modelObj);
if (modelUrl != "") {
return modelUrl;
}
}
}
}
for (const key in obj) {
const value = obj[key];
if (typeof value === "string") {
const url = getStringValue(value);
if (url != "") {
return url;
}
continue;
}
if (value != null && typeof value === "object") {
const nestedObj = value as UTSJSONObject;
const nestedUrl = getPreferredObjectImage(nestedObj);
if (nestedUrl != "") {
return nestedUrl;
}
}
}
return "";
}
function getViewImageUrl(): string {
const views = props.views;
if (views == null) {
return "";
}
if (Array.isArray(views)) {
return getImageFromArray(views as Array<any>);
}
if (typeof views === "object") {
return getImageFromObject(views as UTSJSONObject);
}
return "";
}
</script> </script>
<style lang="scss"> <style lang="scss">
.reception { .reception {
...@@ -36,6 +196,5 @@ ...@@ -36,6 +196,5 @@
.reception-image { .reception-image {
width: 100%; width: 100%;
display: block;
} }
</style> </style>
...@@ -160,18 +160,59 @@ const penSwitch = computed<boolean>(() => { ...@@ -160,18 +160,59 @@ const penSwitch = computed<boolean>(() => {
return isPreview.value == false && drawStatus.value == true; return isPreview.value == false && drawStatus.value == true;
}); });
function getModuleDisplayTitle(obj: UTSJSONObject): string {
const title =
(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)
?? "";
return title;
}
function isRenderableImage(value: string): boolean {
if (value == null || value == "") {
return false;
}
if (
value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("file://")
|| value.startsWith("content://")
|| value.startsWith("/")
|| value.startsWith("./")
|| value.startsWith("../")
) {
return true;
}
if (value.startsWith("data:image/")) {
const marker = "base64,";
const markerIndex = value.indexOf(marker);
if (markerIndex < 0) {
return false;
}
const raw = value.slice(markerIndex + marker.length).replace(/\s/g, "");
if (raw == "" || raw.length < 16) {
return false;
}
if (raw.indexOf("�") >= 0) {
return false;
}
return /^[A-Za-z0-9+/=]+$/.test(raw);
}
return false;
}
const title = computed(() => { const title = computed(() => {
for (const e of media.value) { for (const e of media.value) {
if ((e as UTSJSONObject).id == id.value) { if ((e as UTSJSONObject).id == id.value) {
const titleValue = (e as UTSJSONObject).detailTitle; return getModuleDisplayTitle(e as UTSJSONObject);
return titleValue != null ? titleValue as string : "";
} }
} }
for (const m of moduleList.value) { for (const m of moduleList.value) {
if ((m as UTSJSONObject).id == id.value) { if ((m as UTSJSONObject).id == id.value) {
const titleValue = (m as UTSJSONObject).detailTitle; return getModuleDisplayTitle(m as UTSJSONObject);
return titleValue != null ? titleValue as string : "";
} }
} }
return ""; return "";
...@@ -188,13 +229,27 @@ function toolItemsFromModuleList(modules: Array<any>): Array<any> { ...@@ -188,13 +229,27 @@ function toolItemsFromModuleList(modules: Array<any>): Array<any> {
const out: Array<any> = []; const out: Array<any> = [];
for (let i = 0; i < modules.length; i++) { for (let i = 0; i < modules.length; i++) {
const o = modules[i] as UTSJSONObject; const o = modules[i] as UTSJSONObject;
const detailTitle = o["detailTitle"] as string; const detailTitle = getModuleDisplayTitle(o);
const rid = o["id"]; const rid = o["id"];
const src = o["receptionSourceDetailList"] as UTSJSONObject; const src = o["receptionSourceDetailList"] as UTSJSONObject;
let url = ""; let url = "";
if (src != null) { if (src != null) {
const du = src["detailUrl"] as string; const thumbRaw: any | null = src["thumbnail"];
url = du != null ? du : ""; if (thumbRaw != null && typeof thumbRaw === "string" && isRenderableImage(thumbRaw as string)) {
url = thumbRaw as string;
}
if (url == "") {
const thumbUrlRaw: any | null = src["thumbnailUrl"];
if (thumbUrlRaw != null && typeof thumbUrlRaw === "string" && isRenderableImage(thumbUrlRaw as string)) {
url = thumbUrlRaw as string;
}
}
if (url == "") {
const duRaw: any | null = src["detailUrl"];
if (duRaw != null && typeof duRaw === "string" && isRenderableImage(duRaw as string)) {
url = duRaw as string;
}
}
} }
out.push({ out.push({
id: rid, id: rid,
...@@ -229,7 +284,7 @@ function setViewInfo(data: any): void { ...@@ -229,7 +284,7 @@ function setViewInfo(data: any): void {
break; break;
} }
} }
const detailTitle = findItem != null ? (findItem.detailTitle != null ? findItem.detailTitle : "") : ""; const detailTitle = findItem != null ? getModuleDisplayTitle(findItem) : "";
// receptionTrackLeave() // receptionTrackLeave()
console.log(data); console.log(data);
let dataObj: UTSJSONObject = {} as UTSJSONObject; let dataObj: UTSJSONObject = {} as UTSJSONObject;
...@@ -252,6 +307,12 @@ function setViewInfo(data: any): void { ...@@ -252,6 +307,12 @@ function setViewInfo(data: any): void {
// 处理 moduleList 的空值情况 // 处理 moduleList 的空值情况
const moduleListData: Array<any> = dataObj.moduleList != null ? dataObj.moduleList as Array<any> : []; const moduleListData: Array<any> = dataObj.moduleList != null ? dataObj.moduleList as Array<any> : [];
for (const item of moduleListData) {
const itemObj = item as UTSJSONObject;
if (itemObj["detailTitle"] == null || itemObj["detailTitle"] == "") {
itemObj["detailTitle"] = getModuleDisplayTitle(itemObj);
}
}
moduleList.value = moduleListData; moduleList.value = moduleListData;
// 处理 toolList 的空值情况(无 toolList 时用 module 推导,与 onLoad / 滑动一致) // 处理 toolList 的空值情况(无 toolList 时用 module 推导,与 onLoad / 滑动一致)
...@@ -267,7 +328,7 @@ function setViewInfo(data: any): void { ...@@ -267,7 +328,7 @@ function setViewInfo(data: any): void {
if (id.value != currentMediaId.value) { if (id.value != currentMediaId.value) {
let jumpItem: UTSJSONObject = {} as UTSJSONObject; let jumpItem: UTSJSONObject = {} as UTSJSONObject;
for (const e of moduleListData) { for (const e of moduleListData) {
if ((e as UTSJSONObject).detailTitle == detailTitle) { if (getModuleDisplayTitle(e as UTSJSONObject) == detailTitle) {
jumpItem = e as UTSJSONObject; jumpItem = e as UTSJSONObject;
break; break;
} }
...@@ -549,6 +610,7 @@ onBackPress((options: OnBackPressOptions) => { ...@@ -549,6 +610,7 @@ onBackPress((options: OnBackPressOptions) => {
width: 48px; width: 48px;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
pointer-events: auto; pointer-events: auto;
......
...@@ -76,8 +76,105 @@ const toolList = ref<Array<any>>([]); ...@@ -76,8 +76,105 @@ const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>(""); const mediaId = ref<number | string>("");
const currentSwiperIndex = ref<number>(0); const currentSwiperIndex = ref<number>(0);
function normalizeModuleItem(item: any): UTSJSONObject {
const obj = item as UTSJSONObject;
const detailTitle =
(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)
?? "";
const briefIntroduction =
(obj.briefIntroduction as null | string)
?? (obj.productIntroduction as null | string)
?? (obj.introduction as null | string)
?? (obj.desc as null | string)
?? "";
return {
...obj,
detailTitle,
briefIntroduction
} as UTSJSONObject;
}
function normalizeViewData(data: any): UTSJSONObject {
const src = data as UTSJSONObject;
const rawModuleList =
(src.moduleList as null | Array<any>)
?? (src.materialInfoList as null | Array<any>)
?? [];
const modules = rawModuleList.map((item: any) => normalizeModuleItem(item));
const tools = (src.toolList as null | Array<any>) ?? [];
return {
...src,
moduleList: modules,
toolList: tools
} as UTSJSONObject;
}
function isRenderableImage(value: string): boolean {
if (value == null || value == "") {
return false;
}
if (
value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("file://")
|| value.startsWith("content://")
|| value.startsWith("/")
|| value.startsWith("./")
|| value.startsWith("../")
) {
return true;
}
if (value.startsWith("data:image/")) {
const marker = "base64,";
const markerIndex = value.indexOf(marker);
if (markerIndex < 0) {
return false;
}
const raw = value.slice(markerIndex + marker.length).replace(/\s/g, "");
if (raw == "" || raw.length < 16) {
return false;
}
if (raw.indexOf("�") >= 0) {
return false;
}
return /^[A-Za-z0-9+/=]+$/.test(raw);
}
return false;
}
function pickModuleCover(obj: UTSJSONObject): string {
const candidates = [
obj.thumbnail as any | null,
obj.thumbnailUrl as any | null,
obj.bannerImg as any | null,
obj.contentPicUrl as any | null,
obj.homeEntranceCover as any | null,
obj.imageUrl as any | null,
obj.imgUrl as any | null,
obj.coverUrl as any | null,
obj.coverImg as any | null,
obj.productPoster as any | null,
obj.detailUrl as any | null
];
for (const candidate of candidates) {
if (candidate == null || typeof candidate !== "string") {
continue;
}
const src = candidate as string;
if (isRenderableImage(src)) {
return src;
}
}
return "";
}
function setViewInfo(data: any): void { function setViewInfo(data: any): void {
const dataObj = data as UTSJSONObject; const dataObj = normalizeViewData(data);
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; currentSwiperIndex.value = 0;
...@@ -89,20 +186,7 @@ function setViewInfo(data: any): void { ...@@ -89,20 +186,7 @@ function setViewInfo(data: any): void {
if (moduleList.value.length > 0) { if (moduleList.value.length > 0) {
console.log("[equity] setViewInfo first module:", moduleList.value[0]); console.log("[equity] setViewInfo first module:", moduleList.value[0]);
const firstObj = moduleList.value[0] as UTSJSONObject; const firstObj = moduleList.value[0] as UTSJSONObject;
const firstCover = const firstCover = pickModuleCover(firstObj);
(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 上
...@@ -131,7 +215,14 @@ function handleStart(): void { ...@@ -131,7 +215,14 @@ function handleStart(): void {
function getModuleName(item: any): string { function getModuleName(item: any): string {
const obj = item as UTSJSONObject; const obj = item as UTSJSONObject;
const value = (obj.name as null | string) ?? (obj.title as null | string) ?? ""; 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; return value;
} }
...@@ -139,6 +230,7 @@ function getModuleDesc(item: any): string { ...@@ -139,6 +230,7 @@ function getModuleDesc(item: any): string {
const obj = item as UTSJSONObject; const obj = item as UTSJSONObject;
const value = const value =
(obj.briefIntroduction as null | string) (obj.briefIntroduction as null | string)
?? (obj.materialIntroduction as null | string)
?? (obj.productIntroduction as null | string) ?? (obj.productIntroduction as null | string)
?? (obj.introduction as null | string) ?? (obj.introduction as null | string)
?? (obj.desc as null | string) ?? (obj.desc as null | string)
...@@ -146,22 +238,76 @@ function getModuleDesc(item: any): string { ...@@ -146,22 +238,76 @@ function getModuleDesc(item: any): string {
return value; return value;
} }
function getReceptionCover(obj: UTSJSONObject): string {
const source = obj.receptionSourceDetailList;
if (source == null) {
return "";
}
if (Array.isArray(source)) {
const list = source as Array<any>;
for (const item of list) {
if (item == null) {
continue;
}
const itemObj = item as UTSJSONObject;
const detailUrl = itemObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
}
return "";
}
if (typeof source === "object") {
const sourceObj = source as UTSJSONObject;
const detailUrl = sourceObj.detailUrl as string;
if (detailUrl != null && isRenderableImage(detailUrl)) {
return detailUrl;
}
for (const key in sourceObj) {
const value = sourceObj[key];
if (value != null && typeof value === "string" && isRenderableImage(value as string)) {
return value as string;
}
if (value != null && typeof value === "object") {
const nestedObj = value as UTSJSONObject;
const nestedUrl = nestedObj.detailUrl as string;
if (nestedUrl != null && isRenderableImage(nestedUrl)) {
return nestedUrl;
}
}
}
}
return "";
}
function getToolCoverById(moduleId: any | null): string {
if (moduleId == null) {
return "";
}
for (const item of toolList.value) {
const itemObj = item as UTSJSONObject;
if (itemObj.id == moduleId) {
const cover = itemObj.shortTitleUrl as string;
if (cover != null && isRenderableImage(cover)) {
return cover;
}
}
}
return "";
}
function getModuleCover(item: any): string { function getModuleCover(item: any): string {
const obj = item as UTSJSONObject; const obj = item as UTSJSONObject;
const value = const value = pickModuleCover(obj);
(obj.bannerImg as null | string) if (value != null && value != "") {
?? (obj.contentPicUrl as null | string) return value;
?? (obj.homeEntranceCover as null | string) }
?? (obj.imageUrl as null | string) const receptionCover = getReceptionCover(obj);
?? (obj.imgUrl as null | string) if (receptionCover != "") {
?? (obj.coverUrl as null | string) return receptionCover;
?? (obj.coverImg as null | string) }
?? (obj.productPoster as null | string) const moduleId: any | null = obj.id;
?? (obj.detailUrl as null | string) return getToolCoverById(moduleId);
?? (obj.thumbnailUrl as null | string)
?? (obj.thumbnail as null | string)
?? "";
return value;
} }
function getCurrentModuleTitle(): string { function getCurrentModuleTitle(): string {
...@@ -176,6 +322,9 @@ function getCurrentModuleTitle(): string { ...@@ -176,6 +322,9 @@ function getCurrentModuleTitle(): string {
const obj = item as UTSJSONObject; const obj = item as UTSJSONObject;
const value = const value =
(obj.detailTitle as null | string) (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.title as null | string)
?? (obj.name as null | string) ?? (obj.name as null | string)
?? ""; ?? "";
...@@ -436,6 +585,7 @@ onShow(() => { ...@@ -436,6 +585,7 @@ onShow(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
...@@ -449,6 +599,7 @@ onShow(() => { ...@@ -449,6 +599,7 @@ onShow(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
......
...@@ -71,6 +71,7 @@ function goBack(): void { ...@@ -71,6 +71,7 @@ function goBack(): void {
background: #ffffff; background: #ffffff;
border-radius: var(--l-radius-lg); border-radius: var(--l-radius-lg);
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
min-height: 200px; min-height: 200px;
......
...@@ -157,6 +157,7 @@ onShow(() => { ...@@ -157,6 +157,7 @@ onShow(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
......
...@@ -85,12 +85,14 @@ $uni-font-size-paragraph: 15px; ...@@ -85,12 +85,14 @@ $uni-font-size-paragraph: 15px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: flex; display: flex;
flex-direction: row;
max-height: 48px; /* 根据 font-size * line-height * 2 计算 */ max-height: 48px; /* 根据 font-size * line-height * 2 计算 */
} }
.select-box { .select-box {
.select-item { .select-item {
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
...@@ -102,6 +104,7 @@ $uni-font-size-paragraph: 15px; ...@@ -102,6 +104,7 @@ $uni-font-size-paragraph: 15px;
height: 120rpx; height: 120rpx;
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
padding-left: 48rpx; padding-left: 48rpx;
/* color/font-size/font-weight only on <text> in uni-app-x; use .title-text inside */ /* color/font-size/font-weight only on <text> in uni-app-x; use .title-text inside */
...@@ -113,6 +116,7 @@ $uni-font-size-paragraph: 15px; ...@@ -113,6 +116,7 @@ $uni-font-size-paragraph: 15px;
width: 100%; width: 100%;
height: 120rpx; height: 120rpx;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
padding-left: 48rpx; padding-left: 48rpx;
color: #333333; color: #333333;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!