Commit fd9a12f096171954876e160566fb8d58a154c2ea

Authored by wangfan
1 parent 71ebe3bd

fixbug year

... ... @@ -30,7 +30,7 @@ Page({
},
sellerid:0,
indexOpt:null,
YYYY:'',
YYYY:'YYYY',
onLoad:async function(opt){
let d=new Date()/1000;
let dateStr=util.unixtoTime(d,'MM-DD DAY');
... ...
... ... @@ -2,7 +2,7 @@
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
//import QQMapWX from '../../utils/qqmap-wx-jssdk'
const mapScale=18
Page({
/**
... ... @@ -10,9 +10,9 @@ Page({
*/
data: {
map: {
latitude: 23.099994,
longitude: 113.324520,
scale: 18,
//latitude: 23.099994,
//longitude: 113.324520,
scale: mapScale,
height: 300,
},
markers: [],
... ... @@ -35,10 +35,16 @@ Page({
*/
mapCtx: null,
mapData:{
lat:'',
lng:'',
latitude: 23.099994,
longitude: 113.324520,
scale: 18,
hasRegionchange:false,
region:{
southwest:{},
northeast:{},
},
},
onReady: function () {
this.mapCtx = wx.createMapContext('map')
... ... @@ -143,33 +149,59 @@ Page({
},
regionchange(e){
console.log('regionchange', e)
this.mapCtx.getScale({
success:(res)=>{
this.mapData.scale=res.scale;
console.log('getScale',res,this.data.map.scale)
},
})
this.mapCtx.getCenterLocation({
success:(res)=>{
console.log('getCenterLocation',res)
if(res.latitude!=this.mapData.latitude
|| res.longitude!=this.mapData.longitude){
this.mapData.hasRegionchange=true;
this.mapData.latitude=res.latitude;
this.mapData.longitude=res.longitude;
this.getMarkers();
this.mapData.latitude=res.latitude;
this.mapData.longitude=res.longitude;
if(this.mapData.lat=='' && res.latitude.toString().length>6 && res.longitude.toString().length>6){
this.mapData.lat=res.latitude;
this.mapData.lng=res.longitude;
}
},
});
this.mapCtx.getRegion({
success:(res)=>{
console.log('getRegion',res)
if(res.southwest.latitude!=this.mapData.region.southwest.latitude) {
this.mapData.region = res
this.getMarkers();
}
},
})
},
mapUpdated(e){
console.log('mapUpdated', e)
this.mapCtx.getScale({
success:(res)=>{
this.mapData.scale=res.scale;
console.log('getScale',res,this.data.map.scale)
},
})
this.mapCtx.getCenterLocation({
success:(res)=>{
console.log('getCenterLocation',res)
if(res.latitude!=this.mapData.latitude
|| res.longitude!=this.mapData.longitude){
this.mapData.hasRegionchange=true;
this.mapData.latitude=res.latitude;
this.mapData.longitude=res.longitude;
this.mapData.latitude=res.latitude;
this.mapData.longitude=res.longitude;
},
});
this.mapCtx.getRegion({
success:(res)=>{
console.log('getRegion',res)
if(res.southwest.latitude!=this.mapData.region.southwest.latitude){
this.mapData.region=res
this.getMarkers();
}
},
});
})
},
markertap(e){
console.log(e)
... ... @@ -189,11 +221,12 @@ Page({
let map = this.mapData;
let markers = [];
App.Reserve.SellerList({
lat: map.latitude,
lng: map.longitude,
lat: map.lat,
lng: map.lng,
offset: 0,
rows: 100,
distance: 100,
rows: 10000,
distance: 100000,
map:JSON.stringify(this.mapData.region)
}).then(res => {
if (res.ret == 200) {
let sellersIds=[];
... ... @@ -206,6 +239,18 @@ Page({
this.sellersIds=sellersIds;
this.sellers = res.data;
res.data.forEach(seller => {
if(this.mapData.scale<13){
markers.push({
id: seller.id,
iconPath: "http://qn.colorcun.com/custom/lite-yd/image/diandian.png",
latitude: seller.lat,
longitude: seller.long,
width: 6,
height: 6,
title:seller.seller_name,
})
return;
}
let namelength = seller.sellername.replace(/[^\x00-\xff]/g, "01").length + 8;
markers.push({
id: seller.id,
... ... @@ -292,6 +337,9 @@ Page({
this.getMarkers()
},
moveToLocation(){
this.setData({
[`map.scale`]:mapScale,
})
this.mapCtx.moveToLocation({
success:(res)=>{
console.log('moveToLocation',res)
... ...