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
55fd03cc
Commit
55fd03cc
authored
Feb 05, 2025
by
zhengxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(custom): 新增首页
parent
631af7bf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
234 additions
and
1 deletions
+234
-1
course-block.vue
src/components/course-block.vue
+206
-0
pages.json
src/pages.json
+28
-1
home.vue
src/pages/home/home.vue
+0
-0
No files found.
src/components/course-block.vue
0 → 100644
View file @
55fd03cc
<
template
>
<view
class=
"section-block"
>
<view
class=
"block-header"
>
<view
class=
"left"
>
<text
class=
"title"
>
{{
title
}}
</text>
<text
class=
"desc"
>
{{
subtitle
}}
</text>
</view>
<view
class=
"study-count"
>
{{
studyCount
}}
万人已学习
</view>
</view>
<view
class=
"course-list"
>
<view
class=
"course-item"
v-for=
"(item, index) in showCourseList"
:key=
"index"
>
<image
class=
"course-img"
:src=
"item.image || '/static/images/course-placeholder.png'"
mode=
"aspectFill"
/>
<view
class=
"course-info"
>
<view
class=
"course-title"
>
{{
item
.
title
}}
</view>
<view
class=
"course-desc"
>
{{
item
.
desc
}}
</view>
<view
class=
"course-meta"
>
<text
class=
"enroll-count"
>
{{
item
.
enrollCount
}}
人已报名
</text>
<button
class=
"study-btn"
>
去学习
</button>
</view>
</view>
</view>
</view>
<view
v-if=
"courseList.length > 2"
class=
"show-more"
@
tap=
"toggleShowMore"
>
<text>
{{
isExpanded
?
'收起合集'
:
'展开更多'
}}
</text>
<text
:class=
"['arrow', isExpanded ? 'up' : '']"
>
∨
</text>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'CourseBlock'
,
props
:
{
title
:
{
type
:
String
,
required
:
true
},
subtitle
:
{
type
:
String
,
required
:
true
},
studyCount
:
{
type
:
Number
,
required
:
true
},
courseList
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
data
()
{
return
{
isExpanded
:
false
}
},
computed
:
{
showCourseList
()
{
return
this
.
isExpanded
?
this
.
courseList
:
this
.
courseList
.
slice
(
0
,
2
)
}
},
methods
:
{
toggleShowMore
()
{
this
.
isExpanded
=
!
this
.
isExpanded
}
}
}
</
script
>
<
style
lang=
"scss"
>
.section-block
{
margin
:
20
rpx
;
padding
:
30
rpx
;
background
:
#fff
;
border-radius
:
16
rpx
;
.block-header
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
flex-start
;
margin-bottom
:
24
rpx
;
.left
{
.title
{
font-size
:
32
rpx
;
font-weight
:
500
;
color
:
#333
;
margin-bottom
:
8
rpx
;
display
:
block
;
}
.desc
{
font-size
:
24
rpx
;
color
:
#999
;
}
}
.study-count
{
font-size
:
24
rpx
;
color
:
#999
;
background
:
#F5F6F8
;
padding
:
8
rpx
16
rpx
;
border-radius
:
20
rpx
;
}
}
.course-list
{
.course-item
{
display
:
flex
;
padding
:
24
rpx
0
;
border-bottom
:
1
rpx
solid
#EBEDF0
;
&:last-child
{
border-bottom
:
none
;
}
.course-img
{
width
:
160
rpx
;
height
:
160
rpx
;
border-radius
:
12
rpx
;
margin-right
:
20
rpx
;
background
:
#F5F6F8
;
}
.course-info
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-between
;
.course-title
{
font-size
:
28
rpx
;
font-weight
:
500
;
color
:
#333
;
margin-bottom
:
8
rpx
;
}
.course-desc
{
font-size
:
24
rpx
;
color
:
#999
;
margin-bottom
:
20
rpx
;
}
.course-meta
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
.enroll-count
{
font-size
:
24
rpx
;
color
:
#999
;
display
:
flex
;
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
{
font-size
:
26
rpx
;
color
:
#666
;
background
:
#F5F6F8
;
padding
:
8
rpx
24
rpx
;
border-radius
:
24
rpx
;
border
:
none
;
}
}
}
}
}
.show-more
{
text-align
:
center
;
padding-top
:
20
rpx
;
font-size
:
26
rpx
;
color
:
#999
;
.arrow
{
margin-left
:
8
rpx
;
font-size
:
20
rpx
;
display
:
inline-block
;
transition
:
transform
0.3s
ease
;
&.up
{
transform
:
rotate
(
180deg
);
}
}
}
}
</
style
>
\ No newline at end of file
src/pages.json
View file @
55fd03cc
...
...
@@ -4,6 +4,14 @@
},
"pages"
:
[
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTextStyle"
:
"black"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/my/my"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
...
...
@@ -45,6 +53,25 @@
"navigationBarBackgroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#ffffff"
,
"backgroundTextStyle"
:
"dark"
},
"tabBar"
:
{
"color"
:
"#76787C"
,
"selectedColor"
:
"#55B5F3"
,
"iconWidth"
:
"24px"
,
"spacing"
:
"9px"
,
"list"
:
[
{
"pagePath"
:
"pages/home/home"
,
"text"
:
"首页"
,
"iconPath"
:
"/static/tab_home.png"
,
"selectedIconPath"
:
"/static/tab_home_selected.png"
},
{
"text"
:
"我的"
,
"pagePath"
:
"pages/my/my"
,
"iconPath"
:
"/static/tab_my.png"
,
"selectedIconPath"
:
"/static/tab_my_selected.png"
}
]
}
}
src/pages/home/home.vue
0 → 100644
View file @
55fd03cc
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