Merge branch 'dev-3.6' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.7

This commit is contained in:
zhangyu
2023-02-02 09:47:04 +08:00
2 changed files with 17 additions and 4 deletions

View File

@@ -177,10 +177,14 @@ export default {
this.getHistory()
}, 100),
logout () {
this.$get('logout').then(() => {
this.logoutSuccess()
window.open('', window.opener.name)
})
window.open('', window.opener.name)
const opener = window.opener
opener.postMessage(
JSON.stringify({
close: true,
isLogout: true
})
)
}
}
}

View File

@@ -1,3 +1,4 @@
import { post, get } from '@/http'
const terminalFile = {
state: {
fileList: [],
@@ -23,6 +24,7 @@ const terminalFile = {
},
setExternalTerminal (state, item) { // 第一次 关闭或者打开 termail
state.externalTerminal = !state.externalTerminal
let self = this
if (!state.messageFunction) {
state.messageFunction = true
window.addEventListener('message', function (e) {
@@ -31,6 +33,13 @@ const terminalFile = {
if (data.close) {
state.externalTerminal = false
}
if (data.isLogout) {
console.log(state, self)
get('logout').then(() => {
self.commit('logoutSuccess')
document.location.href = '/'
})
}
} catch (error) {}
})
window.addEventListener('unload', () => {