ZZ 1 mesiac pred
rodič
commit
334fa40904
2 zmenil súbory, kde vykonal 34 pridanie a 62 odobranie
  1. 2 2
      mer_uniapp/api/home.js
  2. 32 60
      mer_uniapp/pages/index/index.vue

+ 2 - 2
mer_uniapp/api/home.js

@@ -14,6 +14,6 @@ export function getMerchantList(data)
  * 获取首页banner以及活动精选信息
  * 
  */
-export function getHomeInfo() {
-  return request.get("index/info", {},{ noAuth : true});
+export function getHomeInfo(data) {
+  return request.get("index/info", data,{ noAuth : true});
 }

+ 32 - 60
mer_uniapp/pages/index/index.vue

@@ -219,76 +219,48 @@
 			this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
 			// console.log("导航栏高度:"+this.globalData.navigationBarHeight)
 			// #endif
-			this.initLocation();   
+			this.initLocation();
 		},
 		methods: {
 			initLocation() {
 				let that = this;
 				this.$util.$L.getLocation().then(res => {
 					const qqmapsdk = new QQMapWX({
-						 key: '7FJBZ-ACWCN-EFWFQ-SBXR5-QXC7K-LPF2U'
+						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);
-					 	}
-					 });
+					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 => {
+				getHomeInfo({
+					latitude: uni.getStorageSync('user_latitude'),
+					longitude: uni.getStorageSync('user_longitude'),
+				}).then(res => {
 					this.bannerList = res.data.banner;
 					this.proList = res.data.proList;
 					console.log(this.proList)
@@ -302,7 +274,7 @@
 					})
 					// this.messageList = [{"id":2,"title":"绿草地活动大促,消费满三十减十五"},{"id":3,"title":"绿草地活动大促,消费满三十减十五33333"}];
 					console.log("this.messageList--", this.messageList)
-					this.startScroll();
+					// this.startScroll();
 				})
 
 			},