123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="hotspot-detail-3">
- <img
- v-show="state === 1"
- class="bg-img"
- src="@/assets/images/hots-detail-bg-state1.png"
- alt=""
- >
- <img
- v-show="state === 2"
- class="bg-img"
- src="@/assets/images/hots-detail-bg-state2.png"
- alt=""
- >
- <img
- v-show="state === 3"
- class="bg-img"
- src="@/assets/images/hots-detail-bg-state3.png"
- alt=""
- >
- <!-- 阴影 -->
- <img
- class="shadow-box"
- :src="shadow"
- :style="{ width: state === 1 ? '50%' : '80%' }"
- >
- <img
- class="content1"
- :src="hots3StateContent1"
- :style="{
- opacity: state === 1 ? 1 : 0,
- }"
- alt=""
- >
- <div
- id="content2"
- ref="content2Dom"
- :style="{
- opacity: state === 2 ? 1 : 0,
- }"
- class="content2"
- @touchmove="handleScroll"
- >
- <img
- id="content2Img"
- :src="hots3StateContent2"
- alt=""
- >
- </div>
- <img
- class="content3"
- :style="{
- opacity: state === 3 ? 1 : 0,
- }"
- :src="hots3StateContent3"
- alt=""
- >
- <OperationTip
- v-show="state == 2 && isShowOperationTip"
- class="operation-tip"
- text="向左划动"
- direction="h"
- :color="'green'"
- :is-show="isShowOperationTip"
- />
- <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 isShowOperationTip = ref(true)
- const goState2 = () => {
- state.value = 2
- setTimeout(() => {
- if (content2Dom.value) {
- const x = 310 / 780
- const allWidth = document
- .getElementById("content2Img")
- .getBoundingClientRect().width
- content2Dom.value.scrollLeft = allWidth * x
- isShowOperationTip.value = true
- }
- }, 5)
- }
- const handleScroll = () => {
- isShowOperationTip.value = false
- console.log("开始滑动")
- }
- </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;
- .bg-img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- object-position: top left;
- position: fixed;
- top: 0;
- left: 0;
- z-index: -1;
- }
- .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%);
- transition: opacity 1s ease;
- bottom: calc(
- 130 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- .content2 {
- width: 100%;
- background-position: left top;
- overflow: auto;
- position: absolute;
- transition: opacity 1s ease;
- z-index: 2;
- &::-webkit-scrollbar {
- display: none;
- }
- img {
- // height: 50vh;
- width: 990px;
- }
- }
- .content3 {
- position: absolute;
- width: 100%;
- transition: opacity 1s ease;
- }
- .operation-tip {
- position: fixed;
- bottom: calc(
- 80 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- left: 50%;
- transform: translateX(-50%);
- }
- .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>
|