From 35b8dbb2da668820db85f5ab6bd43ae98d714cba Mon Sep 17 00:00:00 2001 From: lfs3 Date: Mon, 26 Aug 2019 14:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BC=A0=E7=99=BE=E5=BA=A6?= =?UTF-8?q?=E7=BB=8F=E7=BA=AC=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index 68690ca..d840322 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -2,7 +2,8 @@ import Vue from "vue"; import wx from "weixin-js-sdk"; import axios from "axios"; import wxShareModel from "../models/wxShare-model.js"; - +//引入BMap +import BMap from "BMap"; Vue.prototype.wxLocation = function () { wxShareModel.getWXCheck().then(response =>{ @@ -30,8 +31,19 @@ Vue.prototype.wxLocation = function () { wx.getLocation({ type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' success: function (res) { + console.log('res:'+res); localStorage.setItem("latitude", res.latitude); 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 () { alter("拒绝定位");