zizhong.wang %!s(int64=2) %!d(string=hai) anos
pai
achega
0fb9bd28b7
Modificáronse 1 ficheiros con 20 adicións e 7 borrados
  1. 20 7
      pages/index/index.vue

+ 20 - 7
pages/index/index.vue

@@ -95,8 +95,8 @@
         </view>
       </view>
 	 <view class="noLogin-box" v-if="owner_id == 0">
-		 <view>{{!isAuth ? '未登录': '未关联'}}</view>
-		 <view>{{!isAuth ? '请先完成授权登录': '请先完成关联住房'}}</view>
+		 <view v-show="isShow">{{!isAuth ? '未登录': '未关联'}}</view>
+		 <view v-show="isShow">{{!isAuth ? '请先完成授权登录': '请先完成关联住房'}}</view>
 		 <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>
@@ -157,6 +157,8 @@ export default {
   onShow() {
     uni.hideTabBar({});
 	
+	this.reset();
+	
 	let that = this;
 	setTimeout(function() {
 		 that.getUserInfo();
@@ -176,6 +178,7 @@ export default {
 	setTimeout(function() {
 		 that.getUserInfo();
 	}, 2000);
+	
  },
   onLoad() {
     // uni.showLoading({
@@ -195,8 +198,15 @@ export default {
       }
   },
   methods: {
+	reset(){
+		this.isAuth = false;
+		this.owner_id  = 0;
+	    this.isShow  = false;
+		this.heatList =  [];
+	},
 	getUserInfo(){
-			if (this.isShow){
+			let openId = getApp().globalData.open_id ? getApp().globalData.open_id : uni.getStorageSync('openId');
+			if (this.isShow || openId === ''){
 				return;
 			}
 			let that = this;
@@ -208,7 +218,7 @@ export default {
 		  			'content-type': 'application/x-www-form-urlencoded'
 		  		},
 		  		data: {
-		  			openId: getApp().globalData.open_id ? getApp().globalData.open_id : uni.getStorageSync('openId')
+		  			openId: openId
 		  		},
 				
 				
@@ -226,6 +236,9 @@ export default {
 						else{
 							getApp().globalData.isAuth = true;
 							that.isAuth = true;
+							if (res.data.data.owner_id > 0){
+								that.owner_id = res.data.data.owner_id;
+							}
 							that.getHeatList();
 						}
 						that.isShow = true;
@@ -301,7 +314,7 @@ export default {
         // page_size: 2,
 		openId:getApp().globalData.open_id ? getApp().globalData.open_id : uni.getStorageSync('openId')
       };
-	  
+	  let that = this;
       uni.request({
         url: url,
         method: "POST",
@@ -312,8 +325,8 @@ export default {
         success: (res) => {
           console.log(res);
           if (res.data.code === 200) {
-            this.heatList = res.data.data.list;
-			this.owner_id = res.data.data.owner_id;
+            that.heatList = res.data.data.list;
+			that.owner_id = res.data.data.owner_id;
           }
         },
         fail: () => {