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
2c845752
Commit
2c845752
authored
Aug 19, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify home, because modify question to course detail
parent
c7d02352
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
src/components/Index/index.js
+29
-12
No files found.
src/components/Index/index.js
View file @
2c845752
...
...
@@ -10,10 +10,14 @@ import LiveRoom from './liveRoom'
import
{
Link
}
from
"react-router-dom"
import
{
Toast
}
from
'antd-mobile'
import
{
connect
}
from
"react-redux"
;
import
{
getCourses
}
from
'./../detail/actions'
;
const
animateTypes
=
Swiper
.
animateTypes
@
connect
(
state
=>
({
user
:
state
.
user
}))
class
Index
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -104,6 +108,14 @@ class Index extends Component {
this
.
props
.
history
.
push
(
'/search'
)
}
toCourseDetail
=
(
id
)
=>
{
const
{
dispatch
,
history
}
=
this
.
props
;
dispatch
(
getCourses
(
id
,
()
=>
{
history
.
push
(
`/detail?id=
${
id
}
`
);
return
false
;
}));
}
render
()
{
return
(
<
div
className
=
'index-box'
>
...
...
@@ -154,7 +166,7 @@ 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
}
/
>
<
CourseList
modules
=
{
item
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
<
p
className
=
"borderTop"
><
/p
>
<
/div
>
)
...
...
@@ -199,7 +211,7 @@ function TopSwiper({bannerList}) {
// 课程模块儿公共组件
// 课程数量是奇数第一个课程需要横着展示沾满一行,课程数量是偶数一行显示两个
function
CourseList
({
modules
})
{
function
CourseList
({
modules
,
toDetail
})
{
let
isOdd
=
modules
.
list
.
length
%
2
===
0
// 数量为奇数时,第一个课程显示大图(如后台未上传,前台显示小图),课程数量为偶数时,均显示小图
let
filterList
=
''
...
...
@@ -223,10 +235,10 @@ function CourseList({modules}) {
<
ul
className
=
'index-course-detail'
>
{
!
isOdd
&&
modules
.
list
[
0
].
course_img
!==
''
&&
<
div
className
=
"category-vip"
>
<
Link
to
=
{
`/detail?id=
${
modules
.
list
[
0
].
course_id
}
`
}
>
<
div
className
=
"category-vip"
onClick
=
{()
=>
toDetail
(
modules
.
list
[
0
].
course_id
)}
>
{
/* <Link to={`/detail?id=${modules.list[0].course_id}`}> */
}
<
img
src
=
{
modules
.
list
[
0
].
course_img_small
}
alt
=
""
/>
<
/Link
>
{
/* </Link> */
}
<
/div
>
}
{
...
...
@@ -255,9 +267,17 @@ function CourseList({modules}) {
<
/div
>
)
return
(
<
Course
key
=
{
index
}
top
=
{
top
}
data
=
{
item
}
bottom
=
{
bottom
}
img
=
{
item
.
course_img_small
}
title
=
{
item
.
course_title
}
id
=
{
item
.
course_id
}
className
=
'text-overflow-2'
><
/Course
>
<
Course
key
=
{
index
}
top
=
{
top
}
data
=
{
item
}
bottom
=
{
bottom
}
img
=
{
item
.
course_img_small
}
title
=
{
item
.
course_title
}
id
=
{
item
.
course_id
}
toDetail
=
{
toDetail
}
className
=
'text-overflow-2'
/>
)
})
}
...
...
@@ -314,7 +334,4 @@ function ScrollBox(props) {
}
export
default
connect
(
state
=>
({
user
:
state
.
user
}),
null
)(
WithTab
(
Index
))
export
default
WithTab
(
Index
);
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