Commit e64d15bb authored by Mac's avatar Mac

1

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