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
96638577
Commit
96638577
authored
May 27, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tem
parent
5ec341f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
104 deletions
+72
-104
src/common/Course/course.scss
+1
-0
src/components/study/freeCourses/index.js
+71
-97
src/components/study/myCourses/index.js
+0
-7
No files found.
src/common/Course/course.scss
View file @
96638577
...
...
@@ -7,6 +7,7 @@
img
{
width
:
100%
;
height
:
119px
;
min-height
:
119px
;
}
.course-title
{
...
...
src/components/study/freeCourses/index.js
View file @
96638577
import
React
from
'react'
import
React
,
{
PureComponent
}
from
'react'
import
{
Course
,
Tag
}
from
'../../../common'
import
{
api
}
from
'@/utils'
import
'./free-courses.scss'
const
mockData
=
[
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
{
tagText
:
'机器学习'
,
tagType
:
1
,
title
:
'16年度最火课程TOP10'
,
src
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
},
]
const
Bottom
=
(
props
)
=>
(
<
div
className
=
'bottom'
>
<
Tag
className
=
{
props
.
className
}
>
{
props
.
t
agT
ext
}
<
/Tag
>
<
Tag
className
=
{
props
.
className
}
>
{
props
.
text
}
<
/Tag
>
<
span
>
{
props
.
audience
}
人观看
<
/span
>
<
/div
>
)
class
FreeCourse
extends
PureComponent
{
state
=
{
courses
:
[],
live
:
[],
}
async
componentDidMount
()
{
api
.
get
(
'/m/free_course/1/10'
)
.
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
setState
({
courses
:
res
.
data
.
data
,
})
}
else
{
console
.
log
(
res
.
data
.
msg
)
}
})
api
.
get
(
'/m/live/free_list'
)
.
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
){
this
.
setState
({
live
:
res
.
data
.
data
})
}
})
}
const
FreeCourse
=
(
props
)
=>
{
return
(
<
ul
className
=
'free-courses'
>
{
mockData
.
map
((
item
,
index
)
=>
(
<
Course
data
=
{
item
}
top
=
{
<
Tag
className
=
{
'tag-starting top'
}
>
即将开始
<
/Tag
>
}
bottom
=
{
<
Bottom
audience
=
{
232
}
className
=
{
'tag-category'
}
tagText
=
{
item
.
tagText
}
><
/Bottom
>
}
key
=
{
index
}
>
<
/Course
>
))
}
<
/ul
>
)
render
()
{
return
(
<
ul
className
=
'free-courses'
>
{
this
.
state
.
courses
.
map
((
item
,
index
)
=>
(
<
Course
data
=
{{
src
:
item
.
logo
,
title
:
item
.
video_course_name
}}
top
=
{
<
Tag
className
=
{
'tag-starting top'
}
>
即将开始
<
/Tag
>
}
bottom
=
{
<
Bottom
audience
=
{
item
.
lessons
}
className
=
{
'tag-category'
}
text
=
{
item
.
category
}
/
>
}
key
=
{
index
}
>
<
/Course
>
))
}
{
/*this.state.live.map((item,index) => (
<Course
data={{
src: item.logo,
title: item.video_course_name
}}
top={
<Tag className={'tag-starting top'}>即将开始</Tag>
}
bottom={
<Bottom audience={item.lessons} className={'tag-category'} text={item.category}/>
}
key={index}
/>
))*/
}
<
/ul
>
)
}
}
export
default
FreeCourse
\ No newline at end of file
src/components/study/myCourses/index.js
View file @
96638577
...
...
@@ -58,13 +58,6 @@ export default class MyCourses extends PureComponent {
console
.
log
(
2
);
}
componentDidMount
()
{
api
.
get
(
'/m/free_course/1/10'
)
.
then
(
res
=>
{
console
.
log
(
res
)
})
}
render
()
{
if
(
mockData
.
length
!==
0
)
{
...
...
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