mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 01:11:07 +00:00
perf: 优化 view switch 切换,增加提示
This commit is contained in:
@@ -249,6 +249,7 @@
|
||||
"ReLogin": "Re-Login"
|
||||
},
|
||||
"common": {
|
||||
"ChangeViewHelpText": "Click to change view",
|
||||
"PrivateCloud": "Private cloud",
|
||||
"PublicCloud": "Public cloud",
|
||||
"Correlation": "Correlation",
|
||||
|
@@ -254,6 +254,7 @@
|
||||
"ReLogin": "再ログイン"
|
||||
},
|
||||
"common": {
|
||||
"ChangeViewHelpText": "クリックしてさまざまなビューにアクセス",
|
||||
"PrivateCloud": "プライベートクラウド",
|
||||
"PublicCloud": "パブリッククラウド",
|
||||
"Correlation": "関連",
|
||||
|
@@ -254,6 +254,7 @@
|
||||
"ReLogin": "重新登录"
|
||||
},
|
||||
"common": {
|
||||
"ChangeViewHelpText": "点击切换不同视图",
|
||||
"Component": "组件",
|
||||
"PrivateCloud": "私有云",
|
||||
"PublicCloud": "公有云",
|
||||
|
@@ -1,4 +1,12 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
v-model="iShowTip"
|
||||
:manual="true"
|
||||
:content="tipText"
|
||||
class="item"
|
||||
effect="dark"
|
||||
placement="right"
|
||||
>
|
||||
<el-menu
|
||||
:default-active="currentViewRoute.name"
|
||||
class="menu-main"
|
||||
@@ -26,6 +34,7 @@
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -46,6 +55,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tipText: this.$t('common.ChangeViewHelpText'),
|
||||
showTip: true
|
||||
}
|
||||
},
|
||||
@@ -72,6 +82,31 @@ export default {
|
||||
},
|
||||
currentView() {
|
||||
return this.viewsMapper[this.currentViewRoute.name]
|
||||
},
|
||||
tipHasRead: {
|
||||
set(val) {
|
||||
localStorage.setItem('viewSwitcherTip', val)
|
||||
},
|
||||
get() {
|
||||
return localStorage.getItem('viewSwitcherTip')
|
||||
}
|
||||
},
|
||||
iShowTip: {
|
||||
get() {
|
||||
if (this.mode !== 'horizontal') {
|
||||
return false
|
||||
}
|
||||
if (this.views.length < 2) {
|
||||
return false
|
||||
}
|
||||
if (this.tipHasRead) {
|
||||
return false
|
||||
}
|
||||
return this.showTip
|
||||
},
|
||||
set(val) {
|
||||
this.showTip = val
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -80,6 +115,10 @@ export default {
|
||||
localStorage.setItem('PreView', key)
|
||||
// Next 之前要重置 init 状态,否则这些路由守卫就不走了
|
||||
await store.dispatch('app/reset')
|
||||
if (!this.tipHasRead) {
|
||||
this.tipHasRead = '1'
|
||||
this.iShowTip = false
|
||||
}
|
||||
this.$router.push(routeName)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user