HomeView(横向滑动).vue 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440
  1. <template>
  2. <div
  3. class="home"
  4. >
  5. <div class="bg-mask" />
  6. <Transition name="fade-out">
  7. <Startup
  8. v-if="!store.state.haveShownStartup"
  9. class="startup"
  10. />
  11. </Transition>
  12. <!-- 标题 -->
  13. <div
  14. class="title-wrap"
  15. :style="{
  16. opacity: titleOpacity,
  17. }"
  18. >
  19. <img
  20. class="title"
  21. src="@/assets/images/home-title.png"
  22. alt=""
  23. draggable="false"
  24. >
  25. <div class="sub-text">
  26. 南京博物院<br>
  27. 绢本 墨笔<br>
  28. 元 李衎<br>
  29. </div>
  30. </div>
  31. <!-- 画作 -->
  32. <div
  33. class="painting-wrap"
  34. :style="{
  35. top: summaryOpacity > 0 ? `${90 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px` : `${paintingTop / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  36. width: summaryOpacity > 0 ? `calc(225 / 308 * 100%)`: paintingWidth == 485 ? `110%`: `${paintingWidth / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  37. height: summaryOpacity > 0 ? `${523 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px` :`${paintingHeight / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  38. }"
  39. >
  40. <div
  41. class="size-sign-h"
  42. :style="{
  43. opacity: 0,
  44. }"
  45. >
  46. <img
  47. class=""
  48. src="@/assets/images/size-sign-h.png"
  49. alt=""
  50. draggable="false"
  51. >
  52. <span>100.6cm</span>
  53. </div>
  54. <div
  55. class="size-sign-v"
  56. :style="{
  57. opacity: 0,
  58. }"
  59. >
  60. <img
  61. class=""
  62. src="@/assets/images/size-sign-v.png"
  63. alt=""
  64. draggable="false"
  65. >
  66. <span>151.7cm</span>
  67. </div>
  68. <!-- 绿色幕布层 -->
  69. <div
  70. class="green-box"
  71. :style="{opacity: stemGreenOpacity || leafGreenOpacity || stoneGreenOpacity}"
  72. />
  73. <img
  74. class="painting-border"
  75. src="@/assets/images/painting-border-new.png"
  76. alt=""
  77. draggable="false"
  78. >
  79. <img
  80. class="painting-stem"
  81. src="@/assets/images/home-painting.jpg"
  82. alt=""
  83. draggable="false"
  84. >
  85. <img
  86. class="painting-stem"
  87. src="@/assets/images/home-painting.jpg"
  88. alt=""
  89. draggable="false"
  90. >
  91. <img
  92. class="painting-stem"
  93. :style="{
  94. opacity: stemOpacity,
  95. }"
  96. src="@/assets/images/home-1.jpg"
  97. alt=""
  98. draggable="false"
  99. >
  100. <img
  101. class="painting-stem"
  102. :style="{
  103. opacity: stemOpacity1,
  104. zIndex: 2,
  105. }"
  106. src="@/assets/images/home-1-1.jpg"
  107. alt=""
  108. draggable="false"
  109. >
  110. <img
  111. class="painting-stem"
  112. :style="{
  113. opacity: stemOpacity2,
  114. zIndex: 2,
  115. }"
  116. src="@/assets/images/home-1-2.jpg"
  117. alt=""
  118. draggable="false"
  119. >
  120. <img
  121. class="painting-leaf"
  122. :style="{
  123. opacity: leafOpacity,
  124. zIndex: 2,
  125. }"
  126. src="@/assets/images/home-2.jpg"
  127. alt=""
  128. draggable="false"
  129. >
  130. <img
  131. class="painting-leaf"
  132. :style="{
  133. opacity: leafOpacity1,
  134. zIndex: 2,
  135. }"
  136. src="@/assets/images/home-2-1.jpg"
  137. alt=""
  138. draggable="false"
  139. >
  140. <img
  141. class="painting-leaf"
  142. :style="{
  143. opacity: leafOpacity2,
  144. zIndex: 2,
  145. }"
  146. src="@/assets/images/home-2-2.jpg"
  147. alt=""
  148. draggable="false"
  149. >
  150. <img
  151. class="painting-leaf"
  152. :style="{
  153. opacity: leafOpacity3,
  154. zIndex: 2,
  155. }"
  156. src="@/assets/images/home-2-3.jpg"
  157. alt=""
  158. draggable="false"
  159. >
  160. <img
  161. class="painting-stone"
  162. :style="{
  163. opacity: stoneOpacity,
  164. }"
  165. src="@/assets/images/home-3.jpg"
  166. alt=""
  167. draggable="false"
  168. >
  169. <img
  170. class="painting-stone"
  171. :style="{
  172. opacity: stoneOpacity1,
  173. zIndex: 2,
  174. }"
  175. src="@/assets/images/home-3-1.jpg"
  176. alt=""
  177. draggable="false"
  178. >
  179. </div>
  180. <!-- 热点层 -->
  181. <div
  182. class="hotspot-wrap"
  183. :style="{
  184. top: `${paintingTop / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  185. width: summaryOpacity > 0 ? `calc(215 / 308 * 100%)`: paintingWidth == 485 ? `110%`: `${paintingWidth / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  186. }"
  187. >
  188. <HotspotForHomepage
  189. v-show="isShowHotspot"
  190. class="hotspot-1"
  191. @click="isShowHotspotDetail1 = true"
  192. />
  193. <HotspotForHomepage
  194. v-show="false"
  195. class="hotspot-2"
  196. @click="showBigPainting"
  197. />
  198. <HotspotForHomepage
  199. v-show="isShowHotspot"
  200. class="hotspot-3"
  201. @click="isShowHotspotDetail3 = true"
  202. />
  203. </div>
  204. <!-- 文字介绍 -->
  205. <div
  206. ref="longDesc"
  207. v-touch:swipe.left="onSwipeLeft"
  208. v-touch:swipe.right="onSwipeRight"
  209. class="long-desc"
  210. :style="{
  211. top: `${(paintingTop + paintingHeight + 53) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  212. opacity: longDescOpacity,
  213. }"
  214. >
  215. <!-- <h3>作品简介:</h3> -->
  216. <p
  217. v-for="(item, index) in homepagePaintingDesc"
  218. :key="index"
  219. >
  220. {{ item }}
  221. </p>
  222. <!-- <h3>作者简介:</h3>
  223. <p
  224. v-for="(item, index) in homepageAuthorDesc"
  225. :key="index"
  226. >
  227. {{ item }}
  228. </p> -->
  229. </div>
  230. <div class="" />
  231. <!-- stem title -->
  232. <div
  233. class="fixed-desc detail-title-stem"
  234. :style="{
  235. top: `${( stemOpacity1 > 0 || stemOpacity2 >0? paintingTop + 670 : paintingTop + 750 ) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  236. opacity: stemTextOpacity,
  237. }"
  238. >
  239. 三竿修竹
  240. </div>
  241. <div
  242. class="fixed-desc detail-title-stem"
  243. :style="{
  244. top: `${( stoneOpacity1 > 0 ? paintingTop + 500 : paintingTop + 580 ) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  245. opacity: stoneTextOpacity,
  246. }"
  247. >
  248. 卧石
  249. </div>
  250. <div
  251. class="fixed-desc detail-title-stem"
  252. :style="{
  253. top: `${( leafOpacity1 > 0 || leafOpacity2 >0 || leafOpacity3 >0? paintingTop + 330 : paintingTop + 410 ) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  254. opacity: leafTextOpacity,
  255. }"
  256. >
  257. 竹叶
  258. </div>
  259. <div
  260. class="fixed-desc detail-desc-stem"
  261. :style="{
  262. top: `${(paintingTop + 750) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  263. opacity: stemGreenOpacity,
  264. }"
  265. v-html="detailDescStem"
  266. />
  267. <div
  268. class="fixed-desc detail-desc-leaf"
  269. :style="{
  270. top: `${(paintingTop + 750) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  271. opacity: leafGreenOpacity,
  272. }"
  273. v-html="leafOpacity1 > 0 ? detailDescLeaf1 :leafOpacity2> 0? detailDescLeaf2:detailDescLeaf3"
  274. />
  275. <div
  276. class="fixed-desc detail-desc-stone"
  277. :style="{
  278. top: `${(paintingTop + 750) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  279. opacity: stoneGreenOpacity,
  280. }"
  281. v-html="detailDescStone"
  282. />
  283. <div
  284. class="fixed-desc summary-desc"
  285. :style="{
  286. top: `${(paintingTop + 700) / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)}px`,
  287. opacity: summaryOpacity,
  288. }"
  289. >
  290. {{ summaryDesc }}
  291. </div>
  292. <div class="progress-bar">
  293. <div
  294. class="bar-artwork-desc"
  295. />
  296. <img
  297. class="progress-bar-node-1"
  298. src="@/assets/images/progress-bar-node-1.png"
  299. alt=""
  300. draggable="false"
  301. >
  302. <div class="bar-author-desc" />
  303. <img
  304. class="progress-bar-node-2"
  305. src="@/assets/images/progress-bar-node-2.png"
  306. alt=""
  307. draggable="false"
  308. >
  309. <div class="bar-artwork-enjoy" />
  310. <img
  311. class="progress-bar-node-3"
  312. src="@/assets/images/progress-bar-node-3.png"
  313. alt=""
  314. draggable="false"
  315. >
  316. <div
  317. class="mask"
  318. :style="{
  319. width: `${(1 - scrollerElScrollTop / summaryHideAt) * 100}%`,
  320. backgroundColor:stemGreenOpacity > 0 || leafGreenOpacity > 0 || stoneGreenOpacity > 0?'rgba(85,116,83,0.8)':''
  321. }"
  322. />
  323. </div>
  324. <OperationTip
  325. v-if="isStartupOver"
  326. class="operation-tip"
  327. text="向左划动"
  328. direction="h"
  329. :is-show="isShowOperationTip"
  330. />
  331. <div
  332. ref="scrollerEl"
  333. class="scroller"
  334. @touchstart="handletouchstart($event)"
  335. @touchend="touchEnd($event)"
  336. >
  337. <div
  338. class="inner"
  339. :style="{
  340. height: summaryHideAt + windowHeight + 'px',
  341. }"
  342. />
  343. </div>
  344. <!-- 热点详情页 -->
  345. <Transition name="fade-in-out">
  346. <HotspotDetail1
  347. v-if="isShowHotspotDetail1"
  348. class="hotspot-detail"
  349. @close="isShowHotspotDetail1 = false"
  350. />
  351. </Transition>
  352. <!-- <Transition name="fade-in-out">
  353. <PaintingDetail
  354. v-if="isShowPaintingDetail"
  355. :thumb="require(`@/assets/images/home-painting.jpg`)"
  356. :title="'修篁树石图'"
  357. :author="'李衎'"
  358. :age="'元'"
  359. :subtitle="'轴 绢本 墨笔'"
  360. :location="'南京博物院藏'"
  361. :painting-desc="homepagePaintingDesc.join('\n\n')"
  362. :author-desc="homepageAuthorDesc.join('\n\n')"
  363. :big-painting="require(`@/assets/images/home-painting-big.jpg`)"
  364. :need-operation-tip="true"
  365. class="hotspot-detail painting-detail"
  366. @close="isShowPaintingDetail = false"
  367. />
  368. </Transition> -->
  369. <Transition name="fade-in-out">
  370. <HotspotDetail3
  371. v-if="isShowHotspotDetail3"
  372. class="hotspot-detail"
  373. @close="isShowHotspotDetail3 = false"
  374. />
  375. </Transition>
  376. <Transition name="fade-in">
  377. <video
  378. v-if="isShowVideoFadeToNextPage"
  379. ref="videoFadeToNextPageEl"
  380. class="fade-to-next-page"
  381. src="@/assets/videos/fade-from-home-to-more-content.mp4"
  382. playsinline
  383. webkit-playsinline="true"
  384. x5-video-player-type="h5"
  385. @ended="router.push({
  386. name: 'MoreContentChange',
  387. })"
  388. />
  389. </Transition>
  390. <Transition name="fade-in">
  391. <BtnSkip
  392. v-if="isShowSkip"
  393. @click="router.push({
  394. name: 'MoreContentChange',
  395. })"
  396. />
  397. </Transition>
  398. <BtnClickMe
  399. class="go-next-page"
  400. text="点击继续"
  401. :is-show="isShowBtnGoNextPage"
  402. @click="onClickGoNextPage"
  403. />
  404. </div>
  405. </template>
  406. <script setup>
  407. import { ref, computed, watch, onMounted, inject, onBeforeUnmount, onUnmounted, nextTick } from "vue"
  408. import { useRoute, useRouter } from "vue-router"
  409. import { useStore } from "vuex"
  410. import Startup from '@/views/StartupView.vue'
  411. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  412. import HotspotDetail1 from '@/views/HotspotDetail1.vue'
  413. // import PaintingDetail from '@/views/PaintingDetail.vue'
  414. import HotspotDetail3 from '@/views/HotspotDetail3.vue'
  415. import { api as viewerApi } from 'v-viewer'
  416. import { useWindowSize } from '@vueuse/core'
  417. const { width: windowWidth, height: windowHeight } = useWindowSize()
  418. const route = useRoute()
  419. const router = useRouter()
  420. const store = useStore()
  421. const $env = inject('$env')
  422. const {
  423. windowSizeInCssForRef,
  424. windowSizeWhenDesignForRef,
  425. } = useSizeAdapt()
  426. const homepagePaintingDesc = configText.homepagePaintingDesc
  427. const homepageAuthorDesc = configText.homepageAuthorDesc
  428. const detailDescStem = configText.homepagePaintingDetailDescStem
  429. const detailDescLeaf1 = configText.homepagePaintingDetailDescLeaf1
  430. const detailDescLeaf2 = configText.homepagePaintingDetailDescLeaf2
  431. const detailDescLeaf3 = configText.homepagePaintingDetailDescLeaf3
  432. const detailDescStone = configText.homepagePaintingDetailDescStone
  433. const summaryDesc = configText.homepagePaintingSummary
  434. const scrollerEl = ref(null)
  435. const scrollerElScrollTop = ref(0)
  436. function onScroll() {
  437. scrollerElScrollTop.value = scrollerEl.value.scrollTop
  438. }
  439. onMounted(() => {
  440. scrollerEl.value.addEventListener('scroll', onScroll)
  441. })
  442. onBeforeUnmount(() => {
  443. scrollerEl.value.removeEventListener('scroll', onScroll)
  444. })
  445. const isShowOperationTip = ref(true)
  446. watch(scrollerElScrollTop, (v) => {
  447. if (v > 0) {
  448. isShowOperationTip.value = false
  449. }
  450. })
  451. const haveShownStartup = computed(() => {
  452. return store.state.haveShownStartup
  453. })
  454. const isStartupOver = ref(false)
  455. const unwatch = watch(haveShownStartup, (v) => {
  456. if (v) {
  457. setTimeout(() => {
  458. isStartupOver.value = true
  459. }, 2000)
  460. unwatch()
  461. }
  462. })
  463. const titleHideAt = window.innerHeight * 0
  464. const titleHideFinishAt = window.innerHeight * 0.75
  465. const titleOpacity = computed(() => {
  466. let ret = null
  467. if (scrollerElScrollTop.value <= titleHideAt) {
  468. ret = 1
  469. } else {
  470. ret = 1 - (scrollerElScrollTop.value - titleHideAt) / (titleHideFinishAt - titleHideAt)
  471. }
  472. return ret
  473. })
  474. const paintingMoveUpAt = window.innerHeight * 0
  475. const paintingTopInitial = 236
  476. const paintingMoveUpFinishAt = paintingMoveUpAt + window.innerHeight * 1
  477. const paintingTopMovedUp = 41
  478. const paintingMoveDownAt = paintingMoveUpFinishAt + window.innerHeight * 0.5
  479. const paintingMoveDownFinishAt = paintingMoveDownAt + window.innerHeight * 0.25
  480. const paingtingTopMovedDown = -80
  481. const paintingTop = computed(() => {
  482. let ret = null
  483. if (scrollerElScrollTop.value <= paintingMoveUpAt) {
  484. ret = paintingTopInitial
  485. } else if (scrollerElScrollTop.value > paintingMoveUpAt && scrollerElScrollTop.value <= paintingMoveUpFinishAt) {
  486. ret = (scrollerElScrollTop.value - paintingMoveUpAt) / (paintingMoveUpFinishAt - paintingMoveUpAt) * (paintingTopMovedUp - paintingTopInitial) + paintingTopInitial
  487. } else if (scrollerElScrollTop.value > paintingMoveUpFinishAt && scrollerElScrollTop.value <= paintingMoveDownAt) {
  488. ret = paintingTopMovedUp
  489. } else if (scrollerElScrollTop.value > paintingMoveDownAt && scrollerElScrollTop.value <= paintingMoveDownFinishAt) {
  490. ret = (scrollerElScrollTop.value - paintingMoveDownAt) / (paintingMoveDownFinishAt - paintingMoveDownAt) * (paingtingTopMovedDown - paintingTopMovedUp) + paintingTopMovedUp
  491. } else {
  492. ret = paingtingTopMovedDown
  493. }
  494. return ret
  495. })
  496. const paintingWidthInitial = 308
  497. const paintingWidthMovedUp = 250
  498. const paintingWidthMovedDown = 485
  499. const paintingWidth = computed(() => {
  500. let ret = null
  501. if (scrollerElScrollTop.value <= paintingMoveUpAt) {
  502. ret = paintingWidthInitial
  503. } else if (scrollerElScrollTop.value > paintingMoveUpAt && scrollerElScrollTop.value <= paintingMoveUpFinishAt) {
  504. ret = (scrollerElScrollTop.value - paintingMoveUpAt) / (paintingMoveUpFinishAt - paintingMoveUpAt) * (paintingWidthMovedUp - paintingWidthInitial) + paintingWidthInitial
  505. } else if (scrollerElScrollTop.value > paintingMoveUpFinishAt && scrollerElScrollTop.value <= paintingMoveDownAt) {
  506. ret = paintingWidthMovedUp
  507. } else if (scrollerElScrollTop.value > paintingMoveDownAt && scrollerElScrollTop.value <= paintingMoveDownFinishAt) {
  508. ret = (scrollerElScrollTop.value - paintingMoveDownAt) / (paintingMoveDownFinishAt - paintingMoveDownAt) * (paintingWidthMovedDown - paintingWidthMovedUp) + paintingWidthMovedUp
  509. } else {
  510. ret = paintingWidthMovedDown
  511. }
  512. return ret
  513. })
  514. const paintingHeightInitial = 523
  515. const paintingHeightMovedUp = 425
  516. let paintingHeightMovedDown = 758
  517. const paintingHeight = computed(() => {
  518. let ret = null
  519. if (scrollerElScrollTop.value <= paintingMoveUpAt) {
  520. ret = paintingHeightInitial
  521. } else if (scrollerElScrollTop.value > paintingMoveUpAt && scrollerElScrollTop.value <= paintingMoveUpFinishAt) {
  522. ret = (scrollerElScrollTop.value - paintingMoveUpAt) / (paintingMoveUpFinishAt - paintingMoveUpAt) * (paintingHeightMovedUp - paintingHeightInitial) + paintingHeightInitial
  523. } else if (scrollerElScrollTop.value > paintingMoveUpFinishAt && scrollerElScrollTop.value <= paintingMoveDownAt) {
  524. ret = paintingHeightMovedUp
  525. } else if (scrollerElScrollTop.value > paintingMoveDownAt && scrollerElScrollTop.value <= paintingMoveDownFinishAt) {
  526. ret = (scrollerElScrollTop.value - paintingMoveDownAt) / (paintingMoveDownFinishAt - paintingMoveDownAt) * (paintingHeightMovedDown - paintingHeightMovedUp) + paintingHeightMovedUp
  527. } else {
  528. ret = paintingHeightMovedDown
  529. }
  530. return ret
  531. })
  532. const longDesc = ref(null)
  533. const longDescShowFinishAt = window.innerHeight * 0.25
  534. const longDescHideAt = longDescShowFinishAt + window.innerHeight * 1
  535. const longDescHideFinishAt = longDescHideAt + window.innerHeight * 0.25
  536. const longDescOpacity = computed(() => {
  537. let ret = null
  538. if (scrollerElScrollTop.value <= longDescShowFinishAt) {
  539. ret = 1 - (longDescShowFinishAt - scrollerElScrollTop.value) / (longDescShowFinishAt)
  540. } else if (scrollerElScrollTop.value > longDescShowFinishAt && scrollerElScrollTop.value < longDescHideAt) {
  541. ret = 1
  542. } else {
  543. ret = 1 - (scrollerElScrollTop.value - longDescHideAt) / (longDescHideFinishAt - longDescHideAt)
  544. }
  545. return ret
  546. })
  547. watch(scrollerElScrollTop, (vNew, vOld) => {
  548. if (vNew > paintingMoveUpFinishAt) {
  549. // longDesc.value.scrollTop = vNew - paintingMoveUpFinishAt
  550. } else if (vNew < vOld && vNew <= paintingMoveUpFinishAt) {
  551. // longDesc.value.scrollTop = 0
  552. }
  553. })
  554. // 第一页
  555. const stemShowAt = longDescHideFinishAt + window.innerHeight * 0
  556. const stemShowFinishAt = stemShowAt + window.innerHeight * 0.25
  557. const stemHideAt = stemShowFinishAt + window.innerHeight * 0.3
  558. const stemHideFisishAt = stemHideAt + window.innerHeight * 0.25
  559. const stemOpacity = computed(() => {
  560. let ret = null
  561. if (scrollerElScrollTop.value <= stemShowAt) {
  562. ret = 0
  563. } else if (scrollerElScrollTop.value > stemShowAt && scrollerElScrollTop.value < stemShowFinishAt) {
  564. ret = (scrollerElScrollTop.value - stemShowAt) / (stemShowFinishAt - stemShowAt)
  565. } else if (scrollerElScrollTop.value >= stemShowFinishAt && scrollerElScrollTop.value <= stemHideAt) {
  566. ret = 1
  567. } else if (scrollerElScrollTop.value > stemHideAt && scrollerElScrollTop.value < stemHideFisishAt) {
  568. ret = 1 - (scrollerElScrollTop.value - stemHideAt) / (stemHideFisishAt - stemHideAt)
  569. } else {
  570. ret = 0
  571. }
  572. return ret
  573. })
  574. const stemShowAt1 = stemHideFisishAt + window.innerHeight * 0
  575. const stemShowFinishAt1 = stemShowAt1 + window.innerHeight * 0.25
  576. const stemHideAt1 = stemShowFinishAt1 + window.innerHeight * 0.3
  577. const stemHideFisishAt1 = stemHideAt1 + window.innerHeight * 0.25
  578. const stemOpacity1 = computed(() => {
  579. let ret = null
  580. if (scrollerElScrollTop.value <= stemShowAt1) {
  581. ret = 0
  582. } else if (scrollerElScrollTop.value > stemShowAt1 && scrollerElScrollTop.value < stemShowFinishAt1) {
  583. ret = (scrollerElScrollTop.value - stemShowAt1) / (stemShowFinishAt1 - stemShowAt1)
  584. } else if (scrollerElScrollTop.value >= stemShowFinishAt1 && scrollerElScrollTop.value <= stemHideAt1) {
  585. ret = 1
  586. } else if (scrollerElScrollTop.value > stemHideAt1 && scrollerElScrollTop.value < stemHideFisishAt1) {
  587. ret = 1 - (scrollerElScrollTop.value - stemHideAt1) / (stemHideFisishAt1 - stemHideAt1)
  588. } else {
  589. ret = 0
  590. }
  591. return ret
  592. })
  593. const stemShowAt2 = stemHideFisishAt1 + window.innerHeight * 0
  594. const stemShowFinishAt2 = stemShowAt2 + window.innerHeight * 0.25
  595. const stemHideAt2 = stemShowFinishAt2 + window.innerHeight * 0.3
  596. const stemHideFisishAt2 = stemHideAt2 + window.innerHeight * 0.25
  597. const stemOpacity2 = computed(() => {
  598. let ret = null
  599. if (scrollerElScrollTop.value <= stemShowAt1) {
  600. ret = 0
  601. } else if (scrollerElScrollTop.value > stemShowAt2 && scrollerElScrollTop.value < stemShowFinishAt2) {
  602. ret = (scrollerElScrollTop.value - stemShowAt2) / (stemShowFinishAt2 - stemShowAt2)
  603. } else if (scrollerElScrollTop.value >= stemShowFinishAt2 && scrollerElScrollTop.value <= stemHideAt2) {
  604. ret = 1
  605. } else if (scrollerElScrollTop.value > stemHideAt2 && scrollerElScrollTop.value < stemHideFisishAt2) {
  606. ret = 1 - (scrollerElScrollTop.value - stemHideAt2) / (stemHideFisishAt - stemHideAt2)
  607. } else {
  608. ret = 0
  609. }
  610. return ret
  611. })
  612. const stemShowText = stemShowAt
  613. const stemShowTextFinishAt = stemShowFinishAt
  614. const stemTextHideAt = stemHideAt2
  615. const stemHideTextFisishAt = stemHideFisishAt2
  616. const stemTextOpacity = computed(() => {
  617. let ret = null
  618. if (scrollerElScrollTop.value <= stemShowText) {
  619. ret = 0
  620. } else if (scrollerElScrollTop.value > stemShowText && scrollerElScrollTop.value < stemShowTextFinishAt) {
  621. ret = (scrollerElScrollTop.value - stemShowText) / (stemShowTextFinishAt - stemShowText)
  622. } else if (scrollerElScrollTop.value >= stemShowTextFinishAt && scrollerElScrollTop.value <= stemTextHideAt) {
  623. ret = 1
  624. } else if (scrollerElScrollTop.value > stemTextHideAt && scrollerElScrollTop.value < stemHideTextFisishAt) {
  625. ret = 1 - (scrollerElScrollTop.value - stemTextHideAt) / (stemHideTextFisishAt - stemTextHideAt)
  626. } else {
  627. ret = 0
  628. }
  629. return ret
  630. })
  631. const stemShowGreen = stemShowAt1
  632. const stemShowGreenFinishAt = stemShowFinishAt1
  633. const stemGreenHideAt = stemHideAt2
  634. const stemHideGreenFisishAt = stemHideFisishAt2
  635. const stemGreenOpacity = computed(() => {
  636. let ret = null
  637. if (scrollerElScrollTop.value <= stemShowGreen) {
  638. ret = 0
  639. } else if (scrollerElScrollTop.value > stemShowGreen && scrollerElScrollTop.value < stemShowGreenFinishAt) {
  640. ret = (scrollerElScrollTop.value - stemShowGreen) / (stemShowGreenFinishAt - stemShowGreen)
  641. } else if (scrollerElScrollTop.value >= stemShowGreenFinishAt && scrollerElScrollTop.value <= stemGreenHideAt) {
  642. ret = 1
  643. } else if (scrollerElScrollTop.value > stemGreenHideAt && scrollerElScrollTop.value < stemHideGreenFisishAt) {
  644. ret = 1 - (scrollerElScrollTop.value - stemGreenHideAt) / (stemHideGreenFisishAt - stemGreenHideAt)
  645. } else {
  646. ret = 0
  647. }
  648. return ret
  649. })
  650. const leafShowAt = stemHideFisishAt2 + (0 * window.innerHeight)
  651. const leafShowFinishAt = leafShowAt + (0.25 * window.innerHeight)
  652. const leafHideAt = leafShowFinishAt + (0.3 * window.innerHeight)
  653. const leafHideFisishAt = leafHideAt + (0.25 * window.innerHeight)
  654. const leafOpacity = computed(() => {
  655. let ret = null
  656. if (scrollerElScrollTop.value <= leafShowAt) {
  657. ret = 0
  658. } else if (scrollerElScrollTop.value > leafShowAt && scrollerElScrollTop.value < leafShowFinishAt) {
  659. ret = (scrollerElScrollTop.value - leafShowAt) / (leafShowFinishAt - leafShowAt)
  660. } else if (scrollerElScrollTop.value >= leafShowFinishAt && scrollerElScrollTop.value <= leafHideAt) {
  661. ret = 1
  662. } else if (scrollerElScrollTop.value > leafHideAt && scrollerElScrollTop.value < leafHideFisishAt) {
  663. ret = 1 - (scrollerElScrollTop.value - leafHideAt) / (leafHideFisishAt - leafHideAt)
  664. } else {
  665. ret = 0
  666. }
  667. return ret
  668. })
  669. const leafShowAt1 = leafHideFisishAt + (0 * window.innerHeight)
  670. const leafShowFinishAt1 = leafShowAt1 + (0.25 * window.innerHeight)
  671. const leafHideAt1 = leafShowFinishAt1 + (0.3 * window.innerHeight)
  672. const leafHideFisishAt1 = leafHideAt1 + (0.25 * window.innerHeight)
  673. const leafOpacity1 = computed(() => {
  674. let ret = null
  675. if (scrollerElScrollTop.value <= leafShowAt1) {
  676. ret = 0
  677. } else if (scrollerElScrollTop.value > leafShowAt1 && scrollerElScrollTop.value < leafShowFinishAt1) {
  678. ret = (scrollerElScrollTop.value - leafShowAt1) / (leafShowFinishAt1 - leafShowAt1)
  679. } else if (scrollerElScrollTop.value >= leafShowFinishAt1 && scrollerElScrollTop.value <= leafHideAt1) {
  680. ret = 1
  681. } else if (scrollerElScrollTop.value > leafHideAt1 && scrollerElScrollTop.value < leafHideFisishAt1) {
  682. ret = 1 - (scrollerElScrollTop.value - leafHideAt1) / (leafHideFisishAt1 - leafHideAt1)
  683. } else {
  684. ret = 0
  685. }
  686. return ret
  687. })
  688. const leafShowAt2 = leafHideFisishAt1 + (0 * window.innerHeight)
  689. const leafShowFinishAt2 = leafShowAt2 + (0.25 * window.innerHeight)
  690. const leafHideAt2 = leafShowFinishAt2 + (0.3 * window.innerHeight)
  691. const leafHideFisishAt2 = leafHideAt2 + (0.25 * window.innerHeight)
  692. const leafOpacity2 = computed(() => {
  693. let ret = null
  694. if (scrollerElScrollTop.value <= leafShowAt2) {
  695. ret = 0
  696. } else if (scrollerElScrollTop.value > leafShowAt2 && scrollerElScrollTop.value < leafShowFinishAt2) {
  697. ret = (scrollerElScrollTop.value - leafShowAt2) / (leafShowFinishAt2 - leafShowAt2)
  698. } else if (scrollerElScrollTop.value >= leafShowFinishAt2 && scrollerElScrollTop.value <= leafHideAt2) {
  699. ret = 1
  700. } else if (scrollerElScrollTop.value > leafHideAt2 && scrollerElScrollTop.value < leafHideFisishAt2) {
  701. ret = 1 - (scrollerElScrollTop.value - leafHideAt2) / (leafHideFisishAt2 - leafHideAt2)
  702. } else {
  703. ret = 0
  704. }
  705. return ret
  706. })
  707. const leafShowAt3 = leafHideFisishAt2 + (0 * window.innerHeight)
  708. const leafShowFinishAt3 = leafShowAt3 + (0.25 * window.innerHeight)
  709. const leafHideAt3 = leafShowFinishAt3 + (0.3 * window.innerHeight)
  710. const leafHideFisishAt3 = leafHideAt3 + (0.25 * window.innerHeight)
  711. const leafOpacity3 = computed(() => {
  712. let ret = null
  713. if (scrollerElScrollTop.value <= leafShowAt3) {
  714. ret = 0
  715. } else if (scrollerElScrollTop.value > leafShowAt3 && scrollerElScrollTop.value < leafShowFinishAt3) {
  716. ret = (scrollerElScrollTop.value - leafShowAt3) / (leafShowFinishAt3 - leafShowAt3)
  717. } else if (scrollerElScrollTop.value >= leafShowFinishAt3 && scrollerElScrollTop.value <= leafHideAt3) {
  718. ret = 1
  719. } else if (scrollerElScrollTop.value > leafHideAt3 && scrollerElScrollTop.value < leafHideFisishAt3) {
  720. ret = 1 - (scrollerElScrollTop.value - leafHideAt3) / (leafHideFisishAt3 - leafHideAt3)
  721. } else {
  722. ret = 0
  723. }
  724. return ret
  725. })
  726. const leafShowText = leafShowAt
  727. const leafShowTextFinishAt = leafShowFinishAt
  728. const leafTextHideAt = leafHideAt3
  729. const leafHideTextFisishAt = leafHideFisishAt3
  730. const leafTextOpacity = computed(() => {
  731. let ret = null
  732. if (scrollerElScrollTop.value <= leafShowText) {
  733. ret = 0
  734. } else if (scrollerElScrollTop.value > leafShowText && scrollerElScrollTop.value < leafShowTextFinishAt) {
  735. ret = (scrollerElScrollTop.value - leafShowText) / (leafShowTextFinishAt - leafShowText)
  736. } else if (scrollerElScrollTop.value >= leafShowTextFinishAt && scrollerElScrollTop.value <= leafTextHideAt) {
  737. ret = 1
  738. } else if (scrollerElScrollTop.value > leafTextHideAt && scrollerElScrollTop.value < leafHideTextFisishAt) {
  739. ret = 1 - (scrollerElScrollTop.value - leafTextHideAt) / (leafHideTextFisishAt - leafTextHideAt)
  740. } else {
  741. ret = 0
  742. }
  743. return ret
  744. })
  745. const leafShowGreen = leafShowAt1
  746. const leafShowGreenFinishAt = leafShowFinishAt1
  747. const leafGreenHideAt = leafHideAt3
  748. const leafHideGreenFisishAt = leafHideFisishAt3
  749. const leafGreenOpacity = computed(() => {
  750. let ret = null
  751. if (scrollerElScrollTop.value <= leafShowGreen) {
  752. ret = 0
  753. } else if (scrollerElScrollTop.value > leafShowGreen && scrollerElScrollTop.value < leafShowGreenFinishAt) {
  754. ret = (scrollerElScrollTop.value - leafShowGreen) / (leafShowGreenFinishAt - leafShowGreen)
  755. } else if (scrollerElScrollTop.value >= leafShowGreenFinishAt && scrollerElScrollTop.value <= leafGreenHideAt) {
  756. ret = 1
  757. } else if (scrollerElScrollTop.value > leafGreenHideAt && scrollerElScrollTop.value < leafHideGreenFisishAt) {
  758. ret = 1 - (scrollerElScrollTop.value - leafGreenHideAt) / (leafHideGreenFisishAt - leafGreenHideAt)
  759. } else {
  760. ret = 0
  761. }
  762. return ret
  763. })
  764. const stoneShowAt = leafHideFisishAt3 + (0 * window.innerHeight)
  765. const stoneShowFinishAt = stoneShowAt + (0.25 * window.innerHeight)
  766. const stoneHideAt = stoneShowFinishAt + (0.3 * window.innerHeight)
  767. const stoneHideFinishAt = stoneHideAt + (0.25 * window.innerHeight)
  768. const stoneOpacity = computed(() => {
  769. let ret = null
  770. if (scrollerElScrollTop.value <= stoneShowAt) {
  771. ret = 0
  772. } else if (scrollerElScrollTop.value > stoneShowAt && scrollerElScrollTop.value < stoneShowFinishAt) {
  773. ret = (scrollerElScrollTop.value - stoneShowAt) / (stoneShowFinishAt - stoneShowAt)
  774. } else if (scrollerElScrollTop.value >= stoneShowFinishAt && scrollerElScrollTop.value <= stoneHideAt) {
  775. ret = 1
  776. } else if (scrollerElScrollTop.value > stoneHideAt && scrollerElScrollTop.value < stoneHideFinishAt) {
  777. ret = 1 - (scrollerElScrollTop.value - stoneHideAt) / (stoneHideFinishAt - stoneHideAt)
  778. } else {
  779. ret = 0
  780. }
  781. return ret
  782. })
  783. const stoneShowAt1 = stoneHideFinishAt + (0 * window.innerHeight)
  784. const stoneShowFinishAt1 = stoneShowAt1 + (0.25 * window.innerHeight)
  785. const stoneHideAt1 = stoneShowFinishAt1 + (0.3 * window.innerHeight)
  786. const stoneHideFinishAt1 = stoneHideAt1 + (0.25 * window.innerHeight)
  787. const stoneOpacity1 = computed(() => {
  788. let ret = null
  789. if (scrollerElScrollTop.value <= stoneShowAt1) {
  790. ret = 0
  791. } else if (scrollerElScrollTop.value > stoneShowAt1 && scrollerElScrollTop.value < stoneShowFinishAt1) {
  792. ret = (scrollerElScrollTop.value - stoneShowAt1) / (stoneShowFinishAt1 - stoneShowAt1)
  793. } else if (scrollerElScrollTop.value >= stoneShowFinishAt1 && scrollerElScrollTop.value <= stoneHideAt1) {
  794. ret = 1
  795. } else if (scrollerElScrollTop.value > stoneHideAt1 && scrollerElScrollTop.value < stoneHideFinishAt1) {
  796. ret = 1 - (scrollerElScrollTop.value - stoneHideAt1) / (stoneHideFinishAt1 - stoneHideAt1)
  797. } else {
  798. ret = 0
  799. }
  800. return ret
  801. })
  802. const stoneShowGreen = stoneShowAt1
  803. const stoneShowGreenFinishAt = stoneShowFinishAt1
  804. const stoneGreenHideAt = stoneHideAt1
  805. const stoneHideGreenFisishAt = stoneHideFinishAt1
  806. const stoneGreenOpacity = computed(() => {
  807. let ret = null
  808. if (scrollerElScrollTop.value <= stoneShowGreen) {
  809. ret = 0
  810. } else if (scrollerElScrollTop.value > stoneShowGreen && scrollerElScrollTop.value < stoneShowGreenFinishAt) {
  811. ret = (scrollerElScrollTop.value - stoneShowGreen) / (stoneShowGreenFinishAt - stoneShowGreen)
  812. } else if (scrollerElScrollTop.value >= stoneShowGreenFinishAt && scrollerElScrollTop.value <= stoneGreenHideAt) {
  813. ret = 1
  814. } else if (scrollerElScrollTop.value > stoneGreenHideAt && scrollerElScrollTop.value < stoneHideGreenFisishAt) {
  815. ret = 1 - (scrollerElScrollTop.value - stoneGreenHideAt) / (stoneHideGreenFisishAt - stoneGreenHideAt)
  816. } else {
  817. ret = 0
  818. }
  819. return ret
  820. })
  821. const stoneShowText = stoneShowAt
  822. const stoneShowTextFinishAt = stoneShowFinishAt
  823. const stoneTextHideAt = stoneHideAt1
  824. const stoneHideTextFisishAt = stoneHideFinishAt1
  825. const stoneTextOpacity = computed(() => {
  826. let ret = null
  827. if (scrollerElScrollTop.value <= stoneShowText) {
  828. ret = 0
  829. } else if (scrollerElScrollTop.value > stoneShowText && scrollerElScrollTop.value < stoneShowTextFinishAt) {
  830. ret = (scrollerElScrollTop.value - stoneShowText) / (stoneShowTextFinishAt - stoneShowText)
  831. } else if (scrollerElScrollTop.value >= stoneShowTextFinishAt && scrollerElScrollTop.value <= stoneTextHideAt) {
  832. ret = 1
  833. } else if (scrollerElScrollTop.value > stoneTextHideAt && scrollerElScrollTop.value < stoneHideTextFisishAt) {
  834. ret = 1 - (scrollerElScrollTop.value - stoneTextHideAt) / (stoneHideTextFisishAt - stoneTextHideAt)
  835. } else {
  836. ret = 0
  837. }
  838. return ret
  839. })
  840. const summaryShowAt = stoneHideFinishAt1 + window.innerHeight * 0
  841. const summaryShowFinishAt = summaryShowAt + window.innerHeight * 0.25
  842. const summaryHideAt = summaryShowFinishAt + window.innerHeight * 0.3
  843. const summaryHideFisishAt = summaryHideAt + window.innerHeight * 0.25
  844. const summaryOpacity = computed(() => {
  845. let ret = null
  846. if (scrollerElScrollTop.value <= summaryShowAt) {
  847. ret = 0
  848. } else if (scrollerElScrollTop.value > summaryShowAt && scrollerElScrollTop.value < summaryShowFinishAt) {
  849. ret = (scrollerElScrollTop.value - summaryShowAt) / (summaryShowFinishAt - summaryShowAt)
  850. } else if (scrollerElScrollTop.value >= summaryShowFinishAt && scrollerElScrollTop.value <= summaryHideAt) {
  851. ret = 1
  852. } else if (scrollerElScrollTop.value > summaryHideAt && scrollerElScrollTop.value < summaryHideFisishAt) {
  853. ret = 1 - (scrollerElScrollTop.value - summaryHideAt) / (summaryHideFisishAt - summaryHideAt)
  854. } else {
  855. ret = 0
  856. }
  857. return ret
  858. })
  859. const sizeShowAt = stemShowAt
  860. const sizeShowFinishAt = stemShowFinishAt
  861. const sizeHideAt = stoneHideAt
  862. const sizeHideFisishAt = stoneHideFinishAt
  863. const sizeOpacity = computed(() => {
  864. let ret = null
  865. if (scrollerElScrollTop.value <= sizeShowAt) {
  866. ret = 0
  867. } else if (scrollerElScrollTop.value > sizeShowAt && scrollerElScrollTop.value < sizeShowFinishAt) {
  868. ret = (scrollerElScrollTop.value - sizeShowAt) / (sizeShowFinishAt - sizeShowAt)
  869. } else if (scrollerElScrollTop.value >= sizeShowFinishAt && scrollerElScrollTop.value <= sizeHideAt) {
  870. ret = 1
  871. } else if (scrollerElScrollTop.value > sizeHideAt && scrollerElScrollTop.value < sizeHideFisishAt) {
  872. ret = 1 - (scrollerElScrollTop.value - sizeHideAt) / (sizeHideFisishAt - sizeHideAt)
  873. } else {
  874. ret = 0
  875. }
  876. return ret
  877. })
  878. const isShowHotspot = computed(() => {
  879. let ret = null
  880. console.log('scrollerElScrollTop.value', scrollerElScrollTop.value)
  881. if (scrollerElScrollTop.value >= summaryShowAt) {
  882. ret = true
  883. } else {
  884. return false
  885. }
  886. return ret
  887. })
  888. const isShowHotspotDetail1 = ref(false)
  889. // const isShowPaintingDetail = ref(false)
  890. const isShowHotspotDetail3 = ref(false)
  891. function showBigPainting() {
  892. viewerApi({
  893. images: [require(`@/assets/images/home-painting-big.jpg`)],
  894. })
  895. }
  896. /**
  897. * 跳转新页面
  898. */
  899. const videoFadeToNextPageEl = ref(null)
  900. const isShowVideoFadeToNextPage = ref(false)
  901. const isShowSkip = ref(false)
  902. const isShowBtnGoNextPage = ref(false)
  903. watch(scrollerElScrollTop, (v) => {
  904. if (Math.abs(v + windowHeight.value - scrollerEl.value.scrollHeight) < 3) {
  905. isShowBtnGoNextPage.value = true
  906. } else {
  907. isShowBtnGoNextPage.value = false
  908. }
  909. })
  910. function smoothScrollTo(element, finalPosition, duration = 500, startTime = performance.now()) {
  911. const currentTime = performance.now()
  912. const timeElapsed = currentTime - startTime
  913. const progress = Math.min(timeElapsed / duration, 1) // 确保进度不超过1
  914. const currentPos = element.scrollTop
  915. const newPos = currentPos + (finalPosition - currentPos) * progress
  916. element.scrollTop = newPos
  917. if (progress < 1 && finalPosition == scrollerPositionList[curStep.value] * scrollerEl.value.scrollHeight) {
  918. // console.log('最后位置', finalPosition)
  919. requestAnimationFrame(() => smoothScrollTo(element, finalPosition, duration, startTime))
  920. }
  921. }
  922. const curStep = ref(0)
  923. const scrollerPositionList = [0, 0.115, 0.173, 0.265, 0.346, 0.416, 0.508, 0.589, 0.658, 0.716, 0.809, 1]
  924. const scrollerPositionTimeRight = [6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000]
  925. const scrollerPositionTimeLeft = [6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000]
  926. const onSwipeLeft = () => {
  927. if (curStep.value < scrollerPositionList.length - 1) {
  928. curStep.value ++
  929. const pp = scrollerPositionList[curStep.value]
  930. const startTime = performance.now()
  931. requestAnimationFrame(() => {smoothScrollTo(scrollerEl.value, pp * scrollerEl.value.scrollHeight, scrollerPositionTimeRight[curStep.value], startTime)})
  932. }
  933. }
  934. const onSwipeRight = () => {
  935. if (curStep.value > 0) {
  936. curStep.value --
  937. const pp = scrollerPositionList[curStep.value] * scrollerEl.value.scrollHeight
  938. const startTime = performance.now()
  939. requestAnimationFrame(() => {smoothScrollTo(scrollerEl.value, pp, scrollerPositionTimeLeft[curStep.value], startTime)})
  940. }
  941. }
  942. const lastX = ref(0)
  943. // 开始滑动
  944. const handletouchstart = (event) => {
  945. lastX.value = event.changedTouches[0].pageX
  946. }
  947. // 监听活动
  948. const touchEnd = (event) => {
  949. let currentX = event.changedTouches[0].pageX
  950. let tx = currentX - lastX.value
  951. if (tx < 0) {
  952. if (curStep.value < scrollerPositionList.length - 1) {
  953. curStep.value ++
  954. const pp = scrollerPositionList[curStep.value]
  955. const startTime = performance.now()
  956. requestAnimationFrame(() => {smoothScrollTo(scrollerEl.value, pp * scrollerEl.value.scrollHeight, scrollerPositionTimeRight[curStep.value], startTime)})
  957. }
  958. } else if (tx > 0) {
  959. if (curStep.value > 0) {
  960. curStep.value --
  961. const pp = scrollerPositionList[curStep.value] * scrollerEl.value.scrollHeight
  962. const startTime = performance.now()
  963. requestAnimationFrame(() => {smoothScrollTo(scrollerEl.value, pp, scrollerPositionTimeLeft[curStep.value], startTime)})
  964. }
  965. }
  966. }
  967. function onClickGoNextPage() {
  968. isShowBtnGoNextPage.value = false
  969. isShowVideoFadeToNextPage.value = true
  970. nextTick(() => {
  971. videoFadeToNextPageEl.value.play()
  972. })
  973. setTimeout(() => {
  974. isShowSkip.value = true
  975. }, 2000)
  976. }
  977. </script>
  978. <style lang="less" scoped>
  979. *{
  980. transition: all 1s;
  981. }
  982. .home {
  983. width: 100%;
  984. height: 100%;
  985. background-image: url(@/assets/images/home-painting-line-small.jpg);
  986. background-size: cover;
  987. background-repeat: no-repeat;
  988. background-position: center center;
  989. // 滚动条,只设置某一项可能导致不生效。
  990. ::-webkit-scrollbar {
  991. width: 0;
  992. height: 0;
  993. }
  994. >.bg-mask {
  995. position: absolute;
  996. left: 0;
  997. top: 0;
  998. width: 100%;
  999. height: 100%;
  1000. background: rgba(60, 89, 71, 0.65);
  1001. backdrop-filter: blur(calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')));
  1002. }
  1003. >.startup {
  1004. z-index: 20;
  1005. }
  1006. >.title-wrap {
  1007. position: absolute;
  1008. left: 50%;
  1009. top: calc(36 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1010. transform: translate(-50%);
  1011. width: calc(43 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1012. height: calc(180 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1013. z-index: 5;
  1014. >img.title {
  1015. position: absolute;
  1016. left: 0;
  1017. top: 0;
  1018. width: 100%;
  1019. height: 100%;
  1020. }
  1021. >.sub-text {
  1022. position: absolute;
  1023. left: 110%;
  1024. top: 46%;
  1025. transform: translateY(-50%);
  1026. writing-mode: vertical-lr;
  1027. font-family: KaiTi, KaiTi;
  1028. font-weight: 400;
  1029. font-size: calc(18 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1030. color: #FFFFFF;
  1031. line-height: calc(21 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1032. white-space: pre;
  1033. letter-spacing: 0.2em;
  1034. text-align: center;
  1035. }
  1036. }
  1037. >.painting-wrap {
  1038. position: absolute;
  1039. left: 50%;
  1040. transform: translate(-50%, 0);
  1041. z-index: 1;
  1042. >.green-box{
  1043. width: 200vw;
  1044. height: 200vh;
  1045. background: rgba(85, 116, 83, 0.8);
  1046. position: fixed;
  1047. top: 0;
  1048. left: 0;
  1049. z-index: 2;
  1050. overflow: hidden;
  1051. transition: opacity 1s ease;
  1052. }
  1053. >.size-sign-h {
  1054. position: absolute;
  1055. left: 50%;
  1056. top: 0;
  1057. transform: translate(-50%, -105%);
  1058. width: calc(245 / 308 * 100%);
  1059. >img {
  1060. width: 100%;
  1061. }
  1062. >span {
  1063. position: absolute;
  1064. left: 50%;
  1065. top: 50%;
  1066. transform: translate(-50%, -50%);
  1067. font-family: KaiTi, KaiTi;
  1068. font-weight: 400;
  1069. font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1070. color: #FFFFFF;
  1071. line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1072. text-shadow: 0px 0px calc(4 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')) #F8DD86;
  1073. }
  1074. }
  1075. >.size-sign-v {
  1076. position: absolute;
  1077. right: 0;
  1078. top: 54%;
  1079. transform: translate(80%, -50%);
  1080. height: calc(371 / 523 * 100%);
  1081. >img {
  1082. height: 100%;
  1083. }
  1084. >span {
  1085. position: absolute;
  1086. left: 50%;
  1087. top: 50%;
  1088. transform: translate(-50%, -50%);
  1089. font-family: KaiTi, KaiTi;
  1090. font-weight: 400;
  1091. font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1092. color: #FFFFFF;
  1093. line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1094. text-shadow: 0px 0px calc(4 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')) #F8DD86;
  1095. writing-mode: vertical-lr;
  1096. }
  1097. }
  1098. >img.painting-border {
  1099. position: absolute;
  1100. left: 0;
  1101. top: 0;
  1102. width: 100%;
  1103. height: 100%;
  1104. }
  1105. >img.painting,
  1106. img.painting-stem,
  1107. img.painting-leaf,
  1108. img.painting-stone {
  1109. position: absolute;
  1110. left: 50%;
  1111. top: 54%;
  1112. transform: translate(-50%, -50%);
  1113. width: calc(225 / 308 * 100%);
  1114. }
  1115. }
  1116. >.hotspot-wrap {
  1117. position: absolute;
  1118. left: 50%;
  1119. top: calc(92 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')) !important;
  1120. transform: translate(-46%, 0);
  1121. width: calc(264 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1122. height: calc(517 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1123. z-index: 7;
  1124. pointer-events: none;
  1125. &>div {
  1126. z-index: 100;
  1127. }
  1128. >.hotspot-1 {
  1129. position: absolute;
  1130. top: calc(54 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1131. right: calc(0 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1132. pointer-events: initial;
  1133. }
  1134. >.hotspot-2 {
  1135. position: absolute;
  1136. left: calc(60 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1137. top: calc(222 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1138. pointer-events: initial;
  1139. }
  1140. >.hotspot-3 {
  1141. position: absolute;
  1142. bottom: calc(-10 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1143. right: calc(-10 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1144. pointer-events: initial;
  1145. }
  1146. }
  1147. >.long-desc {
  1148. position: absolute;
  1149. left: 50%;
  1150. bottom: calc(50 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1151. width: calc(309 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1152. transform: translate(-50%, 0);
  1153. color: white;
  1154. overflow: auto;
  1155. font-family: KaiTi, KaiTi;
  1156. color: #FFFFFF;
  1157. animation: none;
  1158. z-index: 10;
  1159. >h3 {
  1160. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1161. margin-bottom: 0.5em;
  1162. font-weight: 600;
  1163. }
  1164. >p {
  1165. font-weight: 400;
  1166. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1167. line-height: calc(25 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1168. text-align: justify;
  1169. margin-bottom: 0.5em;
  1170. }
  1171. }
  1172. >.fixed-desc {
  1173. position: absolute;
  1174. left: 50%;
  1175. transform: translateX(-50%);
  1176. width: calc(309 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1177. height: 20%;
  1178. display: flex;
  1179. justify-content: center;
  1180. align-items: center;
  1181. font-family: KaiTi, KaiTi;
  1182. color: #FFFFFF;
  1183. font-weight: 400;
  1184. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1185. line-height: calc(25 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1186. text-align: justify;
  1187. z-index:2;
  1188. }
  1189. >.detail-title-stem{
  1190. font-size: calc(24 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1191. letter-spacing: 2px;
  1192. transition: top 1s ease;
  1193. position:relative;
  1194. z-index:2;
  1195. }
  1196. >.detail-desc-stem{
  1197. display: block;
  1198. margin-top: 10%;
  1199. }
  1200. >.detail-desc-leaf{
  1201. display: block;
  1202. margin-top: 6%;
  1203. }
  1204. >.detail-desc-stone{
  1205. display: block;
  1206. margin-top: 8%;
  1207. }
  1208. >.progress-bar {
  1209. position: absolute;
  1210. left: 0;
  1211. bottom: 0;
  1212. width: 100%;
  1213. height: 15px;
  1214. z-index: 3;
  1215. >.bar-artwork-desc {
  1216. position: absolute;
  1217. left: 0;
  1218. bottom: 0;
  1219. right: 10px;
  1220. height: 3px;
  1221. background-color: #A9D185;
  1222. }
  1223. >img.progress-bar-node-1 {
  1224. position: absolute;
  1225. left: calc(0.6 * v-bind('longDescHideFinishAt') / v-bind('summaryHideAt') * 100%);
  1226. bottom: 1px;
  1227. width: 2.41px;
  1228. height: 10.23px
  1229. }
  1230. >.bar-author-desc {
  1231. position: absolute;
  1232. left: 12px;
  1233. bottom: 0;
  1234. right: calc(v-bind('longDescHideFinishAt') / v-bind('summaryHideAt') * 100%);
  1235. height: 3px;
  1236. background: #A9D185;
  1237. }
  1238. >img.progress-bar-node-2 {
  1239. position: absolute;
  1240. left: calc(v-bind('longDescHideFinishAt') / v-bind('summaryHideAt') * 100%);
  1241. bottom: 1px;
  1242. width: 7.5px;
  1243. height: 10.8px
  1244. }
  1245. >.bar-artwork-enjoy {
  1246. position: absolute;
  1247. left: calc(v-bind('stoneShowAt') / v-bind('summaryHideAt') * 100%);
  1248. bottom: 0;
  1249. right: 0;
  1250. height: 3px;
  1251. background: #A9D185;
  1252. }
  1253. >img.progress-bar-node-3 {
  1254. position: absolute;
  1255. right: 0;
  1256. bottom: 1px;
  1257. width: 9.7px;
  1258. height: 10.8px
  1259. }
  1260. >.mask {
  1261. position: absolute;
  1262. right: 0;
  1263. bottom: 0;
  1264. height: 15px;
  1265. background-color: #6e8175;
  1266. }
  1267. }
  1268. >.operation-tip {
  1269. position: absolute;
  1270. left: 50%;
  1271. transform: translateX(-50%);
  1272. // bottom: calc(77 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1273. bottom: calc(30 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1274. }
  1275. >.scroller {
  1276. position: absolute;
  1277. left: 0;
  1278. top: 0;
  1279. width: 100%;
  1280. height: 100%;
  1281. overflow: hidden;
  1282. transition: transform 2s ease;
  1283. z-index:3;
  1284. >.inner {
  1285. width: 100%;
  1286. }
  1287. }
  1288. >.hotspot-detail {
  1289. z-index: 21;
  1290. }
  1291. >.hotspot-detail.painting-detail {
  1292. backdrop-filter: blur(calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')));
  1293. }
  1294. >video.fade-to-next-page {
  1295. position: absolute;
  1296. left: 0;
  1297. top: 0;
  1298. width: 100%;
  1299. height: 100%;
  1300. object-fit: cover;
  1301. z-index: 20;
  1302. }
  1303. >button.go-next-page {
  1304. position: absolute;
  1305. left: 50%;
  1306. bottom: calc(25 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  1307. z-index: 20;
  1308. transform: translate(-50%, 0);
  1309. }
  1310. }
  1311. </style>