Skip to content

Commit

Permalink
Preformance
Browse files Browse the repository at this point in the history
  • Loading branch information
cnyet committed Feb 20, 2020
1 parent 85936d4 commit 0659706
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 27 deletions.
68 changes: 41 additions & 27 deletions pages/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions pages/user/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 0659706

Please sign in to comment.