@@ -68,7 +68,7 @@
|
||||
:class="{ disabled: !selectedTarget }"
|
||||
@tap="handleNavigateTap"
|
||||
>
|
||||
<text class="arrival-primary-text">第三方导航</text>
|
||||
<text class="arrival-primary-text">{{ primaryActionText }}</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
@@ -116,9 +116,11 @@ import {
|
||||
} from '@/data/arrivalSearchTargets'
|
||||
import {
|
||||
openThirdPartyMapSearch,
|
||||
openWechatMiniProgramLocation,
|
||||
THIRD_PARTY_MAP_PROVIDERS,
|
||||
type ThirdPartyMapProviderOption
|
||||
} from '@/services/ThirdPartyMapSearchService'
|
||||
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
visible?: boolean
|
||||
@@ -142,6 +144,10 @@ const emit = defineEmits<{
|
||||
|
||||
const typeOptions = computed(() => ARRIVAL_TARGET_TYPES)
|
||||
const mapProviders = computed(() => THIRD_PARTY_MAP_PROVIDERS)
|
||||
const shouldUseMiniProgramLocation = computed(() => isEmbeddedInWechatMiniProgram())
|
||||
const primaryActionText = computed(() => (
|
||||
shouldUseMiniProgramLocation.value ? '打开地图导航' : '第三方导航'
|
||||
))
|
||||
const arrivalPanelRef = ref<unknown>(null)
|
||||
const isCollapsed = ref(false)
|
||||
const providerSheetVisible = ref(false)
|
||||
@@ -238,6 +244,16 @@ const handleNavigateTap = () => {
|
||||
return
|
||||
}
|
||||
|
||||
if (shouldUseMiniProgramLocation.value) {
|
||||
void openWechatMiniProgramLocation({
|
||||
latitude: props.selectedTarget.latitude,
|
||||
longitude: props.selectedTarget.longitude,
|
||||
name: props.selectedTarget.title,
|
||||
address: props.selectedTarget.subtitle
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
providerSheetVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user