Browse Source

1.首页 逻辑

guo 3 years ago
parent
commit
b81c8d70c3

+ 63 - 11
pages/homePage/homePage.vue

@@ -56,36 +56,26 @@
 				<view class="btnName">4S店养车</view>
 			</view>
 			
-			
-			
 			<view class="btnItem" @click="goNo">
 				<image src="../../static/img/homeBtn2.png" mode="" style="width: 80rpx; height: 80rpx;"></image>
 				<view class="btnName">绿色出行</view>
 			</view>
 			
-			
-			
 			<view class="btnItem" @click="goNo">
 				<image src="../../static/img/homeBtn3.png" mode="" style="width: 80rpx; height: 80rpx;"></image>
 				<view class="btnName">车身修复</view>
 			</view>
 			
-			
-			
 			<view class="btnItem" @click="goNo">
 				<image src="../../static/img/homeBtn4.png" mode="" style="width: 80rpx; height: 80rpx;"></image>
 				<view class="btnName">洗车用品</view>
 			</view>
 			
-			
-			
 			<view class="btnItem" @click="goNo">
 				<image src="../../static/img/homeBtn5.png" mode="" style="width: 80rpx; height: 80rpx;"></image>
 				<view class="btnName">二手车</view>
 			</view>
 			
-			
-			
 			<view class="btnItem" @click="goNo">
 				<image src="../../static/img/homeBtn6.png" mode="" style="width: 80rpx; height: 80rpx;"></image>
 				<view class="btnName">特价车</view>
@@ -96,7 +86,7 @@
 		<image src="../../static/img/banner_hongb@2x.png" mode="aspectFit" class="quanImg" @click="goquan"></image>
 		
 		<!-- 车主评价 -->
-		<view class="pingjia">
+		<view class="pingjia" v-if="itemData.length != 0">
 			<view class="pingjiaTitle">车主评价</view>
 			
 			<view class="itemContent">
@@ -252,6 +242,68 @@
 			
 				})
 			},
+			goLonIn(){
+				uni.navigateTo({
+					url:'../login/login'
+				}) 
+			},
+			getLocation() {
+			
+				const that = this
+				uni.getLocation({
+					type: 'gcj02',
+					success: function(res) {
+						console.log('定位', res)
+						that.locationCity.lng = res.longitude
+						that.locationCity.lat = res.latitude
+			
+						
+						that.getAdress();
+			
+					},
+					fail(err) {
+						console.log(err)
+			
+					}
+				});
+			},
+			getAdress() {
+				// 根据经纬度 逆城市地理编码 获取城市信息
+				var location = this.locationCity.lng + ',' + this.locationCity.lat
+				uni.request({
+					url: 'https://restapi.amap.com/v3/place/around',
+					data: {
+						key: '064b6a4a8ade55656edcde2f528876de',
+						location: location,
+						types: "190000",
+						extensions: "all",
+						radius: 100
+					},
+					dataType: "json",
+					success: (res) => {
+						console.log('定位城市', res);
+						let cityname = res.data.pois[0].cityname;
+						var cityCode = res.data.pois[0].adcode
+						cityCode = cityCode.slice(0, -2)
+						cityCode = cityCode + '00'
+						this.locationCity.cityName = cityname
+						this.locationCity.cityCode = cityCode
+			
+						uni.setStorage({
+							key: 'locationCity',
+							data: this.locationCity,
+							success: function() {
+								console.log('定位城市,保存成功');
+							}
+						})
+						
+						this.cityName = this.locationCity.cityName
+						this.cityCode = this.locationCity.cityCode
+						
+						
+					}
+				});
+			},
 			queryHomeDetail() {
 				uni.showLoading({
 					title: '加载中'

+ 3 - 3
pages/login/empower.vue

@@ -37,7 +37,7 @@
 
 			if (this.wxOpendata) {
 				uni.switchTab({
-					url: '../index/index'
+					url: '../homePage/homePage'
 				})
 			} else {
 				this.isload = true;
@@ -46,7 +46,7 @@
 		methods: {
 			goIndex() {
 				uni.switchTab({
-					url: '../index/index'
+					url: '../homePage/homePage'
 				})
 			},
 
@@ -117,7 +117,7 @@
 							uni.hideLoading();
 							if (!that.type) {
 								uni.switchTab({
-									url: '../index/index'
+									url: '../homePage/homePage'
 								})
 							} else {
 								uni.redirectTo({

+ 1 - 1
pages/login/iphoneLogin.vue

@@ -158,7 +158,7 @@
 							duration: 3000
 						});
 						uni.switchTab({
-							url: '../index/index'
+							url: '../homePage/homePage'
 						})
 					} else {
 						uni.showToast({

+ 1 - 1
pages/login/login.vue

@@ -107,7 +107,7 @@ export default {
 			 		     duration: 3000
 			 		 });
 			 		 uni.switchTab({
-			 			 url:'../index/index'
+			 			 url:'../homePage/homePage'
 			 		 }) 
 			 	}else{
 			 		uni.showToast({

+ 1 - 1
pages/order/orderDetail.vue

@@ -536,7 +536,7 @@
 			goback() {
 				if (this.type == 2) {
 					uni.switchTab({
-						url: '../index/index'
+						url: '../homePage/homePage'
 					})
 				} else {
 					uni.navigateBack({})

+ 1 - 1
static/js/share.js

@@ -4,7 +4,7 @@ export default{
                        //设置默认的分享参数
             share:{
                 title:'车蓝图',
-                path:'/pages/index/index',
+                path:'/pages/homePage/homePage',
                 imageUrl:'',
                 desc:'',
                 content:''