Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-group-course
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
黄志
ydl-group-course
Commits
615421ac
Commit
615421ac
authored
Feb 07, 2025
by
zhengxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(custom): 课程首页
parent
55fd03cc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
72 deletions
+87
-72
course-block.vue
src/components/course-block.vue
+87
-72
home.vue
src/pages/home/home.vue
+0
-0
No files found.
src/components/course-block.vue
View file @
615421ac
...
@@ -7,31 +7,35 @@
...
@@ -7,31 +7,35 @@
</view>
</view>
<view
class=
"study-count"
>
{{
studyCount
}}
万人已学习
</view>
<view
class=
"study-count"
>
{{
studyCount
}}
万人已学习
</view>
</view>
</view>
<view
class=
"course-list"
>
<view
class=
"course-list"
>
<view
<view
class=
"course-item"
v-for=
"(item, index) in showCourseList"
v-for=
"(item, index) in showCourseList"
:key=
"index"
:key=
"index"
class=
"course-item"
>
>
<image
<image
class=
"course-img"
class=
"course-img"
:src=
"item.image || '/static/images/course-placeholder.png'"
:src=
"item.image || '/static/images/course-placeholder.png'"
mode=
"aspectFill"
mode=
"aspectFill"
/>
/>
<view
class=
"course-info"
>
<view
class=
"course-info"
>
<view
class=
"course-title"
>
{{
item
.
title
}}
</view>
<view
class=
"course-title"
>
{{
item
.
title
}}
</view>
<view
class=
"course-desc"
>
{{
item
.
desc
}}
</view>
<view
class=
"course-desc"
>
{{
item
.
desc
}}
</view>
<view
class=
"course-meta"
>
<view
class=
"course-meta"
>
<text
class=
"enroll-count"
>
{{
item
.
enrollCount
}}
人已报名
</text>
<text
class=
"enroll-count"
>
{{
item
.
enrollCount
}}
人已报名
</text>
<button
class=
"study-btn"
>
去学习
</button>
<button
class=
"study-btn"
>
去学习
</button>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view
v-if=
"courseList.length > 2"
class=
"show-more"
@
tap=
"toggleShowMore"
>
<view
<text>
{{
isExpanded
?
'收起合集'
:
'展开更多'
}}
</text>
v-if=
"courseList.length > 2"
class=
"show-more"
@
tap=
"toggleShowMore"
>
<text>
{{
isExpanded
?
'收起'
:
'展开更多'
}}
</text>
<text
:class=
"['arrow', isExpanded ? 'up' : '']"
>
∨
</text>
<text
:class=
"['arrow', isExpanded ? 'up' : '']"
>
∨
</text>
</view>
</view>
</view>
</view>
...
@@ -43,141 +47,153 @@ export default {
...
@@ -43,141 +47,153 @@ export default {
props
:
{
props
:
{
title
:
{
title
:
{
type
:
String
,
type
:
String
,
required
:
true
required
:
true
,
},
},
subtitle
:
{
subtitle
:
{
type
:
String
,
type
:
String
,
required
:
true
required
:
true
,
},
},
studyCount
:
{
studyCount
:
{
type
:
Number
,
type
:
Number
,
required
:
true
required
:
true
,
},
},
courseList
:
{
courseList
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[]
default
:
()
=>
[]
,
}
}
,
},
},
data
()
{
data
()
{
return
{
return
{
isExpanded
:
false
isExpanded
:
false
,
}
}
},
},
computed
:
{
computed
:
{
showCourseList
()
{
showCourseList
()
{
return
this
.
isExpanded
?
this
.
courseList
:
this
.
courseList
.
slice
(
0
,
2
)
return
this
.
isExpanded
?
this
.
courseList
:
this
.
courseList
.
slice
(
0
,
2
)
}
}
,
},
},
methods
:
{
methods
:
{
toggleShowMore
()
{
toggleShowMore
()
{
this
.
isExpanded
=
!
this
.
isExpanded
this
.
isExpanded
=
!
this
.
isExpanded
}
}
,
}
}
,
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.section-block
{
.section-block
{
margin
:
20
r
px
;
margin
:
12
px
;
padding
:
30
r
px
;
padding
:
12px
10
px
;
background
:
#fff
;
background
:
#fff
;
border-radius
:
16
r
px
;
border-radius
:
16px
;
.block-header
{
.block-header
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
flex-start
;
align-items
:
center
;
margin-bottom
:
24
r
px
;
margin-bottom
:
16
px
;
.left
{
.left
{
.title
{
.title
{
font-size
:
32
rpx
;
color
:
#242424
;
font-weight
:
5
00
;
font-weight
:
6
00
;
color
:
#333
;
font-size
:
16px
;
margin-bottom
:
8
r
px
;
margin-bottom
:
1
px
;
display
:
block
;
display
:
block
;
line-height
:
22px
;
}
}
.desc
{
.desc
{
font-size
:
24
rpx
;
color
:
#999999
;
color
:
#999
;
font-weight
:
400
;
font-size
:
12px
;
line-height
:
17px
;
}
}
}
}
.study-count
{
.study-count
{
font-size
:
24
rpx
;
display
:
flex
;
color
:
#999
;
align-items
:
center
;
background
:
#F5F6F8
;
border-radius
:
13px
;
padding
:
8
rpx
16
rpx
;
background
:
linear-gradient
(
270deg
,
rgba
(
255
,
244
,
221
,
1
)
0%
,
rgba
(
255
,
255
,
255
,
0
)
100%
);
border-radius
:
20
rpx
;
color
:
#B5985F
;
font-weight
:
400
;
font-size
:
12px
;
padding
:
5px
10px
;
}
}
}
}
.course-list
{
.course-list
{
.course-item
{
.course-item
{
display
:
flex
;
display
:
flex
;
padding
:
24
rpx
0
;
margin-bottom
:
18px
;
border-bottom
:
1
rpx
solid
#EBEDF0
;
&:last-child
{
&:last-child
{
border-bottom
:
none
;
margin-bottom
:
0
;
}
}
.course-img
{
.course-img
{
width
:
160
r
px
;
width
:
64
px
;
height
:
160
r
px
;
height
:
79
px
;
border-radius
:
12
r
px
;
margin-right
:
8
px
;
margin-right
:
20
r
px
;
border-radius
:
4
px
;
background
:
#F5F6F
8
;
background
-color
:
#d8d8d
8
;
}
}
.course-info
{
.course-info
{
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
space-between
;
.course-title
{
.course-title
{
font-size
:
28
rpx
;
color
:
#000000
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#333
;
font-size
:
14px
;
margin-bottom
:
8
rpx
;
line-height
:
20px
;
//
单行
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
}
.course-desc
{
.course-desc
{
font-size
:
24
rpx
;
color
:
#000000
;
color
:
#999
;
font-weight
:
400
;
margin-bottom
:
20
rpx
;
font-size
:
12px
;
line-height
:
12px
;
margin-top
:
6px
;
//
单行
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
}
.course-meta
{
.course-meta
{
flex
:
1
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
center
;
align-items
:
flex-end
;
.enroll-count
{
.enroll-count
{
font-size
:
24
rpx
;
font-size
:
24
rpx
;
color
:
#999
;
color
:
#999
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
&::before
{
content
:
''
;
display
:
inline-block
;
width
:
24
rpx
;
height
:
24
rpx
;
//
background
:
url('/static/icons/user.png')
no-repeat
center
/
cover
;
margin-right
:
8
rpx
;
}
}
}
.study-btn
{
.study-btn
{
font-size
:
26
rpx
;
margin
:
0
;
color
:
#666
;
display
:
flex
;
background
:
#F5F6F8
;
align-items
:
center
;
padding
:
8
rpx
24
rpx
;
justify-content
:
center
;
border-radius
:
24
rpx
;
width
:
60px
;
border
:
none
;
height
:
25px
;
border-radius
:
12.5px
;
background-color
:
rgba
(
0
,
146
,
255
,
0.1
);
color
:
#0092FF
;
font-weight
:
500
;
font-size
:
12px
;
padding
:
0
;
}
}
}
}
}
}
...
@@ -195,11 +211,11 @@ export default {
...
@@ -195,11 +211,11 @@ export default {
font-size
:
20
rpx
;
font-size
:
20
rpx
;
display
:
inline-block
;
display
:
inline-block
;
transition
:
transform
0.3s
ease
;
transition
:
transform
0.3s
ease
;
&.up
{
&.up
{
transform
:
rotate
(
180deg
);
transform
:
rotate
(
180deg
);
}
}
}
}
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/pages/home/home.vue
View file @
615421ac
This diff is collapsed.
Click to expand it.
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