video.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div>
  3. <ul>
  4. <li v-for="(item, i) in videoData" :key="i" @click="playVideo(item.videoUrl)">
  5. <div class="img-content" :style="{background: item.videoCover?'url(./api/file/pub/'+item.videoCover+')': '#000', backgroundSize: '100% 100%'}">
  6. <img class="play-img" width="100" height="100" src="@/assets/img/conference/player.png" alt />
  7. </div>
  8. <p class="title">{{lang=='en'? item.titleEn: item.title}}</p>
  9. </li>
  10. </ul>
  11. <div class="mask" v-show="maskShow" @click="closeMask">
  12. <video
  13. :src="currentUrl" width="500" height="350" controls="controls"
  14. id="ConferenceResultVideo">
  15. Your browser does not support the video tag.
  16. </video>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { getConfrenceDetail } from "@/api/meeting/meetingOutInfo";
  22. export default {
  23. data(){
  24. return {
  25. videoData: [],
  26. lang: '',
  27. currentUrl: '',
  28. maskShow: false,
  29. }
  30. },
  31. created(){
  32. this.lang = this.$i18n.locale;
  33. },
  34. watch: {
  35. '$i18n.locale'(val){
  36. this.lang = val;
  37. }
  38. },
  39. mounted(){
  40. getConfrenceDetail(this.$route.query.key).then((res) => {
  41. this.videoData = res.data.meetingOutInfo.video.filter(item =>{
  42. return (item.outType == "VIDEO" && item.videoUrl);
  43. });
  44. console.log('视频',this.videoData)
  45. });
  46. },
  47. methods: {
  48. closeMask(){
  49. this.maskShow = false;
  50. let videoEl = document.getElementById('ConferenceResultVideo');
  51. videoEl.pause();
  52. },
  53. playVideo(url){
  54. this.currentUrl = './api/file/pub/'+ url;
  55. this.maskShow = true;
  56. let videoEl = document.getElementById('ConferenceResultVideo');
  57. videoEl.play();
  58. },
  59. }
  60. }
  61. </script>
  62. <style scoped>
  63. *{
  64. box-sizing: border-box;
  65. }
  66. ul{
  67. display: flex;
  68. flex-wrap: wrap;
  69. padding: 20px 10px;
  70. }
  71. li{
  72. width: 33.3%;
  73. min-height: 247px;
  74. padding: 10px;
  75. }
  76. .img-content{
  77. width: 100%;
  78. height: 240px;
  79. position: relative;
  80. }
  81. .img-content img{
  82. position: absolute;
  83. top: 50%;
  84. left: 50%;
  85. transform: translate(-50%, -50%);
  86. cursor: pointer;
  87. opacity: 0.8;
  88. }
  89. .img-content img:hover{
  90. opacity: 1;
  91. }
  92. .title{
  93. text-align: center;
  94. margin: 10px 0;
  95. }
  96. video{
  97. background: #000;
  98. border: 1px solid #000;
  99. }
  100. .mask{
  101. width: 100vw;
  102. height: 100vh;
  103. position: fixed;
  104. top: 0;
  105. left: 0;
  106. background: rgba(0 ,0 , 0, 0.7);
  107. z-index: 9;
  108. }
  109. .mask video{
  110. max-width: 100%;
  111. position: absolute;
  112. top: 50%;
  113. left: 50%;
  114. transform: translate(-50%, -50%);
  115. outline: none;
  116. }
  117. </style>