@ -0,0 +1,166 @@ | |||||
<template> | |||||
<view class="Locations"> | |||||
<view class="Locations-list"> | |||||
<view class="main"> | |||||
<image | |||||
class="main-image" | |||||
src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" | |||||
mode="aspectFill"></image> | |||||
<view class="info"> | |||||
<view class="title"> | |||||
陶阳里景区 | |||||
</view> | |||||
<view class="tips"> | |||||
6个遗产点 | |||||
</view> | |||||
<view class="btn"> | |||||
<image src="/static/image/tourGuide/a.png" | |||||
mode=""></image> | |||||
<text class=""> | |||||
语音讲解 | |||||
</text> | |||||
</view> | |||||
</view> | |||||
<view class="controls"> | |||||
<view class="f"> | |||||
<image src="/static/image/tourGuide/f.png" mode=""></image> | |||||
</view> | |||||
<view class="btn" | |||||
@click="show = !show"> | |||||
<text class=""> | |||||
{{ show ? '收起' : '展开' }} | |||||
</text> | |||||
<uv-icon | |||||
:name="show ? 'arrow-up' : 'arrow-down'" | |||||
size="30rpx"></uv-icon> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view class="list" | |||||
v-if="show"> | |||||
<view class="main" | |||||
v-for="(item, index) in 10" | |||||
:key="index"> | |||||
<image | |||||
class="main-image" | |||||
src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" | |||||
mode="aspectFill"></image> | |||||
<view class="info"> | |||||
<view class="title"> | |||||
陶阳里景区 | |||||
</view> | |||||
<view class="tips"> | |||||
6个遗产点 | |||||
</view> | |||||
</view> | |||||
<view class="controls"> | |||||
<view class="f"> | |||||
<image src="/static/image/tourGuide/f.png" mode=""></image> | |||||
</view> | |||||
<view class="f"> | |||||
<image src="/static/image/tourGuide/a.png" mode=""></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
data() { | |||||
return { | |||||
show : true, | |||||
} | |||||
}, | |||||
methods: { | |||||
} | |||||
} | |||||
</script> | |||||
<style scoped lang="scss"> | |||||
.Locations{ | |||||
.Locations-list{ | |||||
.main{ | |||||
display: flex; | |||||
margin: 20rpx; | |||||
.main-image{ | |||||
width: 150rpx; | |||||
height: 150rpx; | |||||
border-radius: 20rpx; | |||||
} | |||||
.info{ | |||||
margin-left: 20rpx; | |||||
.title{ | |||||
font-size: 30rpx; | |||||
font-weight: 900; | |||||
} | |||||
.tips{ | |||||
font-size: 24rpx; | |||||
color: #999999; | |||||
margin-top: 10rpx; | |||||
} | |||||
} | |||||
.controls{ | |||||
margin-left: auto; | |||||
display: flex; | |||||
flex-direction: column; | |||||
justify-content: center; | |||||
align-items: center; | |||||
.f{ | |||||
image{ | |||||
width: 50rpx; | |||||
height: 50rpx; | |||||
} | |||||
} | |||||
} | |||||
.btn{ | |||||
padding: 10rpx; | |||||
font-size: 22rpx; | |||||
color: $uni-color; | |||||
border: 1rpx solid $uni-color; | |||||
background-color: #F4E4C4; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
margin-top: 10rpx; | |||||
border-radius: 15rpx; | |||||
image{ | |||||
width: 25rpx; | |||||
height: 25rpx; | |||||
} | |||||
text{ | |||||
margin: 0 10rpx; | |||||
} | |||||
} | |||||
} | |||||
.list{ | |||||
padding-left: 40rpx; | |||||
.main{ | |||||
align-items: center; | |||||
.main-image{ | |||||
width: 140rpx; | |||||
height: 140rpx; | |||||
} | |||||
.controls{ | |||||
flex-direction: row; | |||||
.f{ | |||||
margin: 30rpx; | |||||
image{ | |||||
width: 40rpx; | |||||
height: 40rpx; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
</style> |
@ -1,25 +1,136 @@ | |||||
<template> | <template> | ||||
<view class="page"> | <view class="page"> | ||||
<map | |||||
style="width: 100%;" | |||||
:layer-style='5' | |||||
:style="{height:mapheight}" | |||||
:show-location='true' | |||||
:latitude="latitude" | |||||
:longitude="longitude" | |||||
:markers="markers" | |||||
:scale="scale" | |||||
@markertap="markertap" | |||||
@callouttap='callouttap'> | |||||
</map> | |||||
<tabber select="1" /> | |||||
<view class="content"> | |||||
<locations/> | |||||
</view> | |||||
<tabber select="1"/> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import position from '@/utils/position.js' | |||||
import locations from '@/components/tourGuide/locations.vue' | |||||
export default { | export default { | ||||
components : { | components : { | ||||
locations, | |||||
}, | }, | ||||
data() { | data() { | ||||
return { | return { | ||||
latitude: 23.106574, //纬度 | |||||
longitude: 113.324587, //经度 | |||||
scale: 12, //缩放级别 | |||||
bottomData: false, | |||||
mapCtx: null, | |||||
markers:[ | |||||
// { //标记点A 的信息 | |||||
// iconPath: "/static/logo.png", //图标 | |||||
// id: 0, | |||||
// width: 20, //图标icon 宽度 | |||||
// height: 28 ,//图标icon 高度 | |||||
// latitude: 26.1272, | |||||
// longitude: 113.11659 | |||||
// } | |||||
], | |||||
} | } | ||||
}, | }, | ||||
onLoad() { | |||||
position.getLocation(res => { | |||||
console.log(res); | |||||
this.latitude = res.latitude | |||||
this.longitude = res.longitude | |||||
this.random() | |||||
}) | |||||
}, | |||||
computed: { | |||||
mapheight() { | |||||
let data = '' | |||||
if (this.bottomData) { | |||||
if (this.upTop) { | |||||
data = '50px' | |||||
} else { | |||||
data = '200px' | |||||
} | |||||
} else { | |||||
data = '50vh' | |||||
} | |||||
return data | |||||
}, | |||||
coverbottom() { | |||||
let data = '' | |||||
if (this.bottomData) { | |||||
data = '20rpx' | |||||
} else { | |||||
data = '100rpx' | |||||
} | |||||
return data | |||||
} | |||||
}, | |||||
onShow() { | |||||
// this.mapCtx = wx.createMapContext('map'); | |||||
// this.mapCtx && this.mapCtx.addCustomLayer({ | |||||
// layerId: '66c5a2ad2849', | |||||
// success: (res) => { | |||||
// console.log('success', res); | |||||
// }, | |||||
// fail: (e) => { | |||||
// console.log('fail', e); | |||||
// }, | |||||
// }); | |||||
}, | |||||
methods: { | methods: { | ||||
//地图点击事件 | |||||
markertap(e) { | |||||
console.log("===你点击了标记点===", e) | |||||
uni.getLocation({ | |||||
success: res => { | |||||
uni.openLocation({ | |||||
latitude: this.latitude + 0.01, | |||||
longitude: this.longitude + 0.01 | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
//地图点击事件 | |||||
callouttap(e) { | |||||
console.log('地图点击事件', e) | |||||
}, | |||||
random(){ | |||||
let list = [] | |||||
for(let i = 0;i < 10;i++){ | |||||
let a = uni.$uv.random(1, 4) | |||||
let obj = { | |||||
latitude: this.latitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2), | |||||
longitude: this.longitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2), | |||||
width: 30, //图标icon 宽度 | |||||
height: 40 ,//图标icon 高度 | |||||
iconPath: `/static/image/tourGuide/${a}.png`, //图标 | |||||
id: i, | |||||
} | |||||
list.push(obj) | |||||
} | |||||
this.markers = list | |||||
}, | |||||
} | } | ||||
} | } | ||||
</script> | </script> | ||||
<style scoped lang="scss"> | <style scoped lang="scss"> | ||||
.page{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
</style> | </style> |