123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="two-hp">
- <div class="content">
- <img class="bg" :src="popImg" alt="">
- <div class="inner">
- <div class="left">
- <video ref="video$" controls muted autoplay class="initial-video" playsinline="true" x5-playsinline="true"
- webkit-playsinline="true" :src="`${$config.CDNPERFIX}/videos/${data.video}`" @mousedown.passive.stop
- @touchstart.passive.stop @wheel.passive.stop />
- </div>
- <div class="right">
- <h2>{{ data.name }}</h2>
- <div class="desc">
- <p v-for="item in data.desc" :key="item">{{ item }}</p>
- </div>
- <ul>
- <li @click="currentIfr = item" v-for="item in data.imgs" :key="item">
- <img :src="`${$config.CDNPERFIX}/images/two/缩略图/${data.name}/${item.name}.png`" alt="">
- <span :title="item.name" class='i-name'>{{ item.name }}</span>
- </li>
- </ul>
- </div>
- </div>
- <img class="close" @click="$emit('close')" :src="closeImg" alt="">
- </div>
- <Transition>
- <div class="ifrcontent" v-if="currentIfr">
- <div class="title">{{ currentIfr.name }}</div>
- <img class="imgcon" id="imgcon" :src="`${$config.CDNPERFIX}/images/two/大图/${data.name}/${currentIfr.name}.jpg`"
- alt="">
- <img class="close" @click="currentIfr = ''" :src="close_thin" alt="">
- </div>
- </Transition>
- </div>
- </template>
- <script setup>
- import { ref, watch, onMounted, nextTick } from "vue"
- import Panzoom from "@panzoom/panzoom";
- const popImg = utils.getImageUrl(`hp_bg.jpg`)
- const closeImg = utils.getImageUrl(`close.png`)
- const close_thin = utils.getImageUrl(`close_thin.png`)
- const currentIfr = ref('')
- const props = defineProps({
- data: {
- default: {},
- type: Object
- }
- })
- const panzoom = ref('')
- const reset = () => {
- panzoom.value.pan(0, 0);
- panzoom.value.zoom(1);
- }
- watch(currentIfr, () => {
- panzoom.value && panzoom.value.destroy()
- nextTick(() => {
- if (currentIfr.value) {
- let elem = document.getElementById("imgcon");
- panzoom.value = Panzoom(elem, {
- maxScale: 10,
- startScale: 1
- });
- let parent = elem.parentElement
- parent.addEventListener("wheel", panzoom.value.zoomWithWheel);
- parent.addEventListener("load", () => {
- reset();
- });
- parent.addEventListener("abort", () => {
- reset();
- });
- parent.addEventListener("error", () => {
- reset();
- });
- }
- })
- })
- </script>
- <style lang="less" scoped>
- .two-hp {
- position: fixed;
- top: 0;
- z-index: 999;
- left: 0;
- bottom: 0;
- right: 0;
- width: 100%;
- height: 100%;
- background: rgba(190, 180, 166, 0.8);
- backdrop-filter: blur(20px);
- .content,
- .ifrcontent {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 70%;
- border-radius: 10px;
- overflow: hidden;
- .inner {
- display: flex;
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- right: 0;
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- padding: 0 30px;
- .left {
- width: 60%;
- flex-shrink: 0;
- padding: 10px;
- border: 3px solid #83796F;
- height: 73%;
- >video {
- width: 100%;
- height: 100%;
- }
- }
- .right {
- padding-left: 30px;
- width: 33%;
- box-sizing: border-box;
- height: 73%;
- overflow-y: auto;
- >h2 {
- color: #911927;
- font-size: 26px;
- line-height: 1.5;
- margin-bottom: 10px;
- }
- .desc {
- @fsize: 16px;
- font-size: @fsize;
- color: #7A6553;
- text-indent: @fsize * 2;
- margin-bottom: 20px;
- >p {
- line-height: 1.5;
- }
- }
- >ul {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- >li {
- width: 49%;
- border-radius: 4px;
- overflow: hidden;
- margin-bottom: 4px;
- position: relative;
- cursor: pointer;
- background-image: linear-gradient(180deg, #75736E 0%, #BCBBB8 100%);
- &:nth-of-type(2n) {
- margin-left: 1%;
- }
- >img {
- width: 100%;
- }
- .i-name {
- content: '';
- position: absolute;
- transform: translateY(-110%);
- left: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- line-height: 1.5;
- padding: 0 10px;
- color: #EAE7DA;
- box-sizing: border-box;
- background: rgba(145, 25, 39,0.8);
- font-size: 18px;
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- align-items: center;
- pointer-events: none;
- transition: transform .3s ease;
- }
- &:hover {
- .i-name {
- transform: translateY(0);
- }
- }
- }
- }
- }
- }
- .bg {
- width: 100%;
- }
- .close {
- position: absolute;
- right: 20px;
- top: 20px;
- z-index: 99;
- cursor: pointer;
- width: 50px;
- }
- }
- .ifrcontent {
- z-index: 1;
- width: 80%;
- height: 80%;
- background: linear-gradient(180deg, #75736E 0%, #BCBBB8 100%);
- display: flex;
- justify-content: center;
- align-items: center;
- text-align: center;
- .title {
- position: absolute;
- left: 20px;
- color: #fff;
- line-height: 45px;
- height: 45px;
- padding: 0 40px 0 20px;
- top: 20px;
- z-index: 99;
- background-image: linear-gradient(90deg, #911927, rgba(145, 25, 39, 0));
- }
- .imgcon {
- width: 90%;
- height: 90%;
- object-fit: contain;
- margin: 0 auto;
- }
- .close {
- width: 40px;
- }
- }
- }
- </style>
|