فهرست منبع

upup更新一些不知道什么东西

aamin 1 سال پیش
والد
کامیت
7354d374f6

BIN
src/assets/images/home-painting-stem.png


BIN
src/assets/images/home-painting1.jpg


BIN
src/assets/images/home-painting2.jpg


BIN
src/assets/images/img_stone_all-min.png


BIN
src/assets/images/img_zhuye-min2.png


BIN
src/assets/images/painting-border-new.png


+ 45 - 0
src/components/HotspotForHomepage.vue

@@ -0,0 +1,45 @@
+<template>
+  <div class="hotspot animation-show-hide-for-home-hotspot">
+    <img
+      class=""
+      src="@/assets/images/icon_hotspot.png"
+      alt=""
+      draggable="false"
+    >
+  </div>
+</template>
+
+<script setup>
+import useSizeAdapt from "@/useFunctions/useSizeAdapt"
+
+const {
+  windowSizeInCssForRef,
+  windowSizeWhenDesignForRef,
+} = useSizeAdapt()
+
+</script>
+
+<style lang="less" scoped>
+.hotspot{
+  width: 48px;
+  height: 48px;
+  >img{
+    width: 100%;
+    height: 100%;
+  }
+}
+.animation-show-hide-for-home-hotspot {
+  animation: show-hide 2.5s infinite;
+}
+@keyframes show-hide {
+  0% {
+    opacity: 0;
+  }
+  50% {
+    opacity: 1;
+  }
+  100% {
+    opacity: 0;
+  }
+}
+</style>

+ 23 - 24
src/components/OperationTip.vue

@@ -4,18 +4,20 @@
       v-show="isShow"
       class="operation-tip"
     >
+      <img
+        class=""
+        :src="
+          require(`@/assets/images/icon_operation_${props.direction}_${props.color}.png`)
+        "
+        alt=""
+        draggable="false"
+      >
       <div
         v-if="props.text"
         class="text"
       >
         {{ props.text }}
       </div>
-      <img
-        class=""
-        :src="require(`@/assets/images/icon_operation_${props.direction}_${props.color}.png`)"
-        alt=""
-        draggable="false"
-      >
     </div>
   </Transition>
 </template>
@@ -24,36 +26,32 @@
 import useSizeAdapt from "@/useFunctions/useSizeAdapt"
 import { ref, computed, watch } from "vue"
 
