【修改】首页权限不存在,则tab不显示首页信息

【修改】退出登录不通过路由
This commit is contained in:
zer0Black
2022-04-17 19:18:19 +08:00
parent 80f0921d60
commit 2ebb7bd20a
3 changed files with 5 additions and 44 deletions
+3 -39
View File
@@ -14,7 +14,7 @@
@change="changePage"
@tabClick="tabCallBack"
@edit="editPage">
<a-tab-pane :id="page.fullPath" :key="page.fullPath" v-for="page in pageList" :closable="!(page.meta.title=='首页')">
<a-tab-pane :id="page.fullPath" :key="page.fullPath" v-for="page in pageList">
<span slot="tab" :pagekey="page.fullPath">{{ page.meta.title }}</span>
</a-tab-pane>
</a-tabs>
@@ -39,7 +39,7 @@ import { triggerWindowResizeEvent } from '@/utils/util'
import Vue from 'vue'
import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types'
const indexKey = '/dashboard/analysis'
const indexKey = '/'
export default {
name: 'TabLayout',
@@ -81,9 +81,6 @@ const indexKey = '/dashboard/analysis'
}
},
created() {
if (this.$route.path != indexKey) {
this.addIndexToFirst()
}
// 复制一个route对象出来,不能影响原route
let currentRoute = Object.assign({}, this.$route)
currentRoute.meta = Object.assign({}, currentRoute.meta)
@@ -138,31 +135,8 @@ const indexKey = '/dashboard/analysis'
}
}
},
// update-begin-author:sunjianlei date:20191223 for: 修复从单页模式切换回多页模式后首页不居第一位的 BUG
device() {
if (this.multipage && this.linkList.indexOf(indexKey) === -1) {
this.addIndexToFirst()
}
},
// update-end-author:sunjianlei date:20191223 for: 修复从单页模式切换回多页模式后首页不居第一位的 BUG
},
methods: {
// update-begin-author:sunjianlei date:20191223 for: 修复从单页模式切换回多页模式后首页不居第一位的 BUG
// 将首页添加到第一位
addIndexToFirst() {
this.pageList.splice(0, 0, {
name: 'dashboard-analysis',
path: indexKey,
fullPath: indexKey,
meta: {
icon: 'dashboard',
title: '首页'
}
})
this.linkList.splice(0, 0, indexKey)
},
// update-end-author:sunjianlei date:20191223 for: 修复从单页模式切换回多页模式后首页不居第一位的 BUG
// update-begin-author:sunjianlei date:20200120 for: 动态更改页面标题
changeTitle(title) {
let projectTitle = "Jero-Boot 企业级快速开发平台"
@@ -192,10 +166,6 @@ const indexKey = '/dashboard/analysis'
this[action](key)
},
remove(key) {
if (key == indexKey) {
this.$message.warning('首页不能关闭!')
return
}
if (this.pageList.length === 1) {
this.$message.warning('这是最后一页,不能再关闭了啦')
return
@@ -264,17 +234,14 @@ const indexKey = '/dashboard/analysis'
},
/* update_end author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */
closeOthers(pageKey) {
let index = this.linkList.indexOf(pageKey)
let index = this.linkList.indexOf(pageKey)
if (pageKey == indexKey || pageKey.indexOf('?ticke=')>=0) {
this.linkList = this.linkList.slice(index, index + 1)
this.pageList = this.pageList.slice(index, index + 1)
this.activePage = this.linkList[0]
} else {
let indexContent = this.pageList.slice(0, 1)[0]
this.linkList = this.linkList.slice(index, index + 1)
this.pageList = this.pageList.slice(index, index + 1)
this.linkList.unshift(indexContent.fullPath)
this.pageList.unshift(indexContent)
this.activePage = this.linkList[1]
}
},
@@ -283,12 +250,9 @@ const indexKey = '/dashboard/analysis'
return
}
let tempList = [...this.pageList]
let indexContent = tempList.slice(0, 1)[0]
let index = this.linkList.indexOf(pageKey)
this.linkList = this.linkList.slice(index)
this.pageList = this.pageList.slice(index)
this.linkList.unshift(indexContent.fullPath)
this.pageList.unshift(indexContent)
if (this.linkList.indexOf(this.activePage) < 0) {
this.activePage = this.linkList[0]
}
+1 -4
View File
@@ -183,10 +183,7 @@
content: '真的要注销登录吗 ?',
onOk() {
return that.Logout({}).then(() => {
// update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面
that.$router.push({ path: '/user/login' });
window.location.reload()
// update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面
window.location.replace("/user/login")
}).catch(err => {
that.$message.error({
title: '错误',
+1 -1
View File
@@ -332,7 +332,7 @@
})
},
loginSuccess () {
this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
this.$router.push({ path: "/" }).catch((res)=>{})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`,