|
@@ -217,10 +217,11 @@ Page({
|
|
|
html: store.content,
|
|
|
id: store.objectId,
|
|
|
licenseList: licenseList,
|
|
|
- locations: store.location
|
|
|
+ locations: store.location,
|
|
|
+ address:store.storeAddress
|
|
|
})
|
|
|
console.log('首页', this.data.locations);
|
|
|
- this.Getlocation()
|
|
|
+ // this.Getlocation()
|
|
|
// this.selectComponent('#hf_editor').setHtml(this.data.html);
|
|
|
this.getQiniuOption()
|
|
|
},
|
|
@@ -322,41 +323,41 @@ Page({
|
|
|
//解析地理位置
|
|
|
Getlocation() {
|
|
|
// 假设 this.storeList[0].location 是一个 Parse.GeoPoint 对象
|
|
|
- if (this.data.locations) {
|
|
|
- const storeLocation = this.data.locations;
|
|
|
+ // if (this.data.locations) {
|
|
|
+ // const storeLocation = this.data.locations;
|
|
|
|
|
|
- // 从 GeoPoint 对象中获取经纬度
|
|
|
- const latitude = storeLocation.latitude; // 纬度
|
|
|
- const longitude = storeLocation.longitude; // 经度
|
|
|
+ // // 从 GeoPoint 对象中获取经纬度
|
|
|
+ // const latitude = storeLocation.latitude; // 纬度
|
|
|
+ // const longitude = storeLocation.longitude; // 经度
|
|
|
|
|
|
- console.log('获取到的经纬度:', latitude, 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 () {}
|
|
|
- });
|
|
|
- }
|
|
|
+ // // 调用 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 () {}
|
|
|
+ // });
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
|
})
|