-
-const {
-  windowSizeInCssForRef,
-  windowSizeWhenDesignForRef,
-} = useSizeAdapt()
+const { windowSizeInCssForRef, windowSizeWhenDesignForRef } = useSizeAdapt()
 
 const props = defineProps({
   direction: {
     type: String,
-    default: 'v', // h
+    default: "v", // h
   },
   color: {
     type: String,
-    default: 'white', // 'green'
+    default: "white", // 'green'
   },
   text: {
     type: String,
-    default: '',
+    default: "",
   },
   isShow: {
     type: Boolean,
     default: true,
-  }
+  },
 })
 
 const color = computed(() => {
-  if (props.color === 'white') {
-    return '#fff'
-  } else if (props.color === 'green') {
-    return '#7B916B'
+  if (props.color === "white") {
+    return "#fff"
+  } else if (props.color === "green") {
+    return "#7B916B"
   } else {
     return props.color
   }
@@ -74,20 +72,21 @@ watch(propIsShow, (v) => {
 </script>
 
 <style lang="less" scoped>
-.operation-tip{
+.operation-tip {
   position: fixed;
   display: flex;
+  flex-direction: column;
   align-items: center;
-  >.text{
-    color: v-bind('color');
+  > .text {
+    color: v-bind("color");
     margin-right: 5px;
     font-family: KaiTi;
     font-weight: 400;
     font-size: 20px;
   }
-  >img{
+  > img {
     width: 40px;
     height: 41px;
   }
 }
-</style>
+</style>

+ 25 - 26
src/rollFu.js

@@ -1,33 +1,32 @@
-import { ref } from 'vue'
-export default function rollFu() {
-
-  let lastScrollTop = ref(0)
-  // 节流函数
-  function throttle(func, delay) {
-    let inThrottle
-    return function () {
-      const args = arguments
-      const context = this
-      if (!inThrottle) {
-        func.apply(context, args)
-        inThrottle = true
-        setTimeout(() => inThrottle = false, delay)
-      }
-    }
-  }
 
+export default function useRollFu() {
   // 滚动事件处理器(传入滚动元素和前进后退函数)
-  const handleScroll = throttle(function (element, fu) {
-    const st = element.scrollTop
-    if (st > lastScrollTop.value) {
-      console.log('向下滚动')
-      fu(1)
-    } else {
-      console.log('向上滚动')
+  // const handleScroll = throttle(function (event, fu) {
+  //   const st = event.target.scrollTop
+  //   console.log(st)
+  //   // if (st > lastScrollTop.value) {
+  //   //   console.log('向下滚动')
+  //   //   fu(1)
+  //   // } else {
+  //   //   console.log('向上滚动')
+  //   //   fu(-1)
+  //   // }
+  //   // lastScrollTop.value = st <= 0 ? 0 : st // For Firefox
+  // }, 1000)
+
+  const handleScroll = function (event, fu) {
+    // const st = event.target.scrollTop
+
+    if (event.deltaY < 0) {
+      console.log('滚轮上滑')
       fu(-1)
+    } else if (event.deltaY > 0) {
+      console.log('滚轮下滑')
+      fu(1)
     }
-    lastScrollTop = st <= 0 ? 0 : st // For Firefox
-  }, 100)
+
+  }
+
 
   return {
     handleScroll

+ 215 - 6
src/views/HomeView.vue

@@ -1,9 +1,11 @@
-
 <script setup>
-import { ref, computed, watch, onMounted, inject } from "vue"
+import { ref, inject } from "vue"
 import { useRoute, useRouter } from "vue-router"
 import { useStore } from "vuex"
 import Startup from "@/views/StartupView.vue"
+import useRollFu from "../rollFu.js"
+
+// import HotspotDetail3 from "@/views/HotspotDetail3.vue"
 
 
 const route = useRoute()
@@ -12,11 +14,35 @@ const store = useStore()
 
 const $env = inject("$env")
 
+const { handleScroll } = useRollFu()
+
+const isShowOperationTip = ref(true)
+
+// 滑动逻辑
+const scrollFu = (val) => {
+  isShowOperationTip.value = false
+  if (val == -1) {
+    // 上滚
+    console.log("上滚")
+  } else if (val == 1) {
+    // 下滚
+    console.log("下滚")
+  }
+}
+
 const curPageIndex = ref(0)
 </script>
 
 <template>
   <div class="home">
+    <!-- 滚动区域 -->
+    <div
+      ref="scroller"
+      class="scroller"
+      @wheel="($event) => handleScroll($event, (val) => scrollFu(val))"
+    >
+      <div class="scroller-content" />
+    </div>
     <!-- 背景 -->
     <div
       class="bg-mask"
@@ -80,15 +106,121 @@ const curPageIndex = ref(0)
       </div>
     </div>
 
+    <!-- 画作 -->
+    <div
+      class="painting-wrap"
+      :class="{
+        'painting-wrap1': curPageIndex == 0,
+        'painting-wrap2': curPageIndex == 1,
+        'painting-wrap3': curPageIndex == 2 || curPageIndex == 3,
+        'painting-wrap4': curPageIndex == 4,
+        'painting-wrap5': curPageIndex == 5,
+      }"
+      @click="
+        () => {
+          curPageIndex == 1 ? (curPageIndex = 2) : '';
+        }
+      "
+    >
+      <img
+        class="painting-border"
+        src="@/assets/images/painting-border-new.png"
+        alt=""
+        draggable="false"
+      >
+      <img
+        class="painting-stem"
+        src="@/assets/images/home-painting1.jpg"
+        alt=""
+        draggable="false"
+      >
+      <img
+        class="painting-stem"
+        src="@/assets/images/home-painting2.jpg"
+        alt=""
+        draggable="false"
+      >
+      <img
+        :style="{ opacity: curPageIndex == 3 ? 1 : 0, zIndex: 3 }"
+        class="painting-stem"
+        src="@/assets/images/home-painting-stem.png"
+        alt=""
+      >
+
+      <img
+        class="painting-stem"
+        src="@/assets/images/img_zhuye-min2.png"
+        alt=""
+        :style="{
+          opacity: curPageIndex == 4 ? 1 : 0,
+          zIndex: 2,
+        }"
+        draggable="false"
+      >
+
+      <img
+        class="painting-stem"
+        src="@/assets/images/img_stone_all-min.png"
+        :style="{
+          opacity: curPageIndex == 5 ? 1 : 0,
+          zIndex: 2,
+        }"
+        alt=""
+        draggable="false"
+      >
+    </div>
+
+    <!-- 热点层1 -->
+    <div class="hotspot-wrap">
+      <HotspotForHomepage
+        v-show="curPageIndex == 0"
+        class="hotspot-1"
+        @click="isShowHotspotDetail1 = true"
+      />
+      <HotspotForHomepage
+        v-show="curPageIndex == 0"
+        class="hotspot-3"
+        @click="isShowHotspotDetail3 = true"
+      />
+    </div>
+
+    <!-- 轴/卷/册热点详情 -->
+    <Transition name="fade-in-out">
+      <HotspotDetail3
+        v-if="isShowHotspotDetail3"
+        class="hotspot-detail"
+        @close="isShowHotspotDetail3 = false"
+      />
+    </Transition>
+
     <!-- 滑动提示 -->
+    <OperationTip
+      v-show="curPageIndex == 0"
+      class="operation-tip"
+      text="向下滑动"
+      :is-show="isShowOperationTip"
+    />
   </div>
 </template>
 
-
 <style lang="less" scoped>
 .home {
   width: 100%;
   height: 100%;
+  > .scroller {
+    width: 100vw;
+    max-height: 100vh;
+    overflow: auto;
+    background: rgba(255, 255, 0, 0);
+    position: absolute;
+    top: 0;
+    z-index: 10;
+    opacity: 0;
+    .scroller-content {
+      width: 100%;
+      height: 200vh;
+    }
+  }
   > .bg-mask {
     position: absolute;
     left: 0;
@@ -112,7 +244,7 @@ const curPageIndex = ref(0)
 
   > .title-wrap {
     position: absolute;
-    right: 20%;
+    right: 25%;
     top: 50%;
     transform: translateY(-50%);
     width: 100px;
@@ -137,7 +269,7 @@ const curPageIndex = ref(0)
       font-weight: 400;
       font-size: 20px;
       color: #ffffff;
-      line-height:30px;
+      line-height: 30px;
       white-space: pre;
       letter-spacing: 0.2em;
       text-align: center;
@@ -155,7 +287,7 @@ const curPageIndex = ref(0)
     display: flex;
     flex-direction: column;
     justify-content: space-between;
-    z-index: 2;
+    z-index: 10;
 
     > .page2-box {
       display: flex;
@@ -178,6 +310,83 @@ const curPageIndex = ref(0)
       }
     }
   }
+  > .painting-wrap {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    width: 551.84px;
+    height: 937.05px;
+    // background: green;
+    transform: translate(-50%, -50%);
+    z-index: 1;
+
+    > .painting-border {
+      width: 100%;
+      height: 100%;
+      position: absolute;
+    }
+
+    > .painting-stem {
+      width: 80%;
+      height: calc(
+        371 / v-bind("windowSizeWhenDesignForRef") *
+          v-bind("windowSizeInCssForRef")
+      );
+      position: absolute;
+      left: 50%;
+      transform: translate(-50%, 26%);
+    }
+  }
 
+
+  > .hotspot-wrap {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-46%, -50%);
+    width: 551.84px;
+    height: 937.05px;
+    z-index: 7;
+    pointer-events: none;
+    will-change: transform;
+    backface-visibility: hidden;
+    z-index: 10;
+
+    & > div {
+      z-index: 100;
+      transition: all 1.5s ease-in-out;
+      cursor: pointer;
+    }
+
+    > .hotspot-1 {
+      position: absolute;
+      top:100px;
+      right: 25px;
+      pointer-events: initial;
+    }
+
+    // > .hotspot-2 {
+    //   position: absolute;
+    //   left: 60px;
+    //   top: 60px;
+    //   pointer-events: initial;
+    // }
+
+    > .hotspot-3 {
+      position: absolute;
+      bottom:0px;
+      right: 25px;
+      pointer-events: initial;
+    }
+  }
+
+   > .operation-tip {
+    position: absolute;
+    right: 30px;
+    transform: translateX(-50%);
+    top: 50%;
+    transform: translateY(-50%);
+  }
 }
 </style>
+

+ 266 - 0
src/views/HotspotDetail3.vue

@@ -0,0 +1,266 @@
+<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>