index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div class="live-config-container">
  3. <el-card class="box-card live-config-header">
  4. <div class="detail-header">
  5. <div class="header-left-area">
  6. <img :src="liveInfo.liveImgUrl" alt="直播封面">
  7. <!-- 加载遮罩 -->
  8. <div class="ss-loading-mask" style="display: none;">
  9. <div class="ss-loading-spinner is-module-loading">
  10. <div class="ss-loading-dot-flashing"></div>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="header-middle-area">
  15. <div class="live-info-title">
  16. <div class="title-text">{{ liveInfo.liveName }}</div>
  17. </div>
  18. <div class="live-info-desc">
  19. <div class="live-type">{{ liveInfo.liveType == 1 ? '视频直播' : '录播' }}</div>
  20. <div class="line"></div>
  21. <div class="live-mode">{{ liveInfo.showType == 1 ? '横屏' : '竖屏' }}</div>
  22. <div class="big-screen-info">
  23. <div class="dataLarge">
  24. <a class="dataLarge__screen ss-popover__reference" aria-describedby="ss-popover-7614" tabindex="0" data-auth-id="818">
  25. <span class="dataLarge__screen__icon"></span>
  26. <span class="dataLarge__screen__txt">实时大屏</span>
  27. </a>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="live-info-state">
  32. <div class="info-state-text live-time">直播时间:{{ liveInfo.startTime }} 至 {{ liveInfo.finishTime }}</div>
  33. <div class="line"></div>
  34. <div class="info-state-text live-state">{{ liveInfo.status == 3 ? '已结束' : liveInfo.status == 2 ? '直播中' : '未开始'}}</div>
  35. <div class="line"></div>
  36. <div class="info-state-text live-active-state">{{ liveInfo.isShow == 1 ? '上架' : '下架' }}</div>
  37. <div class="line"></div>
  38. </div>
  39. </div>
  40. <!-- <div class="header-right-area">-->
  41. <!-- <div class="operation-wrapper">-->
  42. <!-- <div class="operation-item">-->
  43. <!-- <div class="operation-item-icon sales-icon"></div>-->
  44. <!-- <div class="operation-item-text">中控台</div>-->
  45. <!-- </div>-->
  46. <!-- <div class="line"></div>-->
  47. <!-- <div class="operation-item">-->
  48. <!-- <span class="operation-item-icon xe-iconfont"></span>-->
  49. <!-- <div class="operation-item-text">分享</div>-->
  50. <!-- </div>-->
  51. <!-- <div class="line"></div>-->
  52. <!-- <div class="operation-item" data-auth-id="975">-->
  53. <!-- <span class="operation-item-icon xe-iconfont"></span>-->
  54. <!-- <div class="operation-item-text">恢复直播</div>-->
  55. <!-- </div>-->
  56. <!-- <div class="line"></div>-->
  57. <!-- <div class="operation-item ss-popover__reference" aria-describedby="ss-popover-6482" tabindex="0">-->
  58. <!-- <span class="operation-item-icon xe-iconfont"></span>-->
  59. <!-- <div class="operation-item-text">更多</div>-->
  60. <!-- </div>-->
  61. <!-- </div>-->
  62. <!-- </div>-->
  63. </div>
  64. </el-card>
  65. <el-card class="box-card live-config-left">
  66. <div class="container">
  67. <!-- 左边菜单 -->
  68. <div class="left-menu">
  69. <el-menu default-active="1" class="el-menu-vertical-demo" @select="handleSelect">
  70. <el-menu-item :index="item.index" v-for="item in menuList" >
  71. <span>{{item.name}}</span>
  72. </el-menu-item>
  73. </el-menu>
  74. </div>
  75. <!-- 右边信息 -->
  76. <div class="right-info">
  77. <!-- 动态组件 -->
  78. <component :is="currentComponent" ></component>
  79. </div>
  80. </div>
  81. <!-- <el-tabs tab-position="left" style="height: 200px;">-->
  82. <!-- <el-tab-pane label="营销内容">营销内容</el-tab-pane>-->
  83. <!-- <el-tab-pane label="观看奖励">观看奖励</el-tab-pane>-->
  84. <!-- <el-tab-pane label="答题红包">答题红包</el-tab-pane>-->
  85. <!-- <el-tab-pane label="答题">答题</el-tab-pane>-->
  86. <!-- <el-tab-pane label="直播商品">直播商品</el-tab-pane>-->
  87. <!-- <el-tab-pane label="观看积分">观看积分</el-tab-pane>-->
  88. <!-- <el-tab-pane label="身份认证">-->
  89. <!-- <idCard :liveId="liveId" />-->
  90. <!-- </el-tab-pane>-->
  91. <!-- </el-tabs>-->
  92. </el-card>
  93. </div>
  94. </template>
  95. <script>
  96. import WatchReward from './watchReward.vue';
  97. import Answer from './answer.vue';
  98. import Goods from './goods.vue';
  99. import IdCard from './idCard.vue';
  100. import Task from './task.vue';
  101. import LiveRedConf from './liveRedConf.vue'
  102. import LiveLotteryConf from './liveLotteryConf.vue'
  103. import LiveReplay from './liveReplay.vue'
  104. import Preview from './preview.vue'
  105. import LiveCoupon from './liveCoupon.vue'
  106. import Barrage from './barrage.vue'
  107. import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent,handleShelfOrUn,handleDeleteSelected } from "@/api/live/live";
  108. export default {
  109. name: 'LiveConfig',
  110. components: {
  111. WatchReward,
  112. LiveRedConf,
  113. LiveReplay,
  114. LiveLotteryConf,
  115. Answer,
  116. Goods,
  117. IdCard,
  118. Task,
  119. LiveCoupon,
  120. Barrage,
  121. Preview
  122. },
  123. data() {
  124. return {
  125. activeTab: 'watchReward',
  126. liveId: null,
  127. liveInfo: {},
  128. socket:null,
  129. currentComponent: WatchReward,
  130. liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
  131. menuList:[
  132. { name: '观看奖励', label: '观看奖励', index: 'watchReward'},
  133. { name: '直播预告', label: '直播预告', index: 'preview'},
  134. { name: '红包配置', label: '红包配置', index: 'liveRedConf'},
  135. { name: '抽奖配置', label: '抽奖配置', index: 'liveLotteryConf'},
  136. { name: '优惠券配置', label: '优惠券配置', index: 'liveCoupon'},
  137. // { name: '答题', label: '答题', index: 'answer'},
  138. { name: '直播商品', label: '直播商品', index: 'goods'},
  139. { name: '回放设置', label: '回放设置', index: 'liveReplay'},
  140. // { name: '观看积分', label: '观看积分', index: 'watchScore'},
  141. { name: '运营自动化', label: '运营自动化', index: 'task'},
  142. { name: '弹幕脚本', label: '弹幕脚本', index: 'barrage'},
  143. { name: '身份认证', label: '身份认证', index: 'idCard'},
  144. ],
  145. }
  146. },
  147. created() {
  148. this.liveId = this.$route.params.liveId
  149. this.getLiving()
  150. this.connectWebSocket()
  151. },
  152. computed: {
  153. userId() {
  154. return this.$store.state.user.user.userId
  155. },
  156. },
  157. methods: {
  158. connectWebSocket() {
  159. this.$store.dispatch('initLiveWs', {
  160. liveWsUrl: this.liveWsUrl,
  161. liveId: this.liveId,
  162. userId: this.userId
  163. })
  164. this.socket = this.$store.state.liveWs[this.liveId]
  165. this.socket.onmessage = (event) => this.handleWsMessage(event)
  166. },
  167. handleSelect(index){
  168. this.currentComponent = index; // 切换当前显示的组件
  169. },
  170. getLiving() {
  171. getLive(this.liveId).then(res => {
  172. this.liveInfo = res.data
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style scoped>
  179. .el-tabs__header .is-top {
  180. display: none !important;
  181. }
  182. .live-config-header{
  183. padding: 5px;
  184. border: 1px solid #ebeef5;
  185. }
  186. .detail-header {
  187. display: flex;
  188. padding: 20px;
  189. border-bottom: 1px solid #ebeef5;
  190. }
  191. .header-left-area {
  192. flex: 0 0 120px;
  193. position: relative;
  194. }
  195. .header-left-area img {
  196. width: 100px;
  197. height: 100px;
  198. border-radius: 4px;
  199. }
  200. .header-middle-area {
  201. flex: 1;
  202. padding: 0 20px;
  203. }
  204. .header-right-area {
  205. flex: 0 0 200px;
  206. }
  207. .live-info-title .title-text {
  208. font-size: 20px;
  209. font-weight: 500;
  210. color: #303133;
  211. }
  212. .live-info-desc {
  213. display: flex;
  214. align-items: center;
  215. margin-top: 10px;
  216. }
  217. .live-info-desc .line {
  218. width: 1px;
  219. height: 12px;
  220. background: #c0c4cc;
  221. margin: 0 10px;
  222. }
  223. .live-info-state {
  224. display: flex;
  225. align-items: center;
  226. margin-top: 10px;
  227. }
  228. .live-info-state .line {
  229. width: 1px;
  230. height: 12px;
  231. background: #c0c4cc;
  232. margin: 0 10px;
  233. }
  234. .live-state-dot {
  235. width: 8px;
  236. height: 8px;
  237. border-radius: 50%;
  238. }
  239. .live-state-dot-liveEnd {
  240. background: #909399;
  241. }
  242. .info-state-text {
  243. font-size: 14px;
  244. color: #606266;
  245. }
  246. .operation-wrapper {
  247. display: flex;
  248. align-items: center;
  249. }
  250. .operation-item {
  251. display: flex;
  252. flex-direction: column;
  253. align-items: center;
  254. cursor: pointer;
  255. }
  256. .operation-item-text {
  257. font-size: 12px;
  258. color: #606266;
  259. margin-top: 4px;
  260. }
  261. .operation-wrapper .line {
  262. width: 1px;
  263. height: 20px;
  264. background: #c0c4cc;
  265. margin: 0 10px;
  266. }
  267. .container {
  268. display: flex;
  269. height: 100%;
  270. }
  271. .left-menu {
  272. width: 200px;
  273. border-right: 1px solid #e4e7ed;
  274. flex-shrink: 0; /* 不收缩 */
  275. }
  276. .right-info {
  277. flex: 1;
  278. padding: 20px;
  279. }
  280. .right-tabs {
  281. height: 100%;
  282. }
  283. </style>