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
5da5a1f6
Commit
5da5a1f6
authored
Aug 09, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.julyedu.com:baiguangyao/mr-julyedu
parents
409ba221
2eba5b19
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
124 additions
and
59 deletions
+124
-59
src/components/Index/index.js
+7
-3
src/components/Index/index.scss
+2
-2
src/components/Index/liveRoom.js
+5
-4
src/components/bargainMiddlePage/bargain-middle-page.scss
+1
-0
src/components/detail/btnstatus/index.js
+68
-19
src/components/detail/index.js
+22
-24
src/components/detail/shareRank/index.js
+18
-6
src/components/shopCart/index.js
+1
-1
No files found.
src/components/Index/index.js
View file @
5da5a1f6
...
...
@@ -172,7 +172,7 @@ class Index extends Component {
{
this
.
state
.
islive
&&
<
LiveRoom
isShow
=
{
this
.
state
.
isShow
}
colseBox
=
{
this
.
colseBox
}
roomMess
=
{
this
.
state
.
roomMess
}
><
/LiveRoom
>
roomMess
=
{
this
.
state
.
roomMess
}
getIndexData
=
{
this
.
getIndexData
}
><
/LiveRoom
>
}
<
/div
>
...
...
@@ -282,13 +282,17 @@ function ScrollBox(props) {
<
h2
className
=
"item-title"
>
{
item
.
live_title
}
<
/h2
>
<
p
className
=
"item-teacher"
>
讲师:
{
item
.
live_teacher_name
}
<
/p
>
{
item
.
is_prepare
&&
item
.
is_prepare
&&
item
.
live_status
===
0
&&
<
p
className
=
"item-time"
>
时间:
{
item
.
live_start_time
}
<
/p
>
}
{
!
item
.
is_prepare
&&
!
item
.
is_prepare
&&
item
.
live_status
===
0
&&
<
p
className
=
'item-btn'
>
预约
<
/p
>
}
{
(
item
.
live_status
===
1
||
item
.
live_status
===
10
)
&&
<
p
className
=
'item-btn'
>
正在直播
<
/p
>
}
<
/div
>
<
/div
>
<
/li
>
...
...
src/components/Index/index.scss
View file @
5da5a1f6
...
...
@@ -211,10 +211,10 @@
}
.item-btn
{
width
:
49
px
;
padding
:
0
5
px
;
height
:
20px
;
text-align
:
center
;
line-height
:
20
px
;
line-height
:
18
px
;
background
:
linear-gradient
(
60deg
,
$bg_active
0%
,
$bg_0080FF
100%
);
border-radius
:
10px
;
font-size
:
14px
;
...
...
src/components/Index/liveRoom.js
View file @
5da5a1f6
...
...
@@ -82,6 +82,7 @@ class LiveRoom extends Component {
success
:
true
,
toSubscribe
:
false
})
this
.
props
.
getIndexData
()
}
}
else
if
(
res
.
data
.
data
.
status
===
1
)
{
...
...
@@ -275,10 +276,10 @@ class LiveRoom extends Component {
}
<
/div
>
}
{
this
.
state
.
success
&&
<
div
className
=
'success'
>
预约成功
<
/div
>
}
{
/*{*/
}
{
/*this.state.success &&*/
}
{
/*<div className='success'>预约成功</div>*/
}
{
/*}*/
}
<
/div
>
);
}
...
...
src/components/bargainMiddlePage/bargain-middle-page.scss
View file @
5da5a1f6
...
...
@@ -66,6 +66,7 @@
display
:
flex
;
flex-flow
:
column
;
justify-content
:
space-between
;
width
:
100%
;
}
.v-list-item
{
...
...
src/components/detail/btnstatus/index.js
View file @
5da5a1f6
...
...
@@ -17,9 +17,25 @@ class BtnStatus extends Component {
group_status
:
3
,
in_cart
:
false
,
countdown
:
0
,
barInfo
:
''
}
}
componentDidMount
()
{
this
.
getBargainInfo
()
}
// componentDidUpdate(prevProps) {
// let {courseInfo} = this.props
// let {courseInfo: prevCourseInfo} = prevProps
// if (courseInfo && courseInfo.is_bargain) {
// if (prevCourseInfo && courseInfo.is_bargain !== prevCourseInfo.is_bargain) {
// this.getBargainInfo()
// }
// }
// }
componentWillReceiveProps
(
nextProps
)
{
this
.
setState
({
...
nextProps
.
data
.
course_info
,
...
...
@@ -39,13 +55,11 @@ class BtnStatus extends Component {
// this.props.getCourses()
document
.
location
.
reload
()
}
else
{
// window.location.href = '/shopcart'
this
.
props
.
history
.
replace
(
'/shopcart'
);
}
}
else
if
(
res
.
data
.
code
===
15001
)
{
// window.location.href = '/shopcart'
this
.
props
.
history
.
replace
(
'/shopcart'
);
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
...
...
@@ -54,14 +68,20 @@ class BtnStatus extends Component {
}
// 直接购买
tobuy
=
()
=>
{
if
(
this
.
props
.
barInfo
.
bargain_status
===
2
)
{
this
.
toCart
(
2
)
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
// 取消砍价记录
this
.
setState
({
isShowOverlay
:
true
,
bargainStatus
:
1
,
})
if
(
this
.
state
.
barInfo
.
bargain_status
===
2
)
{
this
.
toCart
(
2
)
}
else
{
// 取消砍价记录
this
.
setState
({
isShowOverlay
:
true
,
bargainStatus
:
1
,
})
}
}
}
...
...
@@ -91,15 +111,40 @@ class BtnStatus extends Component {
}
// 砍价接口
toKanjia
=
()
=>
{
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
let
data
=
{
course_id
:
getParam
(
'id'
),
type
:
1
,
// 1 用户自己砍价 2 使用砍价神器 3 好友助力砍价 4 好友第二次助力
parent_uid
:
0
// 被助力人id 【自己本人操作传0】
}
http
.
post
(
`
${
api
.
home
}
/m/bargain/toBargain`
,
data
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
// this.props.getBargainInfo()
document
.
location
.
reload
()
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
})
}
}
//获取砍价信息
getBargainInfo
=
()
=>
{
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
let
data
=
{
course_id
:
getParam
(
'id'
),
type
:
1
,
// 1 用户自己砍价 2 使用砍价神器 3 好友助力砍价 4 好友第二次助力
parent_uid
:
0
// 被助力人id 【自己本人操作传0】
courseId
:
getParam
(
'id'
)
}
http
.
post
(
`
${
API
.
home
}
/m/bargain/toBargain`
,
data
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
// this.props.getBargainInfo()
document
.
location
.
reload
()
this
.
setState
({
barInfo
:
res
.
data
.
data
})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
...
...
@@ -111,8 +156,10 @@ class BtnStatus extends Component {
if
(
this
.
props
.
data
&&
this
.
props
.
data
.
course_info
)
{
info
=
this
.
props
.
data
.
course_info
}
let
barInfo
=
this
.
props
.
barInfo
&&
this
.
props
.
barInfo
const
{
countdown
}
=
this
.
state
;
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
return
(
<
div
>
...
...
@@ -196,15 +243,15 @@ class BtnStatus extends Component {
<
span
onClick
=
{
this
.
tobuy
}
>
直接购买
<
/span
>
<
/button
>
{
barInfo
.
bargain_status
===
2
&&
(
this
.
state
.
barInfo
.
bargain_status
===
2
||
!
uid
)
&&
<
button
className
=
'btn btn-s bg-E02E24'
onClick
=
{
this
.
toKanjia
}
>
我要砍价
<
/button
>
}
{
(
barInfo
.
bargain_status
===
0
||
barInfo
.
bargain_status
===
1
)
&&
(
this
.
state
.
barInfo
.
bargain_status
===
0
||
this
.
state
.
barInfo
.
bargain_status
===
1
)
&&
(
uid
)
&&
<
button
className
=
'btn btn-s bg-E02E24'
>
<
span
>
¥
{
barInfo
.
amount
}
<
/span
>
<
span
>
¥
{
this
.
state
.
barInfo
.
amount
}
<
/span
>
<
span
onClick
=
{
e
=>
this
.
toCart
(
2
)}
>
去支付
<
/span
>
<
/button
>
}
...
...
@@ -256,6 +303,8 @@ function CancelBargain(props) {
}
export
default
connect
(
null
,
state
=>
({
user
:
state
.
user
}),
{
getCourses
}
)(
BtnStatus
)
src/components/detail/index.js
View file @
5da5a1f6
...
...
@@ -13,6 +13,7 @@ import {connect} from "react-redux"
import
{
fetchCoursesListIfNeeded
}
from
"./actions"
import
{
api
,
getParam
,
http
,
browser
}
from
"@/utils"
import
{
Toast
}
from
'antd-mobile'
import
{
compose
}
from
"redux"
;
class
Detail
extends
Component
{
...
...
@@ -35,29 +36,30 @@ class Detail extends Component {
this
.
props
.
fetchCoursesListIfNeeded
();
}
componentDidUpdate
(
prevProps
)
{
let
{
courseInfo
}
=
this
.
props
let
{
courseInfo
:
prevCourseInfo
}
=
prevProps
if
(
courseInfo
&&
courseInfo
.
is_bargain
)
{
if
(
prevCourseInfo
&&
courseInfo
.
is_bargain
!==
prevCourseInfo
.
is_bargain
)
{
this
.
getBargainInfo
()
}
}
}
// 点击子组件试听按钮
toAudition
=
()
=>
{
this
.
setState
(
status
=>
({
auditionBox
:
true
,
}));
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
this
.
setState
({
auditionBox
:
true
,
})
}
}
// 点击子组件单集购买按钮
toSingleset
=
(
item
)
=>
{
this
.
setState
(
status
=>
({
singleBox
:
true
,
singMess
:
item
}));
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
this
.
setState
({
singleBox
:
true
,
singMess
:
item
})
}
}
componentWillReceiveProps
(
nextProps
)
{
...
...
@@ -154,7 +156,6 @@ class Detail extends Component {
})
}
// 自组件传给父组件的boxHide
boxHide
=
(
val
)
=>
{
this
.
setState
({
auditionBox
:
val
,
singleBox
:
val
})
...
...
@@ -262,7 +263,6 @@ class Detail extends Component {
{
/*课程按钮*/
}
<
BtnStatus
countdown
=
{
countdown
}
data
=
{
this
.
props
.
courseInfo
}
barInfo
=
{
this
.
state
.
barInfo
}
getBargainInfo
=
{
this
.
getBargainInfo
}
invitedFriends
=
{
this
.
invitedFriends
}
history
=
{
this
.
props
.
history
}
><
/BtnStatus
>
...
...
@@ -290,13 +290,12 @@ class Detail extends Component {
const
mapStateToProps
=
(
state
)
=>
{
return
{
courseInfo
:
state
.
courseInfo
courseInfo
:
state
.
courseInfo
,
user
:
state
.
user
}
}
const
mapDispatchToProps
=
{
fetchCoursesListIfNeeded
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Detail
)
\ No newline at end of file
src/components/detail/shareRank/index.js
View file @
5da5a1f6
...
...
@@ -38,6 +38,9 @@ class ShareRank extends Component {
// 获取分销码
getCode
=
()
=>
{
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
return
let
data
=
{
course_id
:
getParam
(
'id'
)
}
...
...
@@ -54,11 +57,17 @@ class ShareRank extends Component {
// 点击分销跳转到海报页
share
=
(
info
)
=>
{
const
courseId
=
getParam
(
'id'
)
const
dist_first
=
info
.
dist_first_level_ti
const
uid
=
info
.
uid
const
dist_code
=
this
.
state
.
code
this
.
props
.
history
.
push
(
`/shareposter?courseId=
${
courseId
}
&dist_first=
${
dist_first
}
&uid=
${
uid
}
&dist_code=
${
dist_code
}
`
)
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
const
courseId
=
getParam
(
'id'
)
const
dist_first
=
info
.
dist_first_level_ti
const
uid
=
info
.
uid
const
dist_code
=
this
.
state
.
code
this
.
props
.
history
.
push
(
`/shareposter?courseId=
${
courseId
}
&dist_first=
${
dist_first
}
&uid=
${
uid
}
&dist_code=
${
dist_code
}
`
)
}
}
...
...
@@ -146,7 +155,10 @@ class ShareRank extends Component {
export
default
compose
(
connect
(
state
=>
({
courseInfo
:
state
}),
state
=>
({
courseInfo
:
state
,
user
:
state
.
user
}),
null
),
withRouter
...
...
src/components/shopCart/index.js
View file @
5da5a1f6
...
...
@@ -130,7 +130,7 @@ class Cart extends Component {
tobuy
=
()
=>
{
http
.
get
(
`
${
API
[
'base-api'
]}
/m/cart/addtopreorder/[
${
this
.
state
.
courseIdarr
}
]`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
==
0
)
{
this
.
props
.
history
.
push
(
'/order'
)
this
.
props
.
history
.
push
(
`/order?id=[
${
this
.
state
.
courseIdarr
}
]`
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
...
...
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