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
9bd8e775
Commit
9bd8e775
authored
Aug 26, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
discount modify in order page
parent
2f4d90b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
28 deletions
+70
-28
src/components/Index/index.js
+52
-19
src/components/order/index.js
+18
-9
No files found.
src/components/Index/index.js
View file @
9bd8e775
...
...
@@ -120,17 +120,25 @@ class Index extends Component {
return
(
<
div
className
=
'index-box'
>
<
div
className
=
'header'
>
<
img
className
=
"logo"
src
=
"http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png"
alt
=
""
/>
<
CallApp
className
=
'to-app'
text
=
'在APP打开'
><
/CallApp
>
<
i
className
=
'iconfont iconiconfront- search'
onClick
=
{
this
.
toSearch
.
bind
(
this
)}
><
/i
>
<
img
className
=
"logo"
src
=
"http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png"
alt
=
""
/>
<
CallApp
className
=
'to-app'
text
=
'在APP打开'
/>
<
i
className
=
'iconfont iconiconfront- search'
onClick
=
{
this
.
toSearch
.
bind
(
this
)}
/
>
<
/div
>
<
div
className
=
'index-swiper'
>
{
this
.
state
.
banner
&&
this
.
state
.
banner
.
length
>
0
&&
<
TopSwiper
bannerList
=
{
this
.
state
.
banner
}
/
>
<
TopSwiper
bannerList
=
{
this
.
state
.
banner
}
/
>
}
<
/div
>
...
...
@@ -141,7 +149,7 @@ class Index extends Component {
return
(
<
li
key
=
{
index
}
>
<
a
href
=
{
item
.
href
}
>
<
img
src
=
{
item
.
src
}
alt
=
""
/>
<
img
src
=
{
item
.
src
}
alt
=
""
/>
<
span
>
{
item
.
name
}
<
/span
>
<
/a
>
<
/li
>
...
...
@@ -151,14 +159,17 @@ class Index extends Component {
<
/ul
>
<
/div
>
<
p
className
=
"borderTop"
><
/p
>
<
p
className
=
"borderTop"
/
>
{
(
this
.
state
.
lives
&&
this
.
state
.
lives
.
length
>
0
)
?
<
div
className
=
'lives'
>
<
h2
className
=
"title"
>
近期直播
<
/h2
>
<
ScrollBox
livesList
=
{
this
.
state
.
lives
}
liveCourse
=
{
this
.
liveCourse
}
/
>
<
ScrollBox
livesList
=
{
this
.
state
.
lives
}
liveCourse
=
{
this
.
liveCourse
}
/
>
<
/div> : nul
l
}
...
...
@@ -166,8 +177,11 @@ class Index extends Component {
(
this
.
state
.
modules
&&
this
.
state
.
modules
.
length
>
0
)
?
this
.
state
.
modules
.
map
((
item
,
index
)
=>
{
return
(
<
div
key
=
{
index
}
>
<
CourseList
modules
=
{
item
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
<
p
className
=
"borderTop"
><
/p
>
<
CourseList
modules
=
{
item
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
<
p
className
=
"borderTop"
/>
<
/div
>
)
})
:
null
...
...
@@ -178,16 +192,18 @@ class Index extends Component {
<
p
>
查看全部课程
<
/p
>
<
span
>
数学基础、数学结构、大数据实战、
Python
...
<
/span
>
<
/Link
>
<
/div
>
{
/* 直播间预约 */
}
{
this
.
state
.
islive
&&
<
LiveRoom
isShow
=
{
this
.
state
.
isShow
}
colseBox
=
{
this
.
colseBox
}
roomMess
=
{
this
.
state
.
roomMess
}
getIndexData
=
{
this
.
getIndexData
}
><
/LiveRoom
>
<
LiveRoom
isShow
=
{
this
.
state
.
isShow
}
colseBox
=
{
this
.
colseBox
}
roomMess
=
{
this
.
state
.
roomMess
}
getIndexData
=
{
this
.
getIndexData
}
/
>
}
<
/div
>
)
}
...
...
@@ -197,17 +213,34 @@ class Index extends Component {
function
TopSwiper
({
bannerList
})
{
return
(
<
Swiper
type
=
{
animateTypes
.
CARD
}
loop
=
{
true
}
height
=
{
168
}
autoPlay
=
{
true
}
typePro
createStyle
=
{
createStyle
}
>
<
Swiper
type
=
{
animateTypes
.
CARD
}
loop
=
{
true
}
height
=
{
168
}
autoPlay
=
{
true
}
typePro
createStyle
=
{
createStyle
}
>
{
bannerList
&&
bannerList
.
length
>
0
&&
bannerList
.
map
((
item
,
index
)
=>
{
return
(
Number
.
isNaN
(
parseInt
(
item
.
jump_url
))
?
<
a
href
=
{
item
.
jump_url
}
key
=
{
index
}
>
{
/* <Link to={item.jump_url} key={index}> */
}
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
{
/* </Link> */
}
<
/a>
:
<
Link
to
=
{{
pathname
:
'/detail'
,
search
:
`?id=
${
item
.
jump_url
}
`
}}
key
=
{
index
}
>
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
<
Link
to
=
{{
pathname
:
'/detail'
,
search
:
`?id=
${
item
.
jump_url
}
`
}}
key
=
{
index
}
>
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
<
/Link
>
)
})
...
...
src/components/order/index.js
View file @
9bd8e775
...
...
@@ -13,7 +13,6 @@ import "./order.scss"
const
Item
=
List
.
Item
;
function
OrderList
(
props
)
{
console
.
log
(
props
);
const
listData
=
props
.
list
;
return
(
<
div
>
...
...
@@ -77,8 +76,20 @@ function OrderList(props) {
}}}
>
{
/* <Link to='coupons' query={{id: course_id}} state={{from: '/order'}}> */
}
<
Flex
justify
=
'between'
>
<
span
style
=
{{
color
:
'#333'
,
fontSize
:
'15px'
}}
>
优惠券
<
/span
>
<
span
style
=
{{
fontSize
:
'14px'
,
color
:
'#999999'
}}
>
{
!
coupon_desc
?
(
coupon_num
===
0
?
'无'
:
`
${
coupon_num
}
张可用`
)
:
(
coupon_desc
)}
<
/span
>
<
span
style
=
{{
color
:
'#333'
,
fontSize
:
'15px'
}}
>
优惠券
<
/span
>
<
span
style
=
{{
fontSize
:
'14px'
,
color
:
'#999999'
}}
>
{
!
coupon_desc
?
(
coupon_num
===
0
?
'无'
:
`
${
coupon_num
}
张可用`
)
:
(
coupon_desc
)}
<
/span
>
<
/Flex
>
<
/Link
>
<
/Item
>
...
...
@@ -234,11 +245,11 @@ class Order extends Component {
info
:
!
prevState
.
info
}));
};
// 公共方法 存储数据
publicGetData
=
(
res
)
=>
{
let
{
course
,
total
,
user_account
,
user_info
,
discount
}
=
res
;
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
group
===
1
)
{
console
.
log
(
this
.
state
);
total
=
this
.
state
.
groupPrice
;
}
this
.
cacheObj
=
{
...
...
@@ -260,6 +271,9 @@ class Order extends Component {
publicLocalStorage
=
()
=>
{
if
(
this
.
props
.
history
.
action
===
'PUSH'
)
{
sessionStorage
.
removeItem
(
'orderUseCacheObj'
);
this
.
setState
({
discount
:
0.00
,
});
}
else
{
const
cacheObj
=
sessionStorage
.
getItem
(
'orderUseCacheObj'
);
if
(
cacheObj
!==
null
)
{
...
...
@@ -272,8 +286,6 @@ class Order extends Component {
};
componentDidMount
()
{
let
_this
=
this
;
console
.
log
(
this
.
props
.
location
.
state
);
console
.
log
(
0
);
// type: 1,返现课程,simple: 1,正常购买
if
(
this
.
props
.
location
.
state
&&
this
.
props
.
location
.
state
.
type
===
1
)
{
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder?type=1`
).
then
((
res
)
=>
{
...
...
@@ -285,7 +297,6 @@ class Order extends Component {
}
})
}
else
if
(
this
.
props
.
location
.
state
&&
(
this
.
props
.
location
.
state
.
simple
===
1
||
this
.
props
.
location
.
state
.
bargain
===
1
))
{
console
.
log
(
1
);
// 普通课程立即报名 不带 type = 1
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder`
).
then
(
res
=>
{
if
(
res
.
data
.
errno
===
200
)
{
...
...
@@ -300,8 +311,6 @@ class Order extends Component {
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
API
[
'base-api'
]}
/m/order/preorder`
)]).
then
(
resList
=>
{
let
courseInfo
=
resList
[
0
],
orderInfo
=
resList
[
1
];
console
.
log
(
courseInfo
.
data
);
console
.
log
(
orderInfo
.
data
);
let
newData
=
{};
if
(
orderInfo
.
data
.
errno
===
200
)
{
newData
=
Object
.
assign
({},
orderInfo
.
data
.
data
,
{
course
:
[]});
...
...
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