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