HomeView.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <script setup>
  2. import { ref, inject } from "vue"
  3. import { useRoute, useRouter } from "vue-router"
  4. import { useStore } from "vuex"
  5. import Startup from "@/views/StartupView.vue"
  6. import useRollFu from "../rollFu.js"
  7. import HotspotDetail3 from "@/views/HotspotDetail3.vue"
  8. import HotspotDetail1 from "@/views/HotspotDetail1.vue"
  9. const route = useRoute()
  10. const router = useRouter()
  11. const store = useStore()
  12. const $env = inject("$env")
  13. const { handleScroll } = useRollFu()
  14. const isShowOperationTip = ref(true)
  15. const isShowHotspotDetail1 = ref(false)
  16. const isShowHotspotDetail3 = ref(false)
  17. // 滑动逻辑
  18. const scrollFu = (val) => {
  19. if (val == -1) {
  20. // 上滚
  21. console.log("上滚")
  22. } else if (val == 1) {
  23. // 下滚
  24. console.log("下滚")
  25. isShowOperationTip.value = false
  26. }
  27. }
  28. const curPageIndex = ref(0)
  29. </script>
  30. <template>
  31. <div class="home">
  32. <!-- 滚动区域 -->
  33. <div
  34. ref="scroller"
  35. class="scroller"
  36. @wheel="($event) => handleScroll($event, (val) => scrollFu(val))"
  37. >
  38. <div class="scroller-content" />
  39. </div>
  40. <!-- 背景 -->
  41. <div
  42. class="bg-mask"
  43. :style="{ background: curPageIndex == 2 ? `rgba(85,116,83,0.8)` : `` }"
  44. />
  45. <!-- 开场动画 -->
  46. <Transition name="fade-out">
  47. <Startup
  48. v-if="!store.state.haveShownStartup"
  49. class="startup"
  50. />
  51. </Transition>
  52. <!-- 首页标题 -->
  53. <div
  54. class="title-wrap"
  55. :style="{
  56. opacity: curPageIndex == 0 ? 1 : 0,
  57. }"
  58. >
  59. <img
  60. class="title"
  61. src="@/assets/images/home-title.png"
  62. alt=""
  63. draggable="false"
  64. >
  65. <div class="sub-text">
  66. 南京博物院<br>
  67. 绢本 墨笔<br>
  68. 元 李衎<br>
  69. </div>
  70. </div>
  71. <!-- 作品、作者简介 -->
  72. <div
  73. ref="longDesc"
  74. class="long-desc"
  75. :class="{ 'long-desc-ac': curPageIndex == 0 }"
  76. @touchstart="handletouchstart($event)"
  77. @touchend="touchEnd($event)"
  78. >
  79. <div
  80. class="page2-box"
  81. @click="isShowPaintingDesc = true"
  82. >
  83. <img
  84. src="@/assets/images/icon_home_detail-min.png"
  85. alt=""
  86. >
  87. <div>作品简介</div>
  88. </div>
  89. <div
  90. class="page2-box"
  91. style="margin-top: 10px"
  92. @click="isShowAuthorDesc = true"
  93. >
  94. <img
  95. src="@/assets/images/icon_home_author-min.png"
  96. alt=""
  97. >
  98. <div>作者简介</div>
  99. </div>
  100. </div>
  101. <!-- 画作 -->
  102. <div
  103. class="painting-wrap"
  104. :class="{
  105. 'painting-wrap1': curPageIndex == 0,
  106. 'painting-wrap2': curPageIndex == 1,
  107. 'painting-wrap3': curPageIndex == 2 || curPageIndex == 3,
  108. 'painting-wrap4': curPageIndex == 4,
  109. 'painting-wrap5': curPageIndex == 5,
  110. }"
  111. @click="
  112. () => {
  113. curPageIndex == 1 ? (curPageIndex = 2) : '';
  114. }
  115. "
  116. >
  117. <img
  118. class="painting-border"
  119. src="@/assets/images/painting-border-new.png"
  120. alt=""
  121. draggable="false"
  122. >
  123. <img
  124. class="painting-stem"
  125. src="@/assets/images/home-painting1.jpg"
  126. alt=""
  127. draggable="false"
  128. >
  129. <img
  130. class="painting-stem"
  131. src="@/assets/images/home-painting2.jpg"
  132. alt=""
  133. draggable="false"
  134. >
  135. <img
  136. :style="{ opacity: curPageIndex == 3 ? 1 : 0, zIndex: 3 }"
  137. class="painting-stem"
  138. src="@/assets/images/home-painting-stem.png"
  139. alt=""
  140. >
  141. <img
  142. class="painting-stem"
  143. src="@/assets/images/img_zhuye-min2.png"
  144. alt=""
  145. :style="{
  146. opacity: curPageIndex == 4 ? 1 : 0,
  147. zIndex: 2,
  148. }"
  149. draggable="false"
  150. >
  151. <img
  152. class="painting-stem"
  153. src="@/assets/images/img_stone_all-min.png"
  154. :style="{
  155. opacity: curPageIndex == 5 ? 1 : 0,
  156. zIndex: 2,
  157. }"
  158. alt=""
  159. draggable="false"
  160. >
  161. </div>
  162. <!-- 热点层1 -->
  163. <div class="hotspot-wrap">
  164. <HotspotForHomepage
  165. v-show="curPageIndex == 0"
  166. class="hotspot-1"
  167. @click="isShowHotspotDetail1 = true"
  168. />
  169. <HotspotForHomepage
  170. v-show="curPageIndex == 0"
  171. class="hotspot-3"
  172. @click="isShowHotspotDetail3 = true"
  173. />
  174. </div>
  175. <!-- 轴/卷/册热点详情 -->
  176. <Transition name="fade-in-out">
  177. <HotspotDetail3
  178. v-if="isShowHotspotDetail3"
  179. class="hotspot-detail"
  180. @close="isShowHotspotDetail3 = false"
  181. />
  182. </Transition>
  183. <!-- 材质热点详情 -->
  184. <Transition name="fade-in-out">
  185. <HotspotDetail1
  186. v-if="isShowHotspotDetail1"
  187. class="hotspot-detail"
  188. @close="isShowHotspotDetail1 = false"
  189. />
  190. </Transition>
  191. <!-- 滑动提示 -->
  192. <OperationTip
  193. v-show="curPageIndex == 0"
  194. class="operation-tip"
  195. text="向下滑动"
  196. :is-show="isShowOperationTip"
  197. />
  198. </div>
  199. </template>
  200. <style lang="less" scoped>
  201. .home {
  202. width: 100%;
  203. height: 100%;
  204. > .scroller {
  205. width: 100vw;
  206. max-height: 100vh;
  207. overflow: auto;
  208. background: rgba(255, 255, 0, 0);
  209. position: absolute;
  210. top: 0;
  211. z-index: 10;
  212. opacity: 0;
  213. .scroller-content {
  214. width: 100%;
  215. height: 200vh;
  216. }
  217. }
  218. > .bg-mask {
  219. position: absolute;
  220. left: 0;
  221. top: 0;
  222. width: 100%;
  223. height: 100%;
  224. // background: rgba(60, 89, 71, 0.65);
  225. background: url(@/assets/images/bg-mask.png);
  226. background-size: 100% 100%;
  227. // backdrop-filter: blur(
  228. // calc(
  229. // 22 / v-bind("windowSizeWhenDesignForRef") *
  230. // v-bind("windowSizeInCssForRef")
  231. // )
  232. // );
  233. }
  234. > .startup {
  235. z-index: 20;
  236. }
  237. > .title-wrap {
  238. position: absolute;
  239. right: 25%;
  240. top: 50%;
  241. transform: translateY(-50%);
  242. width: 100px;
  243. height: 45%;
  244. z-index: 5;
  245. > img.title {
  246. position: absolute;
  247. left: 0;
  248. top: 0;
  249. width: 100%;
  250. height: 100%;
  251. }
  252. > .sub-text {
  253. position: absolute;
  254. left: 110%;
  255. top: 46%;
  256. transform: translateY(-50%);
  257. writing-mode: vertical-lr;
  258. font-family: KaiTi;
  259. font-weight: 400;
  260. font-size: 20px;
  261. color: #ffffff;
  262. line-height: 30px;
  263. white-space: pre;
  264. letter-spacing: 0.2em;
  265. text-align: center;
  266. }
  267. }
  268. > .long-desc {
  269. position: absolute;
  270. bottom: 30px;
  271. right: 30px;
  272. color: white;
  273. overflow: hidden;
  274. font-family: KaiTi;
  275. color: #ffffff;
  276. animation: none;
  277. display: flex;
  278. flex-direction: column;
  279. justify-content: space-between;
  280. z-index: 10;
  281. > .page2-box {
  282. display: flex;
  283. flex-direction: column;
  284. justify-content: center;
  285. align-items: center;
  286. cursor: pointer;
  287. > img {
  288. width: 75%;
  289. margin-bottom: 10px;
  290. }
  291. > div {
  292. font-size: calc(
  293. 20 / v-bind("windowSizeWhenDesignForRef") *
  294. v-bind("windowSizeInCssForRef")
  295. );
  296. font-family: KaiTi;
  297. }
  298. }
  299. }
  300. > .painting-wrap {
  301. position: absolute;
  302. left: 50%;
  303. top: 50%;
  304. width: 551.84px;
  305. height: 937.05px;
  306. // background: green;
  307. transform: translate(-50%, -50%);
  308. z-index: 1;
  309. > .painting-border {
  310. width: 100%;
  311. height: 100%;
  312. position: absolute;
  313. }
  314. > .painting-stem {
  315. width: 80%;
  316. height: calc(
  317. 371 / v-bind("windowSizeWhenDesignForRef") *
  318. v-bind("windowSizeInCssForRef")
  319. );
  320. position: absolute;
  321. left: 50%;
  322. transform: translate(-50%, 26%);
  323. }
  324. }
  325. > .hotspot-wrap {
  326. position: absolute;
  327. left: 50%;
  328. top: 50%;
  329. transform: translate(-46%, -50%);
  330. width: 551.84px;
  331. height: 937.05px;
  332. z-index: 7;
  333. pointer-events: none;
  334. will-change: transform;
  335. backface-visibility: hidden;
  336. z-index: 10;
  337. & > div {
  338. z-index: 100;
  339. transition: all 1.5s ease-in-out;
  340. cursor: pointer;
  341. }
  342. > .hotspot-1 {
  343. position: absolute;
  344. top: 100px;
  345. right: 25px;
  346. pointer-events: initial;
  347. }
  348. // > .hotspot-2 {
  349. // position: absolute;
  350. // left: 60px;
  351. // top: 60px;
  352. // pointer-events: initial;
  353. // }
  354. > .hotspot-3 {
  355. position: absolute;
  356. bottom: 0px;
  357. right: 25px;
  358. pointer-events: initial;
  359. }
  360. }
  361. > .hotspot-detail {
  362. z-index: 21;
  363. }
  364. > .operation-tip {
  365. position: absolute;
  366. right: 30px;
  367. transform: translateX(-50%);
  368. top: 50%;
  369. transform: translateY(-50%);
  370. }
  371. }
  372. </style>