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
c98c546a
Commit
c98c546a
authored
Jun 29, 2020
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新用户大礼包
parent
0edee270
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
+35
-13
src/common/UserGift/index.js
+1
-1
src/components/Index/index.js
+16
-6
src/components/detail/index.js
+18
-6
No files found.
src/common/UserGift/index.js
View file @
c98c546a
...
...
@@ -19,7 +19,7 @@ class UserGift extends Component {
}
get_newerModal
=
()
=>
{
this
.
props
.
history
.
push
(
'/passport/login'
)
this
.
props
.
get_newerModal
(
)
}
close
=
()
=>
{
this
.
props
.
close
()
...
...
src/components/Index/index.js
View file @
c98c546a
...
...
@@ -63,20 +63,25 @@ class Index extends Component {
componentDidMount
()
{
this
.
getIndexData
()
this
.
showUserGiftFun
()
this
.
userStatus
()
}
componentWillMount
(){
this
.
showUserGiftFun
()
}
userStatus
=
()
=>
{
this
.
setState
({
isShowUserGift
:
false
})
http
.
get
(
`
${
API
[
'base-api'
]}
/sys/user/new_user_status`
).
then
((
res
)
=>
{
const
{
errno
,
data
}
=
res
.
data
if
(
errno
===
0
)
{
if
(
data
.
status
==
1
)
{
// 新用户登录之后判断是否是新用户
this
.
setState
({
isShowUserGift
:
false
})
Toast
.
info
(
'新人大礼包已领取成功!'
,
2
)
}
else
{
this
.
setState
({
isShowUserGift
:
false
})
}
}
})
...
...
@@ -103,6 +108,11 @@ class Index extends Component {
localStorage
.
setItem
(
'newer_last_time'
,
now_time
)
// 存储关闭时间
}
get_newerModal
=
()
=>
{
this
.
close
()
this
.
props
.
history
.
push
(
'/passport/login'
)
}
// 首页课程
getIndexData
=
()
=>
{
http
.
get
(
`
${
API
.
home
}
/m/home`
).
then
((
res
)
=>
{
...
...
@@ -247,7 +257,7 @@ class Index extends Component {
{
this
.
state
.
isShowUserGift
&&
<
UserGift
close
=
{
this
.
close
}
history
=
{
this
.
props
.
history
}
/
>
<
UserGift
close
=
{
this
.
close
}
get_newerModal
=
{
this
.
get_newerModal
}
/
>
}
<
/div
>
)
...
...
src/components/detail/index.js
View file @
c98c546a
...
...
@@ -59,8 +59,6 @@ class Detail extends Component {
componentDidMount
()
{
this
.
fetchCourseInfo
()
this
.
showUserGiftFun
()
this
.
userStatus
()
const
{
location
:
{
state
=
{}}}
=
this
.
props
if
(
state
.
oid
)
{
this
.
check
(
state
.
oid
)
...
...
@@ -84,18 +82,28 @@ class Detail extends Component {
if
(
getParam
(
'ac'
)
&&
Number
(
getParam
(
'ac'
))
===
11
)
{
this
.
getBorwerCourse
()
}
this
.
userStatus
()
}
componentWillMount
(){
this
.
showUserGiftFun
()
}
userStatus
=
()
=>
{
this
.
setState
({
isShowUserGift
:
false
})
http
.
get
(
`
${
API
[
'base-api'
]}
/sys/user/new_user_status`
).
then
((
res
)
=>
{
const
{
errno
,
data
}
=
res
.
data
if
(
errno
===
0
)
{
if
(
data
.
status
==
1
)
{
// 新用户登录之后判断是否是新用户
this
.
setState
({
isShowUserGift
:
false
})
Toast
.
info
(
'新人大礼包已领取成功!'
,
2
)
}
else
{
this
.
setState
({
isShowUserGift
:
false
})
}
}
})
...
...
@@ -121,6 +129,10 @@ class Detail extends Component {
let
now_time
=
(
new
Date
()).
valueOf
()
// 获取当前时间
localStorage
.
setItem
(
'newer_last_time'
,
now_time
)
// 存储关闭时间
}
get_newerModal
=
()
=>
{
this
.
close
()
this
.
props
.
history
.
push
(
'/passport/login'
)
}
getBorwerCourse
=
()
=>
{
http
.
get
(
`
${
API
.
home
}
/sys/user/blessing`
,
{
type
:
4
,
course_id
:
getParam
(
'id'
)}).
then
(
res
=>
{
...
...
@@ -867,7 +879,7 @@ class Detail extends Component {
{
this
.
state
.
isShowUserGift
&&
<
UserGift
close
=
{
this
.
close
}
history
=
{
this
.
props
.
history
}
/
>
<
UserGift
close
=
{
this
.
close
}
get_newerModal
=
{
this
.
get_newerModal
}
/
>
}
<
/div
>
)
...
...
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