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
49aa67e4
Commit
49aa67e4
authored
Oct 31, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
32bdb014
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
2 deletions
+61
-2
src/components/blessingPreheat/index.js
+61
-2
No files found.
src/components/blessingPreheat/index.js
View file @
49aa67e4
...
@@ -20,7 +20,11 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'
...
@@ -20,7 +20,11 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'
import
{
Toast
}
from
"antd-mobile"
import
{
Toast
}
from
"antd-mobile"
import
Live
from
'./live'
import
Live
from
'./live'
import
Banner
from
'./banner'
import
Banner
from
'./banner'
import
jsCookie
from
"js-cookie"
;
import
cookie
from
"js-cookie"
;
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
import
{
addDays
}
from
"date-fns"
;
import
{
compose
}
from
"redux"
;
import
{
connect
}
from
"react-redux"
;
...
@@ -31,6 +35,7 @@ class BlessingPreheat extends Component {
...
@@ -31,6 +35,7 @@ class BlessingPreheat extends Component {
this
.
navTop
=
183
this
.
navTop
=
183
this
.
prevY
=
0
this
.
prevY
=
0
this
.
state
=
{
this
.
state
=
{
userInfoList
:
[],
isRule
:
false
,
isRule
:
false
,
isCourse
:
false
,
isCourse
:
false
,
inviteUrl
:
''
,
inviteUrl
:
''
,
...
@@ -86,8 +91,56 @@ class BlessingPreheat extends Component {
...
@@ -86,8 +91,56 @@ class BlessingPreheat extends Component {
imgUrl
:
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png'
,
imgUrl
:
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png'
,
})
})
}
}
// 获取App登录信息
window
[
'loginInfo'
]
=
result
=>
{
this
.
loginInfo
(
result
)
}
}
// 获取app登录数据
loginInfo
=
(
result
)
=>
{
this
.
setState
({
userInfoList
:
result
})
if
(
this
.
state
.
userInfoList
.
length
!==
0
)
{
this
.
props
.
startFetchUser
()
this
.
appLogin
()
}
}
// 保存cookie
appLogin
=
()
=>
{
let
expires
=
addDays
(
new
Date
(),
90
)
this
.
state
.
userInfoList
.
map
((
item
,
index
)
=>
{
Toast
.
info
(
item
.
version
,
3
)
cookie
.
set
(
"token"
,
item
.
token
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
cookie
.
set
(
"plat"
,
item
.
plat
,
{
expires
,
path
:
'/'
,
domain
:
'julyedu.com'
});
cookie
.
set
(
"uid"
,
item
.
uid
,
{
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'
});
});
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
}
}
getActiveIndex
=
(
arr
,
n
)
=>
{
getActiveIndex
=
(
arr
,
n
)
=>
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
if
(
arr
[
i
]
>
n
)
{
if
(
arr
[
i
]
>
n
)
{
...
@@ -467,4 +520,9 @@ class BlessingPreheat extends Component {
...
@@ -467,4 +520,9 @@ class BlessingPreheat extends Component {
}
}
}
}
export
default
BlessingPreheat
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
{
setCurrentUser
,
startFetchUser
}
)
)(
BlessingPreheat
)
\ 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