| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <view class="live-container">
- <view class="header">
- <text class="title">健康直播</text>
- <view class="search-btn" @click="goSearch">
- <u-icon name="search" size="20" color="#666"></u-icon>
- <text>搜索直播</text>
- </view>
- </view>
-
- <scroll-view scroll-y class="content-scroll">
- <view class="banner">
- <view class="banner-item">
- <text class="banner-tag">正在直播</text>
- <text class="banner-title">名医讲坛:春季养生之道</text>
- <text class="banner-sub">张医师在线解答您的健康疑问</text>
- </view>
- </view>
-
- <view class="live-list">
- <view class="section-title">精彩直播</view>
- <view class="live-item" v-for="(item, index) in liveList" :key="index" @click="goDetail(item)">
- <view class="cover-box">
- <image :src="item.cover" mode="aspectFill" class="cover"></image>
- <view class="status-tag" :class="{living: item.status === 1}">
- <text class="dot" v-if="item.status === 1"></text>
- {{item.status === 1 ? '直播中' : '回放'}}
- </view>
- <view class="viewer-count">
- <u-icon name="eye" color="#fff" size="12"></u-icon>
- <text>{{item.viewers}}人观看</text>
- </view>
- </view>
- <view class="info">
- <text class="item-title ellipsis">{{item.title}}</text>
- <view class="anchor-info">
- <image :src="item.avatar" class="avatar"></image>
- <text class="name">{{item.anchor}}</text>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- liveList: [
- {
- id: 1,
- title: '中医养生:如何调理脾胃',
- anchor: '李医生',
- avatar: 'https://via.placeholder.com/40',
- cover: 'https://via.placeholder.com/300x180/FF6B6B/FFFFFF?text=Live1',
- status: 1,
- viewers: 1205
- },
- {
- id: 2,
- title: '每日瑜伽:舒缓肩颈',
- anchor: 'Yoga Lisa',
- avatar: 'https://via.placeholder.com/40',
- cover: 'https://via.placeholder.com/300x180/4FACFE/FFFFFF?text=Live2',
- status: 1,
- viewers: 856
- },
- {
- id: 3,
- title: '糖尿病饮食指南',
- anchor: '王营养师',
- avatar: 'https://via.placeholder.com/40',
- cover: 'https://via.placeholder.com/300x180/43E97B/FFFFFF?text=Live3',
- status: 0,
- viewers: 3500
- },
- {
- id: 4,
- title: '儿童生长发育讲座',
- anchor: '陈专家',
- avatar: 'https://via.placeholder.com/40',
- cover: 'https://via.placeholder.com/300x180/FA709A/FFFFFF?text=Live4',
- status: 0,
- viewers: 2100
- }
- ]
- }
- },
- methods: {
- goSearch() {
- uni.navigateTo({
- url: '/pages/course/video/search'
- });
- },
- goDetail(item) {
- uni.navigateTo({
- url: '/pages/course/video/liveDetail?id=' + item.id
- });
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .live-container {
- display: flex;
- flex-direction: column;
- height: 100vh;
- background-color: #f8f8f8;
- }
-
- .header {
- padding: 20rpx 30rpx;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: space-between;
-
- .title {
- font-size: 36rpx;
- font-weight: bold;
- }
-
- .search-btn {
- background-color: #f5f5f5;
- padding: 10rpx 24rpx;
- border-radius: 30rpx;
- display: flex;
- align-items: center;
-
- text {
- font-size: 24rpx;
- color: #999;
- margin-left: 10rpx;
- }
- }
- }
-
- .content-scroll {
- flex: 1;
- height: 0;
- padding: 20rpx;
- }
-
- .banner {
- margin: 20rpx 30rpx;
- height: 200rpx;
- background: linear-gradient(45deg, #2583EB, #4FACFE);
- border-radius: 16rpx;
- padding: 30rpx;
- display: flex;
- align-items: center;
-
- .banner-item {
- display: flex;
- flex-direction: column;
- color: #fff;
-
- .banner-tag {
- background-color: rgba(255,255,255,0.2);
- padding: 4rpx 12rpx;
- border-radius: 8rpx;
- font-size: 20rpx;
- align-self: flex-start;
- margin-bottom: 10rpx;
- }
-
- .banner-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
-
- .banner-sub {
- font-size: 24rpx;
- opacity: 0.9;
- }
- }
- }
-
- .live-list {
- padding: 0 30rpx;
-
- .section-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
- }
-
- .live-item {
- background-color: #fff;
- border-radius: 16rpx;
- overflow: hidden;
- margin-bottom: 30rpx;
- box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.05);
-
- .cover-box {
- position: relative;
- height: 300rpx;
-
- .cover {
- width: 100%;
- height: 100%;
- }
-
- .status-tag {
- position: absolute;
- top: 20rpx;
- left: 20rpx;
- background-color: rgba(0,0,0,0.5);
- color: #fff;
- padding: 6rpx 16rpx;
- border-radius: 30rpx;
- font-size: 22rpx;
- display: flex;
- align-items: center;
-
- &.living {
- background-color: #FF6B6B;
- }
-
- .dot {
- width: 10rpx;
- height: 10rpx;
- background-color: #fff;
- border-radius: 50%;
- margin-right: 8rpx;
- }
- }
-
- .viewer-count {
- position: absolute;
- bottom: 20rpx;
- right: 20rpx;
- background-color: rgba(0,0,0,0.5);
- color: #fff;
- padding: 4rpx 12rpx;
- border-radius: 8rpx;
- font-size: 20rpx;
- display: flex;
- align-items: center;
-
- text {
- margin-left: 6rpx;
- }
- }
- }
-
- .info {
- padding: 20rpx;
-
- .item-title {
- font-size: 30rpx;
- font-weight: bold;
- margin-bottom: 16rpx;
- display: block;
- }
-
- .anchor-info {
- display: flex;
- align-items: center;
-
- .avatar {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- margin-right: 12rpx;
- background-color: #eee;
- }
-
- .name {
- font-size: 24rpx;
- color: #666;
- }
- }
- }
- }
- }
- </style>
|