Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d810afc7
authored
Mar 23, 2026
by
Lin
Committed by
chenwq1
Apr 01, 2026
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 学习中心推荐课程模块开发
1 parent
49348141
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
480 additions
and
4 deletions
api/module/common.js
assets/images/common/icon-group-person.png
env.js
pages/common/studyCenter/components/CompletedCourse.vue
pages/common/studyCenter/components/RecommendClass.vue
pages/common/studyCenter/myCourse.vue
api/module/common.js
View file @
d810afc
...
@@ -523,6 +523,14 @@ module.exports = {
...
@@ -523,6 +523,14 @@ module.exports = {
...
data
...
data
})
})
},
},
// 新 学习中心 - 推荐课程
getRecommendCourseList
(
data
)
{
return
http
.
post
({
method
:
'dj.api.pad.learning.center.myself.course.recommend'
,
projectName
:
'pad'
,
...
data
})
},
// 新 学习中心 - 查询考试分页接口
// 新 学习中心 - 查询考试分页接口
getExamPage
(
data
)
{
getExamPage
(
data
)
{
return
http
.
post
({
return
http
.
post
({
...
...
assets/images/common/icon-group-person.png
0 → 100644
View file @
d810afc
10.5 KB
env.js
View file @
d810afc
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
index
=
1
const
index
=
2
/**
/**
*
*
0本地
0本地
...
...
pages/common/studyCenter/components/CompletedCourse.vue
View file @
d810afc
...
@@ -91,7 +91,7 @@ export default {
...
@@ -91,7 +91,7 @@ export default {
pageSize
pageSize
}
}
const
res
=
await
uni
.
$api
.
commonApi
.
getMyCourseList
(
params
)
const
res
=
await
uni
.
$api
.
commonApi
.
getMyCourseList
(
params
)
console
.
log
(
"已完成课程"
,
res
);
if
(
pageNum
==
1
)
{
if
(
pageNum
==
1
)
{
this
.
completedCourseList
=
res
.
list
this
.
completedCourseList
=
res
.
list
}
else
{
}
else
{
...
...
pages/common/studyCenter/components/RecommendClass.vue
0 → 100644
View file @
d810afc
<!-- 学习中心首页 - 正在学习 -->
<
template
>
<view
class=
"task-box"
>
<scroll-view
scroll-y
ref=
"scrollViewRef"
:scroll-top=
"scrollTop"
@
scrolltolower=
"pageonReachBottom"
class=
"task-list-box"
>
<template
v-if=
"taskList.length"
>
<view
class=
"task-list"
>
<view
class=
"task-item"
v-for=
"(item, index) in taskList"
:key=
"index"
@
click=
"handleTaskItemClick(item, index)"
>
<!-- 左上角:必修/选修标签 -->
<template
v-if=
"item.planCourseType"
>
<image
class=
"course-tag-left"
:src=
"item.planCourseType == 1 ? require('@/assets/images/studyCenter/Required.png') : require('@/assets/images/studyCenter/Elective.png')"
mode=
"aspectFit"
/>
</
template
>
<!-- 右上角:文档/视频标签 -->
<view
class=
"course-tag-right"
v-if=
"item.courseFileType"
>
<text
class=
"tag-text"
>
{{ COURSE_TYPE[item.courseFileType].name}}
</text>
</view>
<image
class=
"task-item-img"
:src=
"require(`@/assets/images/common/${COURSE_TYPE[item.courseFileType].image}.webp`)"
mode=
"aspectFill"
/>
<view
class=
"task-item-content"
>
<view
class=
"task-item-title"
>
{{ item.title }}
</view>
<view
class=
"task-item-text"
>
<view
class=
"task-item-label"
>
课程时长
</view>
<view
class=
"task-item-value"
>
{{ (item.totalDuration || item.totalDuration === 0) ? `${item.totalDuration}min` : '-' }}
</view>
</view>
<view
class=
"task-item-text task-item-text-rate"
>
<u-rate
:count=
"5"
v-model=
"item.totalStar"
active-color=
"#FFB642"
inactive-color=
"#E0E0E0"
></u-rate>
<view
class=
"task-item-score"
>
{{item.totalStar}}
</view>
</view>
<view
class=
"task-item-text"
>
<image
class=
"task-item-student-icon"
:src=
"require('@/assets/images/common/icon-group-person.png')"
mode=
"aspectFit"
/>
<view
class=
"task-item-student"
>
{{item.learnTotal}}人已学习
</view>
</view>
</view>
</view>
</view>
</template>
<
template
v-else
>
<view
class=
"nothing flex"
>
<image
class=
"icon"
src=
"../../../../assets/images/common/noData.png"
/>
暂无数据
</view>
</
template
>
<
template
v-if=
"nothing"
>
<view
class=
"end-text"
>
到底了!
</view>
</
template
>
</scroll-view>
</view>
</template>
<
script
>
const
COURSE_TYPE
=
{
10
:
{
name
:
'视频'
,
image
:
'short-course-default'
},
80
:
{
name
:
'音频'
,
image
:
'course-default-bg'
},
20
:
{
name
:
'混合'
,
image
:
'short-course-default'
},
30
:
{
name
:
'文档'
,
image
:
'course-default-bg'
},
40
:
{
name
:
'H5'
,
image
:
'course-default-bg'
},
70
:
{
name
:
'URL'
,
image
:
'course-default-bg'
},
120
:
{
name
:
'图文'
,
image
:
'course-default-bg'
}
}
import
dayjs
from
'dayjs'
export
default
{
name
:
'MyTask'
,
data
()
{
return
{
finishIndex
:
2
,
nothing
:
false
,
total
:
0
,
pageNum
:
1
,
pageSize
:
12
,
scrollTop
:
0
,
taskList
:
[],
COURSE_TYPE
}
},
mounted
()
{
this
.
getCourseTaskPage
(
this
.
tabIndex
)
},
beforeDestroy
()
{
// 移除事件监听,防止内存泄漏
uni
.
$off
&&
uni
.
$off
(
'backStudyCenter'
);
},
methods
:
{
// 格式化时间
formatTime
(
time
,
formatStr
)
{
if
(
!
time
)
return
'-'
;
return
dayjs
(
time
).
format
(
formatStr
);
},
// 获取正在学习接口, learnStatus: 1, // 学习状态 0:待学习 1: 正在学习 2:已学完
async
getCourseTaskPage
()
{
try
{
uni
.
showLoading
({
mask
:
true
})
const
{
pageNum
,
pageSize
}
=
this
const
params
=
{
pageNum
,
pageSize
}
const
res
=
await
uni
.
$api
.
commonApi
.
getRecommendCourseList
(
params
)
console
.
log
(
"RES"
,
res
);
let
newList
=
res
.
list
||
[];
if
(
pageNum
==
1
)
{
this
.
taskList
=
newList
}
else
{
this
.
taskList
=
this
.
taskList
.
concat
(
newList
)
}
uni
.
hideLoading
()
this
.
total
=
res
.
total
this
.
nothing
=
res
.
length
?
true
:
false
}
catch
(
error
)
{
uni
.
showToast
({
title
:
error
,
icon
:
"none"
,
});
}
},
pageonReachBottom
()
{
console
.
log
(
'到底了'
);
// 解构赋值,设置 nothing 的默认值
let
{
pageNum
,
total
,
pageSize
,
tabIndex
,
finishIndex
}
=
this
;
if
(
Math
.
ceil
(
total
/
pageSize
)
>
pageNum
)
{
this
.
pageNum
+=
1
;
if
(
tabIndex
==
0
)
{
this
.
getCourseTaskPage
()
}
else
{
this
.
getCourseTaskPage
()
}
}
else
{
this
.
nothing
=
true
;
}
},
handleTaskItemClick
(
item
,
index
)
{
console
.
log
(
item
)
const
beisenToken
=
uni
.
$storage
.
get
(
'beisenToken'
)
if
(
!
beisenToken
)
{
uni
.
showToast
({
title
:
'培训账号未创建'
,
icon
:
'none'
})
return
}
let
{
pageNum
,
total
,
nothing
=
'nothing'
,
pageSize
}
=
this
;
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni
.
navigateTo
({
url
:
`/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=
${
index
}
&courseList=
${
encodeURIComponent
(
JSON
.
stringify
(
this
.
taskList
))}
&pageNum=
${
pageNum
}
&pageSize=
${
pageSize
}
&total=
${
total
}
&learnStatus=1`
})
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.task-box
{
height
:
100%
;
}
.tab-list
{
display
:
flex
;
width
:
toRpx
(
436
);
height
:
toRpx
(
80
);
background-color
:
#F5F6F7
;
border-radius
:
toRpx
(
16
);
color
:
#666666
;
font-size
:
toRpx
(
28
);
.tab-item
{
box-sizing
:
border-box
;
display
:
flex
;
flex
:
1
;
align-items
:
center
;
justify-content
:
center
;
margin
:
toRpx
(
6
);
&.active
{
background-color
:
#fff
;
color
:
#1A1A1A
;
border-radius
:
toRpx
(
10
);
font-weight
:
600
;
}
}
}
.tips
{
display
:
flex
;
align-items
:
center
;
padding
:
toRpx
(
8
)
toRpx
(
22
);
background-color
:
rgba
(
255
,
243
,
224
,
0.8
);
border-radius
:
toRpx
(
8
);
font-size
:
toRpx
(
24
);
color
:
#FF9D0A
;
height
:
toRpx
(
48
);
margin
:
toRpx
(
24
)
toRpx
(
40
)
0
;
&-text
{
margin-top
:
toRpx
(
4
);
}
.icon-study-tips
{
margin-right
:
toRpx
(
8
);
}
}
.tab-box
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
margin
:
0
toRpx
(
40
);
}
.finish-tab
{
display
:
flex
;
&-item
{
width
:
toRpx
(
148
);
height
:
toRpx
(
64
);
border-radius
:
toRpx
(
48
);
background
:
#f2f2f2
;
color
:
#666666
;
font-size
:
toRpx
(
28
);
line-height
:
toRpx
(
68
);
text-align
:
center
;
margin-right
:
toRpx
(
16
);
&:last-child
{
margin-right
:
0
;
}
&
.finish-active
{
background
:
#2d66f71
a
;
font-weight
:
500
;
color
:
#2D66F7
;
}
}
}
.task-list-box
{
margin-top
:
toRpx
(
40
);
height
:
100%
;
}
.task-finish-box
{
margin-top
:
toRpx
(
24
);
height
:
calc
(
100%
-
#{
toRpx
(
138
)}
);
}
.task-list
{
display
:
grid
;
grid-template-columns
:
repeat
(
4
,
1
fr
);
gap
:
toRpx
(
32
);
padding
:
0
toRpx
(
64
);
.task-item
{
position
:
relative
;
width
:
100%
;
//
height
:
toRpx
(
432
);
background-color
:
#fff
;
border-radius
:
toRpx
(
24
);
font-size
:
0
;
box-shadow
:
0
toRpx
(
8
)
toRpx
(
24
)
0
#2a61eb1
a
;
//
左上角标签
.course-tag-left
{
position
:
absolute
;
left
:
0
;
top
:
0
;
width
:
toRpx
(
94
);
height
:
toRpx
(
48
);
border-radius
:
toRpx
(
24
)
0
toRpx
(
24
)
0
;
z-index
:
2
;
}
//
右上角标签
.course-tag-right
{
position
:
absolute
;
right
:
toRpx
(
16
);
top
:
toRpx
(
16
);
width
:
toRpx
(
72
);
height
:
toRpx
(
40
);
border-radius
:
toRpx
(
4
);
background
:
rgba
(
0
,
0
,
0
,
0.35
);
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
z-index
:
2
;
.tag-text
{
width
:
toRpx
(
48
);
height
:
toRpx
(
36
);
color
:
#ffffff
;
font-size
:
toRpx
(
24
);
font-weight
:
400
;
font-family
:
"HarmonyOSSansSC"
;
text-align
:
center
;
line-height
:
toRpx
(
36
);
}
}
.task-item-img
{
width
:
100%
;
height
:
toRpx
(
180
);
border-radius
:
toRpx
(
24
)
toRpx
(
24
)
0
0
;
}
.task-item-content
{
padding
:
toRpx
(
32
);
width
:
toRpx
(
530
)
!important
;
}
.task-item-title
{
font-size
:
toRpx
(
30
);
color
:
#292D33
;
font-weight
:
500
;
margin-bottom
:
toRpx
(
24
);
//
width
:
toRpx
(
340
);
display
:
-webkit-box
;
-webkit-line-clamp
:
1
;
line-clamp
:
1
;
-webkit-box-orient
:
vertical
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
word-break
:
break-all
;
}
.task-item-text
{
position
:
relative
;
display
:
flex
;
align-items
:
center
;
font-size
:
toRpx
(
24
);
margin-bottom
:
toRpx
(
24
);
&:last-child
{
margin-bottom
:
0
;
}
.task-item-label
{
width
:
toRpx
(
96
);
color
:
#999EA8
;
margin-right
:
toRpx
(
24
);
}
.task-item-student-icon
{
width
:
toRpx
(
32
);
//
设计
16px
height
:
toRpx
(
32
);
//
设计
16px
margin-right
:
toRpx
(
8
);
}
.task-item-student
{
color
:
#999EA8
;
font-size
:
toRpx
(
24
);
font-weight
:
400
;
font-family
:
"HarmonyOSSansSC"
;
line-height
:
toRpx
(
36
);
}
.task-item-value
{
color
:
#666666
;
display
:
inline-flex
;
align-items
:
center
;
justify-content
:
center
;
.dot-value
{
width
:
toRpx
(
12
);
height
:
toRpx
(
12
);
border-radius
:
50%
;
background
:
#2CCA74
;
margin-right
:
toRpx
(
8
);
}
.green
{
color
:
#2CCA74
;
}
}
.task-item-score
{
color
:
#666666
;
font-size
:
14px
;
font-weight
:
400
;
margin-left
:
toRpx
(
8
);
display
:
flex
;
align-items
:
center
;
line-height
:
1
;
}
}
.task-item-text-rate
{
align-items
:
center
;
}
.task-item-progress
{
width
:
toRpx
(
288
);
height
:
toRpx
(
16
);
background
:
linear-gradient
(
128.8deg
,
rgba
(
117
,
188
,
255
,
.35
)
0%
,
rgba
(
44
,
102
,
247
,
.35
)
100%
);
border-radius
:
toRpx
(
8
);
.task-item-progress-text
{
color
:
#3B73FF
;
font-size
:
toRpx
(
24
);
position
:
absolute
;
top
:
50%
;
right
:
0
;
transform
:
translateY
(
-50%
);
}
.task-item-progress-bar
{
height
:
100%
;
background
:
linear-gradient
(
128.8deg
,
#75bcff
0%
,
#2c66f7
100%
);
border-radius
:
toRpx
(
8
);
}
}
}
}
.nothing
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
height
:
toRpx
(
1000
);
color
:
#999999
;
font-size
:
toRpx
(
24
);
.icon
{
width
:
toRpx
(
344
);
height
:
toRpx
(
208
);
}
}
.end-text
{
color
:
#999
;
text-align
:
center
;
padding
:
toRpx
(
30
)
0
toRpx
(
50
);
font-size
:
toRpx
(
24
);
}
/
deep
/
{
.uni-scroll-view-content
{
height
:
calc
(
100%
-
#{
toRpx
(
20
)}
);
}
}
</
style
>
\ No newline at end of file
\ No newline at end of file
pages/common/studyCenter/myCourse.vue
View file @
d810afc
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
<Studying
v-else-if=
"currentTab === 1"
ref=
"studying"
:cardWidth=
"530"
/>
<Studying
v-else-if=
"currentTab === 1"
ref=
"studying"
:cardWidth=
"530"
/>
<!-- 已学完 tab:使用 CompletedCourse 组件 -->
<!-- 已学完 tab:使用 CompletedCourse 组件 -->
<CompletedCourse
v-else-if=
"currentTab === 2"
ref=
"completedCourse"
:cardWidth=
"530"
/>
<CompletedCourse
v-else-if=
"currentTab === 2"
ref=
"completedCourse"
:cardWidth=
"530"
/>
<!-- 推荐学习 tab:使用 CompletedCourse 组件 -->
<RecommendClass
v-else-if=
"currentTab === 3"
ref=
"completedCourse"
:cardWidth=
"530"
/>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -45,13 +47,15 @@
...
@@ -45,13 +47,15 @@
import
ToLearnCourse
from
'./components/ToLearnCourse.vue'
import
ToLearnCourse
from
'./components/ToLearnCourse.vue'
import
Studying
from
'./components/Studying.vue'
import
Studying
from
'./components/Studying.vue'
import
CompletedCourse
from
'./components/CompletedCourse.vue'
import
CompletedCourse
from
'./components/CompletedCourse.vue'
import
RecommendClass
from
'./components/RecommendClass.vue'
export
default
{
export
default
{
name
:
'MyCoursePage'
,
name
:
'MyCoursePage'
,
components
:
{
components
:
{
ToLearnCourse
,
ToLearnCourse
,
Studying
,
Studying
,
CompletedCourse
CompletedCourse
,
RecommendClass
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -59,7 +63,8 @@ export default {
...
@@ -59,7 +63,8 @@ export default {
tabList
:
[
tabList
:
[
{
label
:
'待学习'
,
count
:
'0'
,
key
:
'unLearnCount'
},
{
label
:
'待学习'
,
count
:
'0'
,
key
:
'unLearnCount'
},
{
label
:
'正在学习'
,
count
:
'0'
,
key
:
'learningCount'
},
{
label
:
'正在学习'
,
count
:
'0'
,
key
:
'learningCount'
},
{
label
:
'已学完'
,
count
:
'0'
,
key
:
'completedCount'
}
{
label
:
'已学完'
,
count
:
'0'
,
key
:
'completedCount'
},
{
label
:
'推荐学习'
,
count
:
'0'
,
key
:
'recommendCount'
}
],
],
residueInfo
:
{
residueInfo
:
{
remindType
:
0
remindType
:
0
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment