feat(地图导航): 添加网点地图导航功能
在多个页面中添加了地图导航功能,用户可以通过点击地址或导航图标打开地图并查看具体位置。如果位置信息缺失,会提示用户“暂无位置信息”。此功能提升了用户体验,方便用户快速找到网点位置。
This commit is contained in:
@@ -141,4 +141,22 @@ Page({
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 打开地图导航
|
||||
openLocation() {
|
||||
if (this.data.info.latitude && this.data.info.longitude) {
|
||||
wx.openLocation({
|
||||
latitude: Number(this.data.info.latitude),
|
||||
longitude: Number(this.data.info.longitude),
|
||||
name: this.data.info.name,
|
||||
address: this.data.info.address,
|
||||
scale: 18
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '暂无位置信息',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -8,9 +8,9 @@
|
||||
<view class="ld" wx:for="{{info.service}}" wx:key="index_i" wx:for-item="s" style="background-color: {{s.color}};">{{s.label}}</view>
|
||||
</view>
|
||||
<view class="tag">{{info.tags}}</view>
|
||||
<view class="ads"><text class="iconfont icon-dingwei"></text>{{info.address}}</view>
|
||||
<view class="ads" bindtap="openLocation"><text class="iconfont icon-dingwei"></text>{{info.address}}</view>
|
||||
<view class="ads yingye"><text class="iconfont icon-shijian"></text>{{info.businesshours || "24小时"}}</view>
|
||||
<view class="dw">
|
||||
<view class="dw" bindtap="openLocation">
|
||||
<text class="ico iconfont icon-daohangdaohang"></text>
|
||||
<view class="jl">{{info.distance}}</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user