yuanmingze пре 2 недеља
родитељ
комит
c2586e7f6b

+ 3 - 0
src/pages-task/task-form/composables/useTaskFormSafeArea.ts

@@ -43,6 +43,8 @@ export const useTaskFormSafeArea = () => {
     return keyboardHeight.value > 0 ? 0 : safeAreaBottom.value
   })
 
+  const keyboardVisible = computed(() => keyboardHeight.value > 0)
+
   const footerHeightPx = computed(() => {
     return (
       rpxToPx(FOOTER_TOP_PADDING_RPX + FOOTER_BUTTON_HEIGHT_RPX + FOOTER_BOTTOM_PADDING_RPX) +
@@ -123,6 +125,7 @@ export const useTaskFormSafeArea = () => {
   return {
     contentStyle,
     footerStyle,
+    keyboardVisible,
     initSafeArea,
   }
 }

+ 10 - 5
src/pages-task/task-visit-add/index.vue

@@ -76,6 +76,7 @@
 
     <view
       v-if="taskFieldConfigList.length"
+      v-show="!keyboardVisible"
       class="visit-add-page__footer"
       :style="footerStyle"
     >
@@ -198,7 +199,7 @@ const { setFieldFormValue, clearFieldValue } = useTaskFormFields({
 })
 
 const { showNotice, noticeText, selectLevel, initializeTaskFormPage } = useTaskFormPageFeatures()
-const { contentStyle, footerStyle, initSafeArea } = useTaskFormSafeArea()
+const { contentStyle, footerStyle, keyboardVisible, initSafeArea } = useTaskFormSafeArea()
 const { currentLocation, locationStatus, rangeRadius, refreshCurrentLocation } = useVisitLocation()
 
 const userId = computed(() => String(userStore.currentUserInfo?.userId ?? '').trim())
@@ -298,14 +299,18 @@ const syncTaskTypeField = () => {
   setFieldText(taskTypeField.value, taskTypeId.value)
 }
 
-const syncSelectedPoint = (point: SelectedPoint) => {
+const syncSelectedPointLocation = (point: SelectedPoint) => {
   setFieldText(coordinateField.value, `${point.longitude},${point.latitude}`)
   setFieldText(addressField.value, point.address)
   setFieldText(districtField.value, point.district)
-  setFieldText(targetNameField.value, point.name)
   syncTaskTypeField()
 }
 
+const initializeSelectedPointFields = (point: SelectedPoint) => {
+  syncSelectedPointLocation(point)
+  setFieldText(targetNameField.value, point.name)
+}
+
 const loadVisitForm = async () => {
   if (!taskTypeId.value) return
 
@@ -404,7 +409,7 @@ const handlePointTap = async (event: MapPoiTapEvent) => {
     }
 
     selectedPoint.value = point
-    syncSelectedPoint(point)
+    initializeSelectedPointFields(point)
   } catch (error) {
     console.error('[task-visit-add] 地点解析失败', error)
     showToast('获取地点信息失败')
@@ -479,7 +484,7 @@ const handleVisitSubmit = async () => {
     return
   }
 
-  syncSelectedPoint(selectedPoint.value)
+  syncSelectedPointLocation(selectedPoint.value)
   setFieldText(checkInField.value, checkInTime.value)
 
   await handleSubmit()