live.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <div
  3. class="mt-10px shadow-default bg-white pl-35px pr-30px pr-35px h-60px rounded-10px relative flex items-center justify-between"
  4. >
  5. <h3 class="nav-title">
  6. 直播课程 -
  7. <span>{{ course_title }}</span>
  8. </h3>
  9. <div class="btnDiv">
  10. <el-button
  11. size="large"
  12. @click="linkTo('jsd_personal_wdkc_zbkc_chapter')"
  13. class="w-100px"
  14. >返回
  15. </el-button>
  16. </div>
  17. </div>
  18. <div
  19. class="mt-10px shadow-default bg-white-grey pt-25px pl-35px pr-35px pb-35px rounded-10px"
  20. >
  21. <div class="flex justify-between">
  22. <div class="w-800px relative">
  23. <div class="flex justify-between items-center">
  24. <h3 class="nav-title flex-1">
  25. <span>第{{ numberToChinese(chapter_info.order_num) }}课时:</span>
  26. <span>{{ chapter_info.tzk_ksmc }}</span>
  27. </h3>
  28. <div class="flex">
  29. <div class="relative align-middle share cursor-pointer">
  30. <span class="align-middle"></span>
  31. <i
  32. class="ml-5px text-16px color-blue inline-block align-middle not-italic"
  33. >分享</i
  34. >
  35. <div class="share-box">
  36. <div class="share-arrow"></div>
  37. <div class="share-con">
  38. <h3 class="text-16px text-center text-black">
  39. 呼唤小伙伴们前来围观吧
  40. </h3>
  41. <div class="flex items-center">
  42. <div class="pt-15px">
  43. <h3 class="t-1">直播间地址</h3>
  44. <h4 class="t-2 mt-8px truncate px-5px">
  45. {{ shareLink }}
  46. </h4>
  47. <div class="mt-10px btnDiv">
  48. <el-button
  49. size="small"
  50. class="w-100px"
  51. @click="copyLink"
  52. >复制链接
  53. </el-button>
  54. </div>
  55. </div>
  56. <div class="d-line"></div>
  57. <div class="w-100px h-100px">
  58. <qrcode-vue
  59. :value="chapter_info.pull_m3u8_address"
  60. size="100"
  61. level="H"
  62. />
  63. </div>
  64. <h3 class="ml-15px text-12px text-black">手机扫码分享</h3>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="mt-20px" id="player-con"></div>
  72. <ChatBlock :id="tzk_id" />
  73. </div>
  74. <!-- v-if="chapter_info.tzk_zjr_user_id === user.user_id" -->
  75. <div class="w-300px mt-46px right-box pt-30px relative">
  76. <el-button v-if="chapter_info.tzk_zjr_user_id === user.user_id" type="primary" color="#1259a1" size="large" class="w-100px live-btn" @click="launchLive">启动直播工具
  77. </el-button>
  78. <!-- <div v-if="user.user_role_id === '75'" class="right-nav ml-20px">
  79. <span>相关文档</span>
  80. <i></i>
  81. </div> -->
  82. <homeworkBlock :id="tzk_id" :dxa="chapter_info.tzk_dxa_file" :homework="chapter_info.tzk_ksce_file" :file="chapter_info.tzk_files_json" :zjr="chapter_info.tzk_zjr_user_id" :ks_id="chapter_info.tzk_ksce_tq_id" @filePre="filePre"></homeworkBlock>
  83. </div>
  84. </div>
  85. </div>
  86. <el-dialog v-model="dialogVisible" :title="title" width="80%">
  87. <!-- <iframe
  88. style="width: 100%; height: 700px; overflow-y: auto"
  89. :src="chapter_info.kscs_preview"
  90. ></iframe> -->
  91. <filePreview style="width: 100%; height: 700px; overflow-y: auto" :url="previewUrl"></filePreview>
  92. <template #footer>
  93. <div class="text-center">
  94. <el-button size="large" type="primary" @click="dialogVisible = false"
  95. >确定</el-button
  96. >
  97. </div>
  98. </template>
  99. </el-dialog>
  100. </template>
  101. <script setup>
  102. import { user } from "@/store/index";
  103. import filePreview from '@/components/FilePreview/index.vue'
  104. import { ElMessageBox } from "element-plus";
  105. import ChatBlock from "../../../zbkc/chat.vue";
  106. import homeworkBlock from "../../../zbkc/homework.vue";
  107. import { useRoute, useRouter } from "vue-router";
  108. import {
  109. chapter_detail,
  110. thumb_add,
  111. thumb_del,
  112. } from "@/pages/jsd/wdkc/zbkc/api.js";
  113. import QrcodeVue from "qrcode.vue";
  114. import { numberToChinese } from "@/utils/helper.ts";
  115. const router = useRouter();
  116. const route = useRoute();
  117. let course_title = $ref("");
  118. let tz_id = $ref("");
  119. let tzk_id = $ref("");
  120. let shareLink = $ref("");
  121. let chapter_info = $ref({
  122. tzk_ksmc: "",
  123. tzk_dzl: "",
  124. is_like: "",
  125. tmz_video_url: "",
  126. tmk_sftjmszx: "",
  127. });
  128. let chapterList = $ref([]);
  129. const navList = [
  130. {
  131. id: "1",
  132. title: "作业&答案",
  133. },
  134. {
  135. id: "2",
  136. title: "资源",
  137. },
  138. ];
  139. let navSelected = $ref("1");
  140. let res_list = $ref([]);
  141. let homework_list = $ref([]);
  142. let dialogVisible = $ref(false);
  143. let previewUrl = $ref("");
  144. const linkTo = (name) => {
  145. router.push({ name: name, params: { tz_id: tz_id } });
  146. };
  147. function getChapterDetail() {
  148. let data = {
  149. tzk_id: tzk_id,
  150. };
  151. chapter_detail(data).then((res) => {
  152. if (res.code === "1") {
  153. chapter_info = res.data.one_info;
  154. course_title = res.data.one_info.kc_info.tz_kcbt;
  155. // if(res.data.one_info.tmz_zjkj_file !== '') {
  156. // let res_obj = {
  157. // title:res.data.one_info.tmz_zjkj_file.split(';')[0],
  158. // url:res.data.one_info.online_file
  159. // }
  160. // res_list.push(res_obj);
  161. // }
  162. // if(res.data.one_info.tmz_zjsjdajx_file !== '') {
  163. // let work_obj = {
  164. // title:res.data.one_info.tmz_zjsjdajx_file.split(';')[0],
  165. // url:res.data.one_info.online_zy_file
  166. // }
  167. // homework_list.push(work_obj);
  168. // }
  169. var player = new Aliplayer(
  170. {
  171. id: "player-con",
  172. source: res.data.one_info.pull_m3u8_address,
  173. width: "100%",
  174. height: "636px",
  175. autoplay: true,
  176. cover: res.data.one_info.tzk_img,
  177. isLive: true,
  178. rePlay: false,
  179. playsinline: true,
  180. preload: true,
  181. controlBarVisibility: "hover",
  182. useH5Prism: true,
  183. skinLayout: [
  184. {
  185. name: "bigPlayButton",
  186. align: "blabs",
  187. x: 30,
  188. y: 80,
  189. },
  190. {
  191. name: "H5Loading",
  192. align: "cc",
  193. },
  194. {
  195. name: "errorDisplay",
  196. align: "tlabs",
  197. x: 0,
  198. y: 0,
  199. },
  200. {
  201. name: "infoDisplay",
  202. },
  203. {
  204. name: "tooltip",
  205. align: "blabs",
  206. x: 0,
  207. y: 56,
  208. },
  209. {
  210. name: "thumbnail",
  211. },
  212. {
  213. name: "controlBar",
  214. align: "blabs",
  215. x: 0,
  216. y: 0,
  217. children: [
  218. {
  219. name: "progress",
  220. align: "blabs",
  221. x: 0,
  222. y: 44,
  223. },
  224. {
  225. name: "playButton",
  226. align: "tl",
  227. x: 15,
  228. y: 12,
  229. },
  230. {
  231. name: "timeDisplay",
  232. align: "tl",
  233. x: 10,
  234. y: 7,
  235. },
  236. {
  237. name: "fullScreenButton",
  238. align: "tr",
  239. x: 10,
  240. y: 12,
  241. },
  242. {
  243. name: "setting",
  244. align: "tr",
  245. x: 15,
  246. y: 12,
  247. },
  248. {
  249. name: "volume",
  250. align: "tr",
  251. x: 5,
  252. y: 10,
  253. },
  254. ],
  255. },
  256. ],
  257. },
  258. function (player) {
  259. console.log("The player is created");
  260. }
  261. );
  262. }
  263. });
  264. }
  265. function changeChapter(item) {
  266. router.replace({
  267. name: "jsd_personal_wdkc_mszy_detail",
  268. params: { tmk_id: item.tmk_id, tmz_id: item.tmz_id },
  269. });
  270. // ttk_id=item.ttk_id;
  271. // ttz_id=item.ttz_id;
  272. // getChapterDetail();
  273. }
  274. function changeNav(item) {
  275. navSelected = item.id;
  276. }
  277. if (route.params.tz_id) {
  278. tz_id = route.params.tz_id;
  279. tzk_id = route.params.tzk_id;
  280. // shareLink = window.location.href;
  281. let a = window.location.href.indexOf("#");
  282. let link = window.location.href.substring(0, a);
  283. shareLink = `${link}#/home_zbkc/home_zbkc_isLive/${route.params.tz_id}/${route.params.tzk_id}`;
  284. getChapterDetail();
  285. // getChapterList();
  286. }
  287. watch(
  288. () => route.path,
  289. () => {
  290. router.go(0);
  291. }
  292. );
  293. async function copyLink() {
  294. await navigator.clipboard.writeText(shareLink);
  295. ElMessage.success("已复制");
  296. }
  297. function showDetail(url) {
  298. dialogVisible = true;
  299. previewUrl = url;
  300. }
  301. function launchLive() {
  302. window.open(chapter_info.push_rtmp_address, "_blank");
  303. }
  304. let title = $ref('资源预览')
  305. function filePre(item) {
  306. console.log(item, 111111);
  307. dialogVisible = true;
  308. previewUrl = getFullUrl(item);
  309. }
  310. </script>
  311. <style lang="scss" scoped>
  312. $color: #1259a1;
  313. .color-blue {
  314. color: $color;
  315. }
  316. .bg-white-grey {
  317. background: #fcfeff;
  318. }
  319. .shadow-default {
  320. box-shadow: 0 10px 24px rgba(161, 153, 168, 0.18);
  321. }
  322. .color-grey {
  323. color: #999;
  324. }
  325. .border-bottom-1 {
  326. border-bottom: 1px solid #eee;
  327. }
  328. .nav-title {
  329. font-size: 16px;
  330. color: #949494;
  331. span {
  332. font-size: 18px;
  333. color: #050026;
  334. }
  335. }
  336. .btnDiv {
  337. .el-button {
  338. background: $color;
  339. border-color: $color;
  340. color: #fff;
  341. }
  342. }
  343. .search-box {
  344. width: 300px;
  345. height: 48px;
  346. background: #f6f8fa;
  347. border-radius: 8px;
  348. padding: 0 10px 0 14px;
  349. display: flex;
  350. align-items: center;
  351. input {
  352. flex: 1;
  353. height: 48px;
  354. border: 0;
  355. font-size: 16px;
  356. color: #333;
  357. outline: none;
  358. background: #f6f8fa;
  359. }
  360. .search-btn {
  361. width: 26px;
  362. height: 26px;
  363. border-radius: 6px;
  364. background: $color url("/images/icon-search.png") center no-repeat;
  365. background-size: 13px 13px;
  366. }
  367. }
  368. .course-list {
  369. display: flex;
  370. flex-wrap: wrap;
  371. li {
  372. min-width: 0;
  373. width: 268px;
  374. background: #fff;
  375. border-radius: 10px;
  376. box-shadow: 0 1px 6px rgba(0, 0, 0, 0.11);
  377. margin-right: 19px;
  378. margin-bottom: 15px;
  379. cursor: pointer;
  380. &:nth-child(4n) {
  381. margin-right: 0;
  382. }
  383. .course-img {
  384. width: 100%;
  385. height: 151px;
  386. border-radius: 10px 10px 0 0;
  387. overflow: hidden;
  388. img {
  389. width: 100%;
  390. }
  391. .info-bottom {
  392. position: absolute;
  393. left: 0;
  394. bottom: 0;
  395. z-index: 30;
  396. width: 152px;
  397. height: 27px;
  398. background: rgba(0, 0, 0, 0.5);
  399. border-radius: 0 10px 0 0;
  400. display: flex;
  401. .icon-view {
  402. width: 24px;
  403. height: 16px;
  404. background: url("/images/icon/view.png") center no-repeat;
  405. background-size: 24px 16px;
  406. }
  407. .icon-thumb {
  408. width: 17px;
  409. height: 16px;
  410. background: url("/images/icon/thumb.png") center no-repeat;
  411. background-size: 17px 16px;
  412. }
  413. }
  414. }
  415. }
  416. }
  417. .thumb {
  418. display: inline-block;
  419. font-size: 16px;
  420. color: $color;
  421. span {
  422. width: 21px;
  423. height: 20px;
  424. display: inline-block;
  425. background: url("/images/icon-thumb.png") center no-repeat;
  426. background-size: 21px 20px;
  427. &.selected {
  428. background: url("/images/icon-thumb-blue.png") center no-repeat;
  429. background-size: 21px 20px;
  430. }
  431. }
  432. }
  433. .share {
  434. display: inline-block;
  435. font-size: 16px;
  436. color: $color;
  437. &:hover {
  438. .share-box {
  439. display: block;
  440. }
  441. }
  442. span {
  443. width: 20px;
  444. height: 20px;
  445. display: inline-block;
  446. background: url("/images/icon-share.png") center no-repeat;
  447. background-size: 20px 20px;
  448. }
  449. .share-box {
  450. display: none;
  451. position: absolute;
  452. left: 50%;
  453. top: 24px;
  454. z-index: 1000;
  455. margin-left: -209px;
  456. width: 418px;
  457. padding-top: 7px;
  458. .share-arrow {
  459. margin: 0 auto;
  460. width: 17px;
  461. height: 9px;
  462. background: url("/images/icon-share-arrow.png") center no-repeat;
  463. background-size: 17px 9px;
  464. }
  465. .share-con {
  466. margin-top: -2px;
  467. width: 100%;
  468. border-top: 4px solid #1259a1;
  469. height: 198px;
  470. background: #fff;
  471. border-radius: 10px;
  472. padding: 20px 0 0 15px;
  473. box-shadow: 0 0 5px rgba(0, 0, 0, 0.25);
  474. .t-1 {
  475. font-size: 12px;
  476. color: #00a3ff;
  477. }
  478. .t-2 {
  479. width: 177px;
  480. height: 34px;
  481. background: #f7f7f7;
  482. font-size: 12px;
  483. color: #000;
  484. line-height: 34px;
  485. }
  486. .d-line {
  487. margin: 15px 15px 0 15px;
  488. width: 1px;
  489. height: 120px;
  490. background: rgb(232, 232, 232);
  491. }
  492. }
  493. }
  494. }
  495. .right-box {
  496. height: 460px;
  497. background: #ffffff;
  498. border-radius: 12px;
  499. box-shadow: 2px 10px 24px rgba(161, 153, 168, 0.18);
  500. .right-nav {
  501. position: relative;
  502. width: 72px;
  503. span {
  504. position: relative;
  505. display: block;
  506. z-index: 30;
  507. font-size: 16px;
  508. color: #222;
  509. text-align: center;
  510. line-height: 30px;
  511. }
  512. i {
  513. position: absolute;
  514. left: 0;
  515. bottom: 3px;
  516. width: 100%;
  517. height: 6px;
  518. border-radius: 3px;
  519. background: rgba(108, 93, 211, 0.2);
  520. }
  521. }
  522. .right-chapter-list {
  523. width: 100%;
  524. height: 350px;
  525. overflow-y: auto;
  526. li {
  527. margin: 0 auto;
  528. width: 253px;
  529. height: 40px;
  530. background: rgba(18, 89, 161, 0.05);
  531. border-radius: 16px 16px 0 0;
  532. padding: 0 20px;
  533. font-size: 14px;
  534. color: #050026;
  535. line-height: 40px;
  536. cursor: pointer;
  537. &.selected {
  538. background: #1259a1;
  539. color: #fff;
  540. }
  541. & + li {
  542. margin: 20px auto 0;
  543. }
  544. }
  545. }
  546. }
  547. .res-box {
  548. width: 100%;
  549. height: 317px;
  550. background: #ffffff;
  551. border-radius: 12px;
  552. box-shadow: 2px 10px 24px rgba(161, 153, 168, 0.18);
  553. .res-nav {
  554. display: flex;
  555. justify-content: center;
  556. align-items: center;
  557. li {
  558. position: relative;
  559. padding: 0 5px;
  560. cursor: pointer;
  561. &.selected {
  562. span {
  563. color: #1259a1;
  564. }
  565. }
  566. & + li {
  567. margin-left: 60px;
  568. }
  569. span {
  570. position: relative;
  571. display: block;
  572. font-size: 16px;
  573. color: #9fa9b4;
  574. text-align: center;
  575. }
  576. i {
  577. position: absolute;
  578. left: 0;
  579. bottom: 2px;
  580. width: 100%;
  581. height: 6px;
  582. opacity: 0.2;
  583. background: #1259a1;
  584. border-radius: 3px;
  585. }
  586. }
  587. }
  588. .res-list {
  589. width: 100%;
  590. padding: 0 20px 0 30px;
  591. height: 200px;
  592. overflow-y: auto;
  593. li {
  594. display: flex;
  595. padding: 20px;
  596. align-items: center;
  597. & + li {
  598. border-top: 1px dashed rgba(110, 88, 197, 0.5);
  599. }
  600. .file-type {
  601. min-width: 0;
  602. width: 26px;
  603. height: 26px;
  604. &.word {
  605. background: url("/images/word.png") center no-repeat;
  606. }
  607. &.excel {
  608. background: url("/images/excel.png") center no-repeat;
  609. }
  610. &.ppt {
  611. background: url("/images/ppt.png") center no-repeat;
  612. }
  613. &.pdf {
  614. background: url("/images/pdf.png") center no-repeat;
  615. }
  616. }
  617. .file-btn {
  618. width: 58px;
  619. height: 24px;
  620. border: 1px solid #1259a1;
  621. border-radius: 12px;
  622. font-size: 12px;
  623. color: #1259a1;
  624. text-align: center;
  625. }
  626. }
  627. }
  628. }
  629. ::v-deep .el-dialog__footer {
  630. text-align: center;
  631. }
  632. .live-btn {
  633. position: absolute;
  634. right: 0;
  635. top: -55px;
  636. }
  637. :deep(.chat) {
  638. // background-color: rgba($color:#fff, $alpha: .7);
  639. position: absolute;
  640. bottom: 0;
  641. z-index: 100;
  642. }
  643. </style>