Commit 07d61a1f70b3ef0a7f48fc250d1c2a407f5efdf4

Authored by wangfan
1 parent 8eb72cbb

activity

... ... @@ -70,7 +70,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getPos()
this.selectComponent('#getpos').getPos();
},
/**
... ... @@ -149,42 +149,6 @@ Page({
}
)
},
getPos(){
this._getPos().then(res => {
console.log('wx.getLocation.then', res);
this.location=res
this.GetSellerDetail();
}).catch((e) => {
console.log('wx.getLocation.catch', e);
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
this.selectComponent('#showModal').options({
header: '定位失败',
body: '需要地理位置授权'
}).show();
} else {
setTimeout(() => {
this.getPos()
}, 500)
}
})
},
_getPos(){
return new Promise((success, fail) => {
wx.getLocation({
type: 'gcj02',
success: (res) => {
success(res)
},
fail: (res) => {
fail(res)
},
complete: (res) => {
console.log('wx.getLocation', res)
}
});
})
},
lookLocation:function(){
//console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
wx.openLocation({
... ... @@ -197,4 +161,9 @@ Page({
}
})
},
onpos(e){
console.log(e);
this.location=e.detail
this.GetSellerDetail();
},
})
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@
"formids":"/components/formids/formids",
"stat":"/components/stat/stat",
"as":"/components/actionSheet/index",
"nav":"/components/nav/nav"
"nav":"/components/nav/nav",
"getpos":"/components/userinfo/getpos"
}
}
\ No newline at end of file
... ...
... ... @@ -126,4 +126,5 @@
</formids>
</view>
</view>
<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预定</as>
\ No newline at end of file
<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预定</as>
<getpos bindpos="onpos" id="getpos"></getpos>
\ No newline at end of file
... ...