Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mining-manager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mining
mining-manager
Commits
126c485b
Commit
126c485b
authored
Apr 27, 2022
by
louyuqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d6737c02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
index.ts
src/router/index.ts
+3
-2
Login.vue
src/views/Login.vue
+2
-1
No files found.
src/router/index.ts
View file @
126c485b
...
@@ -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
{
...
...
src/views/Login.vue
View file @
126c485b
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment