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
69ac4857
Commit
69ac4857
authored
Jun 29, 2020
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新用户大礼包
parent
8b94577e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
1 deletions
+122
-1
src/common/UserGift/index.js
+44
-0
src/common/UserGift/index.scss
+25
-0
src/common/index.js
+1
-0
src/components/Index/index.js
+0
-0
src/components/detail/index.js
+52
-1
No files found.
src/common/UserGift/index.js
0 → 100755
View file @
69ac4857
import
React
,
{
Component
}
from
'react'
import
'./index.scss'
import
{
http
}
from
'@/utils'
class
UserGift
extends
Component
{
state
=
{
user_gift
:
''
}
componentDidMount
()
{
http
.
get
(
`
${
API
[
'base-api'
]}
/web/home/popup`
).
then
((
res
)
=>
{
const
{
errno
,
data
}
=
res
.
data
if
(
errno
===
200
)
{
this
.
setState
({
user_gift
:
data
.
new_user_gift
.
prize_img
})
}
})
}
get_newerModal
=
()
=>
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
close
=
()
=>
{
this
.
props
.
close
()
}
render
()
{
const
{
user_gift
}
=
this
.
state
return
(
<
div
className
=
{
'user-gift-popup'
}
>
<
div
className
=
{
'user-gift-bgimg'
}
>
<
img
onClick
=
{
this
.
get_newerModal
}
src
=
{
user_gift
}
alt
=
""
/>
<
img
className
=
{
'close_gift_box'
}
src
=
"https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/tinypng-common/close_icon.png"
onClick
=
{
this
.
close
}
alt
=
""
/>
<
/div
>
<
/div
>
)
}
}
export
default
UserGift
\ No newline at end of file
src/common/UserGift/index.scss
0 → 100755
View file @
69ac4857
.user-gift-popup
{
background
:
rgba
(
0
,
0
,
0
,
.3
);
position
:
fixed
;
left
:
0
;
top
:
0
;
right
:
0
;
bottom
:
0
;
z-index
:
100
;
.user-gift-bgimg
{
position
:
relative
;
top
:
50%
;
margin-top
:
-200px
;
.close_gift_box
{
position
:
absolute
;
left
:
50%
;
margin-left
:
-13px
;
width
:
26px
;
height
:
26px
;
bottom
:
-45px
;
}
}
}
\ No newline at end of file
src/common/index.js
View file @
69ac4857
...
@@ -11,5 +11,6 @@ export { default as Loading } from './Loading'
...
@@ -11,5 +11,6 @@ export { default as Loading } from './Loading'
export
{
default
as
RenderTabBar
}
from
'./renderTabBar'
export
{
default
as
RenderTabBar
}
from
'./renderTabBar'
export
{
default
as
Popup
}
from
'./closable-popup'
export
{
default
as
Popup
}
from
'./closable-popup'
export
{
default
as
WxLogin
}
from
'./WxLogin'
export
{
default
as
WxLogin
}
from
'./WxLogin'
export
{
default
as
UserGift
}
from
'./UserGift'
src/components/Index/index.js
View file @
69ac4857
This diff is collapsed.
Click to expand it.
src/components/detail/index.js
View file @
69ac4857
...
@@ -20,6 +20,7 @@ import { delCountryNum } from './../country/countryRedux';
...
@@ -20,6 +20,7 @@ import { delCountryNum } from './../country/countryRedux';
import
{
Popup
}
from
"@common/index"
import
{
Popup
}
from
"@common/index"
import
RedPacket
from
'./redPacket'
;
import
RedPacket
from
'./redPacket'
;
import
ExpandActiveToast
from
"../Index/expandActiveToast"
;
import
ExpandActiveToast
from
"../Index/expandActiveToast"
;
import
{
UserGift
}
from
"@common"
class
Detail
extends
Component
{
class
Detail
extends
Component
{
...
@@ -50,12 +51,16 @@ class Detail extends Component {
...
@@ -50,12 +51,16 @@ class Detail extends Component {
isRedPacket
:
true
,
isRedPacket
:
true
,
countDownTime
:
'20s'
,
countDownTime
:
'20s'
,
isShowChannel
:
window
.
sessionStorage
.
getItem
(
'isShowSiteWindowByChannel'
)
isShowChannel
:
window
.
sessionStorage
.
getItem
(
'isShowSiteWindowByChannel'
),
isShowUserGift
:
false
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
fetchCourseInfo
();
this
.
fetchCourseInfo
();
this
.
showUserGiftFun
();
this
.
userStatus
();
const
{
location
:
{
state
=
{}}}
=
this
.
props
;
const
{
location
:
{
state
=
{}}}
=
this
.
props
;
if
(
state
.
oid
)
{
if
(
state
.
oid
)
{
this
.
check
(
state
.
oid
);
this
.
check
(
state
.
oid
);
...
@@ -81,6 +86,47 @@ class Detail extends Component {
...
@@ -81,6 +86,47 @@ class Detail extends Component {
}
}
}
}
userStatus
=
()
=>
{
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
:
true
})
}
else
{
// 老用户
this
.
setState
({
isShowUserGift
:
false
})
}
}
})
}
showUserGiftFun
=
()
=>
{
let
newer_last_time
=
localStorage
.
getItem
(
'newer_last_time'
)
// 获取用户关闭大礼包的时间
let
now_time
=
(
new
Date
()).
valueOf
()
console
.
log
(
newer_last_time
)
if
(
!
newer_last_time
||
now_time
-
newer_last_time
>
86400000
)
{
this
.
setState
({
isShowUserGift
:
true
})
}
else
{
this
.
setState
({
isShowUserGift
:
false
})
}
}
close
=
()
=>
{
this
.
setState
({
isShowUserGift
:
false
})
let
now_time
=
(
new
Date
()).
valueOf
()
// 获取当前时间
localStorage
.
setItem
(
'newer_last_time'
,
now_time
)
// 存储关闭时间
}
getBorwerCourse
=
()
=>
{
getBorwerCourse
=
()
=>
{
http
.
get
(
`
${
API
.
home
}
/sys/user/blessing`
,
{
type
:
4
,
course_id
:
getParam
(
'id'
)}).
then
(
res
=>
{
http
.
get
(
`
${
API
.
home
}
/sys/user/blessing`
,
{
type
:
4
,
course_id
:
getParam
(
'id'
)}).
then
(
res
=>
{
let
{
code
,
data
:
{
today_browsed_courses
}}
=
res
.
data
;
let
{
code
,
data
:
{
today_browsed_courses
}}
=
res
.
data
;
...
@@ -822,6 +868,11 @@ class Detail extends Component {
...
@@ -822,6 +868,11 @@ class Detail extends Component {
)
:
null
)
:
null
}
}
<
/div
>
<
/div
>
{
this
.
state
.
isShowUserGift
&&
<
UserGift
close
=
{
this
.
close
}
history
=
{
this
.
props
.
history
}
/
>
}
<
/div
>
<
/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