video.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div class="hotspot" v-if="!isMobile">
  3. <img
  4. class="vhotspot"
  5. :src="require(`@/assets/images/project/kuangti/hotspot_${theme}.png`)"
  6. alt=""
  7. />
  8. <div class="brightness"></div>
  9. <img
  10. @click="$emit('close')"
  11. class="close"
  12. :src="require('@/assets/images/project/icon/close.png')"
  13. alt=""
  14. />
  15. <div class="vhotspotcon">
  16. <div class="vtitle" v-html="hotspot.title"></div>
  17. <div class="hotspotcon">
  18. <div class="img-con">
  19. <img
  20. class="aa"
  21. v-if="hotspot.video.length > 1"
  22. @click="active -= 1"
  23. :src="require('@/assets/images/project/icon/hotspot_l.png')"
  24. alt=""
  25. />
  26. <div class="imgmain">
  27. <video controls autoplay>
  28. <source :src="hotspot.video[active].url" type="video/mp4" />
  29. </video>
  30. </div>
  31. <img
  32. class="aa"
  33. v-if="hotspot.video.length > 1"
  34. @click="active += 1"
  35. :src="require('@/assets/images/project/icon/hotspot_r.png')"
  36. alt=""
  37. />
  38. <div class="pagna" v-if="hotspot.video.length > 1">
  39. <span>{{ active + 1 }}</span>
  40. /
  41. <span>{{ hotspot.video.length }}</span>
  42. </div>
  43. </div>
  44. <div class="desc" v-html="hotspot.content"></div>
  45. </div>
  46. </div>
  47. </div>
  48. <div v-else class="mbhotspot">
  49. <img
  50. class="vhotspot"
  51. :src="require(`@/assets/images/mobile/kuangti/hotspot_${theme}.png`)"
  52. alt=""
  53. />
  54. <div class="brightness"></div>
  55. <img
  56. @click="$emit('close')"
  57. class="close"
  58. :src="require('@/assets/images/project/icon/close.png')"
  59. alt=""
  60. />
  61. <div class="mbhcon">
  62. <div class="title">{{ hotspot.title }}</div>
  63. <div class="swcon" v-swiper:mySwipervd="swiperOption">
  64. <ul class="swiper-wrapper swiper-wrapper-n">
  65. <div
  66. class="swiper-slide"
  67. v-for="(item, index) in hotspot.video"
  68. :key="index"
  69. >
  70. <div class="sl-item">
  71. <video controls autoplay>
  72. <source :src="item.url" type="video/mp4" />
  73. </video>
  74. </div>
  75. </div>
  76. </ul>
  77. <div class="swiper-pagination pagination" slot="pagination"></div>
  78. </div>
  79. <div v-if="hotspot.content" class="desc">
  80. <div v-html="handleContent(hotspot.content,14)"></div>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import { directive } from "vue-awesome-swiper";
  87. // import style (<= Swiper 5.x)
  88. import "swiper/css/swiper.css";
  89. export default {
  90. directives: {
  91. swiper: directive,
  92. },
  93. props: ["hotspot", "type"],
  94. data() {
  95. return {
  96. active: 0,
  97. mbactive: 0,
  98. };
  99. },
  100. methods: {
  101. handlePage(type) {
  102. if (type === "next") {
  103. console.log(this.hotspot.video.length);
  104. if (this.active >= this.hotspot.video.length - 1) {
  105. this.active = 0;
  106. return;
  107. }
  108. this.active += 1;
  109. } else {
  110. if (this.active == 0) {
  111. this.active = this.hotspot.video.length - 1;
  112. return;
  113. }
  114. this.active -= 1;
  115. }
  116. },
  117. },
  118. computed: {
  119. swiperOption() {
  120. let that = this;
  121. return {
  122. slidesPerView: "auto",
  123. autoplay: false,
  124. centeredSlides: true,
  125. watchSlidesProgress: true,
  126. loop: false,
  127. pagination: {
  128. el: ".swiper-pagination",
  129. },
  130. on: {
  131. slideChangeTransitionEnd: function() {
  132. that.mbactive = this.realIndex;
  133. },
  134. },
  135. };
  136. },
  137. },
  138. };
  139. </script>
  140. <style lang="less" scoped>
  141. .noshow {
  142. opacity: 0 !important;
  143. pointer-events: none !important;
  144. }
  145. @w: 82%;
  146. @fixw: 8px;
  147. .hotspot {
  148. width: @w;
  149. position: relative;
  150. margin: 10px auto 0;
  151. .vhotspot {
  152. width: 100%;
  153. position: relative;
  154. pointer-events: none;
  155. }
  156. .brightness {
  157. position: absolute;
  158. width: 100%;
  159. height: 101%;
  160. left: 0;
  161. top: 0;
  162. z-index: -1;
  163. clip-path: polygon(1% 11%, 10% 2%, 99% 2%, 99% 89%, 91% 98%, 1% 98%);
  164. }
  165. .close {
  166. position: absolute;
  167. top: 40px;
  168. right: 30px;
  169. width: 20px;
  170. cursor: pointer;
  171. z-index: 1000;
  172. }
  173. .vhotspotcon {
  174. position: absolute;
  175. top: 0;
  176. transform: translateX(-50%);
  177. left: 50%;
  178. width: 100%;
  179. height: 100%;
  180. text-align: center;
  181. .vtitle {
  182. position: absolute;
  183. top: 24px;
  184. left: 130px;
  185. z-index: 99;
  186. font-size: 20px;
  187. }
  188. .hotspotcon {
  189. width: 90%;
  190. top: 50%;
  191. left: 50%;
  192. transform: translate(-50%, -50%);
  193. position: absolute;
  194. .img-con {
  195. display: flex;
  196. width: 90%;
  197. align-items: center;
  198. justify-content: space-between;
  199. position: relative;
  200. top: 50%;
  201. left: 50%;
  202. transform: translate(-50%, -50%);
  203. position: absolute;
  204. .imgmain {
  205. width: 90%;
  206. max-height: 76vh;
  207. overflow-x: hidden;
  208. overflow-y: auto;
  209. margin: 0 auto;
  210. position: relative;
  211. video {
  212. width: 89%;
  213. }
  214. }
  215. .aa {
  216. width: 30px;
  217. height: auto;
  218. cursor: pointer;
  219. }
  220. .pagna {
  221. position: absolute;
  222. bottom: -40px;
  223. left: 50%;
  224. transform: translateX(-50%);
  225. text-align: center;
  226. z-index: 999;
  227. font-size: 18px;
  228. color: rgba(255, 255, 255, 0.8);
  229. }
  230. }
  231. .desc {
  232. width: 80%;
  233. font-size: 16px;
  234. text-align: left;
  235. line-height: 1.8;
  236. padding-right: 14px;
  237. max-height: 120px;
  238. margin: 20px auto 0;
  239. overflow-y: auto;
  240. }
  241. }
  242. }
  243. }
  244. .mbhotspot {
  245. width: 96%;
  246. margin: 60px auto 0;
  247. position: relative;
  248. .vhotspot {
  249. width: 100%;
  250. position: relative;
  251. pointer-events: none;
  252. }
  253. .brightness {
  254. position: absolute;
  255. width: 100%;
  256. height: 100%;
  257. left: 0;
  258. top: 0;
  259. z-index: -1;
  260. clip-path: polygon(1% 11%, 10% 2%, 99% 2%, 99% 89%, 92% 99%, 1% 99%);
  261. }
  262. .close{
  263. position: absolute;
  264. top: 26px;
  265. right: 16px;
  266. width: 14px;
  267. z-index: 1000;
  268. }
  269. .mbhcon {
  270. position: absolute;
  271. top: 0;
  272. left: 0;
  273. width: 100%;
  274. .title {
  275. position: absolute;
  276. top: 14px;
  277. left: 40px;
  278. display: inline-block;
  279. font-size: 16px;
  280. margin: 0px auto;
  281. width: 50vw;
  282. }
  283. .swcon {
  284. position: relative;
  285. margin: 60px auto 0;
  286. width: 84%;
  287. .swiper-wrapper {
  288. height: 250px;
  289. padding: 0;
  290. .swiper-slide {
  291. width: 100%;
  292. transform-style: preserve-3d;
  293. position: relative;
  294. height: 100%;
  295. margin: 0 auto;
  296. transform: translate3d(0, 0, 0);
  297. .sl-item {
  298. position: absolute;
  299. top: 0;
  300. left: 50%;
  301. height: 100%;
  302. transform: translateX(-50%);
  303. width: 100%;
  304. overflow: hidden;
  305. > video {
  306. width: 100%;
  307. transform: translateX(-50%);
  308. position: absolute;
  309. left: 50%;
  310. }
  311. }
  312. }
  313. }
  314. .pagination {
  315. position: static;
  316. margin-top: 4px;
  317. z-index: 999;
  318. & /deep/ .swiper-pagination-bullet,
  319. & /deep/ .swiper-pagination-bullet-active {
  320. background-color: #fff!important;
  321. }
  322. & /deep/ .swiper-pagination-bullet-active {
  323. background: #fff !important;
  324. }
  325. }
  326. }
  327. .desc {
  328. text-align: justify;
  329. width: 85%;
  330. padding-right: 14px;
  331. margin: 10px auto 0;
  332. p {
  333. font-size: 16px;
  334. font-weight: bold;
  335. }
  336. div {
  337. font-size: 14px;
  338. margin-top: 10px;
  339. line-height: 1.5;
  340. max-height: 50vh;
  341. overflow-y: auto;
  342. }
  343. }
  344. }
  345. }
  346. </style>