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
9151ad2c
Commit
9151ad2c
authored
Mar 13, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'limit-free' into dev
parents
e6264056
2b111921
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
src/components/Index/index.js
+27
-8
No files found.
src/components/Index/index.js
View file @
9151ad2c
...
@@ -69,10 +69,17 @@ class Index extends Component {
...
@@ -69,10 +69,17 @@ class Index extends Component {
http
.
get
(
`
${
API
.
home
}
/m/home`
).
then
((
res
)
=>
{
http
.
get
(
`
${
API
.
home
}
/m/home`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
const
{
data
}
=
res
.
data
||
{}
const
{
data
}
=
res
.
data
||
{}
const
modules
=
Array
.
isArray
(
data
.
modules
)
?
data
.
modules
:
[]
modules
.
forEach
(
item
=>
{
if
(
item
.
name
===
'限时免费'
)
{
item
.
showMoreButon
=
item
.
list
.
length
&&
item
.
list
.
length
>
4
item
.
list
=
item
.
list
.
slice
(
0
,
4
)
}
})
this
.
setState
({
this
.
setState
({
banner
:
data
.
banner
,
banner
:
data
.
banner
,
lives
:
data
.
lives
,
lives
:
data
.
lives
,
modules
:
typeof
data
.
modules
===
'object'
&&
data
.
modules
.
length
>
0
?
data
.
modules
:
[]
modules
})
})
}
else
{
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
Toast
.
info
(
res
.
data
.
msg
,
2
)
...
@@ -217,15 +224,23 @@ class Index extends Component {
...
@@ -217,15 +224,23 @@ class Index extends Component {
// 课程模块儿公共组件
// 课程模块儿公共组件
// 课程数量是奇数第一个课程需要横着展示沾满一行,课程数量是偶数一行显示两个
// 课程数量是奇数第一个课程需要横着展示沾满一行,课程数量是偶数一行显示两个
function
CourseList
({
modules
,
toDetail
})
{
function
CourseList
({
modules
,
toDetail
})
{
let
filterList
=
[]
let
isOdd
=
modules
.
list
.
length
%
2
===
0
let
isOdd
=
modules
.
list
.
length
%
2
===
0
// 数量为奇数时,第一个课程显示大图(如后台未上传,前台显示小图),课程数量为偶数时,均显示小图
let
filterList
=
''
if
(
isOdd
)
{
if
(
modules
.
name
===
'限时免费'
)
{
filterList
=
modules
.
list
filterList
=
modules
.
list
}
else
{
}
else
{
filterList
=
modules
.
list
[
0
].
course_img
===
modules
.
list
[
0
].
course_img_small
?
modules
.
list
:
modules
.
list
.
slice
(
1
)
// 数量为奇数时,第一个课程显示大图(如后台未上传,前台显示小图),课程数量为偶数时,均显示小图
if
(
isOdd
)
{
filterList
=
modules
.
list
}
else
{
filterList
=
modules
.
list
[
0
].
course_img
===
modules
.
list
[
0
].
course_img_small
?
modules
.
list
:
modules
.
list
.
slice
(
1
)
}
}
}
return
(
return
(
<
div
className
=
'category'
>
<
div
className
=
'category'
>
<
h2
className
=
"title"
>
<
h2
className
=
"title"
>
...
@@ -240,13 +255,17 @@ function CourseList({modules, toDetail}) {
...
@@ -240,13 +255,17 @@ function CourseList({modules, toDetail}) {
<
Link
className
=
"more"
to
=
'/classify'
>
更多
><
/Link
>
<
Link
className
=
"more"
to
=
'/classify'
>
更多
><
/Link
>
}
}
{
{
modules
.
show_more
===
2
&&
modules
.
show_more
===
2
?
<
Link
className
=
"more"
to
=
{
modules
.
name
===
'限时免费'
?
'/free'
:
modules
.
more_page
}
>
更多
><
/Link
>
modules
.
name
===
'限时免费'
?
modules
.
showMoreButon
&&
<
Link
className
=
"more"
to
=
{
'/free'
}
>
更多
><
/Link
>
:
<
Link
className
=
"more"
to
=
{
modules
.
more_page
}
>
更多
><
/Link
>
:
null
}
}
<
LazyLoad
offset
=
{
50
}
>
<
LazyLoad
offset
=
{
50
}
>
<
ul
className
=
'index-course-detail'
>
<
ul
className
=
'index-course-detail'
>
{
{
!
isOdd
&&
modules
.
list
[
0
].
course_img
!==
modules
.
list
[
0
].
course_img_small
&&
modules
.
name
!==
'限时免费'
&&
!
isOdd
&&
modules
.
list
[
0
].
course_img
!==
modules
.
list
[
0
].
course_img_small
&&
<
div
className
=
"category-vip"
onClick
=
{()
=>
toDetail
(
modules
.
list
[
0
].
course_id
)}
>
<
div
className
=
"category-vip"
onClick
=
{()
=>
toDetail
(
modules
.
list
[
0
].
course_id
)}
>
<
img
src
=
{
modules
.
list
[
0
].
course_img
}
alt
=
""
/>
<
img
src
=
{
modules
.
list
[
0
].
course_img
}
alt
=
""
/>
<
/div
>
<
/div
>
...
...
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