浏览代码

进入直播间时添加参数

lex 2 年之前
父节点
当前提交
b3b3fc9854
共有 2 个文件被更改,包括 16 次插入96 次删除
  1. 11 70
      src/views/liveActive/liveRoomList.vue
  2. 5 26
      src/views/liveActive/model/liveRoom.vue

+ 11 - 70
src/views/liveActive/liveRoomList.vue

@@ -1,79 +1,36 @@
 <template>
   <div class="live-room" style="min-height: 100vh; overflow: hidden">
     <!-- 78 -->
-    <van-sticky
-      offset-top="0"
-      style="height: 44px; width: 100%"
-      :style="{ height: params.liveState != '1' ? '78px' : '44px' }"
-    >
-      <van-tabs
-        v-model="params.liveState"
-        color="#01C1B5"
-        line-width="16px"
-        line-height="4px"
-        class="van-hairline--bottom"
-        @change="onSearch"
-      >
+    <van-sticky offset-top="0" style="height: 44px; width: 100%" :style="{ height: params.liveState != '1' ? '88px' : '44px' }">
+      <van-tabs v-model="params.liveState" color="#01C1B5" line-width="16px" line-height="4px" class="van-hairline--bottom" @change="onSearch">
         <van-tab name="1" title="直播中"></van-tab>
         <van-tab name="0" title="未开始"> </van-tab>
         <van-tab name="2" title="已结束"> </van-tab>
       </van-tabs>
 
-      <div
-        v-if="params.liveState != '1'"
-        class="titleWrap week"
-        style="height: 22px; line-height: 22px; padding: 13px 0.28rem"
-        @click="showCalendar = true"
-      >
+      <div v-if="params.liveState != '1'" class="titleWrap week" style="height: 22px; line-height: 22px; padding: 13px 0.28rem" @click="showCalendar = true">
         <!-- <div class="calendar">
           <div>{{ params.startTime }}~{{ params.endTime }}</div>
         </div> -->
         <van-row style="color: #01c1b5">
           <van-col span="10" class="flex">
-            <img
-              src="./images/icon_calendar.png"
-              style="width: 14px; height: 14px; margin-right: 8px"
-            />
+            <img src="./images/icon_calendar.png" style="width: 14px; height: 14px; margin-right: 8px" />
             {{ params.startTime }}</van-col
           >
           <van-col span="4" class="flex" style="height: 22px">
             <span class="calendar-line"></span>
           </van-col>
           <van-col span="10" class="flex">
-            <img
-              src="./images/icon_calendar.png"
-              style="width: 14px; height: 14px; margin-right: 8px"
-            />
+            <img src="./images/icon_calendar.png" style="width: 14px; height: 14px; margin-right: 8px" />
             {{ params.endTime }}
           </van-col>
         </van-row>
       </div>
     </van-sticky>
 
-    <van-calendar
-      v-model="showCalendar"
-      :minDate="minDate"
-      color="#01C1B5"
-      :default-date="[
-        dayjs(params.startTime).toDate(),
-        dayjs(params.endTime).toDate(),
-      ]"
-      type="range"
-      @confirm="onConfirm"
-      :first-day-of-week="1"
-      get-container="body"
-    />
+    <van-calendar v-model="showCalendar" :minDate="minDate" color="#01C1B5" :default-date="[dayjs(params.startTime).toDate(), dayjs(params.endTime).toDate()]" type="range" @confirm="onConfirm" :first-day-of-week="1" get-container="body" />
 
-    <van-list
-      v-model="loading"
-      v-if="dataShow"
-      style="margin-top: 0.15rem"
-      key="ing"
-      :finished="finished"
-      finished-text=" "
-      :immediate-check="false"
-      @load="getList()"
-    >
+    <van-list v-model="loading" v-if="dataShow" style="margin-top: 0.15rem" key="ing" :finished="finished" finished-text=" " :immediate-check="false" @load="getList()">
       <div v-for="(item, index) in dataList" :key="index">
         <live-room :item="item" />
       </div>
@@ -115,22 +72,9 @@ export default {
     };
   },
   mounted() {
-    this.hiddenProperty =
-      "hidden" in document
-        ? "hidden"
-        : "webkitHidden" in document
-        ? "webkitHidden"
-        : "mozHidden" in document
-        ? "mozHidden"
-        : null;
-    this.visibilityChangeEvent = this.hiddenProperty.replace(
-      /hidden/i,
-      "visibilitychange"
-    );
-    document.addEventListener(
-      this.visibilityChangeEvent,
-      this.onVisibilityChange
-    );
+    this.hiddenProperty = "hidden" in document ? "hidden" : "webkitHidden" in document ? "webkitHidden" : "mozHidden" in document ? "mozHidden" : null;
+    this.visibilityChangeEvent = this.hiddenProperty.replace(/hidden/i, "visibilitychange");
+    document.addEventListener(this.visibilityChangeEvent, this.onVisibilityChange);
 
     document.title = "直播间";
     this.getList();
@@ -206,10 +150,7 @@ export default {
   },
   beforeDestroy() {
     clearInterval(this.pageStatusTimer);
-    document.removeEventListener(
-      this.visibilityChangeEvent,
-      this.onVisibilityChange
-    );
+    document.removeEventListener(this.visibilityChangeEvent, this.onVisibilityChange);
   },
 };
 </script>

+ 5 - 26
src/views/liveActive/model/liveRoom.vue

@@ -12,16 +12,10 @@
         </template>
         <template #label>
           直播内容:{{ item.liveRemark }} <br />
-          <template v-if="item.liveState != 1">
-            直播时间:{{ item.liveStartTime }}
-          </template>
+          <template v-if="item.liveState != 1"> 直播时间:{{ item.liveStartTime }} </template>
         </template>
       </van-cell>
-      <van-cell
-        center
-        class="userInfo"
-        style="border-radius: 0.1rem !important"
-      >
+      <van-cell center class="userInfo" style="border-radius: 0.1rem !important">
         <template #title>
           <div class="username">
             <img src="../images/icon_person.png" />
@@ -34,27 +28,12 @@
           </div>
         </template>
 
-        <van-button
-          round
-          size="small"
-          color="#FF806F"
-          v-if="item.liveState == 1"
-          @click="onDetail"
-        >
+        <van-button round size="small" color="#FF806F" v-if="item.liveState == 1" @click="onDetail">
           <img class="svg" src="../images/audio.svg" alt="" />
           开始直播
         </van-button>
 
-        <van-button
-          round
-          size="small"
-          type="info"
-          style="min-width: 68px"
-          v-if="item.liveState == 2"
-          @click="onDetail"
-        >
-          查看回放
-        </van-button>
+        <van-button round size="small" type="info" style="min-width: 68px" v-if="item.liveState == 2" @click="onDetail"> 查看回放 </van-button>
       </van-cell>
     </van-cell-group>
     <van-popup v-model="videoStatus" round style="width: 90%" closeable>
@@ -82,7 +61,7 @@ export default {
       if (item.liveState == 1) {
         postMessage({
           api: "enterLiveRoom",
-          content: { roomId: item.roomUid },
+          content: { roomId: item.roomUid, serviceProvider: item.serviceProvider },
         });
       } else if (item.liveState == 2) {
         this.$router.push("/previewVideo?roomUid=" + item.roomUid);