Commit 9d445368 authored by Mac's avatar Mac

1

parent bf713b32
......@@ -267,15 +267,7 @@
this.amapPlugin.getRegeo({
success: (data) => {
console.log(data,'获取当前位置')
this.address =data[0].name
this.Pickcar = data[0].regeocodeData.addressComponent.city;
this.latitude = data[0].latitude;
this.longitude = data[0].longitude;
let parseResult = AddressParse(this.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
this.getDestination(nameList);
uni.hideLoading();
}
});
} ,
......@@ -449,38 +441,27 @@
scope: 'scope.userLocation',
success() {
// console.log('前用户发起授权请求')
uni.chooseLocation({
latitude:that.latitude,
longitude:that.longitude,
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.getNLocation()
}
});
},
fail() {
// 用户点击不允许引导重新获取授权
console.log('111')
that.fetchAgainLocation()
}
})
} else {
// 已经授权了就会直接进入地图
uni.chooseLocation({
latitude:that.latitude,
longitude:that.longitude,
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.getNLocation()
}
});
}
}
})
......@@ -492,7 +473,7 @@
let that = this
wx.getSetting({
success: (res) => {
console.log()
console.log(res)
var statu = res.authSetting;
if (!statu['scope.userLocation']) {
wx.showModal({
......@@ -508,18 +489,11 @@
icon: 'success',
duration: 1000
})
uni.chooseLocation({
latitude:this.latitude,
longitude:this.longitude,
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.getNLocation()
}
});
} else {
wx.showToast({
title: '授权失败',
......@@ -540,6 +514,36 @@
complete: ()=>{}
})
},
getYLocation(){
console.log('you')
let that = this
uni.chooseLocation({
longitude:that.longitude,
latitude:that.latitude,
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
}
});
},
getNLocation(){
console.log('no')
let that = this
uni.chooseLocation({
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
}
});
},
getDestination(nameList) {
this.request2(
{
......
......@@ -531,22 +531,12 @@
scope: 'scope.userLocation',
success() {
// console.log('前用户发起授权请求')
uni.chooseLocation({
latitude: that.latitude,
longitude: that.longitude,
success: function(res) {
if(that.isShowStart==1){
that.latitude = res.latitude;
that.longitude = res.longitude;
that.msg.ShoppingAddress = res.address
let parseResult = AddressParse(that.msg.ShoppingAddress, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.orderMsg.DestinationAddress = res.address;
that.getNLocation()
}
}
});
},
fail() {
// 用户点击不允许引导重新获取授权
......@@ -555,23 +545,12 @@
})
} else {
// 已经授权了就会直接进入地图
uni.chooseLocation({
latitude: that.latitude,
longitude: that.longitude,
success: function(res) {
if(that.isShowStart==1){
that.latitude = res.latitude;
that.longitude = res.longitude;
that.msg.ShoppingAddress = res.address
let parseResult = AddressParse(that.msg.ShoppingAddress, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.orderMsg.DestinationAddress = res.address;
that.getNLocation()
}
}
});
}
}
})
......@@ -597,18 +576,12 @@
icon: 'success',
duration: 1000
})
uni.chooseLocation({
latitude:that.latitude,
longitude:that.longitude,
success: function (res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
that.address = res.address
let parseResult = AddressParse(that.address, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
if(that.latitude!='' && that.longitude!=''){
that.getYLocation()
}else{
that.getNLocation()
}
});
} else {
wx.showToast({
title: '授权失败',
......@@ -629,6 +602,44 @@
complete: ()=>{}
})
},
getYLocation(){
console.log('you')
let that = this
uni.chooseLocation({
latitude: that.latitude,
longitude: that.longitude,
success: function(res) {
if(that.isShowStart==1){
that.latitude = res.latitude;
that.longitude = res.longitude;
that.msg.ShoppingAddress = res.address
let parseResult = AddressParse(that.msg.ShoppingAddress, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
}else{
that.orderMsg.DestinationAddress = res.address;
}
}
});
},
getNLocation(){
console.log('no')
let that = this
uni.chooseLocation({
success: function(res) {
if(that.isShowStart==1){
that.latitude = res.latitude;
that.longitude = res.longitude;
that.msg.ShoppingAddress = res.address
let parseResult = AddressParse(that.msg.ShoppingAddress, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
that.getDestination(nameList);
}else{
that.orderMsg.DestinationAddress = res.address;
}
}
});
},
//获取数据
getData() {
this.request2({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment