son6.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div class="son6">
  3. <!-- 点击视频播放的盒子 -->
  4. <div class="videoPlayBox" v-if="videoId">
  5. <video controls autoplay :src="`/data/${videoId}.mp4`"></video>
  6. <!-- 关闭按钮 -->
  7. <div class="close" @click="videoId = null"></div>
  8. </div>
  9. <!-- 点击场景播放的盒子 -->
  10. <div class="videoPlayBox" v-if="modelId">
  11. <iframe :src="modelId" frameborder="0"></iframe>
  12. <!-- 关闭按钮 -->
  13. <div class="close" @click="modelId = null"></div>
  14. </div>
  15. <!-- 场景 -->
  16. <div class="modelBox">
  17. <div
  18. class="modelPlay"
  19. @click="
  20. modelId =
  21. 'https://www.4dkankan.com/panorama/show.html?id=WK1526492643662524416&vr=fd720_JUXrSixwc'
  22. "
  23. ></div>
  24. <img src="../assets/img/mod1.png" alt="" />
  25. </div>
  26. <div class="shuming">场景:围馆封仓</div>
  27. <div class="sonBj1"></div>
  28. <div
  29. class="rowBox"
  30. v-for="item in data"
  31. :key="item.id"
  32. :class="{ noPad: item.pad }"
  33. >
  34. <div class="row" @click="toInfo(item.id)" :style="`width: ${item.ww};`">
  35. <img
  36. :style="`height: ${item.hh};`"
  37. :src="require(`@/assets/img/zhanpin/${item.id}.png`)"
  38. alt=""
  39. />
  40. <p>{{ item.name }}</p>
  41. </div>
  42. </div>
  43. <div class="sonBj2"></div>
  44. <!-- 视频 -->
  45. <div class="videoBox">
  46. <div class="vidPlay" @click="videoId = '3'"></div>
  47. <img src="../assets/img/vid4.png" alt="" />
  48. </div>
  49. <div class="shuming">《传讯行商》</div>
  50. </div>
  51. </template>
  52. <script>
  53. export default {
  54. name: "son6",
  55. components: {},
  56. data() {
  57. //这里存放数据
  58. return {
  59. videoId: null,
  60. modelId: null,
  61. data: [
  62. {
  63. id: 38,
  64. name: "林则徐画像",
  65. ww: "155px",
  66. hh: "183px",
  67. pad: true,
  68. },
  69. {
  70. id: 39,
  71. name: "(油画)销烟壮举",
  72. ww: "257px",
  73. hh: "190px",
  74. },
  75. ],
  76. };
  77. },
  78. //监听属性 类似于data概念
  79. computed: {},
  80. //监控data中的数据变化
  81. watch: {},
  82. //方法集合
  83. methods: {
  84. toInfo(id) {
  85. this.$router.push(`/info/${id}`);
  86. },
  87. },
  88. //生命周期 - 创建完成(可以访问当前this实例)
  89. created() {},
  90. //生命周期 - 挂载完成(可以访问DOM元素)
  91. mounted() {},
  92. beforeCreate() {}, //生命周期 - 创建之前
  93. beforeMount() {}, //生命周期 - 挂载之前
  94. beforeUpdate() {}, //生命周期 - 更新之前
  95. updated() {}, //生命周期 - 更新之后
  96. beforeDestroy() {}, //生命周期 - 销毁之前
  97. destroyed() {}, //生命周期 - 销毁完成
  98. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  99. };
  100. </script>
  101. <style lang='less' scoped>
  102. .son6 {
  103. .videoPlayBox {
  104. position: fixed;
  105. width: 100vw;
  106. height: 100vh;
  107. z-index: 999;
  108. top: 0;
  109. left: 0;
  110. background-color: rgba(0, 0, 0, 0.9);
  111. video {
  112. position: absolute;
  113. width: 100%;
  114. max-height: 60vh;
  115. top: 50%;
  116. transform: translateY(-50%);
  117. }
  118. .close {
  119. position: absolute;
  120. bottom: 20px;
  121. left: 50%;
  122. transform: translateX(-50%);
  123. width: 32px;
  124. height: 32px;
  125. background: url("../assets/img/close.png");
  126. background-size: 100% 100%;
  127. }
  128. iframe {
  129. width: 100%;
  130. height: 100%;
  131. }
  132. }
  133. .videoBox {
  134. position: relative;
  135. & > img {
  136. width: 100%;
  137. }
  138. .vidPlay {
  139. position: absolute;
  140. top: 50%;
  141. left: 50%;
  142. transform: translate(-50%, -50%);
  143. width: 77px;
  144. height: 77px;
  145. background: url("../assets/img/videoPlay.png");
  146. background-size: 100% 100%;
  147. }
  148. }
  149. .modelBox {
  150. position: relative;
  151. & > img {
  152. width: 100%;
  153. }
  154. .modelPlay {
  155. position: absolute;
  156. top: 50%;
  157. left: 50%;
  158. transform: translate(-50%, -50%);
  159. width: 77px;
  160. height: 77px;
  161. background: url("../assets/img/modelPlay.png");
  162. background-size: 100% 100%;
  163. }
  164. }
  165. .rowBox {
  166. padding: 0;
  167. margin-bottom: 50px;
  168. display: flex;
  169. .row {
  170. & > img {
  171. width: 100%;
  172. }
  173. & > p {
  174. color: #ffffff;
  175. font-size: 16px;
  176. text-align: center;
  177. width: 100%;
  178. padding: 10px;
  179. line-height: 24px;
  180. }
  181. }
  182. &:nth-of-type(2n) {
  183. justify-content: end;
  184. }
  185. }
  186. .noPad {
  187. padding: 0 24px;
  188. }
  189. }
  190. </style>