소스 검색

fix log miss

jihuaqiang 2 년 전
부모
커밋
3c3940a2af
2개의 변경된 파일14개의 추가작업 그리고 9개의 파일을 삭제
  1. 8 8
      components/MobileLandPage.vue
  2. 6 1
      pages/course/index.vue

+ 8 - 8
components/MobileLandPage.vue

@@ -218,14 +218,14 @@ export default {
 				delete logData.params.eventData.postId;
 				logData.params.eventData.nftProjectId = this.nftProjectId;
 			}
-			Report.reportLog(logData);
-			setTimeout(() => {
-				if (userInfo) {
-					location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;
-				} else {
-					this.twitterAuth();
-				}
-			}, 200);
+			if (userInfo) {
+				// ios手机跳转时丢失log,缓存至下个页面进行上报
+				setStorage('land-page-log', JSON.stringify(logData));
+				location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;
+			} else {
+				Report.reportLog(logData);
+				this.twitterAuth();
+			}
 		},
 		cancelLogin() {
 			location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;

+ 6 - 1
pages/course/index.vue

@@ -25,7 +25,7 @@
 import { PlayType, UsefulType } from '../../types';
 import axios from 'axios';
 import Report from '../../log-center/log';
-import { getQueryString, baseURL, appVersionCode, getMid } from '../../utils/help';
+import { getQueryString, baseURL, appVersionCode, getMid, getStorage, removeStorage } from '../../utils/help';
 
 export default {
 	name: 'course',
@@ -138,6 +138,11 @@ export default {
 	},
 	mounted() {
 		this.reportLog();
+		const landPageLog = getStorage('land-page-log');
+		if (landPageLog) {
+			Report.reportLog(JSON.parse(landPageLog));
+			removeStorage('land-page-log');
+		}
 	},
 };
 </script>