From 0659706618265eab36e05f75fa46af4bd3a7c40e Mon Sep 17 00:00:00 2001 From: cnyet Date: Thu, 20 Feb 2020 14:44:54 +0800 Subject: [PATCH] Preformance --- pages/map/map.js | 68 ++++++++++++++++++++++++++------------------ pages/user/user.json | 1 + 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/pages/map/map.js b/pages/map/map.js index 5a775c0..2a098a6 100644 --- a/pages/map/map.js +++ b/pages/map/map.js @@ -46,37 +46,51 @@ Page({ title: "正在加载..." }); wx.getLocation({ - type: '', + type: 'wgs84', altitude: true, success: function (res) { + console.log(res); var lat = res.latitude; var lon = res.longitude; // 调用接口 - qqmapsdk.search({ - keyword: '上海', - page_size: 5, - success: function (res) { - console.log(lat, lon) - var title = res.data.length ? res.data[0].address : ""; - wx.openLocation({ - latitude: lat, - longitude: lon, - scale: 28, - name: "你当前的位置", - address: title - }); + // qqmapsdk.search({ + // keyword: '号', + // page_size: 5, + // success: function (res) { + // console.log(lat, lon) + // var title = res.data.length ? res.data[0].address : ""; console.log(title); + // wx.openLocation({ + // latitude: lat, + // longitude: lon, + // scale: 28, + // name: "你当前的位置", + // address: title + // }); + // }, + // fail: function (res) { + // wx.showToast({ + // title: res.message + // }); + // }, + // complete: function (res) { + // wx.hideLoading(); + // } + // }) + qqmapsdk.reverseGeocoder({ + location: { + latitude: 39.984060, + longitude: 116.307520 + }, + success: function (res){ + console.log(res); }, - fail: function (res) { - wx.showToast({ - title: res.message - }); + fail: function (error) { + console.error(error); }, - complete: function (res) { - wx.hideLoading(); - console.log("ok"); + complete: function (res) { + wx.hideLoading(); } - }) - + }) }, fail: function (res) { wx.showToast({ @@ -115,10 +129,10 @@ Page({ // 调用接口 qqmapsdk.search({ keyword: '上海', - location: { - longitude: 121.4997200000, - latitude: 31.2396900000 - }, + // location: { + // longitude: 121.4997200000, + // latitude: 31.2396900000 + // }, page_size: 5, success: function (res) { var region = res.region.title; diff --git a/pages/user/user.json b/pages/user/user.json index e69de29..9e26dfe 100644 --- a/pages/user/user.json +++ b/pages/user/user.json @@ -0,0 +1 @@ +{} \ No newline at end of file