index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div class="container">
  3. <div class="popup-player" v-if="showVideo">
  4. <div class="mask" @click="()=>{currenVideo='';showVideo=false}"></div>
  5. <video autoplay controls :src="currenVideo" class="video-fr"></video>
  6. </div>
  7. <mediaSwiper @handleVideo="itemHandle" class="media-con"/>
  8. <div class="setion">
  9. <p class="b-text2">{{langVideoCourse.name}}</p>
  10. <p class="b-text3">{{langVideoCourse.sub}}</p>
  11. <ul class="i-ul">
  12. <li @click="itemHandle(sub)" v-for="(sub,idx) in langVideoCourse.items" :key="idx">
  13. <img class="li-img" :src="`${$cdn}course/img/${sub.code}.jpg`" alt="">
  14. <img class="bofang" :src="`${$cdn}course/img/video_play@2x.png`" alt="">
  15. <h3 class="btom-text">{{sub.name}}</h3>
  16. </li>
  17. </ul>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { mapState } from 'vuex'
  23. import mediaSwiper from '@/components/videoSwiper'
  24. export default {
  25. components: {
  26. mediaSwiper
  27. },
  28. computed: {
  29. ...mapState({
  30. langVideoCourse: state => state.language.home.videoCourse.content[1],
  31. language: state => state.language.current
  32. })
  33. },
  34. data () {
  35. return {
  36. currenVideo: '',
  37. showVideo: false
  38. }
  39. },
  40. methods: {
  41. itemHandle (item) {
  42. this.showVideo = true
  43. this.currenVideo = `${this.$cdn}course/videos/${this.language === 'en' ? `en/${item.code}` : item.code}.mp4`
  44. },
  45. itemHandles (item) {
  46. console.log(item)
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .container{
  53. width: 100%;
  54. .media-con{
  55. width: 90%;
  56. margin: 20px auto;
  57. }
  58. .popup-player {
  59. position: fixed;
  60. left: 0;
  61. top: 0;
  62. width: 100%;
  63. height: 100%;
  64. z-index: 99999;
  65. .mask {
  66. width: 100%;
  67. height: 100%;
  68. position: absolute;
  69. left: 0;
  70. top: 0;
  71. background: rgba(0, 0, 0, 0.9);
  72. }
  73. .video-fr {
  74. width: 100%;
  75. position: absolute;
  76. top: 50%;
  77. left: 50%;
  78. transform: translate(-50%, -50%);
  79. }
  80. }
  81. .setion{
  82. width: 90%;
  83. margin: 20px auto;
  84. .b-text2,.b-text3{
  85. text-align: left;
  86. margin-left: 0;
  87. margin-right: 0;
  88. }
  89. .i-ul{
  90. display: flex;
  91. justify-content: space-between;
  92. align-items: center;
  93. flex-wrap: wrap;
  94. width: 100%;
  95. li{
  96. position: relative;
  97. max-width: 49%;
  98. min-height: 160px;
  99. margin-top: 20px;
  100. .btom-text{
  101. font-size: 14px;
  102. color: rgba(0, 0, 0, 0.7);
  103. line-height: 20px;
  104. font-weight: bold;
  105. margin-top: 10px;
  106. }
  107. .li-img{
  108. width: 100%;
  109. cursor: pointer;
  110. border-radius: 4px;
  111. overflow: hidden;
  112. }
  113. .bofang{
  114. width: 20px;
  115. height: 20px;
  116. position: absolute;
  117. left: 20px;
  118. top: 70px;
  119. }
  120. .li-p{
  121. font-size: 16px;
  122. color: #2d2d2d;
  123. margin-top: 10px;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. </style>