VideoDetail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="video_detail_contianer">
  3. <el-container>
  4. <el-aside width="284px">
  5. <div class="aside_header">
  6. <span>CONTACT</span>
  7. <span>章节目录</span>
  8. </div>
  9. <div class="aside_content">
  10. <el-tree ref="treeBox" :data="videoList" :props="defaultProps" :default-expanded-keys="expandId" node-key="id" :default-checked-keys="childrenId" :highlight-current="true" @node-click="treeNodeClick">
  11. <p class="custom-tree-node text-ellipsis" :title="node.label" slot-scope="{node, data}">
  12. <span :title="node.label">{{ node.label }}</span>
  13. </p>
  14. </el-tree>
  15. </div>
  16. </el-aside>
  17. <el-main>
  18. <div class="video_wrap">
  19. <div class="videoplay">
  20. <div class="video">
  21. <mx-video :aliIdType="aliIdType" :src="section_aliId"></mx-video>
  22. </div>
  23. </div>
  24. <div class="text">
  25. <span class="info_active">课程概要</span>
  26. </div>
  27. </div>
  28. <!-- 视频 信息 -->
  29. <div class="video_info">
  30. <!-- 课程概要 -->
  31. <div class="summary">
  32. <div class="summary_tit">
  33. {{ videoInfo.title }}
  34. </div>
  35. <div class="vis_totle">
  36. <img src="@/assets/images/icon_eye.png" alt="" />
  37. <span>-人已观看</span>
  38. </div>
  39. </div>
  40. </div>
  41. </el-main>
  42. </el-container>
  43. </div>
  44. </template>
  45. <script>
  46. import aliplayer from "./compoent/aliplayer";
  47. import {
  48. videoInfo,
  49. getVideoPlayAuth
  50. } from "@/api/webApi/webVideo";
  51. export default {
  52. components: {
  53. aliplayer,
  54. },
  55. data() {
  56. return {
  57. packId: "",
  58. videoList: [],
  59. defaultProps: {
  60. children: "children",
  61. label: "section_name",
  62. },
  63. aliIdType: '',
  64. section_aliId: "", // 默认的视频aliId
  65. expandId: [], // 默认展开的节点id
  66. childrenId: [], // 默认选中的节点id
  67. checkNode: {}, //选中的节点
  68. videoUrl: "",
  69. videoInfo: {},
  70. };
  71. },
  72. created() {
  73. this.packId = this.$route.query.packId;
  74. this.aliIdType = this.$route.query.aliIdType;
  75. this.section_aliId = this.$route.query.section_aliId;
  76. this.expandId.push(this.$route.query.chapter_id);
  77. this.childrenId.push(this.$route.query.childrenId);
  78. this.getVideos();
  79. },
  80. methods: {
  81. getVideos() {
  82. videoInfo({
  83. packId: this.packId
  84. }).then((res) => {
  85. console.log(res.rows);
  86. let arr = res.rows.map((item, index) => {
  87. if (item.chapter_name) {
  88. item.section_name = item.chapter_name;
  89. delete item.chapter_name;
  90. }
  91. if (item.chapter_id) {
  92. item.id = item.chapter_id;
  93. delete item.chapter_id;
  94. }
  95. item.children.map((child, childIndex) => {
  96. child.section_name = `${index + 1}-${childIndex + 1} ${child.section_name
  97. } `;
  98. });
  99. return item;
  100. });
  101. console.log(arr);
  102. this.videoList = res.rows;
  103. this.$nextTick(function () {
  104. this.$refs.treeBox.setCurrentKey(this.childrenId[0]);
  105. this.checkNode = this.$refs.treeBox.getCheckedNodes();
  106. });
  107. });
  108. },
  109. treeNodeClick(data) {
  110. if (data.hasOwnProperty("children")) {
  111. return;
  112. }
  113. this.checkNode = data;
  114. this.aliIdType = data.aliIdType;
  115. this.section_aliId = data.section_aliId;
  116. },
  117. },
  118. };
  119. </script>
  120. <style scoped>
  121. .video_detail_contianer {
  122. padding: 20px;
  123. min-height: 100vh;
  124. background: #f7f7f7;
  125. }
  126. .el-main {
  127. padding: 7px 8px;
  128. background: #fff;
  129. }
  130. .aside_header {
  131. background: white;
  132. display: flex;
  133. flex-direction: column;
  134. justify-content: flex-end;
  135. padding: 24px 16px 0 16px;
  136. margin-bottom: 16px;
  137. }
  138. .el-aside {
  139. background: white;
  140. padding: 0;
  141. margin-bottom: 0;
  142. margin-right: 16px;
  143. }
  144. .aside_header span {
  145. margin-top: 5px;
  146. width: 84px;
  147. height: 22px;
  148. font-size: 16px;
  149. font-family: PingFangSC-Medium, PingFang SC;
  150. font-weight: 500;
  151. color: #343434;
  152. line-height: 22px;
  153. }
  154. .aside_header span:first-child {
  155. width: 173px;
  156. height: 27px;
  157. background: linear-gradient(180deg, #ffffff 0%, #47c6a2 100%);
  158. opacity: 0.5;
  159. }
  160. .video_wrap {
  161. border-bottom: 10px solid #f7f7f7;
  162. }
  163. .video_wrap video {
  164. width: 100%;
  165. height: 566px;
  166. }
  167. .text {
  168. padding-left: 32px;
  169. }
  170. .text span {
  171. cursor: pointer;
  172. width: 64px;
  173. font-size: 16px;
  174. font-family: PingFangSC-Medium, PingFang SC;
  175. font-weight: 600;
  176. color: #343434;
  177. margin-right: 16px;
  178. position: relative;
  179. padding: 32px 0 25px 0;
  180. display: inline-block;
  181. }
  182. .video_info {
  183. width: 100%;
  184. height: 172px;
  185. background: #ffffff;
  186. border-radius: 4px;
  187. padding-top: 28px;
  188. padding-left: 32px;
  189. font-size: 14px;
  190. font-family: PingFangSC-Medium, PingFang SC;
  191. font-weight: 500;
  192. color: #343434;
  193. }
  194. .info_active::after {
  195. content: "";
  196. width: 0px;
  197. height: 0px;
  198. border-width: 10px;
  199. border-style: solid;
  200. border-color: transparent transparent #47c6a2 transparent;
  201. position: absolute;
  202. bottom: -10px;
  203. left: 50%;
  204. transform: translateX(-50%);
  205. }
  206. .video_info {
  207. border-top: 4px solid #47c6a2;
  208. border-radius: 4px 4px 0px 0px;
  209. }
  210. .summary_tit {
  211. margin-bottom: 16px;
  212. }
  213. .vis_totle {
  214. display: flex;
  215. flex-direction: row;
  216. align-items: center;
  217. }
  218. .vis_totle img {
  219. margin-right: 6px;
  220. }
  221. .el-tree {
  222. overflow: scroll;
  223. height: 600px;
  224. scroll-margin: 20px;
  225. overflow-x: hidden;
  226. }
  227. ::-webkit-scrollbar {
  228. width: 4px;
  229. }
  230. ::-webkit-scrollbar-thumb {
  231. -webkit-box-shadow: inset 0 0 1px rgba(136, 136, 136, 0.3);
  232. background-color: rgb(238, 241, 245);
  233. }
  234. </style>
  235. <style lang="scss" scoped>
  236. .video_detail_contianer ::v-deep .el-tree-node__content {
  237. padding-top: 6px;
  238. padding-bottom: 6px;
  239. height: 32px;
  240. font-size: 14px;
  241. font-family: PingFangSC-Medium, PingFang SC;
  242. font-weight: 500;
  243. color: #343434;
  244. line-height: 20px;
  245. }
  246. .video_detail_contianer ::v-deep .el-tree-node__expand-icon.expanded {
  247. content: "";
  248. }
  249. .video_detail_contianer ::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
  250. padding: 6px;
  251. /* position: absolute; */
  252. right: 16px;
  253. }
  254. .video_detail_contianer ::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  255. color: #47c6a2;
  256. }
  257. </style>