Video.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="video-page">
  3. <div class="video-title">
  4. <h3 class="video-title-h3">12月03日直播</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 videos" @click="showVideo(index)">
  51. <img src="../../assets/image/default-act.png" width="95%" />
  52. <p>{{item.title}}</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. export default {
  61. data() {
  62. return {
  63. playerOptions: {
  64. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  65. autoplay: false, //如果true,浏览器准备好时开始回放。
  66. controls: true, //控制条
  67. preload: 'auto', //视频预加载
  68. muted: false, //默认情况下将会消除任何音频。
  69. loop: false, //导致视频一结束就重新开始。
  70. language: 'zh-CN',
  71. aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  72. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  73. sources: [{
  74. type: 'application/x-mpegURL',
  75. src: 'https://teammodelstorage.blob.core.chinacloudapi.cn/teammodelcontest/20190517/demo/2019.m3u8'
  76. }],
  77. poster: "http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg", //你的封面地址
  78. width: document.documentElement.clientWidth,
  79. notSupportedMessage: '此视频暂无法播放,请稍后再试' //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  80. },
  81. routerData: {},
  82. rewardDatas: [],
  83. videos: [
  84. {
  85. title:'12月14日直播'
  86. },
  87. {
  88. title:'12月14日直播'
  89. },
  90. {
  91. title:'12月14日直播'
  92. },
  93. {
  94. title:'12月14日直播'
  95. },
  96. {
  97. title:'12月14日直播'
  98. },
  99. {
  100. title:'12月14日直播'
  101. },
  102. {
  103. title:'12月14日直播'
  104. },
  105. {
  106. title:'12月14日直播'
  107. }
  108. ]
  109. }
  110. },
  111. methods: {
  112. showVideo(index) {
  113. //alert(index);
  114. this.$router.push(
  115. {
  116. name: 'video',
  117. query: {
  118. rewardIndex: index
  119. }
  120. }
  121. );
  122. }
  123. },
  124. mounted() {
  125. let index = this.$route.query.rewardIndex;
  126. //alert(index);
  127. this.rewardDatas = rewardList.data.list;
  128. if (index == undefined) {
  129. this.routerData = this.rewardDatas[0];
  130. } else {
  131. this.routerData = this.rewardDatas[index];
  132. }
  133. },
  134. watch: {
  135. $route() {
  136. let index = this.$route.query.rewardIndex;
  137. //alert(index);
  138. if (index == undefined) {
  139. this.routerData = this.rewardDatas[0];
  140. } else {
  141. this.routerData = this.rewardDatas[index];
  142. }
  143. }
  144. }
  145. }
  146. </script>
  147. <style>
  148. .video-page {
  149. width: 1200px;
  150. margin: 100px auto;
  151. }
  152. .video-title {
  153. margin-bottom: 20px;
  154. height: 20px;
  155. }
  156. .video-title-h3 {
  157. height: 20px;
  158. font-size: 20px;
  159. line-height: 20px;
  160. border-left: 6px solid #37b1fa;
  161. padding-left: 12px;
  162. }
  163. .video-info {
  164. width: 100%;
  165. display: table;
  166. }
  167. .video-detail-info {
  168. width:400px;
  169. background:#222222;
  170. display:table-cell;
  171. vertical-align:top;
  172. padding:20px 10px 20px 30px;
  173. position:relative;
  174. }
  175. .video-detail-info .ivu-form-item {
  176. margin-bottom:8px;
  177. }
  178. .video-detail-info .ivu-form .ivu-form-item-label {
  179. font-size:14px;
  180. color:#999999;
  181. }
  182. .video-detail-info .ivu-form-item-content {
  183. font-size: 14px;
  184. color: #ffffff;
  185. }
  186. .video-src {
  187. display:table-cell;
  188. width:800px;
  189. background:#000000;
  190. }
  191. .video-src .video-js {
  192. width:800px;
  193. height:450px;
  194. }
  195. .download-video {
  196. text-align:center;
  197. position:absolute;
  198. width:100%;
  199. bottom:20px;
  200. left:0;
  201. }
  202. .video-other {
  203. margin-top:20px;
  204. }
  205. .videos-wrap {
  206. margin:0px -10px 0px -10px;
  207. }
  208. .video-item {
  209. width: 25%;
  210. display: inline-block;
  211. padding: 0px 10px;
  212. margin-top:20px;
  213. cursor:pointer;
  214. }
  215. .video-item p {
  216. font-size: 16px;
  217. color: #000;
  218. margin-top: 10px;
  219. text-decoration: none;
  220. text-indent: 8px;
  221. }
  222. </style>