Commit e64d15bb authored by Mac's avatar Mac

1

parent 907b1ceb
......@@ -71,7 +71,12 @@
"urlCheck" : false,
"minified" : false
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
}
},
"mp-alipay" : {
"usingComponents" : true
......
......@@ -72,7 +72,7 @@
<view style="display: flex;flex-direction: column;justify-content: space-between;height: 30px;margin-left: 8px;">
<view class="itemb">
<span style='font-size: 11px;color: #111111;'>{{x.guidename}}</span>
<view style="background-image: linear-gradient( to right,#FF8585, #EE4454);color: #FFF;font-size: 10px;border-radius: 1px;margin-left: 5px;padding: 0 2px;">
<view v-if='x.guidescore>0' style="background-image: linear-gradient( to right,#FF8585, #EE4454);color: #FFF;font-size: 10px;border-radius: 1px;margin-left: 5px;padding: 0 2px;">
{{x.guidescore}}
</view>
</view>
......
......@@ -257,16 +257,17 @@
this.amapPlugin = new amap.AMapWX({
key: this.key
});
this.getRegeo()
// this.getRegeo()
},
methods:{
getRegeo() { //进入页面获取当前地址位置
uni.showLoading({
title: '获取信息中'
});
// uni.showLoading({
// title: '获取信息中'
// });
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;
......@@ -439,19 +440,105 @@
}
},
openmap(){//打开地图选择详情地址
let that = this
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);
}
});
let that = this
wx.getSetting({
success(res) {
console.log('res是否开启授权', res)
if (!res.authSetting['scope.userLocation']) {
wx.authorize({
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);
}
});
},
fail() {
// 用户点击不允许引导重新获取授权
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);
}
});
}
}
})
},
fetchAgainLocation(){
let that = this
wx.getSetting({
success: (res) => {
console.log()
var statu = res.authSetting;
if (!statu['scope.userLocation']) {
wx.showModal({
title: '是否授权当前位置',
content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
success: (tip) => {
if (tip.confirm) {
wx.openSetting({
success: (data) => {
if (data.authSetting["scope.userLocation"] === true) {
wx.showToast({
title: '授权成功',
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);
}
});
} else {
wx.showToast({
title: '授权失败',
icon: 'success',
duration: 1000
})
}
},
fail: () => {},
complete: () => {}
});
}
}
})
}
},
fail: ()=>{},
complete: ()=>{}
})
},
getDestination(nameList) {
this.request2(
......
......@@ -493,7 +493,7 @@
this.amapPlugin = new amap.AMapWX({
key: this.key
});
this.getRegeo()
// this.getRegeo()
}
},
created() {
......@@ -506,11 +506,12 @@
},
methods: {
getRegeo() {
uni.showLoading({
title: '获取信息中'
});
// uni.showLoading({
// title: '获取信息中'
// });
this.amapPlugin.getRegeo({
success: (data) => {
console.log(data,'获取当前位置')
this.Pickcar = data[0].regeocodeData.addressComponent.city;
this.latitude = data[0].latitude;
this.longitude = data[0].longitude;
......@@ -519,23 +520,112 @@
});
},
openmap() { //打开地图选择详情地址
let that = this
wx.getSetting({
success(res) {
console.log('res是否开启授权', res)
if (!res.authSetting['scope.userLocation']) {
wx.authorize({
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);
}else{
that.orderMsg.DestinationAddress = res.address;
}
}
});
},
fail() {
// 用户点击不允许引导重新获取授权
that.fetchAgainLocation()
}
})
} 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);
}else{
that.orderMsg.DestinationAddress = res.address;
}
}
});
}
}
})
},
fetchAgainLocation(){
let that = this
uni.chooseLocation({
latitude: this.latitude,
longitude: this.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;
}
}
});
wx.getSetting({
success: (res) => {
console.log()
var statu = res.authSetting;
if (!statu['scope.userLocation']) {
wx.showModal({
title: '是否授权当前位置',
content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
success: (tip) => {
if (tip.confirm) {
wx.openSetting({
success: (data) => {
if (data.authSetting["scope.userLocation"] === true) {
wx.showToast({
title: '授权成功',
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);
}
});
} else {
wx.showToast({
title: '授权失败',
icon: 'success',
duration: 1000
})
}
},
fail: () => {},
complete: () => {}
});
}
}
})
}
},
fail: ()=>{},
complete: ()=>{}
})
},
//获取数据
getData() {
......
......@@ -28,6 +28,7 @@
:bold="false"
@change="changeHandler"
></u-tabs>
<button @click="gosid">司导</button>
<template v-for="(item, i) in myPageData.home_pages.navs">
<view :key="i" v-if="active == i">
<template v-for="(d, di) in item.template.data">
......@@ -401,6 +402,11 @@ export default {
},
methods: {
gosid(){
uni.navigateTo({
url:'/pages/guidecar/index'
})
},
//调用获取code
getCode(obj) {
var that = this;
......
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