index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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 PasswordBag from './passwordBag.vue'
  108. import Vote from './vote.vue'
  109. import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent,handleShelfOrUn,handleDeleteSelected } from "@/api/live/live";
  110. export default {
  111. name: 'LiveConfig',
  112. components: {
  113. WatchReward,
  114. LiveRedConf,
  115. LiveReplay,
  116. LiveLotteryConf,
  117. Answer,
  118. Goods,
  119. IdCard,
  120. Task,
  121. LiveCoupon,
  122. Barrage,
  123. Preview,
  124. PasswordBag,
  125. Vote
  126. },
  127. data() {
  128. return {
  129. activeTab: 'watchReward',
  130. liveId: null,
  131. liveInfo: {},
  132. socket:null,
  133. currentComponent: WatchReward,
  134. liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
  135. menuList:[
  136. { name: '观看奖励', label: '观看奖励', index: 'watchReward'},
  137. { name: '直播预告', label: '直播预告', index: 'preview'},
  138. { name: '红包配置', label: '红包配置', index: 'liveRedConf'},
  139. { name: '口令福袋', label: '口令福袋', index: 'passwordBag'},
  140. { name: '投票', label: '投票', index: 'vote'},
  141. { name: '抽奖配置', label: '抽奖配置', index: 'liveLotteryConf'},
  142. { name: '优惠券配置', label: '优惠券配置', index: 'liveCoupon'},
  143. { name: '直播间试题', label: '直播间试题', index: 'answer'},
  144. { name: '直播商品', label: '直播商品', index: 'goods'},
  145. { name: '回放设置', label: '回放设置', index: 'liveReplay'},
  146. // { name: '观看积分', label: '观看积分', index: 'watchScore'},
  147. { name: '运营自动化', label: '运营自动化', index: 'task'},
  148. { name: '弹幕脚本', label: '弹幕脚本', index: 'barrage'},
  149. { name: '身份认证', label: '身份认证', index: 'idCard'},
  150. ],
  151. }
  152. },
  153. created() {
  154. this.liveId = this.$route.params.liveId
  155. this.getLiving()
  156. this.connectWebSocket()
  157. },
  158. computed: {
  159. userId() {
  160. return this.$store.state.user.user.userId
  161. },
  162. },
  163. methods: {
  164. connectWebSocket() {
  165. this.$store.dispatch('initLiveWs', {
  166. liveWsUrl: this.liveWsUrl,
  167. liveId: this.liveId,
  168. userId: this.userId
  169. })
  170. this.socket = this.$store.state.liveWs[this.liveId]
  171. this.socket.onmessage = (event) => this.handleWsMessage(event)
  172. },
  173. handleSelect(index){
  174. this.currentComponent = index; // 切换当前显示的组件
  175. },
  176. getLiving() {
  177. getLive(this.liveId).then(res => {
  178. this.liveInfo = res.data
  179. })
  180. },
  181. }
  182. }
  183. </script>
  184. <style scoped>
  185. .el-tabs__header .is-top {
  186. display: none !important;
  187. }
  188. .live-config-header{
  189. padding: 5px;
  190. border: 1px solid #ebeef5;
  191. }
  192. .detail-header {
  193. display: flex;
  194. padding: 20px;
  195. border-bottom: 1px solid #ebeef5;
  196. }
  197. .header-left-area {
  198. flex: 0 0 120px;
  199. position: relative;
  200. }
  201. .header-left-area img {
  202. width: 100px;
  203. height: 100px;
  204. border-radius: 4px;
  205. }
  206. .header-middle-area {
  207. flex: 1;
  208. padding: 0 20px;
  209. }
  210. .header-right-area {
  211. flex: 0 0 200px;
  212. }
  213. .live-info-title .title-text {
  214. font-size: 20px;
  215. font-weight: 500;
  216. color: #303133;
  217. }
  218. .live-info-desc {
  219. display: flex;
  220. align-items: center;
  221. margin-top: 10px;
  222. }
  223. .live-info-desc .line {
  224. width: 1px;
  225. height: 12px;
  226. background: #c0c4cc;
  227. margin: 0 10px;
  228. }
  229. .live-info-state {
  230. display: flex;
  231. align-items: center;
  232. margin-top: 10px;
  233. }
  234. .live-info-state .line {
  235. width: 1px;
  236. height: 12px;
  237. background: #c0c4cc;
  238. margin: 0 10px;
  239. }
  240. .live-state-dot {
  241. width: 8px;
  242. height: 8px;
  243. border-radius: 50%;
  244. }
  245. .live-state-dot-liveEnd {
  246. background: #909399;
  247. }
  248. .info-state-text {
  249. font-size: 14px;
  250. color: #606266;
  251. }
  252. .operation-wrapper {
  253. display: flex;
  254. align-items: center;
  255. }
  256. .operation-item {
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. cursor: pointer;
  261. }
  262. .operation-item-text {
  263. font-size: 12px;
  264. color: #606266;
  265. margin-top: 4px;
  266. }
  267. .operation-wrapper .line {
  268. width: 1px;
  269. height: 20px;
  270. background: #c0c4cc;
  271. margin: 0 10px;
  272. }
  273. .container {
  274. display: flex;
  275. height: 100%;
  276. }
  277. .left-menu {
  278. width: 200px;
  279. border-right: 1px solid #e4e7ed;
  280. flex-shrink: 0; /* 不收缩 */
  281. }
  282. .right-info {
  283. flex: 1;
  284. padding: 20px;
  285. }
  286. .right-tabs {
  287. height: 100%;
  288. }
  289. </style>