| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <template>
- <view class="live-detail-container">
- <!-- 视频播放区 -->
- <view class="video-wrap">
- <video
- id="myVideo"
- src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126.mp4"
- controls
- autoplay
- class="video-player"
- ></video>
- </view>
-
- <!-- 详情与聊天切换 -->
- <view class="tab-header">
- <view class="tab-item" :class="{active: currentTab === 0}" @click="currentTab = 0">聊天互动</view>
- <view class="tab-item" :class="{active: currentTab === 1}" @click="currentTab = 1">主播介绍</view>
- </view>
-
- <scroll-view scroll-y class="content-area" :scroll-top="scrollTop">
- <!-- 聊天区 -->
- <view class="chat-list" v-if="currentTab === 0">
- <view class="chat-item system">
- <text class="content">系统公告:欢迎来到直播间,请文明发言。</text>
- </view>
- <view class="chat-item" v-for="(item, index) in chatList" :key="index">
- <view class="user-name">{{item.name}}:</view>
- <view class="user-content">{{item.content}}</view>
- </view>
- </view>
-
- <!-- 介绍区 -->
- <view class="intro-box" v-if="currentTab === 1">
- <view class="anchor-card">
- <image src="https://via.placeholder.com/60" class="avatar"></image>
- <view class="info">
- <text class="name">李医生</text>
- <text class="title">主任医师 | 20年临床经验</text>
- </view>
- <view class="follow-btn">关注</view>
- </view>
- <view class="desc">
- <text class="desc-title">直播简介</text>
- <text class="desc-content">本期直播主要讲解春季常见病的预防与中医调理方法,特别是针对脾胃虚弱的人群,提供食疗方案。</text>
- </view>
- </view>
- </scroll-view>
-
- <!-- 底部输入框 -->
- <view class="bottom-bar" v-if="currentTab === 0">
- <input type="text" v-model="inputContent" placeholder="说点什么..." class="input-box" confirm-type="send" @confirm="sendMsg" />
- <view class="send-btn" @click="sendMsg">发送</view>
- <view class="icon-btn">
- <u-icon name="heart" size="24" color="#666"></u-icon>
- </view>
- <view class="icon-btn">
- <u-icon name="share" size="24" color="#666"></u-icon>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- currentTab: 0,
- scrollTop: 0,
- inputContent: '',
- chatList: [
- { name: '用户8892', content: '医生讲得真好!' },
- { name: '快乐每一天', content: '请问这个药方可以直接抓药吗?' },
- { name: 'HealthUser', content: '已关注,期待下期。' },
- { name: '小张', content: '声音有点小,可以大一点吗?' }
- ]
- }
- },
- onLoad(options) {
- if(options.id) {
- // Load detail by id
- console.log('Live ID:', options.id);
- }
- },
- methods: {
- sendMsg() {
- if (!this.inputContent.trim()) return;
- this.chatList.push({
- name: '我',
- content: this.inputContent
- });
- this.inputContent = '';
-
- // Scroll to bottom
- this.$nextTick(() => {
- this.scrollTop = 99999;
- });
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .live-detail-container {
- display: flex;
- flex-direction: column;
- height: 100vh;
- background-color: #f8f8f8;
- }
-
- .video-wrap {
- width: 100%;
- height: 422rpx;
- background-color: #000;
-
- .video-player {
- width: 100%;
- height: 100%;
- }
- }
-
- .tab-header {
- display: flex;
- height: 88rpx;
- background-color: #fff;
- border-bottom: 1rpx solid #eee;
-
- .tab-item {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28rpx;
- color: #666;
- position: relative;
-
- &.active {
- color: #2583EB;
- font-weight: bold;
-
- &::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 50%;
- transform: translateX(-50%);
- width: 40rpx;
- height: 4rpx;
- background-color: #2583EB;
- border-radius: 2rpx;
- }
- }
- }
- }
-
- .content-area {
- flex: 1;
- height: 0;
- background-color: #f5f5f5;
- }
-
- .chat-list {
- padding: 20rpx;
-
- .chat-item {
- margin-bottom: 16rpx;
- display: flex;
- align-items: flex-start;
- font-size: 26rpx;
-
- &.system {
- background-color: rgba(37, 131, 235, 0.1);
- padding: 10rpx;
- border-radius: 8rpx;
- color: #2583EB;
- justify-content: center;
- margin-bottom: 20rpx;
- }
-
- .user-name {
- color: #999;
- white-space: nowrap;
- }
-
- .user-content {
- color: #333;
- line-height: 1.4;
- }
- }
- }
-
- .intro-box {
- padding: 30rpx;
- background-color: #fff;
-
- .anchor-card {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
- padding-bottom: 30rpx;
- border-bottom: 1rpx solid #eee;
-
- .avatar {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- margin-right: 20rpx;
- background-color: #eee;
- }
-
- .info {
- flex: 1;
- display: flex;
- flex-direction: column;
-
- .name {
- font-size: 30rpx;
- font-weight: bold;
- margin-bottom: 8rpx;
- }
-
- .title {
- font-size: 24rpx;
- color: #999;
- }
- }
-
- .follow-btn {
- padding: 8rpx 24rpx;
- background-color: #2583EB;
- color: #fff;
- font-size: 24rpx;
- border-radius: 30rpx;
- }
- }
-
- .desc {
- .desc-title {
- font-size: 30rpx;
- font-weight: bold;
- margin-bottom: 16rpx;
- display: block;
- }
-
- .desc-content {
- font-size: 26rpx;
- color: #666;
- line-height: 1.6;
- }
- }
- }
-
- .bottom-bar {
- background-color: #fff;
- padding: 16rpx 20rpx;
- display: flex;
- align-items: center;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- border-top: 1rpx solid #eee;
-
- .input-box {
- flex: 1;
- background-color: #f5f5f5;
- height: 72rpx;
- border-radius: 36rpx;
- padding: 0 30rpx;
- font-size: 26rpx;
- margin-right: 20rpx;
- }
-
- .send-btn {
- padding: 0 24rpx;
- height: 60rpx;
- line-height: 60rpx;
- background-color: #2583EB;
- color: #fff;
- font-size: 24rpx;
- border-radius: 30rpx;
- margin-right: 20rpx;
- }
-
- .icon-btn {
- width: 60rpx;
- display: flex;
- justify-content: center;
- margin-left: 10rpx;
- }
- }
- </style>
|