Commit 126c485b authored by louyuqi's avatar louyuqi

update

parent d6737c02
...@@ -2,13 +2,14 @@ import {createRouter, createWebHistory, RouterOptions} from 'vue-router' ...@@ -2,13 +2,14 @@ import {createRouter, createWebHistory, RouterOptions} from 'vue-router'
import {routes} from "../config/menu"; import {routes} from "../config/menu";
import {getStore} from "../utils/userinfo"; import {getStore} from "../utils/userinfo";
// @ts-ignore // @ts-ignore
const userInfo = getStore('mining-manager')
const router=createRouter(<RouterOptions>{ const router=createRouter(<RouterOptions>{
history: createWebHistory(), history: createWebHistory(),
routes, routes,
}) })
router.beforeEach((to,from,next)=>{ router.beforeEach((to,from,next)=>{
// console.log(to,from,'???') const userInfo = getStore('mining-manager')
console.log(to,from,'???',userInfo)
if(to.path!=='/login'&&!userInfo?.token){ if(to.path!=='/login'&&!userInfo?.token){
next({path:'/login'}) next({path:'/login'})
}else{ }else{
......
...@@ -22,11 +22,12 @@ const login = async () => { ...@@ -22,11 +22,12 @@ const login = async () => {
token: getToken, token: getToken,
expire: '1d' expire: '1d'
}) })
router.push('/user')
ElMessage({ ElMessage({
message: "用户登陆成功", message: "用户登陆成功",
type: "success" type: "success"
}) })
router.push('/user')
console.log('?') console.log('?')
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment