|
@@ -219,40 +219,73 @@
|
|
|
this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
|
|
|
// console.log("导航栏高度:"+this.globalData.navigationBarHeight)
|
|
|
// #endif
|
|
|
- this.getAddressInfo()
|
|
|
+ this.initLocation();
|
|
|
},
|
|
|
methods: {
|
|
|
- getAddressInfo() {
|
|
|
+ initLocation() {
|
|
|
let that = this;
|
|
|
- const qqmapsdk = new QQMapWX({
|
|
|
- // key: 'SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7'
|
|
|
- key: '7FJBZ-ACWCN-EFWFQ-SBXR5-QXC7K-LPF2U'
|
|
|
- });
|
|
|
- qqmapsdk.reverseGeocoder({
|
|
|
- location: {
|
|
|
- latitude: uni.getStorageSync('user_latitude'),
|
|
|
- longitude: uni.getStorageSync('user_longitude'),
|
|
|
- },
|
|
|
- success: (res2) => {
|
|
|
- const address = res2.result.address; // 完整地址(如北京市海淀区中关村)
|
|
|
- const province = res2.result.ad_info.province; // 省份
|
|
|
- const city = res2.result.ad_info.city; // 城市
|
|
|
- const recommend = res2.result.address_reference.landmark_l2.title;; // 推荐使用的地址描述,描述精确性较高
|
|
|
- console.log('地址信息1:', res2);
|
|
|
- that.userAddress = recommend;
|
|
|
- getMerchantList({
|
|
|
- latitude: uni.getStorageSync('user_latitude'),
|
|
|
- longitude: uni.getStorageSync('user_longitude'),
|
|
|
- }).then(res => {
|
|
|
- that.merchantList = res.data.list;
|
|
|
- console.log('商品信息:', that.merchantList);
|
|
|
- });
|
|
|
- that.getHomeData();
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- console.error('逆地理编码失败:', err);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.$util.$L.getLocation().then(res => {
|
|
|
+ const qqmapsdk = new QQMapWX({
|
|
|
+ key: '7FJBZ-ACWCN-EFWFQ-SBXR5-QXC7K-LPF2U'
|
|
|
+ //key: '7FJBZ-ACWCN-EFWFQ-SBXR5-QXC7K-LPF2U'
|
|
|
+ });
|
|
|
+ qqmapsdk.reverseGeocoder({
|
|
|
+ location: {
|
|
|
+ latitude: uni.getStorageSync('user_latitude'),
|
|
|
+ longitude: uni.getStorageSync('user_longitude'),
|
|
|
+ },
|
|
|
+ success: (res2) => {
|
|
|
+ const address = res2.result.address; // 完整地址(如北京市海淀区中关村)
|
|
|
+ const province = res2.result.ad_info.province; // 省份
|
|
|
+ const city = res2.result.ad_info.city; // 城市
|
|
|
+ const recommend = res2.result.address_reference.landmark_l2.title;; // 推荐使用的地址描述,描述精确性较高
|
|
|
+ console.log('地址信息1:', res2);
|
|
|
+ that.userAddress = recommend;
|
|
|
+ getMerchantList({
|
|
|
+ latitude: uni.getStorageSync('user_latitude'),
|
|
|
+ longitude: uni.getStorageSync('user_longitude'),
|
|
|
+ }).then(res => {
|
|
|
+ that.merchantList = res.data.list;
|
|
|
+ console.log('商品信息:', that.merchantList);
|
|
|
+ });
|
|
|
+ that.getHomeData();
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.error('逆地理编码失败:', err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // const qqmapsdk = new QQMapWX({
|
|
|
+ // key: 'SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7'
|
|
|
+ // //key: '7FJBZ-ACWCN-EFWFQ-SBXR5-QXC7K-LPF2U'
|
|
|
+ // });
|
|
|
+ // qqmapsdk.reverseGeocoder({
|
|
|
+ // location: {
|
|
|
+ // latitude: uni.getStorageSync('user_latitude'),
|
|
|
+ // longitude: uni.getStorageSync('user_longitude'),
|
|
|
+ // },
|
|
|
+ // success: (res2) => {
|
|
|
+ // const address = res2.result.address; // 完整地址(如北京市海淀区中关村)
|
|
|
+ // const province = res2.result.ad_info.province; // 省份
|
|
|
+ // const city = res2.result.ad_info.city; // 城市
|
|
|
+ // const recommend = res2.result.address_reference.landmark_l2.title;; // 推荐使用的地址描述,描述精确性较高
|
|
|
+ // console.log('地址信息1:', res2);
|
|
|
+ // that.userAddress = recommend;
|
|
|
+ // getMerchantList({
|
|
|
+ // latitude: uni.getStorageSync('user_latitude'),
|
|
|
+ // longitude: uni.getStorageSync('user_longitude'),
|
|
|
+ // }).then(res => {
|
|
|
+ // that.merchantList = res.data.list;
|
|
|
+ // console.log('商品信息:', that.merchantList);
|
|
|
+ // });
|
|
|
+ // that.getHomeData();
|
|
|
+ // },
|
|
|
+ // fail: (err) => {
|
|
|
+ // console.error('逆地理编码失败:', err);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
getHomeData() {
|
|
|
getHomeInfo().then(res => {
|