TwoDetail.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="two-hp">
  3. <div class="content">
  4. <img class="bg" :src="popImg" alt="">
  5. <div class="inner">
  6. <div class="left">
  7. <video ref="video$" controls muted autoplay class="initial-video" playsinline="true" x5-playsinline="true"
  8. webkit-playsinline="true" :src="`${$config.CDNPERFIX}/videos/${data.video}`" @mousedown.passive.stop
  9. @touchstart.passive.stop @wheel.passive.stop />
  10. </div>
  11. <div class="right">
  12. <h2>{{ data.name }}</h2>
  13. <div class="desc">
  14. <p v-for="item in data.desc" :key="item">{{ item }}</p>
  15. </div>
  16. <ul>
  17. <li @click="currentIfr = item" v-for="item in data.imgs" :key="item">
  18. <img :src="`${$config.CDNPERFIX}/images/two/缩略图/${data.name}/${item.name}.png`" alt="">
  19. <span :title="item.name" class='i-name'>{{ item.name }}</span>
  20. </li>
  21. </ul>
  22. </div>
  23. </div>
  24. <img class="close" @click="$emit('close')" :src="closeImg" alt="">
  25. </div>
  26. <Transition>
  27. <div class="ifrcontent" v-if="currentIfr">
  28. <div class="title">{{ currentIfr.name }}</div>
  29. <img class="imgcon" id="imgcon" :src="`${$config.CDNPERFIX}/images/two/大图/${data.name}/${currentIfr.name}.jpg`"
  30. alt="">
  31. <img class="close" @click="currentIfr = ''" :src="close_thin" alt="">
  32. </div>
  33. </Transition>
  34. </div>
  35. </template>
  36. <script setup>
  37. import { ref, watch, onMounted, nextTick } from "vue"
  38. import Panzoom from "@panzoom/panzoom";
  39. const popImg = utils.getImageUrl(`hp_bg.jpg`)
  40. const closeImg = utils.getImageUrl(`close.png`)
  41. const close_thin = utils.getImageUrl(`close_thin.png`)
  42. const currentIfr = ref('')
  43. const props = defineProps({
  44. data: {
  45. default: {},
  46. type: Object
  47. }
  48. })
  49. const panzoom = ref('')
  50. const reset = () => {
  51. panzoom.value.pan(0, 0);
  52. panzoom.value.zoom(1);
  53. }
  54. watch(currentIfr, () => {
  55. panzoom.value && panzoom.value.destroy()
  56. nextTick(() => {
  57. if (currentIfr.value) {
  58. let elem = document.getElementById("imgcon");
  59. panzoom.value = Panzoom(elem, {
  60. maxScale: 10,
  61. startScale: 1
  62. });
  63. let parent = elem.parentElement
  64. parent.addEventListener("wheel", panzoom.value.zoomWithWheel);
  65. parent.addEventListener("load", () => {
  66. reset();
  67. });
  68. parent.addEventListener("abort", () => {
  69. reset();
  70. });
  71. parent.addEventListener("error", () => {
  72. reset();
  73. });
  74. }
  75. })
  76. })
  77. </script>
  78. <style lang="less" scoped>
  79. .two-hp {
  80. position: fixed;
  81. top: 0;
  82. z-index: 999;
  83. left: 0;
  84. bottom: 0;
  85. right: 0;
  86. width: 100%;
  87. height: 100%;
  88. background: rgba(190, 180, 166, 0.8);
  89. backdrop-filter: blur(20px);
  90. .content,
  91. .ifrcontent {
  92. position: absolute;
  93. left: 50%;
  94. top: 50%;
  95. transform: translate(-50%, -50%);
  96. width: 70%;
  97. border-radius: 10px;
  98. overflow: hidden;
  99. .inner {
  100. display: flex;
  101. position: absolute;
  102. left: 0;
  103. top: 0;
  104. bottom: 0;
  105. right: 0;
  106. width: 100%;
  107. height: 100%;
  108. display: flex;
  109. align-items: center;
  110. padding: 0 30px;
  111. .left {
  112. width: 60%;
  113. flex-shrink: 0;
  114. padding: 10px;
  115. border: 3px solid #83796F;
  116. height: 73%;
  117. >video {
  118. width: 100%;
  119. height: 100%;
  120. }
  121. }
  122. .right {
  123. padding-left: 30px;
  124. width: 33%;
  125. box-sizing: border-box;
  126. height: 73%;
  127. overflow-y: auto;
  128. >h2 {
  129. color: #911927;
  130. font-size: 26px;
  131. line-height: 1.5;
  132. margin-bottom: 10px;
  133. }
  134. .desc {
  135. @fsize: 16px;
  136. font-size: @fsize;
  137. color: #7A6553;
  138. text-indent: @fsize * 2;
  139. margin-bottom: 20px;
  140. >p {
  141. line-height: 1.5;
  142. }
  143. }
  144. >ul {
  145. width: 100%;
  146. display: flex;
  147. flex-wrap: wrap;
  148. >li {
  149. width: 49%;
  150. border-radius: 4px;
  151. overflow: hidden;
  152. margin-bottom: 4px;
  153. position: relative;
  154. cursor: pointer;
  155. background-image: linear-gradient(180deg, #75736E 0%, #BCBBB8 100%);
  156. &:nth-of-type(2n) {
  157. margin-left: 1%;
  158. }
  159. >img {
  160. width: 100%;
  161. }
  162. .i-name {
  163. content: '';
  164. position: absolute;
  165. transform: translateY(-110%);
  166. left: 0;
  167. bottom: 0;
  168. width: 100%;
  169. height: 100%;
  170. line-height: 1.5;
  171. padding: 0 10px;
  172. color: #EAE7DA;
  173. box-sizing: border-box;
  174. background: rgba(145, 25, 39,0.8);
  175. font-size: 18px;
  176. display: flex;
  177. flex-wrap: wrap;
  178. justify-content: center;
  179. align-items: center;
  180. pointer-events: none;
  181. transition: transform .3s ease;
  182. }
  183. &:hover {
  184. .i-name {
  185. transform: translateY(0);
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. .bg {
  193. width: 100%;
  194. }
  195. .close {
  196. position: absolute;
  197. right: 20px;
  198. top: 20px;
  199. z-index: 99;
  200. cursor: pointer;
  201. width: 50px;
  202. }
  203. }
  204. .ifrcontent {
  205. z-index: 1;
  206. width: 80%;
  207. height: 80%;
  208. background: linear-gradient(180deg, #75736E 0%, #BCBBB8 100%);
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. text-align: center;
  213. .title {
  214. position: absolute;
  215. left: 20px;
  216. color: #fff;
  217. line-height: 45px;
  218. height: 45px;
  219. padding: 0 40px 0 20px;
  220. top: 20px;
  221. z-index: 99;
  222. background-image: linear-gradient(90deg, #911927, rgba(145, 25, 39, 0));
  223. }
  224. .imgcon {
  225. width: 90%;
  226. height: 90%;
  227. object-fit: contain;
  228. margin: 0 auto;
  229. }
  230. .close {
  231. width: 40px;
  232. }
  233. }
  234. }
  235. </style>