|
|
|
|
@ -28,11 +28,11 @@
|
|
|
|
|
<map id="myMap" min-scale="6" max-scale="16" :longitude="lng" show-location :enable-scroll="!showLoad"
|
|
|
|
|
@regionchange="pushMarkers" :scale="scale" :latitude="lat" :markers="markers" @callouttap="showDetail">
|
|
|
|
|
<cover-view slot="callout" class="maps-covers">
|
|
|
|
|
<block v-for="(item,index) in markers">
|
|
|
|
|
<block v-for="(item,index) in markers" :key="item.id">
|
|
|
|
|
<cover-view :marker-id="item.id" :key='index'>
|
|
|
|
|
<cover-view class="maps-cover">
|
|
|
|
|
<cover-view class="maps-cover-wrap">
|
|
|
|
|
<cover-image class="maps-cover-img" :src='item.truePath'></cover-image>
|
|
|
|
|
<cover-image class="maps-cover-img" :src='item.truePath'></cover-image>
|
|
|
|
|
|
|
|
|
|
<block v-if="item.has_answer===0">
|
|
|
|
|
<cover-view class="maps-cover-lock">
|
|
|
|
|
@ -42,16 +42,16 @@
|
|
|
|
|
</cover-view>
|
|
|
|
|
</block>
|
|
|
|
|
</cover-view>
|
|
|
|
|
<cover-view class="maps-cover-label" v-if="showLabel">
|
|
|
|
|
<!-- <cover-image class="maps-labelbg" :src="'/static/home-cur.png'"></cover-image> -->
|
|
|
|
|
{{item.title}}
|
|
|
|
|
<cover-view class="maps-cover-label" v-if="showLabel">
|
|
|
|
|
<!-- <cover-image class="maps-labelbg" :src="'/static/home-cur.png'"></cover-image> -->
|
|
|
|
|
{{item.title}}
|
|
|
|
|
</cover-view>
|
|
|
|
|
</cover-view>
|
|
|
|
|
</cover-view>
|
|
|
|
|
</block>
|
|
|
|
|
</cover-view>
|
|
|
|
|
<cover-view class="maps-info" v-if="showNear">
|
|
|
|
|
<cover-view class="maps-info-near" @click="getNears">
|
|
|
|
|
<cover-view class="maps-info-near" @click="getNears" v-if="!showLocationTip">
|
|
|
|
|
<cover-image src="../../static/home-near.png" mode=""></cover-image>
|
|
|
|
|
</cover-view>
|
|
|
|
|
<cover-view class="maps-info-pointer" v-if="showPointer && pointer">
|
|
|
|
|
@ -63,7 +63,7 @@
|
|
|
|
|
</cover-view>
|
|
|
|
|
<cover-view>距你{{pointer.distance?pointer.distance:'-'}}</cover-view>
|
|
|
|
|
<cover-view v-if="pointer.config.length>0">
|
|
|
|
|
<block v-for="con in pointer.config">
|
|
|
|
|
<block v-for="(con, cIdx) in pointer.config" :key="con.key || cIdx">
|
|
|
|
|
<block v-if="con.key==='address'">
|
|
|
|
|
{{con.value}}
|
|
|
|
|
</block>
|
|
|
|
|
@ -82,6 +82,9 @@
|
|
|
|
|
</cover-view>
|
|
|
|
|
</cover-view>
|
|
|
|
|
</cover-view>
|
|
|
|
|
<cover-view class="maps-info-tip" v-if="showLocationTip" @click="retryLocationAuth">
|
|
|
|
|
使用完整功能,需要获取您的定位,点击授权
|
|
|
|
|
</cover-view>
|
|
|
|
|
|
|
|
|
|
</map>
|
|
|
|
|
</view>
|
|
|
|
|
@ -158,8 +161,9 @@
|
|
|
|
|
showArea: false,
|
|
|
|
|
tips: '',
|
|
|
|
|
showLoad: false,
|
|
|
|
|
showNear: true,
|
|
|
|
|
showLabel:false
|
|
|
|
|
showNear: true,
|
|
|
|
|
showLabel:false,
|
|
|
|
|
showLocationTip: false
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -170,32 +174,27 @@
|
|
|
|
|
return shareInfo
|
|
|
|
|
},
|
|
|
|
|
onReady() {
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: 'scope.userLocation',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.initLocationAuth()
|
|
|
|
|
this.mapContext = uni.createMapContext('myMap', this);
|
|
|
|
|
// 获取当前地图层级
|
|
|
|
|
let _this = this
|
|
|
|
|
// 获取当前地图层级
|
|
|
|
|
let _this = this
|
|
|
|
|
|
|
|
|
|
if (this.mapTimer) {
|
|
|
|
|
clearInterval(this.mapTimer)
|
|
|
|
|
} else {
|
|
|
|
|
this.mapTimer = setInterval(function() {
|
|
|
|
|
_this.mapContext.getScale({
|
|
|
|
|
success: function(res) {
|
|
|
|
|
if(res.scale>12){
|
|
|
|
|
_this.showLabel = true
|
|
|
|
|
}else{
|
|
|
|
|
_this.showLabel = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: function(error) {
|
|
|
|
|
console.log('获取地图缩放级别失败:', error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.mapTimer = setInterval(function() {
|
|
|
|
|
_this.mapContext.getScale({
|
|
|
|
|
success: function(res) {
|
|
|
|
|
if(res.scale>12){
|
|
|
|
|
_this.showLabel = true
|
|
|
|
|
}else{
|
|
|
|
|
_this.showLabel = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: function(error) {
|
|
|
|
|
console.log('获取地图缩放级别失败:', error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -241,19 +240,49 @@
|
|
|
|
|
onHide() {
|
|
|
|
|
this.showTips = false
|
|
|
|
|
this.showPointer = false
|
|
|
|
|
this.pointer = null
|
|
|
|
|
if(!this.mapTimer){
|
|
|
|
|
this.mapTimer = null
|
|
|
|
|
clearInterval(this.mapTimer)
|
|
|
|
|
}
|
|
|
|
|
this.pointer = null
|
|
|
|
|
if(!this.mapTimer){
|
|
|
|
|
this.mapTimer = null
|
|
|
|
|
clearInterval(this.mapTimer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initLocationAuth() {
|
|
|
|
|
uni.getSetting({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
const setting = res.authSetting || {}
|
|
|
|
|
const loc = setting['scope.userLocation']
|
|
|
|
|
if (loc === true) {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
} else if (loc === false) {
|
|
|
|
|
this.showLocationTip = true
|
|
|
|
|
} else {
|
|
|
|
|
// undefined: first time, try authorize
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: 'scope.userLocation',
|
|
|
|
|
success: () => {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
this.showLocationTip = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
this.showLocationTip = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 我的位置
|
|
|
|
|
getUserLocation() {
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
uni.removeStorageSync('vuex_latlng')
|
|
|
|
|
this.lng = res.longitude
|
|
|
|
|
this.lat = res.latitude
|
|
|
|
|
@ -265,6 +294,47 @@
|
|
|
|
|
},
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
console.log("err", err)
|
|
|
|
|
this.showLocationTip = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
retryLocationAuth() {
|
|
|
|
|
// 根据当前授权状态选择 authorize 或直接打开设置
|
|
|
|
|
uni.getSetting({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
const setting = res.authSetting || {}
|
|
|
|
|
const loc = setting['scope.userLocation']
|
|
|
|
|
if (loc === true) {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
} else if (loc === false) {
|
|
|
|
|
uni.openSetting({
|
|
|
|
|
success: (rs) => {
|
|
|
|
|
if (rs.authSetting && rs.authSetting['scope.userLocation']) {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: 'scope.userLocation',
|
|
|
|
|
success: () => {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
uni.openSetting({
|
|
|
|
|
success: (rs) => {
|
|
|
|
|
if (rs.authSetting && rs.authSetting['scope.userLocation']) {
|
|
|
|
|
this.showLocationTip = false
|
|
|
|
|
this.getUserLocation()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
@ -668,15 +738,29 @@
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&-tip {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 50%;
|
|
|
|
|
bottom: 160rpx;
|
|
|
|
|
transform: translate(-50%,-50%);
|
|
|
|
|
width: 80%;
|
|
|
|
|
z-index: 99;
|
|
|
|
|
text-align: center;
|
|
|
|
|
background: rgba(0,0,0,0.6);
|
|
|
|
|
color: #fff;
|
|
|
|
|
padding: 10rpx 30rpx;
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&-cover {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
z-index: 9999;
|
|
|
|
|
z-index: 9999;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
position: relative;
|
|
|
|
|
position: relative;
|
|
|
|
|
flex-flow: column;
|
|
|
|
|
&-wrap {
|
|
|
|
|
position: relative;
|
|
|
|
|
@ -715,12 +799,12 @@
|
|
|
|
|
// width: 270rpx;
|
|
|
|
|
// height: 65rpx;
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #960909;
|
|
|
|
|
width: 200rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
width: 200rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
// cover-view {
|
|
|
|
|
// padding: 10rpx;
|
|
|
|
|
@ -789,16 +873,16 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.areaPicker{
|
|
|
|
|
.u-drawer{
|
|
|
|
|
>view{
|
|
|
|
|
.u-picker-body{
|
|
|
|
|
height:750rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
.areaPicker{
|
|
|
|
|
.u-drawer{
|
|
|
|
|
>view{
|
|
|
|
|
.u-picker-body{
|
|
|
|
|
height:750rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|