Commit 7f886019 by liimin

fix(iOS): 解决横屏模式下安全区域和弹窗显示问题

- 为 FinishStep 组件添加 safe-area-inset-bottom 属性控制
- 在组件打开时同步窗口尺寸以适配 iOS 设备
- 使用 nextTick 确保 DOM 更新后才显示弹窗
- 为 callComponentMethod 工具函数添加错误处理和调试日志
- 修复 HBuilderX 调试配置中的 playground 类型设置
1 parent 73d56f33
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
"bundleId" : "uni.app.UNIB602BFA", "bundleId" : "uni.app.UNIB602BFA",
"certificateFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/证书.p12", "certificateFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/证书.p12",
"certificateProfileFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/uniappxtapeProfiles.mobileprovision", "certificateProfileFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/uniappxtapeProfiles.mobileprovision",
"customPlaygroundType" : "device", "customPlaygroundType" : "local",
"playground" : "standard", "playground" : "custom",
"runSignStatus" : 1, "runSignStatus" : 1,
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
:round="isLandscapeMode ? 0 : 20" :round="isLandscapeMode ? 0 : 20"
:closeable="true" :closeable="true"
:z-index="10075" :z-index="10075"
:safe-area-inset-bottom="!isLandscapeMode"
@close="close"> @close="close">
<view class="popup-wrapper" :class="isLandscapeMode ? 'landscape-wrapper' : 'portrait-wrapper'"> <view class="popup-wrapper" :class="isLandscapeMode ? 'landscape-wrapper' : 'portrait-wrapper'">
<!-- 标题栏 --> <!-- 标题栏 -->
...@@ -468,11 +469,16 @@ const handleSelect = (item: IUTSObject, popkey: string): void => { ...@@ -468,11 +469,16 @@ const handleSelect = (item: IUTSObject, popkey: string): void => {
// 打开弹窗 // 打开弹窗
const open = (): void => { const open = (): void => {
console.log('[FinishStep] open() 被调用');
isLoading.value = true; isLoading.value = true;
// iOS 兼容:先同步窗口尺寸
syncWindowSize();
console.log('[FinishStep] 窗口尺寸:', windowWidth.value, windowHeight.value);
recordService.getBusinessData().then((data: any) => { recordService.getBusinessData().then((data: any) => {
console.log('[FinishStep] getBusinessData 成功', data);
const customerInfo = (data != null ? data as UTSJSONObject : null); const customerInfo = (data != null ? data as UTSJSONObject : null);
console.log("customerInfo", customerInfo);
if (customerInfo != null) { if (customerInfo != null) {
// 填充表单数据 // 填充表单数据
formData.value = { formData.value = {
...@@ -484,7 +490,7 @@ const open = (): void => { ...@@ -484,7 +490,7 @@ const open = (): void => {
salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "", salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "",
}; };
console.log("formData", formData.value); console.log("[FinishStep] formData", formData.value);
const _sceneType = props.sceneType; const _sceneType = props.sceneType;
const _customerType = props.customerType; const _customerType = props.customerType;
let stepValue = 1; let stepValue = 1;
...@@ -522,15 +528,22 @@ console.log("formData", formData.value); ...@@ -522,15 +528,22 @@ console.log("formData", formData.value);
} }
step.value = stepValue; step.value = stepValue;
console.log('[FinishStep] step 设置为:', stepValue);
syncWindowSize();
// 打开弹窗 // iOS 兼容:使用 nextTick 确保 DOM 更新后再显示弹窗
showPopup.value = true; nextTick(() => {
updateViewKey.value = Date.now(); console.log('[FinishStep] nextTick 中设置 showPopup = true');
showPopup.value = true;
updateViewKey.value = Date.now();
console.log('[FinishStep] showPopup 当前值:', showPopup.value);
});
} else {
console.warn('[FinishStep] customerInfo 为空');
} }
isLoading.value = false; isLoading.value = false;
}).catch(() => { }).catch((error) => {
console.error('[FinishStep] getBusinessData 失败', error);
isLoading.value = false; isLoading.value = false;
}); });
}; };
......
...@@ -13,6 +13,13 @@ export type ComponentRef = ComponentPublicInstance | null; ...@@ -13,6 +13,13 @@ export type ComponentRef = ComponentPublicInstance | null;
*/ */
export const callComponentMethod = (ref: Ref<ComponentRef>, methodName: string): void => { export const callComponentMethod = (ref: Ref<ComponentRef>, methodName: string): void => {
if (ref.value != null) { if (ref.value != null) {
(ref.value as ComponentPublicInstance).$callMethod(methodName); console.log(`[callComponentMethod] 调用方法: ${methodName}`);
try {
(ref.value as ComponentPublicInstance).$callMethod(methodName);
} catch (error) {
console.error(`[callComponentMethod] 调用失败: ${methodName}`, error);
}
} else {
console.warn(`[callComponentMethod] ref.value 为空,无法调用: ${methodName}`);
} }
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!