Ver código fonte

index bug ok

zizhong.wang 2 anos atrás
pai
commit
89226fb040
1 arquivos alterados com 37 adições e 7 exclusões
  1. 37 7
      pages/index/index.vue

+ 37 - 7
pages/index/index.vue

@@ -97,8 +97,8 @@
 	 <view class="noLogin-box" v-if="owner_id == 0">
 		 <view>{{!isAuth ? '未登录': '未关联'}}</view>
 		 <view>{{!isAuth ? '请先完成授权登录': '请先完成关联住房'}}</view>
-		 <view class="withHouseBtn" @click="goHouse" v-show="isAuth">关联住房</view>
-		 <button type='primary' class="withHouseBtn" v-show="!isAuth" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权登录</button>
+		 <view class="withHouseBtn" @click="goHouse" v-show="isAuth && isShow">关联住房</view>
+		 <button type='primary' class="withHouseBtn" v-show="!isAuth && isShow" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权登录</button>
 	 </view>
     </view>
    
@@ -151,11 +151,31 @@ export default {
 	  statusObj:getApp().globalData.statusObj,
 	  statusColor:getApp().globalData.statusColor,
 	  owner_id : 0,
+	  isShow : false,
     };
   },
   onShow() {
     uni.hideTabBar({});
-	this.getUserInfo();
+	
+	let that = this;
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 100);
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 500);
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 800);
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 1000);
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 1500);
+	setTimeout(function() {
+		 that.getUserInfo();
+	}, 2000);
  },
   onLoad() {
     // uni.showLoading({
@@ -163,7 +183,8 @@ export default {
     //   mask: true,
     // });
     //this.getSwiperList();
-	this.getUserInfo();
+	//this.getUserInfo();	
+	//this.getUserInfo();
   },
   onShareAppMessage() {
   //  url: "/pages/index/index";
@@ -175,6 +196,10 @@ export default {
   },
   methods: {
 	getUserInfo(){
+			if (this.isShow){
+				return;
+			}
+			let that = this;
 		  	let url = getApp().makeApiUrl("user",'user','info_by_openid');
 			uni.request({
 		  		url:url,
@@ -186,20 +211,24 @@ export default {
 		  			openId: getApp().globalData.open_id ? getApp().globalData.open_id : uni.getStorageSync('openId')
 		  		},
 				
+				
 		  		success: (res) => {
 		  			console.log(res)
 		  			if(res.data.code === 200){
+						
 						if (res.data.data.phone === ''){
 							//必须有手机号才算登录成功,系统才可用。
 	//						console.log("res.data.data.phone="+res.data.data.phone);
 							getApp().globalData.isAuth = false;
-							this.isAuth = false;
+							that.isAuth = false;
+							
 						}
 						else{
 							getApp().globalData.isAuth = true;
-							this.isAuth = true;
-							this.getHeatList();
+							that.isAuth = true;
+							that.getHeatList();
 						}
+						that.isShow = true;
 					//	uni.hideLoading() 
 		  			}
 		  		},
@@ -211,6 +240,7 @@ export default {
 	getPhoneNumber(e){
 		let res = getApp().getPhoneNumber(e);
 		if (res){
+			this.isShow = false;
 			this.goHouse();
 		}
 	},