wcni %!s(int64=5) %!d(string=hai) anos
pai
achega
13bc027719
Modificáronse 1 ficheiros con 24 adicións e 9 borrados
  1. 24 9
      pages/index/index.vue

+ 24 - 9
pages/index/index.vue

@@ -79,7 +79,6 @@
 		 定位失败暂时获取不到周边酒店信息哦
 	 </view>
      </scroll-view>
-	 <!-- || !successlogion-->
 	 <unipopup :images="images"   v-if="enable == 1"  :show="ishow"/>
 	 <Gobacktop @getop="getop" v-if="isTop" />
 	</view>
@@ -147,8 +146,9 @@
 			]),
 		},
 		onShow() {
-			if(this.beginload) {
+			if(this.successlogion && this.hasLogin) {
 				this.getuserinfo();
+				this.firstget()
 			}
 		},
 		onHide() {
@@ -158,7 +158,6 @@
 		onLoad() {
 			if(this.beginload) {
 			this.getpicture(); // 开机广告
-			//this.gethotelist(); // 酒店列表
 			if(this.allow) {
 				
 			}else {
@@ -169,9 +168,12 @@
 			});  
 			this.isGetLocation();  // 检查是否开启定位权限
 			this.isUserInfo();  // 检查是否允许获取用户授权
-			 // 用户授全
 			this.getswiper();   // 获取首页轮播 
 		   }
+		   if(this.successlogion && this.hasLogin) {
+			   this.firstget();
+			   this.getuserinfo();
+		   }
 	    },
 		
 		watch: {
@@ -182,14 +184,28 @@
 				});  
 				this.isGetLocation();  // 检查是否开启定位权限
 				this.isUserInfo();  // 检查是否允许获取用户授权
-				this.getuserinfo();
 				this.getswiper();   // 获取首页轮播 
-			}
+			},
+			'hasLogin':function(val) {
+				if(val) {
+					this.firstget();
+					this.getuserinfo();
+				}
+			},
 		},
 		methods: {
 			...mapMutations(['login','showDialog']),
+			firstget() {
+				this.request({
+					url:'/v2/member/info',
+					method:'GET',
+					success: (res)=>{
+					  this.msg_count = res.data.data.msg_count;
+					}
+				})
+			},
 			getuserinfo() {
-			 let second = Math.round((Math.random()+1)*3);
+			 // let second = Math.round((Math.random()+1)*3);
 			 this.timer = setInterval(()=>{
 					this.request({
 						url:'/v2/member/info',
@@ -198,7 +214,7 @@
 						  this.msg_count = res.data.data.msg_count;
 						}
 					})
-				}, second*60000);
+				}, 180000);
 			},
 			refeshadress() {
 				this.isrefesh = false;
@@ -316,7 +332,6 @@
 			}); 
 			_this.amapPlugin.getRegeo({  
 				success: (data) => {
-					console.log(data);
 					this.isrefesh = true;
 					this.location = data[0].name;
 					this.lat = data[0].latitude; // 经度