From 5e97621b182ac1ffcf15888685ea69e8878dc801 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 11 Aug 2023 10:43:55 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/cli/terminal.vue | 23 ++++++++---- .../components/common/bottomBox/bottomBox.vue | 6 +++- .../bottomBox/tabs/terminalLogMonitorTab.vue | 36 +++++++------------ .../bottomBox/tabs/terminalLogRecordTab.vue | 12 +++++-- .../src/components/common/js/tools.js | 1 - 5 files changed, 43 insertions(+), 35 deletions(-) diff --git a/nezha-fronted/src/components/cli/terminal.vue b/nezha-fronted/src/components/cli/terminal.vue index 911720836..5157ba1a9 100644 --- a/nezha-fronted/src/components/cli/terminal.vue +++ b/nezha-fronted/src/components/cli/terminal.vue @@ -53,40 +53,49 @@ -
{{$t('webshell.selAsset')}}
+
{{$t('terminal.personal')}}
-
{{$t('terminal.render')}}
- +
{{$t('terminal.render')}}
+ +
{{$t('terminal.waterMakerInfo')}}
- + + +
{{$t('terminal.scrollbackLinesInfo')}}
-
{{$t('terminal.mouse')}}
+
{{$t('terminal.mouse')}}
{{$t('project.topology.none')}} {{$t('terminal.menu')}} {{$t('terminal.paste')}} + - + + +
{{$t('terminal.wordSeparatorInfo')}}
-
{{$t('terminal.clipboard')}}
+
{{$t('terminal.clipboard')}}
+ + +
{{$t('terminal.copyTrimEndInfo')}}
diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index d80a3a41d..ccd66098f 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -28,7 +28,7 @@ - + @@ -409,6 +409,10 @@ export default { setTimeout(() => { this.$refs.reminalLogRecordTab.consoleResize() }, 600) + } else if (this.from === this.fromRoute.terminalLog && this.targetTab === 'monitorTab') { + setTimeout(() => { + this.$refs.reminalLogMonitorTab.consoleResize() + }, 600) } const subListDom = document.querySelector('.sub-list') // 副列表 const height = window.innerHeight > 900 ? 505 : 250 diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogMonitorTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogMonitorTab.vue index 06bf9fca3..00b178320 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogMonitorTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogMonitorTab.vue @@ -11,9 +11,9 @@ @@ -38,6 +38,7 @@ import Terminal from '../../js/Xterm' import { AttachAddon } from 'xterm-addon-attach' import { FitAddon } from 'xterm-addon-fit' +import { CanvasAddon } from 'xterm-addon-canvas' import bus from '../../../../libs/bus' // import dataListMixin from '@/components/common/mixin/dataList' import subDataListMixin from '@/components/common/mixin/subDataList' @@ -117,12 +118,17 @@ export default { this.termFitAddon.fit() } else { this.terminal = new Terminal({ - rows: parseInt(this.$refs.recordConsole.offsetHeight / 18), - cols: parseInt(this.$refs.recordConsole.offsetWidth / 11) + cursorStyle: 'block', // 光标样式 null | 'block' | 'underline' | 'bar' + overviewRulerWidth: 8, + lineHeight: 1.2, + fontSize: 16, + disableStdin: true// 是否应禁用输入 }) + this.terminal.loadAddon(new CanvasAddon()) this.termFitAddon = new FitAddon() this.terminal.loadAddon(this.termFitAddon) this.terminal.open(document.getElementById(this.obj.uuid)) + this.terminal && this.termFitAddon.fit() } if (this.recordData.length > 0) { diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 11be33b6d..8813150ff 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -1162,7 +1162,6 @@ function addWaterMarker (parentNode, text, font, textColor, width, height, textR cans.textBaseline = 'middle' cans.fillText(text, 200, 150) cans.fillText(text1, 200, 170) - console.log(show) if (show) { parentNode.style.backgroundImage = 'url(' + can.toDataURL('image/png') + ')' } else {