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