Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
campSite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨梦雪
campSite
Commits
021af906
Commit
021af906
authored
Nov 03, 2021
by
孟飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
ee7a5caa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
15 deletions
+27
-15
src/router/index.js
src/router/index.js
+27
-14
src/views/index/recruit/Index.vue
src/views/index/recruit/Index.vue
+0
-1
No files found.
src/router/index.js
View file @
021af906
...
...
@@ -9,7 +9,8 @@ import indexCamp from './index/camp'
import
{
getCam
}
from
"
r/index/login
"
;
import
{
Message
}
from
'
element-ui
'
;
Vue
.
prototype
.
$message
=
Message
;
Vue
.
use
(
VueRouter
)
...
...
@@ -76,9 +77,20 @@ router.onError((error) => {
})
function
checkCam
(
code
,
cb
)
{
if
(
!
code
){
Message
({
message
:
"
请访问正确的营地链接地址
"
,
type
:
'
waring
'
});
cb
&&
cb
(
false
);
return
false
;
}
getCam
(
code
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
!=
200
)
{
this
.
$store
.
$message
.
error
(
res
.
data
.
message
);
Message
({
message
:
"
请访问正确的营地链接地址
"
,
type
:
'
waring
'
});
cb
&&
cb
(
false
);
return
false
;
}
...
...
@@ -113,37 +125,38 @@ router.beforeEach((to, from, next) => {
toLogin
=
"
/login
"
,
toRegister
=
"
/register
"
,
toReset
=
"
/reset
"
// toRecruit = "/:code"
let
token
=
localStorage
.
getItem
(
tokenKey
);
let
nextUrl
=
false
;
let
code
=
false
;
document
.
title
=
to
.
meta
.
title
;
if
(
to
.
path
==
toLogin
||
to
.
path
==
toRegister
||
to
.
path
==
toReset
)
{
// nextUrl = false;
code
=
to
.
params
.
code
;
code
=
to
.
params
.
code
?
to
.
params
.
code
:
to
.
query
.
code
;
checkCam
(
code
,
(
res
)
=>
{
if
(
res
)
{
nextUrl
=
false
;
return
next
()
;
}
});
}
else
if
(
to
.
name
==
"
recruit
"
)
{
code
=
to
.
params
.
code
;
console
.
log
(
code
,
'
code
'
)
to
.
path
==
"
/:code
"
checkCam
(
code
,
(
res
)
=>
{
if
(
res
)
{
nextUrl
=
false
;
return
next
()
;
}
});
}
else
{
if
(
!
token
)
{
nextUrl
=
toLogin
;
return
next
(
toLogin
)
;
}
else
{
nextUrl
=
false
;
code
=
to
.
params
.
code
?
to
.
params
.
code
:
to
.
query
.
code
;
checkCam
(
code
,
(
res
)
=>
{
if
(
res
)
{
return
next
();
}
});
}
}
document
.
title
=
to
.
meta
.
title
;
return
nextUrl
?
next
(
nextUrl
)
:
next
();
// return nextUrl ? next(nextUrl) : next();
})
// 页面跳转之后页面回滚到顶部
...
...
src/views/index/recruit/Index.vue
View file @
021af906
...
...
@@ -78,7 +78,6 @@ export default {
if
(
res
.
data
.
code
!=
200
)
{
return
this
.
$message
.
error
(
res
.
data
.
message
);
}
this
.
$message
.
success
(
res
.
data
.
message
);
this
.
info
=
res
.
data
;
});
},
...
...
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