From b5c0fccdf6d85d731521b841e03c9bff90b4f312 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 10 Jan 2023 17:53:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9terminal=20login?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=20=E5=86=8D=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/assets/css/common/loading.scss | 43 ++++++ .../src/components/cli/consoleNew.vue | 44 +----- .../src/components/cli/webSSHNew.vue | 129 ++++++++++++++---- .../common/globalSearch/globalSearch.vue | 2 +- .../components/page/config/system/license.vue | 4 + 5 files changed, 157 insertions(+), 65 deletions(-) diff --git a/nezha-fronted/src/assets/css/common/loading.scss b/nezha-fronted/src/assets/css/common/loading.scss index cec4152d9..20460c3b6 100644 --- a/nezha-fronted/src/assets/css/common/loading.scss +++ b/nezha-fronted/src/assets/css/common/loading.scss @@ -259,3 +259,46 @@ loading-hide{ } } /** END of circle3 */ +/**===== circle3 =====*/ +.circleMin { + display: block; + position: absolute; + top: 50%; + left: 50%; + height: 50px; + width: 50px; + margin: -25px 0 0 -25px; + border: 4px rgba(0, 0, 0, 0.25) solid; + border-top: 4px black solid; + border-right: 4px black solid; + border-bottom: 4px black solid; + border-radius: 50%; + -webkit-animation: spinMin 1s infinite linear; + animation: spinMin 1s infinite linear; +} + +@-webkit-keyframes spinMin { + from { + -webkit-transform: rotate(0deg) scale(0.4); + transform: rotate(0deg) scale(0.4); + } + to { + -webkit-transform: rotate(359deg) scale(0.4); + transform: rotate(359deg) scale(0.4); + } +} +@keyframes spinMin { + from { + -webkit-transform: rotate(0deg) scale(0.4); + transform: rotate(0deg) scale(0.4); + -webkit-transform: rotate(0deg) scale(0.4); + transform: rotate(0deg) scale(0.4); + } + to { + -webkit-transform: rotate(359deg) scale(0.4); + transform: rotate(359deg) scale(0.4); + -webkit-transform: rotate(359deg) scale(0.4); + transform: rotate(359deg) scale(0.4); + } +} +/** END of circle3 */ diff --git a/nezha-fronted/src/components/cli/consoleNew.vue b/nezha-fronted/src/components/cli/consoleNew.vue index 78ae2a6de..bf1dfa1c0 100644 --- a/nezha-fronted/src/components/cli/consoleNew.vue +++ b/nezha-fronted/src/components/cli/consoleNew.vue @@ -107,42 +107,7 @@ export default { }) this.term.open(terminalContainer) this.term.focus() - const params = { - width: this.terminal.width, - height: this.terminal.height, - cols: this.terminal.cols, - rows: this.terminal.rows, - host: this.$loadsh.get(this.terminal, 'custom.host', ''), - port: this.$loadsh.get(this.terminal, 'custom.port', ''), - assetId: this.$loadsh.get(this.terminal, 'assetId', ''), - accountId: this.$loadsh.get(this.terminal, 'accountId', ''), - authProtocol: this.$loadsh.get(this.terminal, 'custom.authProtocol', ''), - authProtocolPort: this.$loadsh.get(this.terminal, 'custom.authProtocolPort', ''), - authType: this.$loadsh.get(this.terminal, 'custom.authType', ''), - authUsername: this.$loadsh.get(this.terminal, 'custom.authUsername', ''), - authPin: this.$loadsh.get(this.terminal, 'custom.authPin', ''), - authPriKey: this.$loadsh.get(this.terminal, 'custom.authPriKey', ''), - authUserTip: this.$loadsh.get(this.terminal, 'custom.authUserTip', ''), - authPinTip: this.$loadsh.get(this.terminal, 'custom.authPinTip', '') - } - this.$post('/terminal/login', params).then(res => { - if (res.code == 200) { - this.terminal.uuid = res.data.uuid - this.$forceUpdate() - this.terminal.userName = res.data.authUsername + '@' + res.data.host - this.host = res.data.host - this.create() - } else { - if (res.data) { - this.terminal.uuid = res.data.uuid - this.terminal.userName = res.data.authUsername + '@' + res.data.host - this.host = res.data.host - } - params.name = this.terminal.name - this.$emit('loginFail', params) - this.$message.error(res.msg) - } - }) + this.create() }, create () { const that = this @@ -172,6 +137,7 @@ export default { this.terminalSocket.onopen = () => { this.terminal.isLogin = true this.isInit = true + this.term.focus() } // 登录后,你输入的内容从后台服务返回 this.term.on('data', function (data) { @@ -288,9 +254,9 @@ export default { reconnect () { this.terminal.isLogin = false this.closeSocket() - this.term.off('selection') - this.term.off('data') - this.beforeCreate() + setTimeout(()=>{ + this.beforeCreate() + },100) }, closeFileDir () { this.showFileDir(false) diff --git a/nezha-fronted/src/components/cli/webSSHNew.vue b/nezha-fronted/src/components/cli/webSSHNew.vue index ba841e95c..aa95a10c6 100644 --- a/nezha-fronted/src/components/cli/webSSHNew.vue +++ b/nezha-fronted/src/components/cli/webSSHNew.vue @@ -88,7 +88,7 @@ - +
{{$t('webshell.selAsset')}}