|
|
@ -2,7 +2,8 @@ import Vue from "vue"; |
|
|
import wx from "weixin-js-sdk"; |
|
|
import wx from "weixin-js-sdk"; |
|
|
import axios from "axios"; |
|
|
import axios from "axios"; |
|
|
import wxShareModel from "../models/wxShare-model.js"; |
|
|
import wxShareModel from "../models/wxShare-model.js"; |
|
|
|
|
|
|
|
|
|
|
|
//引入BMap
|
|
|
|
|
|
import BMap from "BMap"; |
|
|
|
|
|
|
|
|
Vue.prototype.wxLocation = function () { |
|
|
Vue.prototype.wxLocation = function () { |
|
|
wxShareModel.getWXCheck().then(response =>{ |
|
|
wxShareModel.getWXCheck().then(response =>{ |
|
|
@ -30,8 +31,19 @@ Vue.prototype.wxLocation = function () { |
|
|
wx.getLocation({ |
|
|
wx.getLocation({ |
|
|
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
success: function (res) { |
|
|
success: function (res) { |
|
|
|
|
|
console.log('res:'+res); |
|
|
localStorage.setItem("latitude", res.latitude); |
|
|
localStorage.setItem("latitude", res.latitude); |
|
|
localStorage.setItem("longitude", res.longitude); |
|
|
localStorage.setItem("longitude", res.longitude); |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: 'http://api.map.baidu.com/geocoder/v2/?ak=a79bFu054xIbE23jlynkSXX20F9yGD4G&callback=renderReverse&location=' + res.latitude + ',' + res.longitude + '&output=json&pois=1', |
|
|
|
|
|
type: "get", |
|
|
|
|
|
dataType: "jsonp", |
|
|
|
|
|
jsonp: "callback", |
|
|
|
|
|
success: function (data) { |
|
|
|
|
|
console.log('data:'+data); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
cancel: function () { |
|
|
cancel: function () { |
|
|
alter("拒绝定位"); |
|
|
alter("拒绝定位"); |
|
|
|