|
|
@ -1,8 +1,32 @@ |
|
|
|
<template> |
|
|
|
<view class="Locations"> |
|
|
|
|
|
|
|
<view class="Locations-list"> |
|
|
|
<view class="main"> |
|
|
|
<map |
|
|
|
style="width: 100%;height: 60vh" |
|
|
|
:layer-style='5' |
|
|
|
:show-location='true' |
|
|
|
:latitude="position.latitude" |
|
|
|
:longitude="position.longitude" |
|
|
|
:markers="spotGuideMarkers" |
|
|
|
:scale="scale" |
|
|
|
@markertap="markertap" |
|
|
|
@callouttap='callouttap'> |
|
|
|
</map> |
|
|
|
|
|
|
|
<view class="tabs"> |
|
|
|
<view class="" |
|
|
|
v-for="(item, index) in tabs" |
|
|
|
:key="index" |
|
|
|
@click="setSpotGuideIndex(index)" |
|
|
|
:class="{act : spotGuideIndex == index}"> |
|
|
|
{{ item }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- '文化遗产', '找厕所', '找美食', '找民宿' --> |
|
|
|
<view class="Locations-list" v-if="spotGuideIndex != 1"> |
|
|
|
<view class="main" v-if="spotGuideIndex == 0"> |
|
|
|
<image |
|
|
|
class="main-image" |
|
|
|
src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" |
|
|
@ -43,26 +67,29 @@ |
|
|
|
<view class="list" |
|
|
|
v-if="show"> |
|
|
|
<view class="main" |
|
|
|
v-for="(item, index) in 10" |
|
|
|
v-for="(item, index) in spotGuide" |
|
|
|
:key="index"> |
|
|
|
<image |
|
|
|
class="main-image" |
|
|
|
src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" |
|
|
|
:src="item.spotImage" |
|
|
|
mode="aspectFill"></image> |
|
|
|
|
|
|
|
<view class="info"> |
|
|
|
<view class="title"> |
|
|
|
陶阳里景区 |
|
|
|
{{ item.spotName }} |
|
|
|
</view> |
|
|
|
<view class="tips" v-if="item.distance > 1"> |
|
|
|
距离您{{ item.distance }}km |
|
|
|
</view> |
|
|
|
<view class="tips"> |
|
|
|
6个遗产点 |
|
|
|
<view class="tips" v-else> |
|
|
|
距离您{{ item.distance * 1000 }}m |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="controls"> |
|
|
|
<view class="f"> |
|
|
|
<image |
|
|
|
|
|
|
|
@click="openLocation(item)" |
|
|
|
src="/static/image/tourGuide/f.png" mode=""></image> |
|
|
|
</view> |
|
|
|
<view class="f"> |
|
|
@ -74,6 +101,9 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- '路径定制', --> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -86,14 +116,28 @@ |
|
|
|
// "provider" : "wx069ba97219f66d99" |
|
|
|
// } |
|
|
|
// } |
|
|
|
import { mapState, mapGetters } from 'vuex' |
|
|
|
export default { |
|
|
|
props : ['spotGuide', 'spotGuideMarkers'], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
latitude: 23.106574, //纬度 |
|
|
|
longitude: 113.324587, //经度 |
|
|
|
scale: 12, //缩放级别 |
|
|
|
show : true, |
|
|
|
context : uni.createInnerAudioContext(), |
|
|
|
tabs : ['文化遗产', '路径定制', '找厕所', '找美食', '找民宿'], |
|
|
|
} |
|
|
|
}, |
|
|
|
computed : { |
|
|
|
// ...mapGetters(['spotGuide', 'spotGuideMarkers']), |
|
|
|
...mapState(['position', 'spotGuideIndex']), |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 修改前选择的菜单,0-景点 1-美食店铺 2-民宿 3-厕所 |
|
|
|
setSpotGuideIndex(index){ |
|
|
|
this.$store.commit('setSpotGuideIndex', index) |
|
|
|
}, |
|
|
|
textToSpeech(){ |
|
|
|
console.log('textToSpeech'); |
|
|
|
|
|
|
@ -112,12 +156,53 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//地图点击事件 |
|
|
|
markertap(e) { |
|
|
|
console.log("===你点击了标记点===", e) |
|
|
|
this.spotGuideMarkers.forEach(n => { |
|
|
|
if(n.id == e.detail.markerId){ |
|
|
|
uni.openLocation({ |
|
|
|
latitude: n.latitude, |
|
|
|
longitude: n.longitude, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
openLocation(n){ |
|
|
|
uni.openLocation({ |
|
|
|
latitude: n.spotLatitude, |
|
|
|
longitude: n.spotLongitude, |
|
|
|
}) |
|
|
|
}, |
|
|
|
//地图点击事件 |
|
|
|
callouttap(e) { |
|
|
|
console.log('地图点击事件', e) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
.Locations{ |
|
|
|
|
|
|
|
.tabs{ |
|
|
|
display: flex; |
|
|
|
&>view{ |
|
|
|
flex: 1; |
|
|
|
margin: 20rpx 10rpx; |
|
|
|
padding: 20rpx 10rpx; |
|
|
|
background-color: #F8E2E2; |
|
|
|
color: #C83741; |
|
|
|
border-radius: 40rpx; |
|
|
|
font-size: 24rpx; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
.act{ |
|
|
|
background-color: #C83741; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.Locations-list{ |
|
|
|
.main{ |
|
|
|
display: flex; |
|
|
|