guhongwei 4 anni fa
parent
commit
78faf75455

+ 9 - 10
src/views/live/index.vue

@@ -6,18 +6,17 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <!-- <liveList></liveList> -->
-          <el-tabs v-model="activeName" stretch>
-            <el-tab-pane label="正在直播" name="first">
+          <van-tabs v-model="active">
+            <van-tab title="正在直播">
               <liveList :list="listNow" :total="nowTotal" status="1" @query="searchList" :province="province" :place="place"></liveList>
-            </el-tab-pane>
-            <el-tab-pane label="下期预告" name="second">
+            </van-tab>
+            <van-tab title="下期预告">
               <liveList :list="listPre" :total="nowTotal" status="0" @query="searchList" :province="province" :place="place"></liveList>
-            </el-tab-pane>
-            <el-tab-pane label="往期直播" name="third">
+            </van-tab>
+            <van-tab title="往期直播">
               <liveList :list="listPast" :total="nowTotal" status="2" @query="searchList" :province="province" :place="place"></liveList>
-            </el-tab-pane>
-          </el-tabs>
+            </van-tab>
+          </van-tabs>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -50,7 +49,7 @@ export default {
       isleftarrow: '',
       // 返回
       navShow: true,
-      activeName: 'first',
+      active: 0,
       // 下期预告
       listPre: [],
       preTotal: 0,

+ 0 - 157
src/views/live/parts/roomsDetail.vue

@@ -1,157 +0,0 @@
-<template>
-  <div id="roomsDetail">
-    <el-row>
-      <el-col :span="24" class="info">
-        <el-col :span="24" class="video">
-          <el-col :span="15" class="videoLeft">
-            <div id="look-video-left" class="video-box col-div" style="justify-content: flex-end"></div>
-          </el-col>
-          <el-col :span="9" class="videoRight">
-            <div id="look-video-right" class="video-box col-div" style="justify-content: flex-end"></div>
-          </el-col>
-        </el-col>
-        <el-col :span="24" class="chat">
-          <chat></chat>
-        </el-col>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import TRTC from 'trtc-js-sdk';
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: gensign } = createNamespacedHelpers('gensign');
-const { mapActions: room } = createNamespacedHelpers('room');
-import chat from '@/components/parts/chat.vue';
-export default {
-  name: 'roomsDetail',
-  props: {},
-  components: {
-    chat,
-  },
-  data: function() {
-    return {
-      client_: null,
-      localStream_: null,
-      sdkAppId_: '1400380125',
-      userId_: '',
-    };
-  },
-  created() {
-    this.initclient();
-    this.lookuserSearch();
-  },
-  methods: {
-    ...gensign(['gensignFetch']),
-    ...room(['lookuserFetch']),
-    async lookuserSearch() {
-      let data = {};
-      data.roomid = this.id;
-      data.roomname = this.roomname;
-      data.userid = this.user.userid;
-      data.username = this.user.name;
-      data.phone = this.user.phone;
-      const res = await this.lookuserFetch(data);
-    },
-    onSubmit() {
-      console.log(this.input);
-    },
-    async initclient() {
-      this.userId_ = this.user.uid;
-      const res = await this.gensignFetch({ userid: this.userId_ });
-      if (this.$checkRes(res)) {
-        this.client_ = TRTC.createClient({
-          mode: 'live',
-          sdkAppId: this.sdkAppId_,
-          userId: this.userId_,
-          userSig: res.data,
-        });
-        await this.client_.join({ roomId: this.roomname, role: 'audience' });
-        let i = 0;
-        this.client_.on('stream-subscribed', event => {
-          const remoteStream = event.stream;
-          // 远端流订阅成功,播放远端音视频流
-          console.log('111' + remoteStream.getType());
-          i = i + 1;
-          if (i === 1) {
-            remoteStream.play('look-video-right');
-          } else {
-            remoteStream.play('look-video-left');
-          }
-        });
-        // 监听远端流增加事件
-        this.client_.on('stream-added', event => {
-          const remoteStream = event.stream;
-          console.log('222' + remoteStream.getType());
-          // 订阅远端音频和视频流
-          this.client_.subscribe(remoteStream, { audio: false, video: true }).catch(e => {
-            console.error('failed to subscribe remoteStream');
-          });
-        });
-      }
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-    id() {
-      return this.$route.query.id;
-    },
-    roomname() {
-      return this.$route.query.roomname;
-    },
-    pageTitle() {
-      return `${this.$route.meta.title}`;
-    },
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.info {
-  .video {
-    background: #fff;
-    margin: 0 0 10px 0;
-    .videoLeft {
-      height: 200px;
-    }
-    .videoRight {
-      height: 200px;
-    }
-  }
-  .chat {
-    background: #fff;
-    padding: 10px;
-    .chatList {
-      border: 1px solid #ccc;
-      min-height: 300px;
-      margin: 0 0 10px 0;
-      border-radius: 10px;
-      padding: 5px 10px;
-    }
-    .chatInput {
-      .el-button {
-        width: 100%;
-        padding: 13px 0;
-      }
-    }
-  }
-}
-/deep/.video-js {
-  height: 190px !important;
-  border-radius: 10px;
-}
-#look-video-left {
-  width: 100%;
-  height: 200px;
-  grid-area: 1/1/3/4;
-}
-#look-video-right {
-  width: 100%;
-  height: 200px;
-  grid-area: 1/1/3/4;
-}
-</style>

+ 0 - 11
src/views/live/parts/videoDetail.vue

@@ -8,17 +8,6 @@
           </video>
         </el-col>
         <el-col :span="24" class="chat">
-          <!-- <el-col :span="24" class="chatList">
-            聊天列表
-          </el-col>
-          <el-col :span="24" class="chatInput">
-            <el-col :span="19" class="input">
-              <el-input v-model="input"></el-input>
-            </el-col>
-            <el-col :span="5" class="btn">
-              <el-button type="primary" size="mini" @click="onSubmit">发送</el-button>
-            </el-col>
-          </el-col> -->
           <chat></chat>
         </el-col>
         <el-col :span="24" class="tab">

+ 0 - 73
src/views/live/roomDetail.vue

@@ -1,73 +0,0 @@
-<template>
-  <div id="roomDetail">
-    <el-row>
-      <el-col :span="24" class="style">
-        <el-col :span="24" class="top">
-          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
-        </el-col>
-        <el-col :span="24" class="main">
-          <roomsDetail></roomsDetail>
-        </el-col>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-import NavBar from '@/layout/common/topInfo.vue';
-import footInfo from '@/layout/common/footInfo.vue';
-import roomsDetail from './parts/roomsDetail.vue';
-export default {
-  name: 'roomDetail',
-  props: {},
-  components: {
-    NavBar,
-    // footInfo,
-    roomsDetail, //直播详情
-  },
-  data: function() {
-    return {
-      // 头部标题
-      title: '',
-      // meta为true
-      isleftarrow: '',
-      // 返回
-      navShow: true,
-    };
-  },
-  created() {
-    console.log(this.user);
-  },
-  methods: {},
-  computed: {
-    ...mapState(['user']),
-  },
-  mounted() {
-    this.title = this.$route.meta.title;
-    this.isleftarrow = this.$route.meta.isleftarrow;
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.style {
-  width: 100%;
-  min-height: 667px;
-  position: relative;
-  background-color: #f9fafc;
-}
-.top {
-  height: 46px;
-  overflow: hidden;
-  position: relative;
-  z-index: 999;
-}
-.main {
-  min-height: 570px;
-}
-.foot {
-  position: absolute;
-  bottom: 0;
-}
-</style>