Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
baiguangyao
mr-julyedu
Commits
f14bff4f
Commit
f14bff4f
authored
Oct 31, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app登录信息
parent
ea0d8952
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
src/components/blessingPreheat/toAppDemo.js
+34
-2
No files found.
src/components/blessingPreheat/toAppDemo.js
View file @
f14bff4f
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
{
SendMessageToApp
}
from
'@/utils'
import
{
SendMessageToApp
}
from
'@/utils'
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
import
{
Button
,
Toast
,
WhiteSpace
}
from
'antd-mobile'
import
{
Button
,
Toast
,
WhiteSpace
}
from
'antd-mobile'
import
cookie
from
'js-cookie'
import
cookie
from
'js-cookie'
import
{
addDays
}
from
"date-fns"
import
{
addDays
}
from
"date-fns"
import
{
compose
}
from
"redux"
;
import
{
connect
}
from
"react-redux"
;
class
ToAppDemo
extends
Component
{
class
ToAppDemo
extends
Component
{
state
=
{
state
=
{
userInfoList
:
[],
userInfoList
:
[
],
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -29,6 +33,7 @@ class ToAppDemo extends Component {
...
@@ -29,6 +33,7 @@ class ToAppDemo extends Component {
userInfoList
:
result
userInfoList
:
result
})
})
if
(
this
.
state
.
userInfoList
.
length
!==
0
)
{
if
(
this
.
state
.
userInfoList
.
length
!==
0
)
{
this
.
props
.
startFetchUser
()
this
.
appLogin
()
this
.
appLogin
()
}
}
}
}
...
@@ -43,6 +48,26 @@ class ToAppDemo extends Component {
...
@@ -43,6 +48,26 @@ class ToAppDemo extends Component {
cookie
.
set
(
"uname"
,
item
.
uname
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
cookie
.
set
(
"uname"
,
item
.
uname
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
cookie
.
set
(
"avatar_file"
,
item
.
avatar_file
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
cookie
.
set
(
"avatar_file"
,
item
.
avatar_file
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
});
});
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
this
.
state
.
userInfoList
))
}
transformUser
=
res
=>
{
let
payload
res
.
map
((
item
,
index
)
=>
{
payload
=
{
hasError
:
false
,
data
:
{
username
:
item
.
uname
,
avatar
:
item
.
avatar_file
,
token
:
item
.
token
,
uid
:
item
.
uid
},
isFetching
:
false
}
})
return
payload
}
}
...
@@ -132,4 +157,10 @@ class ToAppDemo extends Component {
...
@@ -132,4 +157,10 @@ class ToAppDemo extends Component {
}
}
}
}
export
default
ToAppDemo
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
{
setCurrentUser
,
startFetchUser
}
)
)(
ToAppDemo
)
\ No newline at end of file
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