Commit 07d61a1f70b3ef0a7f48fc250d1c2a407f5efdf4

Authored by wangfan
1 parent 8eb72cbb

activity

@@ -70,7 +70,7 @@ Page({ @@ -70,7 +70,7 @@ Page({
70 * 生命周期函数--监听页面显示 70 * 生命周期函数--监听页面显示
71 */ 71 */
72 onShow: function () { 72 onShow: function () {
73 - this.getPos() 73 + this.selectComponent('#getpos').getPos();
74 }, 74 },
75 75
76 /** 76 /**
@@ -149,42 +149,6 @@ Page({ @@ -149,42 +149,6 @@ Page({
149 } 149 }
150 ) 150 )
151 }, 151 },
152 - getPos(){  
153 - this._getPos().then(res => {  
154 - console.log('wx.getLocation.then', res);  
155 - this.location=res  
156 - this.GetSellerDetail();  
157 - }).catch((e) => {  
158 - console.log('wx.getLocation.catch', e);  
159 - if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {  
160 - this.selectComponent('#showModal').options({  
161 - header: '定位失败',  
162 - body: '需要地理位置授权'  
163 - }).show();  
164 - } else {  
165 - setTimeout(() => {  
166 - this.getPos()  
167 - }, 500)  
168 - }  
169 -  
170 - })  
171 - },  
172 - _getPos(){  
173 - return new Promise((success, fail) => {  
174 - wx.getLocation({  
175 - type: 'gcj02',  
176 - success: (res) => {  
177 - success(res)  
178 - },  
179 - fail: (res) => {  
180 - fail(res)  
181 - },  
182 - complete: (res) => {  
183 - console.log('wx.getLocation', res)  
184 - }  
185 - });  
186 - })  
187 - },  
188 lookLocation:function(){ 152 lookLocation:function(){
189 //console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address) 153 //console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
190 wx.openLocation({ 154 wx.openLocation({
@@ -197,4 +161,9 @@ Page({ @@ -197,4 +161,9 @@ Page({
197 } 161 }
198 }) 162 })
199 }, 163 },
  164 + onpos(e){
  165 + console.log(e);
  166 + this.location=e.detail
  167 + this.GetSellerDetail();
  168 + },
200 }) 169 })
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "formids":"/components/formids/formids", 6 "formids":"/components/formids/formids",
7 "stat":"/components/stat/stat", 7 "stat":"/components/stat/stat",
8 "as":"/components/actionSheet/index", 8 "as":"/components/actionSheet/index",
9 - "nav":"/components/nav/nav" 9 + "nav":"/components/nav/nav",
  10 + "getpos":"/components/userinfo/getpos"
10 } 11 }
11 } 12 }
@@ -126,4 +126,5 @@ @@ -126,4 +126,5 @@
126 </formids> 126 </formids>
127 </view> 127 </view>
128 </view> 128 </view>
129 -<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预定</as>  
  129 +<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预定</as>
  130 +<getpos bindpos="onpos" id="getpos"></getpos>