liveRoom.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div>
  3. <van-cell-group class="cell-group" :border="false">
  4. <van-cell center style="border-radius: 0.1rem !important">
  5. <template #title>
  6. <div class="title">
  7. <img src="../images/icon_video.png" alt="" />
  8. <p class="van-ellipsis" style="width: 2.8rem">
  9. {{ item.roomTitle }}
  10. </p>
  11. </div>
  12. </template>
  13. <template #label>
  14. 直播内容:{{ item.liveRemark }} <br />
  15. <template v-if="item.liveState != 1">
  16. 直播时间:{{ item.liveStartTime }}
  17. </template>
  18. </template>
  19. </van-cell>
  20. <van-cell
  21. center
  22. class="userInfo"
  23. style="border-radius: 0.1rem !important"
  24. >
  25. <template #title>
  26. <div class="username">
  27. <img src="../images/icon_person.png" />
  28. <span>主讲人:{{ item.speakerName }}</span>
  29. <div class="tag" v-if="item.liveState != 2">
  30. <img src="../images/icon_mobli.png" />
  31. {{ item.os == "pc" ? "电脑直播" : "手机直播" }}
  32. </div>
  33. </div>
  34. </template>
  35. <van-button
  36. round
  37. size="small"
  38. color="#FF806F"
  39. v-if="item.liveState == 1"
  40. @click="onDetail"
  41. >
  42. <img class="svg" src="../images/audio.svg" alt="" />
  43. 开始直播
  44. </van-button>
  45. <van-button
  46. round
  47. size="small"
  48. type="info"
  49. style="min-width: 68px"
  50. v-if="item.liveState == 2"
  51. @click="onDetail"
  52. >
  53. 查看回放
  54. </van-button>
  55. </van-cell>
  56. </van-cell-group>
  57. <van-popup v-model="videoStatus" round style="width: 90%" closeable>
  58. <preview-video v-if="videoStatus" :videoList="videoList" />
  59. </van-popup>
  60. </div>
  61. </template>
  62. <script>
  63. import { postMessage } from "@/helpers/native-message";
  64. import previewVideo from "./previewVideo";
  65. export default {
  66. components: { previewVideo },
  67. props: ["item"],
  68. data() {
  69. return {
  70. videoStatus: false,
  71. videoList: [],
  72. src: "",
  73. };
  74. },
  75. methods: {
  76. async onDetail() {
  77. const item = this.item;
  78. if (item.liveState == 1) {
  79. postMessage({
  80. api: "enterLiveRoom",
  81. content: { roomId: item.roomUid },
  82. });
  83. } else if (item.liveState == 2) {
  84. this.$router.push("/previewVideo?roomUid=" + item.roomUid);
  85. this.videoStatus = true;
  86. }
  87. },
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .cell-group {
  93. margin: 0.12rem 0.14rem;
  94. overflow: hidden !important;
  95. border-radius: 0.1rem !important;
  96. /deep/.van-cell__label {
  97. // line-height: 1.5;
  98. }
  99. }
  100. .title {
  101. display: flex;
  102. align-items: center;
  103. font-size: 0.16rem;
  104. font-weight: 500;
  105. color: #000000;
  106. line-height: 1.2;
  107. padding-top: 0.1rem;
  108. padding-bottom: 0.05rem;
  109. img {
  110. width: 0.22rem;
  111. height: 0.22rem;
  112. margin-right: 0.08rem;
  113. }
  114. }
  115. .svg {
  116. width: 0.12rem;
  117. height: 0.09rem;
  118. }
  119. .username {
  120. display: flex;
  121. align-items: center;
  122. font-size: 0.13rem;
  123. color: #ff806f;
  124. img {
  125. width: 0.12rem;
  126. height: 0.15rem;
  127. margin-right: 0.05rem;
  128. }
  129. }
  130. .userInfo {
  131. /deep/.van-cell__title {
  132. flex: 40%;
  133. }
  134. }
  135. .tag {
  136. margin-left: 0.1rem;
  137. padding: 0 0.06rem;
  138. display: flex;
  139. align-items: center;
  140. justify-items: center;
  141. font-size: 0.12rem;
  142. color: #ff806f;
  143. background: rgba(255, 128, 111, 0.08);
  144. border-radius: 3px;
  145. border: 1px solid rgba(255, 128, 111, 0.25);
  146. height: 0.2rem;
  147. img {
  148. width: 0.1rem;
  149. height: 0.12rem;
  150. margin-right: 0.02rem;
  151. }
  152. }
  153. </style>