实时控制台页面优化

This commit is contained in:
zhengjie
2019-06-03 10:34:22 +08:00
parent 30285d739c
commit 0a5db88f71

View File

@@ -1,5 +1,5 @@
<template> <template>
<div :style="'min-width:' + width" class="container"> <div class="container">
<el-tooltip :content="content" class="lock item" effect="dark" placement="left"> <el-tooltip :content="content" class="lock item" effect="dark" placement="left">
<el-button type="info" size="mini" circle @click="doLock"><svg-icon :icon-class="ico"/></el-button> <el-button type="info" size="mini" circle @click="doLock"><svg-icon :icon-class="ico"/></el-button>
</el-tooltip> </el-tooltip>
@@ -28,8 +28,7 @@ export default {
data() { data() {
return { return {
ico: 'unlock', unlock: true, content: '锁定滚动条', ico: 'unlock', unlock: true, content: '锁定滚动条',
height: document.documentElement.clientHeight - 140 + 'px;', height: '0px',
width: document.documentElement.clientWidth - 210 + 'px;',
data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output' }], data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output' }],
// level // level
INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000' INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000'
@@ -38,7 +37,10 @@ export default {
computed: { computed: {
...mapGetters([ ...mapGetters([
'socketApi' 'socketApi'
]) ]),
tagsView() {
return this.$store.state.settings.tagsView
}
}, },
// 监听控制滚动条 // 监听控制滚动条
watch: { watch: {
@@ -51,13 +53,19 @@ export default {
} }
}) })
} }
},
tagsView(newVal, oldVal) {
this.height = this.tagsView ? document.documentElement.clientHeight - 95 + 'px;' : document.documentElement.clientHeight - 65 + 'px;'
} }
}, },
created() {
this.height = this.tagsView ? document.documentElement.clientHeight - 95 + 'px;' : document.documentElement.clientHeight - 65 + 'px;'
},
mounted: function() { mounted: function() {
this.initWebSocket() this.initWebSocket()
const that = this const that = this
window.onresize = function temp() { window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 94.5 + 'px;' that.height = that.tagsView ? document.documentElement.clientHeight - 95 + 'px;' : document.documentElement.clientHeight - 65 + 'px;'
} }
}, },
beforeDestroy: function() { beforeDestroy: function() {
@@ -129,8 +137,7 @@ export default {
} }
.container { .container {
width: 100%; margin: 2px
margin: 5px
} }
.container .console { .container .console {