| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <view class="container">
- <!-- 顶部导航 Tab -->
- <view class="top-nav">
- <view class="nav-tabs">
- <view
- class="nav-item"
- :class="{ active: tabIndex === 0 }"
- @click="tabIndex = 0"
- >
- <text>精品课程</text>
- <view v-if="tabIndex === 0" class="nav-indicator"></view>
- </view>
- <view
- class="nav-item"
- :class="{ active: tabIndex === 1 }"
- @click="tabIndex = 1"
- >
- <text>最近学习</text>
- <view v-if="tabIndex === 1" class="nav-indicator"></view>
- </view>
- </view>
- <view class="nav-actions">
- <text class="action-icon">⋯</text>
- <text class="action-icon">⊙</text>
- </view>
- </view>
- <!-- 精品课程 内容 -->
- <scroll-view v-show="tabIndex === 0" scroll-y class="scroll-wrap" :show-scrollbar="false">
- <!-- 分类标签区 -->
- <view class="category-wrap">
- <view class="category-tags" :class="{ collapsed: !categoryExpand }">
- <view
- v-for="(cat, idx) in categories"
- :key="idx"
- class="tag-item"
- :class="{ active: categoryIndex === idx }"
- @click="categoryIndex = idx"
- >
- <text>{{ cat }}</text>
- </view>
- </view>
- <view class="expand-btn" @click="categoryExpand = !categoryExpand">
- <text>{{ categoryExpand ? '收起' : '展开' }}</text>
- <text class="arrow">{{ categoryExpand ? '▲' : '▼' }}</text>
- </view>
- </view>
- <!-- 课程网格 -->
- <view class="course-grid">
- <view
- v-for="(course, idx) in courseList"
- :key="idx"
- class="course-card"
- @click="onCourseClick(course)"
- >
- <view class="card-cover">
- <image :src="course.cover || 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png'" mode="aspectFill" class="cover-img"></image>
- </view>
- <text class="card-title">{{ course.title }}</text>
- <view class="card-footer">
- <text class="card-views"> {{ course.views }}</text>
- <view class="btn-watch" @click.stop="onCourseClick(course)">立即观看</view>
- </view>
- </view>
- </view>
- <view class="bottom-placeholder"></view>
- </scroll-view>
- <!-- 最近学习 内容 -->
- <scroll-view v-show="tabIndex === 1" scroll-y class="scroll-wrap" :show-scrollbar="false">
- <!-- 有学习记录:按日期分组列表 -->
- <template v-if="recentList.length > 0">
- <view v-for="(group, gIdx) in recentList" :key="gIdx" class="recent-group">
- <view class="group-date">
- <text class="date-icon"></text>
- <text class="date-text">{{ group.date }}</text>
- </view>
- <view
- v-for="(item, i) in group.list"
- :key="i"
- class="recent-card"
- @click="onCourseClick(item)"
- >
- <view class="recent-thumb">
- <image :src="item.cover || 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png'" mode="aspectFill" class="thumb-img"></image>
- </view>
- <view class="recent-info">
- <text class="recent-title">{{ item.title }}</text>
- <text class="recent-progress">已学: {{ item.progress }}%</text>
- <view class="btn-watch" @click.stop="onCourseClick(item)">立即观看</view>
- </view>
- </view>
- </view>
- </template>
- <!-- 无学习记录:空态 + 为您精选 -->
- <template v-else>
- <view class="empty-state">
- <view class="empty-icon"></view>
- <text class="empty-text">暂无学习内容</text>
- </view>
- <view class="recommend-section">
- <text class="recommend-title">为您精选</text>
- <view class="course-grid">
- <view
- v-for="(course, idx) in recommendList"
- :key="idx"
- class="course-card"
- @click="onCourseClick(course)"
- >
- <view class="card-cover">
- <image :src="course.cover || 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png'" mode="aspectFill" class="cover-img"></image>
- </view>
- <text class="card-title">{{ course.title }}</text>
- <view class="card-footer">
- <text class="card-views"> {{ course.views }}</text>
- <view class="btn-watch" @click.stop="onCourseClick(course)">立即观看</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <view class="bottom-placeholder"></view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tabIndex: 0,
- categoryExpand: true,
- categoryIndex: 0,
- categories: ['全部', '歌唱艺术', '太极养生', '防骗指南', '手机摄影', '棋牌益智', '用药指导', '膳食营养', '慢病管理'],
- courseList: [
- { title: '刘金的《0基础金曲演唱速练课》', views: '9239', cover: '' },
- { title: '邹方斌讲《毛笔书法修心课》', views: '10.8w', cover: '' },
- { title: '张斌《元气八段锦》系列课', views: '2.5w', cover: '' },
- { title: '翔哥精讲摄影课—手机微距拍摄技巧...', views: '100w+', cover: '' },
- { title: '道家智慧 入门21讲', views: '1.2w', cover: '' },
- { title: '入门进阶必修 瑜伽呼吸全精讲', views: '3.6w', cover: '' }
- ],
- recentList: [
- {
- date: '2026-02-08',
- list: [
- { title: '歌唱家刘金的《0基础金曲演唱速练课》', progress: 87, cover: '' },
- { title: '资深编辑邹方斌讲《毛笔书法修心课》', progress: 56, cover: '' }
- ]
- },
- {
- date: '2026-02-01',
- list: [
- { title: '张斌《元气八段锦》系列课', progress: 56, cover: '' }
- ]
- }
- ],
- recommendList: [
- { title: '刘金的《0基础金曲演唱速练课》', views: '9239', cover: '' },
- { title: '邹方斌讲《毛笔书法修心课》', views: '10.8w', cover: '' },
- { title: '张斌《元气八段锦》系列课', views: '2.5w', cover: '' },
- { title: '翔哥精讲摄影课-手机微距拍摄技巧...', views: '100w+', cover: '' }
- ]
- }
- },
- onLoad() {
- // 若无最近学习,可置空 recentList 显示空态
- // this.recentList = [];
- },
- methods: {
- onCourseClick(course) {
- uni.showToast({ title: course.title || '立即观看', icon: 'none' })
- // uni.navigateTo({ url: '/pages_course/videovip?id=' + (course.id || '') })
- }
- }
- }
- </script>
- <style scoped>
- .container {
- min-height: 100vh;
- background: #fff;
- display: flex;
- flex-direction: column;
- }
- /* 顶部 Tab */
- .top-nav {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx 24rpx 20rpx;
- background: #fff;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .nav-tabs {
- display: flex;
- align-items: center;
- gap: 48rpx;
- }
- .nav-item {
- position: relative;
- padding: 8rpx 0;
- }
- .nav-item text {
- font-size: 32rpx;
- color: #999;
- }
- .nav-item.active text {
- color: #333;
- font-weight: bold;
- }
- .nav-indicator {
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 40rpx;
- height: 6rpx;
- background: #e54d42;
- border-radius: 3rpx;
- }
- .nav-actions {
- display: flex;
- align-items: center;
- gap: 24rpx;
- }
- .action-icon {
- font-size: 36rpx;
- color: #666;
- }
- /* 滚动区 */
- .scroll-wrap {
- flex: 1;
- height: 0;
- }
- /* 分类标签 */
- .category-wrap {
- padding: 20rpx 24rpx;
- background: #fff;
- }
- .category-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 16rpx 16rpx;
- }
- .category-tags.collapsed {
- max-height: 88rpx;
- overflow: hidden;
- }
- .tag-item {
- padding: 14rpx 28rpx;
- border-radius: 36rpx;
- background: #f0f0f0;
- }
- .tag-item text {
- font-size: 26rpx;
- color: #333;
- }
- .tag-item.active {
- background: #e54d42;
- }
- .tag-item.active text {
- color: #fff;
- }
- .expand-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 20rpx;
- padding: 12rpx 0;
- }
- .expand-btn text {
- font-size: 26rpx;
- color: #e54d42;
- }
- .expand-btn .arrow {
- margin-left: 6rpx;
- font-size: 22rpx;
- }
- /* 课程网格 */
- .course-grid {
- display: flex;
- flex-wrap: wrap;
- padding: 20rpx 24rpx;
- gap: 24rpx 20rpx;
- }
- .course-card {
- width: calc(50% - 10rpx);
- background: #fff;
- border-radius: 16rpx;
- overflow: hidden;
- box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.06);
- }
- .card-cover {
- width: 100%;
- height: 220rpx;
- background: #f0f0f0;
- }
- .cover-img {
- width: 100%;
- height: 100%;
- }
- .card-title {
- display: block;
- padding: 16rpx 16rpx 8rpx;
- font-size: 26rpx;
- color: #333;
- line-height: 1.4;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .card-footer {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 16rpx 16rpx;
- }
- .card-views {
- font-size: 24rpx;
- color: #999;
- }
- .btn-watch {
- padding: 10rpx 24rpx;
- background: #e54d42;
- border-radius: 32rpx;
- font-size: 24rpx;
- color: #fff;
- }
- /* 最近学习 - 按日期分组 */
- .recent-group {
- padding: 24rpx 24rpx 0;
- }
- .group-date {
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .date-icon {
- font-size: 28rpx;
- margin-right: 8rpx;
- }
- .date-text {
- font-size: 28rpx;
- color: #333;
- font-weight: 500;
- }
- .recent-card {
- display: flex;
- background: #f8f8f8;
- border-radius: 16rpx;
- overflow: hidden;
- margin-bottom: 20rpx;
- }
- .recent-thumb {
- width: 220rpx;
- height: 160rpx;
- flex-shrink: 0;
- background: #e8e8e8;
- }
- .thumb-img {
- width: 100%;
- height: 100%;
- }
- .recent-info {
- flex: 1;
- padding: 20rpx 24rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- min-width: 0;
- }
- .recent-title {
- font-size: 28rpx;
- color: #333;
- line-height: 1.4;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- margin-bottom: 8rpx;
- }
- .recent-progress {
- font-size: 24rpx;
- color: #666;
- margin-bottom: 12rpx;
- }
- /* 空态 */
- .empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 80rpx 0 48rpx;
- background: linear-gradient(180deg, #fff5f5 0%, #fff 100%);
- }
- .empty-icon {
- font-size: 120rpx;
- margin-bottom: 24rpx;
- opacity: 0.9;
- }
- .empty-text {
- font-size: 28rpx;
- color: #999;
- }
- /* 为您精选 */
- .recommend-section {
- padding: 0 24rpx 32rpx;
- }
- .recommend-title {
- display: block;
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 24rpx;
- }
- .bottom-placeholder {
- height: 120rpx;
- }
- </style>
|