huangxiaojing 2 년 전
부모
커밋
c19da06ebc
1개의 변경된 파일18개의 추가작업 그리고 7개의 파일을 삭제
  1. 18 7
      pages/welfare-community/list.vue

+ 18 - 7
pages/welfare-community/list.vue

@@ -95,13 +95,6 @@ export default {
       timer: null
     }
   },
-  fetch() {
-    this.token = this.$route.query.token;
-    this.id = this.$route.query.id;
-    this.user = this.$route.query.user;
-    this.gameName = this.$route.query.gameName;
-    this.getAppGameGiftActivityDetailsList();
-  },
   head: {
     title: '福利社区',
   },
@@ -112,7 +105,25 @@ export default {
       }
     }
   },
+  created() {
+    this.token = this.$route.query.token;
+    this.id = this.$route.query.id;
+    this.user = this.$route.query.user;
+    this.gameName = this.$route.query.gameName;
+    this.getAppGameGiftActivityDetailsList();
+  },
+  mounted() {
+    document.addEventListener('visibilitychange', this.handleVisiable)
+  },
+  destroyed() {
+    document.removeEventListener('visibilitychange', this.handleVisiable)
+  },
   methods: {
+    handleVisiable(e) {
+      if (e.target.visibilityState === 'visible') {
+        this.getAppGameGiftActivityDetailsList();
+      }
+    },
     closeShowAd() {
       this.showAd = false;
       clearInterval(this.timer);