lion 2 years ago
parent aa48abc6ac
commit 1e60bfb106

@ -72,12 +72,10 @@ const shareInfo = {
// 计算距离
const getDistance = (la1, lo1, la2, lo2) => { // 当前的纬度,当前的经度,接口拿到的纬度,接口拿到的经度
console.log(la1, lo1, la2, lo2)
la1 = parseFloat(la1)
lo1 = parseFloat(lo1)
la2 = parseFloat(la2)
lo2 = parseFloat(lo2)
console.log(la1, lo1, la2, lo2)
let La1 = la1 * Math.PI / 180.0;
let La2 = la2 * Math.PI / 180.0;
let La3 = La1 - La2;

@ -2,7 +2,7 @@
<view class="">
<cover-view class="loadwrap" v-if="showLoad">
<cover-view class="loadwrap-my">
<cover-image src="/static/loading.gif" alt="">
<cover-image src="/static/loading.gif" alt=""></cover-image>
</cover-view>
</cover-view>
</view>

@ -49,8 +49,8 @@
{
id: 2,
centerItem: false,
width: 61,
height: 61,
width: 54,
height: 60,
"text": "我的",
"pagePath": "/pages/me/me",
"iconPath": require("@/static/icon3.png"),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 29 KiB

@ -25,14 +25,15 @@
</view>
</view>
<view class="maps">
<map id="myMap" :longitude="lng" show-location :enable-scroll="!showLoad" @regionchange="pushMarkers"
:scale="scale" :latitude="lat" :markers="markers" @callouttap="showDetail">
<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">
<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">
<cover-image class="maps-cover-lockimg"
@ -41,9 +42,9 @@
</cover-view>
</block>
</cover-view>
<cover-view class="maps-cover-label">
<cover-image class="maps-labelbg" :src="'/static/home-cur.png'"></cover-image>
<cover-view>{{item.title}}</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>
</cover-view>
</cover-view>
@ -85,7 +86,7 @@
</map>
</view>
<u-picker v-model="showArea" @confirm="confirmArea" @cancel="cancelArea" :range="listArea" range-key="value"
<u-picker class="areaPicker" v-model="showArea" :visibleItemCount='10' @confirm="confirmArea" @cancel="cancelArea" :range="listArea" range-key="value"
:confirm-color="'#e50015'" mode="selector"></u-picker>
<!-- 锦囊 -->
<view class="tips" v-if="showTips" :class="showTips?'fade-in':'fade-out'">
@ -114,7 +115,7 @@
</template>
<script>
import tabbar from '@/components/tabbar/tabbar.vue'
import tabbar from '@/components/tabbar/tabbar.vue'
import myloading from '@/components/myloading.vue'
import {
ROOTPATH as baseUrl
@ -126,10 +127,10 @@
getDistance,
toMapAPP
} from '@/common/util.js'
export default {
components: {
tabbar,
tabbar,
myloading
},
data() {
@ -140,6 +141,7 @@
theme_id: '',
area: '区域',
mapContext: null,
mapTimer: null,
scale: 11,
lat: null,
lng: null,
@ -150,12 +152,14 @@
pointer: null,
listArea: [{
id: '',
value: '全部'
value: '全部',
sort: -999999
}],
showArea: false,
tips: '',
showLoad: false,
showNear: true
showNear: true,
showLabel:false
}
},
@ -173,6 +177,28 @@
}
})
this.mapContext = uni.createMapContext('myMap', 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);
}
});
}, 1000)
}
},
onLoad(option) {
@ -188,9 +214,9 @@
},
onShow() {
let vuex_pointer = uni.getStorageSync('vuex_pointer') ? uni.getStorageSync('vuex_pointer') : null
let vuex_latlng = uni.getStorageSync('vuex_latlng') ? uni.getStorageSync('vuex_latlng') : ''
let vuex_latlng = uni.getStorageSync('vuex_latlng') ? uni.getStorageSync('vuex_latlng') : ''
let vuex_point_id = uni.getStorageSync('vuex_point_id') ? uni.getStorageSync('vuex_point_id') : ''
//
//
if (vuex_pointer) {
this.pointer = vuex_pointer
this.pointer.distance = getDistance(vuex_latlng.lat, vuex_latlng.lng, this.pointer.lat, this.pointer.lng)
@ -201,23 +227,26 @@
longitude: parseFloat(this.pointer.lng),
latitude: parseFloat(this.pointer.lat)
});
}
//
console.log("vuex_point_id",vuex_point_id)
if(vuex_point_id){
this.markers.map(item=>{
if(item.id==vuex_point_id){
item.has_answer = 1
uni.removeStorageSync("vuex_point_id")
}
})
}
//
if (vuex_point_id) {
this.markers.map(item => {
if (item.id == vuex_point_id) {
item.has_answer = 1
uni.removeStorageSync("vuex_point_id")
}
})
}
},
onHide() {
console.log("this.showTips", this.showTips)
this.showTips = false
this.showPointer = false
this.pointer = null
this.pointer = null
if(!this.mapTimer){
this.mapTimer = null
clearInterval(this.mapTimer)
}
},
methods: {
//
@ -225,7 +254,6 @@
uni.getLocation({
type: 'gcj02',
success: (res) => {
console.log("res", res)
uni.removeStorageSync('vuex_latlng')
this.lng = res.longitude
this.lat = res.latitude
@ -244,7 +272,6 @@
await uni.login({
provider: 'weixin',
success: (res) => {
console.log("rescode", res.code)
this.$u.api.login({
code: res.code
}).then(res => {
@ -278,6 +305,7 @@
},
success(res) {
that.listArea.push(...res.data.detail)
that.listArea.sort((a, b) => a.sort - b.sort);
},
fail(err) {
console.log(err)
@ -290,66 +318,66 @@
this.theme_id = this.listArea[e].id
this.showPointer = false
this.pointer = null
this.showNear = true
this.showNear = true
this.scale = 11
this.markers = []
// id markers
if(this.theme_id==''){
// this.mapContext.moveToLocation({
// longitude: this.lng,
// latitude: this.lat,
// });
// this.getPointers()
this.pointers.map((item, index) => {
if(index<10){
this.markers.push({
id: item.id,
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
iconPath: '/static/home-marker.png',
truePath: item.logo ? item.logo.url : item.image.url,
width: 0,
height: 0,
title: item.name,
distance: item.distance ? parseInt(item.distance) : 0,
has_answer: item.has_answer,
customCallout: {
anchorX: 70,
anchorY: 30,
display: 'ALWAYS'
},
})
}
})
}else{
this.pointers.map((item, index) => {
if (this.theme_id && item.theme_id == this.theme_id) {
this.markers.push({
id: item.id,
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
iconPath: '/static/home-marker.png',
truePath: item.logo ? item.logo.url : item.image.url,
width: 0,
height: 0,
title: item.name,
distance: item.distance ? parseInt(item.distance) : 0,
has_answer: item.has_answer,
customCallout: {
anchorX: 70,
anchorY: 30,
display: 'ALWAYS'
},
})
}
})
this.mapContext.moveToLocation({
longitude: this.markers[0].longitude,
latitude: this.markers[0].latitude,
});
this.markers = []
// id markers
if (this.theme_id == '') {
// this.mapContext.moveToLocation({
// longitude: this.lng,
// latitude: this.lat,
// });
// this.getPointers()
this.pointers.map((item, index) => {
if (index < 10) {
this.markers.push({
id: item.id,
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
iconPath: '/static/home-marker.png',
truePath: item.logo ? item.logo.url : item.image.url,
width: 0,
height: 0,
title: item.name,
distance: item.distance ? parseInt(item.distance) : 0,
has_answer: item.has_answer,
customCallout: {
anchorX: 70,
anchorY: 30,
display: 'ALWAYS'
},
})
}
})
} else {
this.pointers.map((item, index) => {
if (this.theme_id && item.theme_id == this.theme_id) {
this.markers.push({
id: item.id,
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
iconPath: '/static/home-marker.png',
truePath: item.logo ? item.logo.url : item.image.url,
width: 0,
height: 0,
title: item.name,
distance: item.distance ? parseInt(item.distance) : 0,
has_answer: item.has_answer,
customCallout: {
anchorX: 70,
anchorY: 30,
display: 'ALWAYS'
},
})
}
})
this.mapContext.moveToLocation({
longitude: this.markers[0].longitude,
latitude: this.markers[0].latitude,
});
}
// this.getPointers()
}
@ -384,7 +412,6 @@
})
},
getNears() {
console.log("123")
this.scale = 13
this.showPointer = false
this.pointer = null
@ -425,7 +452,6 @@
},
//
pushMarkers(e) {
console.log("e", e)
let lengthM = this.markers.length //markers
//
if (this.showLoad || this.theme_id) {
@ -435,7 +461,7 @@
this.pointers.map((item, index) => {
// 10
if (index > lengthM - 1 && index < lengthM + 10) {
// uni.showLoading()
// uni.showLoading()
this.$refs.myloading.showLoading()
this.showLoad = true
this.markers.push({
@ -457,9 +483,9 @@
})
let that = this
setTimeout(function() {
// uni.hideLoading()
that.$refs.myloading.hideLoading()
// uni.hideLoading()
that.$refs.myloading.hideLoading()
that.showLoad = false
}, 2000)
}
@ -484,7 +510,6 @@
if (arr.length > 0) {
this.pointer = arr[0]
this.pointer.distance = getDistance(this.lat, this.lng, this.pointer.lat, this.pointer.lng)
console.log(this.pointer.distance)
}
this.showPointer = true
@ -534,8 +559,8 @@
padding: 0 30rpx;
&-left {
width: 58rpx;
height: 86rpx;
width: 57rpx;
height: 87rpx;
}
&-center {
@ -638,8 +663,8 @@
text-align: right;
cover-image {
width: 243rpx;
height: 142rpx;
width: 246rpx;
height: 132rpx;
display: inline-block;
}
}
@ -649,8 +674,10 @@
&-cover {
display: flex;
align-items: center;
z-index: 9999;
z-index: 9999;
flex-wrap: wrap;
position: relative;
flex-flow: column;
&-wrap {
position: relative;
}
@ -684,23 +711,23 @@
}
&-label {
cover-image {
width: 270rpx;
height: 65rpx;
}
font-size: 20rpx;
color: #dbd0ba;
display: flex;
align-items: center;
// cover-image {
// width: 270rpx;
// height: 65rpx;
cover-view {
padding: 10rpx 40rpx;
width: 200rpx;
white-space: normal;
position: absolute;
}
// }
font-size: 22rpx;
color: #960909;
width: 200rpx;
text-align: center;
white-space: normal;
// cover-view {
// padding: 10rpx;
// width: 200rpx;
// white-space: normal;
// position: absolute;
// }
}
}
}
@ -747,10 +774,10 @@
font-size: 33rpx;
margin: 0 auto;
line-height: 2;
height: 650rpx;
height: 660rpx;
overflow: scroll;
position: absolute;
top: 350rpx;
top: 345rpx;
left: 50%;
transform: translate(-50%, 0%);
width: 80%;
@ -762,6 +789,16 @@
}
}
}
}
.areaPicker{
.u-drawer{
>view{
.u-picker-body{
height:750rpx;
}
}
}
}
}

@ -18,7 +18,7 @@
<view class="titlewrap">
<view class="title-progress">
<view class="progress-text">{{progressPercentage}}%</view>
<!-- <view class="progress-text">{{progressPercentage}}%</view> -->
<view class="progress-bar-container">
<view class="progress-bar" :style="{'width':progressPercentage+'%'}"></view>
</view>

@ -44,8 +44,8 @@
<view class="line-item-pointer-item-title">{{pointer.name}}</view>
<view class="line-item-pointer-item-detail">点位详情</view>
</view>
<image class="line-item-pointer-item-icon" :src="require('@/static/line-icon.png')"
mode=""></image>
<!-- <image class="line-item-pointer-item-icon" :src="require('@/static/line-icon.png')"
mode=""></image> -->
</view>
</view>
</view>

@ -19,7 +19,7 @@
<view>
<view v-if="item.id==='cer'" class="cer">
<view class="cer-progress">
<view v-if="done>0 && answerTotal>0">{{(done/answerTotal)*100+'%'}}</view>
<view v-if="done>0 && answerTotal>0">{{done}}/{{answerTotal}}</view>
<view v-else>0</view>
<view class="cer-progress-bar">
<view class="cer-progress-item" :style="{'width':done>0 && answerTotal>0?(done/answerTotal)*100+'%':0}">
@ -127,11 +127,11 @@
height: '49rpx',
}, {
id: 'tips',
title: '活动锦囊',
title: '打卡规则',
url: '',
src: require('@/static/me-icon3.png'),
width: '46rpx',
height: '48rpx',
width: '42rpx',
height: '43rpx',
}]
}
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 791 B

Loading…
Cancel
Save