mirror of https://gitee.com/xiaonuobase/snowy
【更新】前端登录跳转至退出前的界面调整
parent
6afe3835b1
commit
ac84f7376a
|
@ -25,7 +25,7 @@ const routes = {
|
||||||
children: []
|
children: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 默认首页、用户中心
|
// 默认首页、个人中心
|
||||||
menu: [
|
menu: [
|
||||||
{
|
{
|
||||||
id: '001',
|
id: '001',
|
||||||
|
@ -42,11 +42,11 @@ const routes = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '002',
|
id: '002',
|
||||||
name: 'usercenter',
|
name: 'userCenter',
|
||||||
path: '/usercenter12',
|
path: '/userCenter',
|
||||||
component: 'userCenter/index',
|
component: 'sys/user/userCenter',
|
||||||
meta: {
|
meta: {
|
||||||
title: '用户中心',
|
title: '个人中心',
|
||||||
type: 'menu',
|
type: 'menu',
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,6 +25,20 @@ export const afterLogin = async (loginToken) => {
|
||||||
// 如果有缓存,将其登录跳转到最后访问的路由
|
// 如果有缓存,将其登录跳转到最后访问的路由
|
||||||
indexMenu = tool.data.get('LAST_VIEWS_PATH')
|
indexMenu = tool.data.get('LAST_VIEWS_PATH')
|
||||||
}
|
}
|
||||||
|
// 如果存在退出后换新账号登录,进行重新匹配,匹配无果则默认首页
|
||||||
|
if (menu) {
|
||||||
|
let routerTag = 0
|
||||||
|
menu.forEach((item) => {
|
||||||
|
if (item.children) {
|
||||||
|
if (JSON.stringify(item.children).indexOf(indexMenu) > -1) {
|
||||||
|
routerTag++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (routerTag === 0) {
|
||||||
|
indexMenu = menu[0].children[0].path
|
||||||
|
}
|
||||||
|
}
|
||||||
await router.replace({
|
await router.replace({
|
||||||
path: indexMenu
|
path: indexMenu
|
||||||
})
|
})
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
<CropUpload ref="cropUpload" :img-src="userInfo.avatar" @successful="cropUploadSuccess" />
|
<CropUpload ref="cropUpload" :img-src="userInfo.avatar" @successful="cropUploadSuccess" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup name="userCenter">
|
||||||
import { onMounted } from 'vue'
|
import { onMounted } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import tool from '@/utils/tool'
|
import tool from '@/utils/tool'
|
||||||
|
|
Loading…
Reference in New Issue