Commit b883a5ce187505635f6548de7a9cff7a6c001443

Authored by wangfan
1 parent d3581c01

C端调整

@@ -22,6 +22,21 @@ Component({ @@ -22,6 +22,21 @@ Component({
22 this.triggerEvent("pos",res); 22 this.triggerEvent("pos",res);
23 }).catch((e) => { 23 }).catch((e) => {
24 console.log('wx.getLocation.catch', e); 24 console.log('wx.getLocation.catch', e);
  25 + if(e.errCode==2){//定位失败
  26 + wx.showModal({
  27 + title:'定位失败',
  28 + content:'请开启位置服务',
  29 + showCancel:false,
  30 + success:()=>{
  31 + console.log('wx.showModal::success,给默认坐标');
  32 + this.triggerEvent("pos",{
  33 + latitude: 39.636911,
  34 + longitude: 118.150591,
  35 + });
  36 + },
  37 + })
  38 + return;
  39 + }
25 if ('getLocation:fail auth deny' == e.errMsg 40 if ('getLocation:fail auth deny' == e.errMsg
26 || 'getLocation:fail:auth denied' == e.errMsg 41 || 'getLocation:fail:auth denied' == e.errMsg
27 || 'getLocation:fail authorize no response' == e.errMsg) { 42 || 'getLocation:fail authorize no response' == e.errMsg) {
@@ -16,6 +16,8 @@ const renNum=function(){ @@ -16,6 +16,8 @@ const renNum=function(){
16 } 16 }
17 const cates_version='?1.1'; 17 const cates_version='?1.1';
18 const hasSellerConcat=true;//变量存储所有商户 18 const hasSellerConcat=true;//变量存储所有商户
  19 +const def_latitude=39.63691;
  20 +const def_longitude=118.15059;
19 Page({ 21 Page({
20 22
21 /** 23 /**
@@ -23,8 +25,8 @@ Page({ @@ -23,8 +25,8 @@ Page({
23 */ 25 */
24 data: { 26 data: {
25 map: { 27 map: {
26 - latitude: 23.099994,  
27 - longitude: 113.324520, 28 + latitude: def_latitude,
  29 + longitude: def_longitude,
28 scale: mapScale, 30 scale: mapScale,
29 height: 300, 31 height: 300,
30 }, 32 },
@@ -49,8 +51,8 @@ Page({ @@ -49,8 +51,8 @@ Page({
49 sellersNow:[],//本次视图内商户 51 sellersNow:[],//本次视图内商户
50 searchAddrTop:50, 52 searchAddrTop:50,
51 user:{ 53 user:{
52 - latitude: 23.099994,  
53 - longitude: 113.324520, 54 + latitude: def_latitude,
  55 + longitude: def_longitude,
54 }, 56 },
55 /** 57 /**
56 * 生命周期函数--监听页面加载 58 * 生命周期函数--监听页面加载
@@ -332,7 +334,7 @@ Page({ @@ -332,7 +334,7 @@ Page({
332 if(!map.region.southwest.latitude || !map.region.southwest.longitude) return false;//未获得视野 334 if(!map.region.southwest.latitude || !map.region.southwest.longitude) return false;//未获得视野
333 if(this.hasInRegionFlag) return true; 335 if(this.hasInRegionFlag) return true;
334 if(!this.user.latitude) return false;//用户无定位 336 if(!this.user.latitude) return false;//用户无定位
335 - if(this.user.latitude==23.099994 && this.user.longitude==113.324520) return false;//默认位置 337 + if(this.user.latitude==def_latitude && this.user.longitude==def_longitude) return false;//默认位置
336 ///判断定位 首次 进入视野 338 ///判断定位 首次 进入视野
337 if((this.user.latitude>map.region.southwest.latitude 339 if((this.user.latitude>map.region.southwest.latitude
338 && this.user.longitude>map.region.southwest.longitude 340 && this.user.longitude>map.region.southwest.longitude