Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
wanda-ball
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4ac1d7f3
authored
May 20, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
c6504b13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
src/modules/store/index.js
+15
-5
src/pages/index/App.vue
+9
-5
No files found.
src/modules/store/index.js
View file @
4ac1d7f3
...
...
@@ -59,12 +59,17 @@ export default new Vuex.Store({
},
getUserInfo
(
state
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
'/contest/user/info'
).
then
(
res
=>
{
axios
.
get
(
'/contest/user/info'
,
{
headers
:
{
'accessToken'
:
window
.
localStorage
.
getItem
(
'token'
)
}
}).
then
(
res
=>
{
state
.
userInfo
=
res
.
data
.
data
localStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
res
.
data
.
data
))
alert
(
'获取用户信息成功'
)
resolve
(
res
)
}).
catch
(
e
=>
{
alert
(
'获取用户信息失败'
)
reject
(
e
)
})
})
...
...
@@ -79,11 +84,16 @@ export default new Vuex.Store({
})
})
},
getToken
({
commit
,
state
}){
getToken
({
commit
,
state
}
,
code
){
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
'weixin/callback'
).
then
(
res
=>
{
window
.
localStorage
.
setItem
(
'callbackurl'
,
location
.
href
)
location
.
href
=
res
.
data
.
data
.
url
+
'/video/2.html'
axios
.
get
(
'weixin/callback'
,
{
params
:
{
code
}
}).
then
(
res
=>
{
window
.
localStorage
.
setItem
(
'token'
,
res
.
data
.
data
.
accessToken
)
// location.href = res.data.data.url + '/video/2.html'
commit
(
'getUserInfo'
)
})
})
}
...
...
src/pages/index/App.vue
View file @
4ac1d7f3
...
...
@@ -42,15 +42,19 @@ export default {
},
created
()
{
this
.
hiddenBar
();
if
(
localStorage
.
getItem
(
'token'
))
{
}
else
{
store
.
dispatch
(
'getAuth'
)
}
// 请求入围信息,提前加载入围的信息防止入围公告闪烁
store
.
commit
(
'getRuweiInfo'
);
},
mounted
()
{
if
(
localStorage
.
getItem
(
'token'
))
{
store
.
commit
(
'getUserInfo'
)
}
else
{
store
.
dispatch
(
'getAuth'
).
then
()
}
if
(
this
.
$route
.
query
.
code
)
{
store
.
dispatch
(
'getToken'
,
this
.
$route
.
query
.
code
).
then
()
}
var
tar_userinfo
=
localStorage
.
getItem
(
'tar_userinfo'
);
console
.
log
(
tar
)
if
(
tar_userinfo
)
{
...
...
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