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
312b4a6d
Commit
312b4a6d
authored
Jul 26, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
特训营课程报名购买学习流程
parent
9af87de7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
4 deletions
+105
-4
src/components/detail/btnstatus/index.js
+88
-2
src/components/detail/btnstatus/index.scss
+11
-0
src/components/detail/index.js
+5
-1
src/components/order/index.js
+1
-1
No files found.
src/components/detail/btnstatus/index.js
View file @
312b4a6d
...
@@ -18,6 +18,7 @@ class BtnStatus extends Component {
...
@@ -18,6 +18,7 @@ class BtnStatus extends Component {
in_cart
:
false
,
in_cart
:
false
,
countdown
:
0
,
countdown
:
0
,
}
}
console
.
log
(
props
);
}
}
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
...
@@ -51,7 +52,45 @@ class BtnStatus extends Component {
...
@@ -51,7 +52,45 @@ class BtnStatus extends Component {
Toast
.
info
(
res
.
data
.
msg
,
2
);
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
}
})
})
}
};
// 返现课程的立即购买
signUpNow
=
()
=>
{
if
(
this
.
props
.
user
.
hasError
)
{
// 未登录 去登陆
this
.
props
.
history
.
push
(
'/passport'
);
}
else
{
// 登陆 走登陆的逻辑
/**
let cidArr = JSON.stringify([getParam('id')]);
this.axios({
method : 'get',
url : "cart/addtopreorder/" + cidArr + "?type=1"
})
.then(function(res){
if(res.data.errno == 0 ){
_this.$router.push({ path: 'order', query: { type: 1 }});
}
})
.catch(function(err){
console.log(err);
})
}
* **/
let
cidArr
=
JSON
.
stringify
([
getParam
(
'id'
)]);
http
.
get
(
`
${
api
[
'base-api'
]}
/cart/addtopreorder/
${
cidArr
}
?type=1`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
props
.
history
.
push
({
pathname
:
'/order'
,
state
:
{
type
:
1
}})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
}
};
// 格式化开课时间
formatDate
=
(
date
)
=>
{
let
ary
=
date
.
split
(
'-'
);
return
`
${
ary
[
1
]}
月
${
ary
[
2
]}
日开课`
;
};
// 直接购买
// 直接购买
tobuy
=
()
=>
{
tobuy
=
()
=>
{
if
(
this
.
props
.
barInfo
.
bargain_status
===
2
)
{
if
(
this
.
props
.
barInfo
.
bargain_status
===
2
)
{
...
@@ -63,7 +102,7 @@ class BtnStatus extends Component {
...
@@ -63,7 +102,7 @@ class BtnStatus extends Component {
bargainStatus
:
1
,
bargainStatus
:
1
,
})
})
}
}
}
}
;
// 取消砍价
// 取消砍价
...
@@ -222,6 +261,53 @@ class BtnStatus extends Component {
...
@@ -222,6 +261,53 @@ class BtnStatus extends Component {
<
/div
>
<
/div
>
}
}
{
/*特训营课程 未登录 未报名*/
}
{
(
info
.
is_aist
&&
(
this
.
props
.
user
.
hasError
||
info
.
is_baoming
===
0
))
&&
<
div
className
=
'btns-box'
>
<
a
className
=
'consult consult-m'
href
=
"https://q.url.cn/AB8aue?_type=wpa&qidian=true"
>
<
i
className
=
'iconfont iconerji'
><
/i
>
<
span
>
课程咨询
<
/span
>
<
/a
>
<
button
className
=
'btn sign-up-now'
onClick
=
{
e
=>
this
.
signUpNow
()}
>
<
span
>
立即报名
<
/span
>
<
/button
>
{
/*<Link to={`/play?id=${getParam('id')}`} className='btn btn-m learn-now'>*/
}
{
/* <span>开始学习</span>*/
}
{
/*</Link>*/
}
{
/*<button className='btn btn-m wait-open' >*/
}
{
/* <span>{this.formatDate('2019-02-10')}</span>*/
}
{
/*</button>*/
}
<
/div
>
}
{
/*特训营课程 登陆且已报名*/
}
{
info
.
is_aist
&&
!
this
.
props
.
user
.
hasError
&&
info
.
is_baoming
===
0
&&
<
div
className
=
'btns-box'
>
<
a
className
=
'consult consult-m'
href
=
"https://q.url.cn/AB8aue?_type=wpa&qidian=true"
>
<
i
className
=
'iconfont iconerji'
><
/i
>
<
span
>
课程咨询
<
/span
>
<
/a
>
{
info
.
aist_start_time
===
""
?
(
<
Link
to
=
{
`/play?id=
${
getParam
(
'id'
)}
`
}
className
=
'btn btn-m learn-now'
>
<
span
>
开始学习
<
/span
>
<
/Link
>
)
:
(
<
button
className
=
'btn btn-m wait-open'
>
<
span
>
{
this
.
formatDate
(
info
.
aist_start_time
)}
<
/span
>
<
/button
>
)
}
<
/div
>
}
{
{
this
.
state
.
isShowOverlay
&&
this
.
state
.
isShowOverlay
&&
...
...
src/components/detail/btnstatus/index.scss
View file @
312b4a6d
...
@@ -84,6 +84,17 @@
...
@@ -84,6 +84,17 @@
font-size
:
12px
;
font-size
:
12px
;
}
}
}
}
.sign-up-now
{
width
:
50%
;
color
:
#fff
;
font-size
:
16px
;
background
:
linear-gradient
(
270deg
,
rgba
(
255
,
64
,
0
,
1
)
0%
,
rgba
(
253
,
119
,
0
,
1
)
100%
);
}
.learn-now
{
background-color
:
#0099FF
;
font-size
:
16px
;
color
:
#FFF
;
}
.btn-m
{
.btn-m
{
width
:
50%
;
width
:
50%
;
...
...
src/components/detail/index.js
View file @
312b4a6d
...
@@ -267,6 +267,7 @@ class Detail extends Component {
...
@@ -267,6 +267,7 @@ class Detail extends Component {
{
/*课程按钮*/
}
{
/*课程按钮*/
}
<
BtnStatus
countdown
=
{
countdown
}
<
BtnStatus
countdown
=
{
countdown
}
data
=
{
this
.
props
.
courseInfo
}
data
=
{
this
.
props
.
courseInfo
}
user
=
{
this
.
props
.
user
}
barInfo
=
{
this
.
state
.
barInfo
}
barInfo
=
{
this
.
state
.
barInfo
}
getBargainInfo
=
{
this
.
getBargainInfo
}
getBargainInfo
=
{
this
.
getBargainInfo
}
invitedFriends
=
{
this
.
invitedFriends
}
invitedFriends
=
{
this
.
invitedFriends
}
...
@@ -295,7 +296,10 @@ class Detail extends Component {
...
@@ -295,7 +296,10 @@ class Detail extends Component {
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
courseInfo
:
state
.
courseInfo
courseInfo
:
state
.
courseInfo
,
user
:
{
...
state
.
user
}
}
}
}
}
...
...
src/components/order/index.js
View file @
312b4a6d
...
@@ -205,7 +205,7 @@ class Order extends Component {
...
@@ -205,7 +205,7 @@ class Order extends Component {
})
})
}
else
{
}
else
{
http
.
get
(
`
${
api
.
home
}
/m/order/preorder`
).
then
((
res
)
=>
{
http
.
get
(
`
${
api
[
'base-api'
]
}
/m/order/preorder`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
!==
200
)
{
if
(
res
.
data
.
code
!==
200
)
{
return
;
return
;
}
}
...
...
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