恢复首页来馆快捷入口。 原生微信小程序直接调用地图位置能力,H5 嵌入场景补充宿主环境识别与承接页跳转。 同时修复 H5 与小程序构建中的静态资源平台兼容。
This commit is contained in:
@@ -124,7 +124,10 @@ import {
|
||||
THIRD_PARTY_MAP_PROVIDERS,
|
||||
type ThirdPartyMapProviderOption
|
||||
} from '@/services/ThirdPartyMapSearchService'
|
||||
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
|
||||
import {
|
||||
isNativeWechatMiniProgram,
|
||||
isWechatMiniProgramRuntime
|
||||
} from '@/utils/hostEnvironment'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
visible?: boolean
|
||||
@@ -148,7 +151,7 @@ const emit = defineEmits<{
|
||||
|
||||
const typeOptions = computed(() => ARRIVAL_TARGET_TYPES)
|
||||
const mapProviders = computed(() => THIRD_PARTY_MAP_PROVIDERS)
|
||||
const shouldUseMiniProgramLocation = computed(() => isEmbeddedInWechatMiniProgram())
|
||||
const shouldUseMiniProgramLocation = computed(() => isWechatMiniProgramRuntime())
|
||||
const primaryActionText = computed(() => (
|
||||
shouldUseMiniProgramLocation.value ? '打开地图导航' : '第三方导航'
|
||||
))
|
||||
@@ -239,7 +242,7 @@ const startLayoutObserver = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleNavigateTap = () => {
|
||||
const handleNavigateTap = async () => {
|
||||
if (!props.selectedTarget) {
|
||||
uni.showToast({
|
||||
title: '请先选择点位',
|
||||
@@ -248,13 +251,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
|
||||
})
|
||||
const target = {
|
||||
latitude: props.selectedTarget.latitude,
|
||||
longitude: props.selectedTarget.longitude,
|
||||
name: props.selectedTarget.title,
|
||||
address: props.selectedTarget.subtitle
|
||||
}
|
||||
const isNativeMiniProgram = isNativeWechatMiniProgram()
|
||||
const openedInMiniProgram = await openWechatMiniProgramLocation(target)
|
||||
|
||||
if (openedInMiniProgram || isNativeMiniProgram || isWechatMiniProgramRuntime()) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user