Commit d8660e73 by Lin

feat(reception): 统一竖屏锁定并优化接待中心组件

- 更新 App.uvue 以默认锁定竖屏并延迟刷新屏幕尺寸
- 修改 manifest.json 中的屏幕方向设置为竖屏
- 重构接待中心组件,更新数据绑定和样式以提升用户体验
- 新增客户标签和接待场景选择功能,优化表单输入字段
- 统一接口调用,重命名相关函数以提高可读性
1 parent d2dd5b5b
...@@ -15,20 +15,14 @@ export default { ...@@ -15,20 +15,14 @@ export default {
layoutService.init(); layoutService.init();
const sys = uni.getSystemInfoSync(); const sys = uni.getSystemInfoSync();
console.log(`[App] 当前分辨率:${ sys.screenWidth } x ${ sys.screenHeight}`); console.log(`[App] 当前分辨率:${ sys.screenWidth } x ${ sys.screenHeight}`);
// pad/大屏锁定横屏,手机锁定竖屏 // 默认竖屏:锁定后延迟刷新屏幕尺寸,并重试锁定避免首屏被框架改向
if (layoutService.isMode("pad") || layoutService.isMode("desktop")) { lockOrientation("portrait-primary");
lockOrientation("landscape-primary");
// 锁定后延迟刷新屏幕尺寸,此时已旋转为横屏,getSystemInfoSync() 会返回 1174x768
setTimeout(() => { setTimeout(() => {
layoutService.refreshScreenInfo(); layoutService.refreshScreenInfo();
updateResolutionConfig(); // 同步更新分辨率适配配置 updateResolutionConfig();
}, 400); }, 400);
// 启动阶段多次重试锁定,避免首屏/框架稍后把方向改回竖屏(不做按页面锁定) setTimeout(() => { lockOrientation("portrait-primary"); }, 600);
setTimeout(() => { lockOrientation("landscape-primary"); }, 600); setTimeout(() => { lockOrientation("portrait-primary"); }, 1200);
setTimeout(() => { lockOrientation("landscape-primary"); }, 1200);
} else {
lockOrientation("portrait-primary");
}
// #endif // #endif
console.log("App Launch"); console.log("App Launch");
// 启动时仅做分辨率配置,避免后台定时器/录音模拟导致对象被长时间持有 // 启动时仅做分辨率配置,避免后台定时器/录音模拟导致对象被长时间持有
......
...@@ -58,15 +58,91 @@ export async function findAllSence(params: UTSJSONObject): Promise<any> { ...@@ -58,15 +58,91 @@ export async function findAllSence(params: UTSJSONObject): Promise<any> {
} }
return await http.fetch("dj.api.smartcarlife.customervisits.findAllSence", data, true, "dj") return await http.fetch("dj.api.smartcarlife.customervisits.findAllSence", data, true, "dj")
} }
// 根据客户标签
export async function findSenceTag(params: UTSJSONObject): Promise<any> { export async function findCustomerTags(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = { const data: UTSJSONObject = {
projectName: 'boutique', projectName: 'boutique',
...params ...params
} }
return await http.fetch("dj.api.smartcarlife.customervisits.findSenceTag", data, true, "dj") return await http.fetch("dj.api.smartcarlife.customervisits.findSenceTag", data, true, "dj")
} }
export async function saveVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.saveVisitsInfo", data, true, "dj")
}
export async function updateVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.updateVisitsInfo", data, true, "dj")
}
export async function findVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.findVisitsInfo", data, true, "dj")
}
/**
* 查询客户档案详情
*/
// findVisitsInfo (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.findVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
// findCustomerTags (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.findSenceTag',
// projectName: 'boutique',
// ...data
// })
// },
// {
// "customerTag": "23,24,26,60",
// "merchantId": 44209510,
// "bussinessScene": 2,
// "ownerName": "林磊1122",
// "ownerPhone": "13001362233",
// "brandModel": "奥迪A3(进口)",
// "receptionScene": 6,
// "arrivalDate": "2026-03-30",
// "customerTagName": "40岁以上,已婚,企业高管及负责人,车架号较好的",
// "carModelId": 1145128,
// "carBrand": "奥迪(进口)",
// "carBrandId": 2128,
// "oneCarBrand": "奥迪",
// "oneCarBrandId": 2125
// }
// /*
// * 保存客户档案
// */
// saveVisitsInfo (data) {
// console.log("保存客户档案",data);
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.saveVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
// /**
// * 更新客户档案
// */
// updateVisitsInfo (data) {
// console.log("更新客户档案",data);
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.updateVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
/**ҵ������ */ /**ҵ������ */
// getMerchantPerformance(data){ // getMerchantPerformance(data){
// return http.post({ // return http.post({
......
...@@ -40,28 +40,17 @@ ...@@ -40,28 +40,17 @@
import { ref, nextTick, computed } from 'vue' import { ref, nextTick, computed } from 'vue'
import { ComponentPublicInstance } from 'vue' import { ComponentPublicInstance } from 'vue'
/** 接口失败或空列表时的兜底数据 */
function buildMockSceneList(): Array<UTSJSONObject> {
const out: Array<UTSJSONObject> = []
const o1 = {} as UTSJSONObject
o1['id'] = 'new_delivery'
o1['label'] = '新车交付'
out.push(o1)
const o2 = {} as UTSJSONObject
o2['id'] = 'after_sales'
o2['label'] = '售后场景'
out.push(o2)
const o3 = {} as UTSJSONObject
o3['id'] = 'second_conversion'
o3['label'] = '二次转化'
out.push(o3)
return out
}
/** 将接口项统一为 id / label,兼容常见字段名 */ /** 将接口项统一为 id / label,兼容常见字段名 */
function normalizeSceneRow(raw: UTSJSONObject): UTSJSONObject | null { function normalizeSceneRow(raw: UTSJSONObject): UTSJSONObject | null {
const idVal = raw['id'] != null ? raw['id'] : raw['sceneId'] const idVal = raw['id'] != null ? raw['id'] : raw['sceneId']
const labelVal = raw['label'] != null ? raw['label'] : (raw['sceneName'] != null ? raw['sceneName'] : raw['name']) const labelVal =
raw['label'] != null
? raw['label']
: raw['sceneName'] != null
? raw['sceneName']
: raw['name'] != null
? raw['name']
: raw['receptionSceneName']
if (labelVal == null) { if (labelVal == null) {
return null return null
} }
...@@ -75,6 +64,20 @@ ...@@ -75,6 +64,20 @@
return out return out
} }
function normalizeSceneListItems(rawList: any[]): Array<UTSJSONObject> {
const out: Array<UTSJSONObject> = []
let i = 0
while (i < rawList.length) {
const item = rawList[i] as UTSJSONObject
const row = normalizeSceneRow(item)
if (row != null) {
out.push(row)
}
i++
}
return out
}
/** 解析 findAllSence 返回:data 为数组,或 data.list 为数组 */ /** 解析 findAllSence 返回:data 为数组,或 data.list 为数组 */
function parseSceneListFromResponse(res: any): Array<UTSJSONObject> { function parseSceneListFromResponse(res: any): Array<UTSJSONObject> {
const resObj = res as UTSJSONObject const resObj = res as UTSJSONObject
...@@ -92,17 +95,7 @@ ...@@ -92,17 +95,7 @@
if (rawList == null) { if (rawList == null) {
return [] return []
} }
const out: Array<UTSJSONObject> = [] return normalizeSceneListItems(rawList)
let i = 0
while (i < rawList.length) {
const item = rawList[i] as UTSJSONObject
const row = normalizeSceneRow(item)
if (row != null) {
out.push(row)
}
i++
}
return out
} }
const props = defineProps({ const props = defineProps({
...@@ -124,7 +117,7 @@ ...@@ -124,7 +117,7 @@
const emit = defineEmits(['close', 'confirm']) const emit = defineEmits(['close', 'confirm'])
const sheetRef = ref<ComponentPublicInstance | null>(null) const sheetRef = ref<ComponentPublicInstance | null>(null)
const sceneList = ref<Array<UTSJSONObject>>(buildMockSceneList()) const sceneList = ref<Array<UTSJSONObject>>([])
/** 底部弹层半屏高度,与 MessageBox popupH/maxHeight 一致(同 CustomerTags) */ /** 底部弹层半屏高度,与 MessageBox popupH/maxHeight 一致(同 CustomerTags) */
const sheetPanelHeightPx = ref(400) const sheetPanelHeightPx = ref(400)
...@@ -160,18 +153,13 @@ ...@@ -160,18 +153,13 @@
async function loadSceneListFromApi(): Promise<void> { async function loadSceneListFromApi(): Promise<void> {
try { try {
const params = { scene: 1 } as UTSJSONObject const params = { scene: props.scene } as UTSJSONObject
const res = await findAllSence(params) const res = await findAllSence(params)
console.error('findAllSence 成功:', res) sceneList.value = parseSceneListFromResponse(res)
const parsed = parseSceneListFromResponse(res)
if (parsed.length > 0) {
sceneList.value = parsed
return
}
} catch (e) { } catch (e) {
console.error('findAllSence 失败:', e) console.error('findAllSence 失败:', e)
sceneList.value = []
} }
sceneList.value = buildMockSceneList()
} }
function openSheet(): void { function openSheet(): void {
......
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
} }
}, },
"orientation": [ "orientation": [
"portrait-primary", "portrait-primary"
"landscape-primary"
] ]
} }
}, },
...@@ -69,8 +68,7 @@ ...@@ -69,8 +68,7 @@
"default": {} "default": {}
}, },
"orientation": [ "orientation": [
"portrait-primary", "portrait-primary"
"landscape-primary"
], ],
"permissions": [ "permissions": [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
...@@ -97,8 +95,7 @@ ...@@ -97,8 +95,7 @@
"icons": {}, "icons": {},
"splashScreens": {}, "splashScreens": {},
"orientation": [ "orientation": [
"portrait-primary", "portrait-primary"
"landscape-primary"
] ]
} }
}, },
......
...@@ -96,15 +96,23 @@ export function useLayoutCssClass(): string { ...@@ -96,15 +96,23 @@ export function useLayoutCssClass(): string {
export function getResponsiveImage(img: ResponsiveImage): string { export function getResponsiveImage(img: ResponsiveImage): string {
const pr = resolutionState.pixelRatio; const pr = resolutionState.pixelRatio;
// 高倍率屏优先使用高清图 // 高倍率屏优先使用高清图(可选字段须显式判空,不可直接 if (string?))
if (pr >= 3) { if (pr >= 3) {
if (img.x3 != null) return img.x3; if (img.x3 != null && img.x3 != "") {
if (img.x2 != null) return img.x2; return img.x3;
}
if (img.x2 != null && img.x2 != "") {
return img.x2;
}
return img.x1; return img.x1;
} }
if (pr >= 2) { if (pr >= 2) {
if (img.x2 != null) return img.x2; if (img.x2 != null && img.x2 != "") {
if (img.x3 != null) return img.x3; return img.x2;
}
if (img.x3 != null && img.x3 != "") {
return img.x3;
}
return img.x1; return img.x1;
} }
......
/** /**
* 按设备统一应用屏幕方向锁定(pad 横屏、手机竖屏) * 统一应用竖屏锁定
* 供 App.onShow 与全局 mixin onShow 调用,避免每个页面单独写 * 供 App.onShow 与全局 mixin onShow 调用;锁向后延迟刷新屏幕尺寸以同步分辨率适配
* pad 锁横屏后延迟刷新屏幕尺寸,使首页等布局按横屏尺寸正确计算
*/ */
// #ifdef APP // #ifdef APP
import { layoutService } from '@/services/LayoutService.uts' import { layoutService } from '@/services/LayoutService.uts'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!