index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div id="huiyi" class="huiyi" :style="{backgroundImage:`url(${require('@/assets/images/project/cards-bg.png')})`}">
  3. <div class="single-active" v-if="active">
  4. <img :src="require(`@/assets/images/project/${active.img}`)" alt="">
  5. <span :style="{backgroundImage:`url(${require('@/assets/images/project/select.png')})`}">{{active.name}}</span>
  6. <div class="tips">请待视频播放完毕再操作</div>
  7. </div>
  8. <ul v-else>
  9. <li @click="changeVideo(item)" :class="{active:item.id==active.id}" v-for="(item,i) in people" :key="i">
  10. <img :src="require(`@/assets/images/project/${item.img}`)" alt="">
  11. <span :style="{backgroundImage:item.id==active.id?`url(${require('@/assets/images/project/select.png')})`:'none'}">{{item.name}}</span>
  12. </li>
  13. </ul>
  14. <img v-if="showBg" class="bg" @click="hideBg" :src="require('@/assets/images/project/index-bg.png')" alt="">
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. data(){
  20. return {
  21. active:'',
  22. showBg:true,
  23. people:[{
  24. name:'陈独秀',
  25. id:'chen',
  26. img:'cdx.jpg',
  27. src:'chen.mp4'
  28. },{
  29. name:'李大钊',
  30. id:'li',
  31. img:'ldz.jpg',
  32. src:'li.mp4'
  33. },{
  34. name:'毛泽东',
  35. id:'mao',
  36. img:'mzd.jpg',
  37. src:'mao.mp4'
  38. }]
  39. }
  40. },
  41. mounted(){
  42. window.player.on("videoEnded", ()=> {
  43. this.showBg = true
  44. this.active = ''
  45. })
  46. },
  47. methods:{
  48. hideBg(){
  49. this.showBg = false
  50. },
  51. changeVideo(item){
  52. console.log(item);
  53. this.active = item
  54. window.switchVideoSrc(require(`@/assets/videos/${item.src}`))
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="less" scoped>
  60. .huiyi{
  61. color:#000;
  62. width: 100%;
  63. height: 100%;
  64. background-repeat: no-repeat;
  65. text-align: center;
  66. background-size: 100% 100%;
  67. position: relative;
  68. pointer-events: auto;
  69. .bg{
  70. cursor: pointer;
  71. width: 100%;
  72. height: 100%;
  73. position: absolute;
  74. z-index: 999;
  75. top: 0;
  76. left: 0;
  77. }
  78. >ul{
  79. display: flex;
  80. justify-content: space-between;
  81. width: 80%;
  82. position: absolute;
  83. top: 50%;
  84. left: 50%;
  85. transform: translate(-50%,-50%);
  86. >li{
  87. cursor: pointer;
  88. &:not(:last-of-type){
  89. margin-right: 40px;
  90. }
  91. >img{
  92. width: 100%;
  93. }
  94. >span{
  95. font-size: 38px;
  96. padding: 0 60px 20px;
  97. background: none;
  98. }
  99. }
  100. .active{
  101. >img{
  102. border: 16px solid #DFB057;
  103. }
  104. >span{
  105. background-repeat: no-repeat;
  106. background-size: 100% 100%;
  107. color: #DFB057;
  108. }
  109. }
  110. }
  111. .single-active{
  112. display: flex;
  113. justify-content: space-between;
  114. flex-direction: column;
  115. width: 24%;
  116. position: absolute;
  117. top: 10%;
  118. left: 50%;
  119. transform: translateX(-50%);
  120. text-align: center;
  121. >img{
  122. width: 100%;
  123. margin-bottom: 20px;
  124. }
  125. >span{
  126. background-repeat: no-repeat;
  127. background-size: 100% 100%;
  128. color: #DFB057;
  129. font-size: 38px;
  130. padding: 0 60px 20px;
  131. }
  132. .tips{
  133. font-size: 20px;
  134. font-weight: bold;
  135. color: #DFB057;
  136. min-width: 300px;
  137. padding: 40px 0;
  138. }
  139. }
  140. }
  141. </style>