Merge pull request 'role' (#102) from role into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/102
This commit is contained in:
clay
2024-04-29 02:04:03 +00:00
2 changed files with 19 additions and 1 deletions

View File

@@ -188,7 +188,8 @@ router.beforeEach(async (to, form, next) => {
next()
NProgress.done()
} else {
next({path: '/login'})
sessionStorage.setItem('toView', JSON.stringify(to))
next({path: '/cas/login'})
}
} else {
if (to.path === '/login'|| to.path === '/cas/login') {

View File

@@ -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', () => {