From 8e36cf0540a398cc48ee96cdc4e294f57300a700 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 16 十二月 2025 15:02:38 +0800
Subject: [PATCH] 首页权限跳转多次登录页问题

---
 pages/tabbar/index/home.vue |  106 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 62 insertions(+), 44 deletions(-)

diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index fab411f..11528ac 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -403,63 +403,72 @@
 	onShow() {
 		getSessionId().then(res=>{
 			console.log('res',JSON.stringify(res))
-			this.pageSessionNo = res.data.data
-			if(this.pageSessionNo){
-			let	param = Object.assign({},this.actionParam);
-			this.actionParam.sessionId = this.pageSessionNo
-			param.sessionId = this.pageSessionNo
-				userAction(param)
-			}
+      if (res.code === 200){
+        this.pageSessionNo = res.data.data
+        if(this.pageSessionNo){
+          let	param = Object.assign({},this.actionParam);
+          this.actionParam.sessionId = this.pageSessionNo
+          param.sessionId = this.pageSessionNo
+          userAction(param)
+        }
+        this.getONPrizeActivity()
+        let showPopup = storage.getPopupShow();
+        console.log(showPopup)
+        if (showPopup) {
+          console.log("棣栨鎵撳紑锛屾樉绀哄脊绐�");
+          storage.setPopupShow(true); // 鏍囪涓哄凡鏄剧ず
+        } else {
+          console.log("宸叉樉绀鸿繃锛屼笉寮圭獥");
+        }
+        if(showPopup){
+          this.openActivityPopup()
+        }
+        if (!this.userId) {
+          this.getUserId()
+        }
+        // const token = storage.getAccessToken();
+        // if (! token) {
+        //  this.wxSilentLogin(() => {
+        //   this.loadVideos();
+        //  })
+        // } else {
+        // 	  this.loadVideos();
+        // }
+        if (this.videoList.length < 1) {
+          this.loading = false;
+          this.videoNoMore = false;
+          console.log('瑙﹀彂鏁版嵁鍔犺浇')
+          this.loadVideos();
+        }
+        // 濡傛灉瑙嗛鎸変笅鏆傚仠鍚庡垏鎹㈤〉闈㈠啀鍥炲埌椤甸潰鏃讹紝鍙畻鏆傚仠鏃堕棿锛堝洜涓烘殏鍋滄椂闂村拰绂诲紑椤甸潰鏃堕棿鏄噸澶嶇殑锛屽彧绠椾竴涓級
+        if (this.startHidenTime !== 0 && this.currentVideoIsPlaying) {
+          const duration = Date.now() - this.startHidenTime
+          this.totalHidenTime += duration
+        }
+
+
+      }
+
 		})
-    this.getONPrizeActivity()
-    let showPopup = storage.getPopupShow();
-    console.log(showPopup)
-    if (showPopup) {
-      console.log("棣栨鎵撳紑锛屾樉绀哄脊绐�");
-      storage.setPopupShow(true); // 鏍囪涓哄凡鏄剧ず
-    } else {
-      console.log("宸叉樉绀鸿繃锛屼笉寮圭獥");
-    }
-    if(showPopup){
-      this.openActivityPopup()
-    }
 
-
-
-		if (!this.userId) {
-			this.getUserId()
-		}
-		// const token = storage.getAccessToken();
-		// if (! token) {
-		//  this.wxSilentLogin(() => {
-		//   this.loadVideos();
-		//  })
-		// } else {
-		// 	  this.loadVideos();
-		// }
-		if (this.videoList.length < 1) {
-			this.loading = false;
-			this.videoNoMore = false;
-			console.log('瑙﹀彂鏁版嵁鍔犺浇')
-			this.loadVideos();
-		}
-		// 濡傛灉瑙嗛鎸変笅鏆傚仠鍚庡垏鎹㈤〉闈㈠啀鍥炲埌椤甸潰鏃讹紝鍙畻鏆傚仠鏃堕棿锛堝洜涓烘殏鍋滄椂闂村拰绂诲紑椤甸潰鏃堕棿鏄噸澶嶇殑锛屽彧绠椾竴涓級
-		if (this.startHidenTime !== 0 && this.currentVideoIsPlaying) {
-			const duration = Date.now() - this.startHidenTime
-			this.totalHidenTime += duration
-		}
 	},
   onUnload() {
     let	param = Object.assign({},this.actionParam);
     if (this.sendOnShow)return
     param.pageStatus = "LEAVE"
-    userAction(param)
+    // if (this.isNotEmpty(param.sessionId)){
+      console.log("绂诲紑椤甸潰寮�濮嬭褰�")
+      //TODO 椤甸潰鍒锋柊 瀵艰嚧onshow鏈墽琛岋紝瀵艰嚧sessionId鏈祴鍊�
+      userAction(param)
+    // }
+
   },
   onHide() {
     this.startHidenTime = Date.now()
     let	param = Object.assign({},this.actionParam);
     this.sendOnShow = true;
     param.pageStatus = "LEAVE"
+    console.log("鎵цonHide鐨剈serAction")
     userAction(param)
   },
 	onLoad(option) {
@@ -598,6 +607,15 @@
 		});
 	},
 	methods: {
+     isNotEmpty(value) {
+       if (value === null || value === undefined) {
+         return false;
+       }
+       if (typeof value === 'string') {
+         return value.trim() !== '';
+       }
+       return true;
+     },
     getONPrizeActivity(){
       getONPrizeActivity().then(res =>{
         if(res.statusCode=== 200){

--
Gitblit v1.8.0