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
a2c06216
Commit
a2c06216
authored
Jun 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
倒计时
parent
4fe6a13a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
src/components/detail/btnstatus/index.js
+5
-3
src/components/detail/group/togroup.js
+1
-1
src/components/detail/index.js
+32
-10
No files found.
src/components/detail/btnstatus/index.js
View file @
a2c06216
...
...
@@ -16,12 +16,14 @@ class BtnStatus extends Component {
is_baoming
:
0
,
group_status
:
3
,
in_cart
:
false
,
countdown
:
0
,
}
}
componentWillReceiveProps
(
nextProps
)
{
this
.
setState
({
...
nextProps
.
data
.
course_info
...
nextProps
.
data
.
course_info
,
countdown
:
nextProps
.
countdown
,
});
}
...
...
@@ -121,7 +123,7 @@ class BtnStatus extends Component {
info
=
this
.
props
.
data
.
course_info
}
let
barInfo
=
this
.
props
.
barInfo
&&
this
.
props
.
barInfo
const
{
countdown
}
=
this
.
state
;
return
(
<
div
>
...
...
@@ -187,7 +189,7 @@ class BtnStatus extends Component {
<
span
>
课程咨询
<
/span
>
<
/a
>
<
div
className
=
'btn btn-l bg-E02E24'
onClick
=
{
this
.
props
.
invitedFriends
}
>
邀请好友参团
23
:
32
:
23
后结束
邀请好友参团
{
countdown
}
后结束
<
/div
>
<
/div
>
}
...
...
src/components/detail/group/togroup.js
View file @
a2c06216
...
...
@@ -78,7 +78,7 @@ class ToGroup extends Component {
}
componentDidMount
()
{
Promise
.
all
([
http
.
get
(
`
${
api
[
'pay-api'
]}
/pdd/goupon_pay_page/
15610158875449306780
`
),
http
.
get
(
`
${
api
.
home
}
/m/user_info`
)]).
then
(
resultList
=>
{
Promise
.
all
([
http
.
get
(
`
${
api
[
'pay-api'
]}
/pdd/goupon_pay_page/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
api
.
home
}
/m/user_info`
)]).
then
(
resultList
=>
{
console
.
log
(
resultList
);
let
res
=
resultList
[
0
],
userInfo
=
resultList
[
1
];
...
...
src/components/detail/index.js
View file @
a2c06216
...
...
@@ -28,11 +28,12 @@ class Detail extends Component {
singMess
:
''
,
barInfo
:
''
,
share
:
false
,
countdown
:
'00:00:00'
,
}
}
componentDidMount
()
{
this
.
props
.
fetchCoursesListIfNeeded
()
this
.
props
.
fetchCoursesListIfNeeded
()
;
}
componentDidUpdate
(
prevProps
)
{
...
...
@@ -60,6 +61,29 @@ class Detail extends Component {
}));
}
componentWillReceiveProps
(
nextProps
)
{
let
_this
=
this
;
if
(
nextProps
.
courseInfo
.
course_info
)
{
let
courseInfo
=
nextProps
.
courseInfo
.
course_info
;
if
(
courseInfo
.
group_status
===
3
||
courseInfo
.
group_status
===
4
)
{
let
endTime
=
courseInfo
.
pdd_group_info
.
groupon_member
.
end_time
;
let
date
=
endTime
*
1000
,
hours
=
0
,
minutes
=
0
,
seconds
=
0
;
setInterval
(()
=>
{
date
-=
1000
hours
=
`
${
parseInt
(
date
/
(
60
*
60
*
1000
))}
`
.
padStart
(
2
,
0
);
minutes
=
`
${
parseInt
((
date
-
hours
*
3600000
)
/
60000
)}
`
.
padStart
(
2
,
0
);
seconds
=
`
${
parseInt
((
date
-
hours
*
3600000
-
minutes
*
60000
)
/
1000
)}
`
.
padStart
(
2
,
0
);
_this
.
setState
({
countdown
:
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
});
},
1000
)
}
}
}
invitedFriends
=
()
=>
{
const
{
course_title
,
image_name
,
course_id
,
pdd_group_info
,
pdd_group_info
:
{
groupon_member
,
groupon_member
:
{
number
},
price
}}
=
this
.
props
.
courseInfo
.
course_info
;
if
(
browser
.
isWeixin
)
{
...
...
@@ -138,20 +162,18 @@ class Detail extends Component {
}
render
()
{
let
courseInfo
=
''
;
let
service
=
''
;
let
number
=
0
;
let
courseInfo
=
''
,
service
=
''
,
number
=
0
,
endTime
=
0
;
if
(
this
.
props
.
courseInfo
.
course_info
)
{
courseInfo
=
this
.
props
.
courseInfo
.
course_info
;
service
=
courseInfo
.
service
;
if
(
courseInfo
.
group_status
!==
0
)
{
if
(
courseInfo
.
group_status
===
3
||
courseInfo
.
group_status
===
4
)
{
number
=
courseInfo
.
pdd_group_info
.
groupon_member
.
number
;
}
}
const
{
is_bargain
,
// 是否是砍价课程
}
=
this
.
props
;
const
{
share
}
=
this
.
state
;
const
{
share
,
countdown
}
=
this
.
state
;
return
(
<
div
className
=
'detail-box'
>
<
CallApp
className
=
'toapp'
><
/CallApp
>
...
...
@@ -239,7 +261,7 @@ class Detail extends Component {
<
OutLine
data
=
{
this
.
props
.
courseInfo
}
toAudition
=
{
this
.
toAudition
}
toSingleset
=
{
this
.
toSingleset
}
/
>
{
/*课程按钮*/
}
<
BtnStatus
data
=
{
this
.
props
.
courseInfo
}
barInfo
=
{
this
.
state
.
barInfo
}
getBargainInfo
=
{
this
.
getBargainInfo
}
invitedFriends
=
{
this
.
invitedFriends
}
history
=
{
this
.
props
.
history
}
><
/BtnStatus
>
<
BtnStatus
countdown
=
{
countdown
}
data
=
{
this
.
props
.
courseInfo
}
barInfo
=
{
this
.
state
.
barInfo
}
getBargainInfo
=
{
this
.
getBargainInfo
}
invitedFriends
=
{
this
.
invitedFriends
}
history
=
{
this
.
props
.
history
}
><
/BtnStatus
>
{
share
?
(
...
...
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