Video.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="video-page">
  3. <div class="video-title">
  4. <h3 class="video-title-h3">{{routerData.applyName}}</h3>
  5. </div>
  6. <div class="video-info">
  7. <div class="video-src">
  8. <video-player class="video-player-box" style="width:800px;"
  9. ref="videoPlayer"
  10. :options="playerOptions"
  11. :playsinline="true">
  12. </video-player>
  13. </div>
  14. <div class="video-detail-info">
  15. <Form :label-width="100">
  16. <FormItem label="获奖情况:">
  17. <span>{{routerData.activityAwardName}}</span>
  18. </FormItem>
  19. <FormItem label="主讲:">
  20. <span>{{routerData.employeeName}}</span>
  21. </FormItem>
  22. <FormItem label="单位:">
  23. <span>{{routerData.employeeSchoolName}}</span>
  24. </FormItem>
  25. <FormItem label="年级:">
  26. <span>{{routerData.gradeName}}</span>
  27. </FormItem>
  28. <FormItem label="学科:">
  29. <span>{{routerData.categoryName}}</span>
  30. </FormItem>
  31. <FormItem label="教学设计:">
  32. <span>暂无数据</span>
  33. </FormItem>
  34. <FormItem label="教学反思:">
  35. <span>暂无数据</span>
  36. </FormItem>
  37. </Form>
  38. <div class="download-video">
  39. <a download="video" style="color:#999999;font-size:14px;" href="https://teammodelstorage.blob.core.chinacloudapi.cn/teammodelcontest/20190517/%E5%B0%8F%E5%AD%A6%E8%8B%B1%E8%AF%AD301%E8%83%A1%E9%A2%96--2019.mp4">
  40. <Icon type="md-cloud-download" size="22" color="white" />
  41. 下载视频
  42. </a>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="video-other">
  47. <h3 class="video-title-h3">推荐作品</h3>
  48. </div>
  49. <div class="videos-wrap">
  50. <div class="video-item" v-for="(item , index) in rewardDatas" @click="showVideo(index)">
  51. <img src="../../assets/image/default-act.png" width="95%" />
  52. <p>{{item.applyName}}</p>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import rewardList from '@/static/rewardList.json'
  59. import"videojs-contrib-hls.js/src/videojs.hlsjs"
  60. import { setTimeout } from 'core-js';
  61. export default {
  62. data() {
  63. return {
  64. playerOptions: {
  65. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  66. autoplay: false, //如果true,浏览器准备好时开始回放。
  67. controls: true, //控制条
  68. preload: 'auto', //视频预加载
  69. muted: false, //默认情况下将会消除任何音频。
  70. loop: false, //导致视频一结束就重新开始。
  71. language: 'zh-CN',
  72. aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  73. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  74. sources: [{
  75. type: 'application/x-mpegURL',
  76. src: 'https://teammodelstorage.blob.core.chinacloudapi.cn/teammodelcontest/20190517/demo/2019.m3u8'
  77. }],
  78. //poster: "http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg", //你的封面地址
  79. width: document.documentElement.clientWidth,
  80. notSupportedMessage: '此视频暂无法播放,请稍后再试' //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  81. },
  82. routerData: {},
  83. rewardDatas: [],
  84. videos: [
  85. {
  86. title:'05月11日直播'
  87. },
  88. {
  89. title:'05月12日直播'
  90. },
  91. {
  92. title:'05月13日直播'
  93. },
  94. {
  95. title:'05月14日直播'
  96. },
  97. {
  98. title:'05月15日直播'
  99. },
  100. {
  101. title:'05月16日直播'
  102. },
  103. {
  104. title:'05月17日直播'
  105. },
  106. {
  107. title:'05月18日直播'
  108. }
  109. ]
  110. }
  111. },
  112. methods: {
  113. showVideo(index) {
  114. //alert(index);
  115. this.$router.push(
  116. {
  117. name: 'video',
  118. query: {
  119. rewardIndex: index
  120. }
  121. }
  122. );
  123. this.$refs.videoPlayer.player.src({ type: "application/x-mpegURL", src: "https://teammodelstorage.blob.core.chinacloudapi.cn/teammodelcontest/20190517/history/history.m3u8" });
  124. }
  125. },
  126. mounted() {
  127. let index = this.$route.query.rewardIndex;
  128. //alert(index);
  129. this.rewardDatas = rewardList.data.list;
  130. if (index == undefined) {
  131. this.routerData = this.rewardDatas[0];
  132. } else {
  133. this.routerData = this.rewardDatas[index];
  134. }
  135. },
  136. watch: {
  137. $route() {
  138. this.$Spin.show();
  139. let that = this;
  140. let index = this.$route.query.rewardIndex;
  141. //alert(index);
  142. if (index == undefined) {
  143. this.routerData = this.rewardDatas[0];
  144. } else {
  145. this.routerData = this.rewardDatas[index];
  146. }
  147. setTimeout(function () {
  148. that.$Spin.hide()
  149. }, 500);
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. .video-page {
  156. width: 1200px;
  157. margin: 100px auto;
  158. }
  159. .video-title {
  160. margin-bottom: 20px;
  161. height: 20px;
  162. }
  163. .video-title-h3 {
  164. height: 20px;
  165. font-size: 20px;
  166. line-height: 20px;
  167. border-left: 6px solid #37b1fa;
  168. padding-left: 12px;
  169. }
  170. .video-info {
  171. width: 100%;
  172. display: table;
  173. }
  174. .video-detail-info {
  175. width:400px;
  176. background:#222222;
  177. display:table-cell;
  178. vertical-align:top;
  179. padding:20px 10px 20px 30px;
  180. position:relative;
  181. }
  182. .video-detail-info .ivu-form-item {
  183. margin-bottom:8px;
  184. }
  185. .video-detail-info .ivu-form .ivu-form-item-label {
  186. font-size:14px;
  187. color:#999999;
  188. }
  189. .video-detail-info .ivu-form-item-content {
  190. font-size: 14px;
  191. color: #ffffff;
  192. }
  193. .video-src {
  194. display:table-cell;
  195. width:800px;
  196. background:#000000;
  197. }
  198. .video-src .video-js {
  199. width:800px;
  200. height:450px;
  201. }
  202. .video-src .video-js .vjs-big-play-button {
  203. top: 50%;
  204. left: 50%;
  205. margin-left: -40px;
  206. margin-top:-20px;
  207. }
  208. .download-video {
  209. text-align:center;
  210. position:absolute;
  211. width:100%;
  212. bottom:20px;
  213. left:0;
  214. }
  215. .video-other {
  216. margin-top:20px;
  217. }
  218. .videos-wrap {
  219. margin:0px -10px 0px -10px;
  220. }
  221. .video-item {
  222. width: 25%;
  223. display: inline-block;
  224. padding: 0px 10px;
  225. margin-top:20px;
  226. cursor:pointer;
  227. }
  228. .video-item p {
  229. font-size: 16px;
  230. color: #000;
  231. margin-top: 10px;
  232. text-decoration: none;
  233. text-indent: 8px;
  234. }
  235. </style>