feat: 新增登录重定向之前被拦截的页面
This commit is contained in:
@@ -188,6 +188,7 @@ router.beforeEach(async (to, form, next) => {
|
||||
next()
|
||||
NProgress.done()
|
||||
} else {
|
||||
sessionStorage.setItem('toView', JSON.stringify(to))
|
||||
next({path: '/login'})
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
import * as echarts from 'echarts'
|
||||
import homeImage from "@/assets/home/home.png"
|
||||
import coffee from "@/assets/home/coffee.png"
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const router = useRouter()
|
||||
const list=ref([
|
||||
{
|
||||
title: '在线用户量',
|
||||
@@ -172,8 +175,22 @@ const init = () => {
|
||||
data.pieCharts = echarts.init(document.getElementById('pie3')).setOption(pieOption)
|
||||
}
|
||||
|
||||
const redirectView = () => {
|
||||
const toView = sessionStorage.getItem('toView')
|
||||
console.log(toView, 'toView');
|
||||
toView ?
|
||||
router.push({
|
||||
path: JSON.parse(toView).path,
|
||||
query: {
|
||||
...JSON.parse(toView).query
|
||||
}
|
||||
}) :
|
||||
null
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
redirectView()
|
||||
})
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
|
||||
Reference in New Issue
Block a user