|
@@ -128,7 +128,7 @@ Page({
|
|
|
}else{
|
|
|
image=this.data.image
|
|
|
}
|
|
|
- console.log(this.data.name, image, this.data.storeName, this.data.perCapita, this.data.desc, this.data.workingTime, this.data.html);
|
|
|
+ console.log(this.data.name, image, this.data.storeName, this.data.perCapita, this.data.desc, this.data.workingTime, this.data.html,this.data.locations);
|
|
|
let query = new Parse.Query("ShopStore")
|
|
|
|
|
|
let ShopStore = await query.get(this.data.id)
|
|
@@ -214,8 +214,10 @@ Page({
|
|
|
html: store.content,
|
|
|
id: store.objectId,
|
|
|
licenseList: licenseList,
|
|
|
+ locations:store.location
|
|
|
})
|
|
|
- console.log('首页',this.data.perCapita);
|
|
|
+ console.log('首页',this.data.locations);
|
|
|
+ this.Getlocation()
|
|
|
this.selectComponent('#hf_editor').setHtml(this.data.html);
|
|
|
this.getQiniuOption()
|
|
|
},
|
|
@@ -282,6 +284,7 @@ Page({
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
},
|
|
|
+ //选择地理位置
|
|
|
chooseGeoPoint() {
|
|
|
wx.chooseLocation({
|
|
|
latitude: 0,
|
|
@@ -309,4 +312,41 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //解析地理位置
|
|
|
+ Getlocation() {
|
|
|
+ // 假设 this.storeList[0].location 是一个 Parse.GeoPoint 对象
|
|
|
+ const storeLocation = this.data.locations;
|
|
|
+
|
|
|
+ // 从 GeoPoint 对象中获取经纬度
|
|
|
+ const latitude = storeLocation.latitude; // 纬度
|
|
|
+ const longitude = storeLocation.longitude; // 经度
|
|
|
+
|
|
|
+ console.log('获取到的经纬度:', latitude, longitude); // 添加日志
|
|
|
+
|
|
|
+ // 调用 API 解析地址
|
|
|
+ wx.request({
|
|
|
+ url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=sHZTomd7grslfP7sPKB8tRgT49FK9TEu&output=json&coordtype=gcj02&location=' + latitude + ',' + longitude,
|
|
|
+ data: {},
|
|
|
+ header: {
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ },
|
|
|
+ success: (ops) => { // 使用箭头函数
|
|
|
+ console.log(ops);
|
|
|
+ const address = ops.data.result.formatted_address;
|
|
|
+ this.setData({
|
|
|
+ address: address,
|
|
|
+ });
|
|
|
+ console.log(this.data.address);
|
|
|
+ },
|
|
|
+ fail: function (resq) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '信息提示',
|
|
|
+ content: '请求失败',
|
|
|
+ showCancel: false,
|
|
|
+ confirmColor: '#f37938'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ complete: function () {}
|
|
|
+ });
|
|
|
+ },
|
|
|
})
|