123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <div class="hotspot-detail-3">
- <!-- 阴影 -->
- <img
- class="shadow-box"
- :src="shadow"
- :style="{ width: state === 1 ? '50%' : '80%' }"
- >
- <img
- v-show="state == 1"
- class="content1"
- :src="hots3StateContent1"
- alt=""
- >
- <div
- v-show="state == 2"
- id="content2"
- ref="content2Dom"
- class="content2"
- >
- <img
- id="content2Img"
- :src="hots3StateContent2"
- alt=""
- >
- </div>
- <img
- v-show="state == 3"
- class="content3"
- :src="hots3StateContent3"
- alt=""
- >
- <div class="btns-box">
- <img
- :src="state == 1 ? hots3StateBtn1 : hots3StateBtn1Ac"
- alt=""
- @click="state = 1"
- >
- <img
- :src="state == 2 ? hots3StateBtn2 : hots3StateBtn2Ac"
- alt=""
- @click="goState2"
- >
- <img
- :src="state == 3 ? hots3StateBtn3 : hots3StateBtn3Ac"
- alt=""
- @click="state = 3"
- >
- </div>
- <BtnBack @click="emit('close')" />
- </div>
- </template>
- <script setup>
- import { ref, computed, onMounted } from "vue"
- import useSizeAdapt from "@/useFunctions/useSizeAdapt"
- const emit = defineEmits(['close'])
- // 三个背景图
- import hots3StateBg1 from '@/assets/images/hots-detail-bg-state1.png'
- import hots3StateBg2 from '@/assets/images/hots-detail-bg-state2.png'
- import hots3StateBg3 from '@/assets/images/hots-detail-bg-state3.png'
- // 三个按钮
- import hots3StateBtn1 from '@/assets/images/hots-detail-btn-state1.png'
- import hots3StateBtn2 from '@/assets/images/hots-detail-btn-state2.png'
- import hots3StateBtn3 from '@/assets/images/hots-detail-btn-state3.png'
- import hots3StateBtn1Ac from '@/assets/images/hots-detail-btn-state1-ac.png'
- import hots3StateBtn2Ac from '@/assets/images/hots-detail-btn-state2-ac.png'
- import hots3StateBtn3Ac from '@/assets/images/hots-detail-btn-state3-ac.png'
- // 三个阴影
- import hots3StateShadow1 from '@/assets/images/img_shadow_1.png'
- import hots3StateShadow2 from '@/assets/images/img_shadow_2.png'
- import hots3StateShadow3 from '@/assets/images/img_shadow_3.png'
- // 三个内容
- import hots3StateContent1 from '@/assets/images/hots-detail-content-state1.png'
- import hots3StateContent2 from '@/assets/images/hots-detail-content-state2.png'
- import hots3StateContent3 from '@/assets/images/hots-detail-content-state3.png'
- const {
- windowSizeInCssForRef,
- windowSizeWhenDesignForRef,
- } = useSizeAdapt()
- // 轴1 卷2 册3
- const state = ref(1)
- const homeBg = computed(() => {
- return `url(${state.value == 1 ? hots3StateBg1 : state.value == 2 ? hots3StateBg2 : hots3StateBg3})`
- })
- const shadow = computed(() => {
- return state.value == 1 ? hots3StateShadow1 : state.value == 2 ? hots3StateShadow2 : hots3StateShadow3
- })
- const content2Dom = ref(null)
- const goState2 = () => {
- state.value = 2
- setTimeout(() => {
- if (content2Dom.value) {
- const x = 310 / 780
- const allWidth = document.getElementById('content2Img').getBoundingClientRect().width
- console.log(allWidth * x)
- content2Dom.value.scrollLeft = allWidth * x
- }
- }, 5)
- }
- </script>
- <style lang="less" scoped>
- .hotspot-detail-3 {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background-image: v-bind(homeBg);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: top left;
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- z-index: 3;
- .shadow-box {
- position: absolute;
- bottom: calc(80 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- left: 50%;
- transform: translateX(-50%);
- }
- .content1 {
- width: 90%;
- max-height: 80vh;
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- bottom: calc(130 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- .content2{
- width: 100%;
- background-position: left top;
- overflow: auto;
- img{
- // height: 50vh;
- width: 990px;
- }
- }
- .btns-box {
- width: 55%;
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- justify-content: space-evenly;
- bottom: calc(35 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- >img {
- width: calc(35 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- width: calc(35 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- }
- }
- </style>
|