|
@@ -231,7 +231,7 @@ export default {
|
|
|
this.twitterAuth();
|
|
|
}
|
|
|
},
|
|
|
- cancelLogin() {
|
|
|
+ goCoursePage() {
|
|
|
location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}&nftProjectId=${this.nftProjectId}&srcContentId=${this.srcContentId}`;
|
|
|
},
|
|
|
async twitterAuth() {
|
|
@@ -245,6 +245,7 @@ export default {
|
|
|
if (code == 0) {
|
|
|
let url = getOauthUrl(data.authToken);
|
|
|
this.isLoading = true;
|
|
|
+ setStorage('goto-twitter-login-page', 1);
|
|
|
win.location.href = url;
|
|
|
this.timer.value = setInterval(() => {
|
|
|
if (win && win.closed) {
|
|
@@ -253,14 +254,14 @@ export default {
|
|
|
if (getStorage(storageKey.backFromTwitterLogin)) {
|
|
|
this.isLoading = false;
|
|
|
removeStorage(storageKey.backFromTwitterLogin);
|
|
|
- this.cancelLogin();
|
|
|
+ this.goCoursePage();
|
|
|
}
|
|
|
}
|
|
|
}, 500);
|
|
|
} else {
|
|
|
Toast('login fail');
|
|
|
win.close();
|
|
|
- this.cancelLogin();
|
|
|
+ this.goCoursePage();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -282,11 +283,29 @@ export default {
|
|
|
location.href = `/course?useful=${this.useFul ? '1' : '0'}&playType=${this.playType}&rewardType=${this.rewardType}&postId=${this.postId}`;
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ this.isLoading = false;
|
|
|
}
|
|
|
},
|
|
|
+ visibilityHandle() {
|
|
|
+ document.addEventListener('visibilitychange', function () {
|
|
|
+ var isHidden = document.hidden;
|
|
|
+ if (!isHidden) {
|
|
|
+ const isFromTwitterLoginPage = getStorage('goto-twitter-login-page');
|
|
|
+ if (isFromTwitterLoginPage) {
|
|
|
+ this.isLoading = false;
|
|
|
+ this.goCoursePage();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ document.addEventListener('visibilitychange', this.visibilityHandle);
|
|
|
},
|
|
|
unmounted() {
|
|
|
removeStorage(storageKey.backFromTwitterLogin);
|
|
|
+ document.removeEventListener('visibilitychange', this.visibilityHandle);
|
|
|
},
|
|
|
components: { FontZoom },
|
|
|
};
|