| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <template>
- <view class="live-container">
- <image class="live-bg" src="/static/home_top_bg.png" mode="aspectFill"></image>
-
- <!-- 顶部导航栏 -->
- <view class="custom-navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
- <view class="navbar-content">
- <text class="page-title">精选课程</text>
- <view class="search-box">
- <image class="search-icon" src="/static/icon_search_org.png" mode="aspectFit"></image>
- <input class="search-input" type="text" placeholder="搜索课程" placeholder-class="search-placeholder" />
- <button class="search-btn">搜索</button>
- </view>
- </view>
- </view>
- <!-- 分类标签栏 - 悬浮在导航栏下方 -->
- <view class="category-tabs-wrap" :style="{ top: (statusBarHeight + 44) + 'px' }">
- <scroll-view scroll-x class="category-tabs">
- <view class="tab-item" :class="{ active: activeCategory === index }" v-for="(category, index) in categories" :key="index" @click="selectCategory(index)">
- <text>{{ category }}</text>
- </view>
- </scroll-view>
- </view>
- <!-- 页面内容区域 - 可滚动 -->
- <scroll-view scroll-y class="page-content-scroll" :style="{ paddingTop: (statusBarHeight +88) + 'px' }">
- <!-- 课程列表 -->
- <view class="course-list">
- <view class="course-card-horizontal" v-for="(item, index) in courses" :key="index" @click="goCourseDetail(item.id)">
- <view class="course-cover-wrap">
- <image class="course-cover" :src="item.imgUrl || '/static/course_img.png'" mode="aspectFill"></image>
- <view class="tag-yangsheng" v-if="item.tag">{{ item.tag }}</view>
- </view>
- <view class="course-content">
- <view class="course-title ellipsis-1">{{ item.title }}</view>
- <view class="course-tags">
- <text class="tag-orange" v-if="item.tag">{{ item.tag }}</text>
- <text class="meta-text">{{ item.playCount }}次播放</text>
- <text class="meta-text">|</text>
- <text class="meta-text">{{ item.likes }}人喜欢</text>
- </view>
- <view class="course-footer">
- <view class="author-box">
- <image class="author-avatar" :src="item.authorAvatar || '/static/avatar.png'" mode="aspectFill"></image>
- <text class="author-name">{{ item.authorName }}</text>
- </view>
- <view class="study-btn-orange">立即学习</view>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 底部安全区占位 -->
- <view class="bottom-safe-area"></view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
- categories: ['全部', '养生', '饮食', '运动', '心理', '国学', '乐器'],
- activeCategory: 0,
- courses: [{
- id: 1,
- title: '中医基础理论与养生智慧',
- tag: '养生',
- playCount: '2468',
- likes: '900',
- authorName: '李医生',
- authorAvatar: '/static/avatar.png',
- imgUrl: '/static/famous_doctor_img.png'
- }, {
- id: 2,
- title: '上班族 30 分钟每日养生计划',
- tag: '养生',
- playCount: '2468',
- likes: '900',
- authorName: '李医生',
- authorAvatar: '/static/avatar.png',
- imgUrl: '/static/famous_doctor_img2.png'
- }, {
- id: 3,
- title: '马年四季养生课:跟着节气养生',
- tag: '养生',
- playCount: '2468',
- likes: '900',
- authorName: '李医生',
- authorAvatar: '/static/avatar.png',
- imgUrl: '/static/course_img.png'
- }, {
- id: 4,
- title: '科学膳食与慢性病管理',
- tag: '健康',
- playCount: '2468',
- likes: '900',
- authorName: '张教授',
- authorAvatar: '/static/avatar.png',
- imgUrl: '/static/famous_doctor_img.png'
- }, {
- id: 5,
- title: '乐器入门:古筝基础教程',
- tag: '艺术',
- playCount: '2468',
- likes: '900',
- authorName: '王老师',
- authorAvatar: '/static/avatar.png',
- imgUrl: '/static/famous_doctor_img2.png'
- }]
- };
- },
- methods: {
- selectCategory(index) {
- this.activeCategory = index;
- },
- goCourseDetail(id) {
- uni.navigateTo({
- url: '/pages_course/learn?courseId=' + id
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .live-container {
- min-height: 100vh;
- background-color: #F8F8F8;
- position: relative;
-
- .live-bg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 380rpx;
- z-index: 0;
- }
- }
- .custom-navbar {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 100;
-
- .navbar-content {
- height: 44px;
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- .page-title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333333;
- }
- .search-box {
- display: flex;
- align-items: center;
- background-color: #ffffff;
- padding: 8rpx 8rpx 8rpx 24rpx;
- width: 324rpx;
- margin-left: 30rpx;
- border-radius: 36rpx;
- border: 2rpx solid #F5723A;
- .search-icon {
- width: 32rpx;
- height: 32rpx;
- margin-right: 10rpx;
- }
- .search-input {
- flex: 1;
- font-size: 26rpx;
- color: #333333;
- height: 100%;
- }
- .search-placeholder {
- color: #999999;
- }
- .search-btn {
- background: linear-gradient(180deg, #FFA33B 0%, #F5723A 100%);
- border-radius: 58rpx;
- color: #FFFFFF;
- font-size: 24rpx;
- padding: 12rpx 24rpx;
- line-height: 1;
- height: auto;
- border: none;
- margin: 0;
-
- &::after {
- border: none;
- }
- }
- }
- }
- }
- .category-tabs-wrap {
- position: fixed;
- left: 0;
- width: 100%;
- z-index: 99;
- padding: 20rpx 0;
-
- .category-tabs {
- white-space: nowrap;
- padding: 0 30rpx;
-
- .tab-item {
- display: inline-block;
- margin-right: 68rpx;
- font-size: 30rpx;
- color: #666666;
- position: relative;
- padding-bottom: 10rpx;
- &.active {
- color: #333333;
- font-weight: bold;
- &::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 50%;
- transform: translateX(-50%);
- width: 40rpx;
- height: 6rpx;
- background-color: #F5723A;
- border-radius: 3rpx;
- }
- }
- }
- }
- }
- .page-content-scroll {
- height: 100vh;
- box-sizing: border-box;
-
- .course-list {
- padding: 20rpx 24rpx;
-
- .course-card-horizontal {
- display: flex;
- background-color: #FFFFFF;
- border-radius: 20rpx;
- margin-bottom: 24rpx;
- padding: 24rpx;
- .course-cover-wrap {
- position: relative;
- width: 220rpx;
- height: 160rpx;
- margin-right: 24rpx;
- flex-shrink: 0;
-
- .course-cover {
- width: 100%;
- height: 100%;
- border-radius: 16rpx;
- }
-
- .tag-yangsheng {
- position: absolute;
- top: 0;
- left: 0;
- background: rgba(0,0,0,0.4);
- color: #FFFFFF;
- font-size: 20rpx;
- padding: 4rpx 12rpx;
- border-top-left-radius: 16rpx;
- border-bottom-right-radius: 16rpx;
- }
- }
-
- .course-content {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- .course-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- }
-
- .course-tags {
- display: flex;
- align-items: center;
- margin-top: 8rpx;
-
- .tag-orange {
- background: #FFF1E8;
- color: #F8792B;
- font-size: 22rpx;
- padding: 2rpx 12rpx;
- border-radius: 8rpx;
- margin-right: 16rpx;
- }
-
- .meta-text {
- font-size: 24rpx;
- color: #999999;
- margin-right: 12rpx;
- }
- }
-
- .course-footer {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 10rpx;
-
- .author-box {
- display: flex;
- align-items: center;
-
- .author-avatar {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- margin-right: 12rpx;
- }
-
- .author-name {
- font-size: 24rpx;
- color: #666666;
- }
- }
-
- .study-btn-orange {
- background: linear-gradient(180deg, #FFA33B 0%, #F5723A 100%);
- color: #FFFFFF;
- font-size: 24rpx;
- padding: 10rpx 24rpx;
- border-radius: 86rpx;
- }
- }
- }
- }
- }
- }
- .bottom-safe-area {
- height: 40rpx;
- padding-bottom: env(safe-area-inset-bottom);
- }
- .ellipsis-1 {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- </style>
|