Browse Source

登录后从新加载就请求一次用户状态

master
liaoxinyu 2 years ago
parent
commit
b7c3a51759
  1. 10
      App.vue

10
App.vue

@ -29,9 +29,9 @@ export default {
}, },
sendHeartbeat() { sendHeartbeat() {
Home.online().then((response) => { Home.online().then((response) => {
console.log('心跳机制'); console.log('心跳机制');
}).catch((err) => {}); }).catch((err) => {});
}, },
startHeartbeat() { startHeartbeat() {
if (!this.heartbeatInterval && this.isLogin) { if (!this.heartbeatInterval && this.isLogin) {
@ -171,6 +171,10 @@ export default {
mounted() { mounted() {
// //
document.addEventListener('visibilitychange', this.handleVisibilityChange); document.addEventListener('visibilitychange', this.handleVisibilityChange);
//
if (this.isLogin){
this.sendHeartbeat()
}
// //
this.startHeartbeat(); this.startHeartbeat();
}, },

Loading…
Cancel
Save