|
|
@ -40,8 +40,9 @@ |
|
|
<view class="course-title">课程</view> |
|
|
<view class="course-title">课程</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="course-list"> |
|
|
<view class="course-list"> |
|
|
|
|
|
<!-- 限制在做多五個課程 --> |
|
|
<view |
|
|
<view |
|
|
v-for="(course, index) in courseList.records" |
|
|
|
|
|
|
|
|
v-for="(course, index) in courseList.records.slice(0, 5)" |
|
|
@click="startLearning(course.id)" |
|
|
@click="startLearning(course.id)" |
|
|
:key="index" |
|
|
:key="index" |
|
|
class="course-item" |
|
|
class="course-item" |
|
|
@ -54,7 +55,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="course-footer"> |
|
|
<view class="course-footer"> |
|
|
<view class="course-total">全部课程 · {{ courseList.total }}节</view> |
|
|
|
|
|
|
|
|
<view class="course-total" @click="showAllCoursePopup">全部课程 · {{ courseList.total }}节</view> |
|
|
<uv-icon name="arrow-right" size="24rpx" color="#999"></uv-icon> |
|
|
<uv-icon name="arrow-right" size="24rpx" color="#999"></uv-icon> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -110,6 +111,40 @@ |
|
|
<uv-safe-bottom></uv-safe-bottom> |
|
|
<uv-safe-bottom></uv-safe-bottom> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 全部課程彈出窗 --> |
|
|
|
|
|
<uv-popup |
|
|
|
|
|
mode="bottom" |
|
|
|
|
|
ref="allCoursePopup" |
|
|
|
|
|
round="32rpx" |
|
|
|
|
|
bg-color="#f8f8f8" |
|
|
|
|
|
> |
|
|
|
|
|
<view class="course-popup"> |
|
|
|
|
|
<view class="popup-header"> |
|
|
|
|
|
<view> |
|
|
|
|
|
<uv-icon name="arrow-down" color="black" size="20"></uv-icon> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="popup-title">全部课程</view> |
|
|
|
|
|
<view class="popup-title" @click="toggleCourseSort"> |
|
|
|
|
|
倒序 |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="course-list"> |
|
|
|
|
|
<view |
|
|
|
|
|
v-for="(course, index) in displayAllCourseList" |
|
|
|
|
|
:key="course.id" |
|
|
|
|
|
class="course-item" |
|
|
|
|
|
@click="startLearning(course.id)" |
|
|
|
|
|
> |
|
|
|
|
|
<view class="course-number">{{ String(course.index || index + 1).padStart(2, '0') }}</view> |
|
|
|
|
|
<view class="course-content"> |
|
|
|
|
|
<view class="course-english">{{ course.english }}</view> |
|
|
|
|
|
<view class="course-chinese">{{ course.chinese }}</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</uv-popup> |
|
|
|
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -128,7 +163,16 @@ export default { |
|
|
id: '', |
|
|
id: '', |
|
|
courseList: [ |
|
|
courseList: [ |
|
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
allCourseList: [], // 全部課程列表 |
|
|
|
|
|
isCourseSortReversed: false, // 課程排序是否倒序 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
computed: { |
|
|
|
|
|
// 顯示的全部課程列表(支持倒序) |
|
|
|
|
|
displayAllCourseList() { |
|
|
|
|
|
const list = this.allCourseList.length > 0 ? this.allCourseList : this.courseList.records || []; |
|
|
|
|
|
return this.isCourseSortReversed ? [...list].reverse() : list; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
@ -173,8 +217,20 @@ export default { |
|
|
}) |
|
|
}) |
|
|
if (courseRes.code === 200){ |
|
|
if (courseRes.code === 200){ |
|
|
this.courseList = courseRes.result |
|
|
this.courseList = courseRes.result |
|
|
|
|
|
// 同時設置全部課程列表 |
|
|
|
|
|
this.allCourseList = courseRes.result.records || [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 顯示全部課程彈出窗 |
|
|
|
|
|
showAllCoursePopup() { |
|
|
|
|
|
this.$refs.allCoursePopup.open() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 切換課程排序 |
|
|
|
|
|
toggleCourseSort() { |
|
|
|
|
|
this.isCourseSortReversed = !this.isCourseSortReversed |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
onLoad(options) { |
|
|
onLoad(options) { |
|
|
if (options.id){ |
|
|
if (options.id){ |
|
|
@ -380,6 +436,91 @@ export default { |
|
|
.course-total { |
|
|
.course-total { |
|
|
font-size: 24rpx; |
|
|
font-size: 24rpx; |
|
|
color: #999; |
|
|
color: #999; |
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 课程弹出窗样式 */ |
|
|
|
|
|
.course-popup { |
|
|
|
|
|
padding: 0 32rpx; |
|
|
|
|
|
max-height: 80vh; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.popup-header { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
padding: 20rpx 0; |
|
|
|
|
|
border-bottom: 2rpx solid #EEEEEE |
|
|
|
|
|
// margin-bottom: 40rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.popup-title { |
|
|
|
|
|
font-family: PingFang SC; |
|
|
|
|
|
font-weight: 500; |
|
|
|
|
|
font-size: 34rpx; |
|
|
|
|
|
color: #181818; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.course-list { |
|
|
|
|
|
max-height: 60vh; |
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.course-item { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
gap: 24rpx; |
|
|
|
|
|
padding-top: 24rpx; |
|
|
|
|
|
padding-right: 8rpx; |
|
|
|
|
|
padding-bottom: 24rpx; |
|
|
|
|
|
padding-left: 8rpx; |
|
|
|
|
|
|
|
|
|
|
|
border-bottom: 1px solid #EEEEEE; |
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
|
|
|
|
&:last-child { |
|
|
|
|
|
border-bottom: none; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.course-number { |
|
|
|
|
|
width: 80rpx; |
|
|
|
|
|
font-family: PingFang SC; |
|
|
|
|
|
// font-weight: 400; |
|
|
|
|
|
font-size: 36rpx; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
&.highlight { |
|
|
|
|
|
color: $primary-color; |
|
|
|
|
|
} |
|
|
|
|
|
// margin-right: 24rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.course-content { |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.course-english { |
|
|
|
|
|
font-family: PingFang SC; |
|
|
|
|
|
font-weight: 600; |
|
|
|
|
|
font-size: 36rpx; |
|
|
|
|
|
line-height: 44rpx; |
|
|
|
|
|
color: #252545; |
|
|
|
|
|
margin-bottom: 8rpx; |
|
|
|
|
|
|
|
|
|
|
|
&.highlight { |
|
|
|
|
|
color: $primary-color; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.course-chinese { |
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
line-height: 48rpx; |
|
|
|
|
|
color: #3B3D3D; |
|
|
|
|
|
&.highlight { |
|
|
|
|
|
color: $primary-color; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 简介部分 */ |
|
|
/* 简介部分 */ |
|
|
|