MoreContent.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <div
  3. class="more-content"
  4. >
  5. <div
  6. ref="scrollTarget"
  7. class="scroll-target"
  8. >
  9. <img
  10. class="bg"
  11. :style="{
  12. left: bgLeft + 'px'
  13. }"
  14. src="@/assets/images/fade-chapter-wood/bg-more-content.jpg"
  15. alt=""
  16. draggable="false"
  17. >
  18. <div
  19. class="layer-4"
  20. :style="{
  21. left: layer4Left + 'px',
  22. }"
  23. >
  24. <img
  25. class="bamboo-4_01"
  26. src="@/assets/images/fade-chapter-wood/4_01.png"
  27. alt=""
  28. draggable="false"
  29. >
  30. <img
  31. class="bamboo-4_02"
  32. src="@/assets/images/fade-chapter-wood/4_02.png"
  33. alt=""
  34. draggable="false"
  35. >
  36. <img
  37. class="bamboo-4_03"
  38. src="@/assets/images/fade-chapter-wood/4_03.png"
  39. alt=""
  40. draggable="false"
  41. >
  42. <img
  43. class="bamboo-4_04"
  44. src="@/assets/images/fade-chapter-wood/4_04.png"
  45. alt=""
  46. draggable="false"
  47. >
  48. <img
  49. class="bamboo-4_05"
  50. src="@/assets/images/fade-chapter-wood/4_05.png"
  51. alt=""
  52. draggable="false"
  53. >
  54. <img
  55. class="bamboo-4_06"
  56. src="@/assets/images/fade-chapter-wood/4_06.png"
  57. alt=""
  58. draggable="false"
  59. >
  60. <img
  61. class="bamboo-4_07"
  62. src="@/assets/images/fade-chapter-wood/4_07.png"
  63. alt=""
  64. draggable="false"
  65. >
  66. </div>
  67. <div
  68. class="layer-3"
  69. :style="{
  70. left: layer3Left + 'px',
  71. }"
  72. >
  73. <img
  74. class="bamboo-3_01"
  75. src="@/assets/images/fade-chapter-wood/3_01.png"
  76. alt=""
  77. draggable="false"
  78. >
  79. <img
  80. class="bamboo-3_02"
  81. src="@/assets/images/fade-chapter-wood/3_02.png"
  82. alt=""
  83. draggable="false"
  84. >
  85. </div>
  86. <div
  87. class="layer-2"
  88. :style="{
  89. left: layer2Left + 'px',
  90. }"
  91. >
  92. <img
  93. class="bamboo-2_01"
  94. src="@/assets/images/fade-chapter-wood/2_01.png"
  95. alt=""
  96. draggable="false"
  97. >
  98. <img
  99. class="bamboo-2_03"
  100. src="@/assets/images/fade-chapter-wood/2_03.png"
  101. alt=""
  102. draggable="false"
  103. >
  104. <img
  105. class="bamboo-2_02"
  106. src="@/assets/images/fade-chapter-wood/2_02.png"
  107. alt=""
  108. draggable="false"
  109. >
  110. </div>
  111. <div
  112. class="layer-1"
  113. :style="{
  114. left: layer1Left + 'px',
  115. }"
  116. >
  117. <img
  118. class="bamboo-1_01"
  119. src="@/assets/images/fade-chapter-wood/1_01.png"
  120. alt=""
  121. draggable="false"
  122. >
  123. <HotspotComp
  124. class="hotspot"
  125. @click="router.push({
  126. name: 'BambooHot',
  127. })"
  128. />
  129. <div
  130. class="shuang-gou-she-se-group"
  131. >
  132. <button
  133. class="watch-detail animation-show-hide"
  134. @click="onClickShuangGouEntry"
  135. >
  136. 查看详情
  137. </button>
  138. <div class="group-title">
  139. 双钩设色
  140. <img
  141. class="deco"
  142. src="@/assets/images/more-content-deco.png"
  143. alt=""
  144. draggable="false"
  145. >
  146. </div>
  147. </div>
  148. <img
  149. class="bamboo-1_02"
  150. src="@/assets/images/fade-chapter-wood/1_02.png"
  151. alt=""
  152. draggable="false"
  153. >
  154. <div
  155. class="mo-zhu-group"
  156. >
  157. <div class="button-group">
  158. <button
  159. class="poem animation-show-hide"
  160. @click="onClickEntryAtMoZhu('PoemList')"
  161. >
  162. 人文
  163. </button>
  164. <button
  165. class="animation-show-hide"
  166. @click="onClickEntryAtMoZhu('PaintingList')"
  167. >
  168. 画作
  169. </button>
  170. <button
  171. class="animation-show-hide"
  172. @click="onClickEntryAtMoZhu('BambooBook')"
  173. >
  174. 竹谱
  175. </button>
  176. </div>
  177. <div class="group-title">
  178. 墨竹
  179. <img
  180. class="deco"
  181. src="@/assets/images/more-content-deco.png"
  182. alt=""
  183. draggable="false"
  184. >
  185. </div>
  186. </div>
  187. <img
  188. class="bamboo-1_03"
  189. src="@/assets/images/fade-chapter-wood/1_03.png"
  190. alt=""
  191. draggable="false"
  192. >
  193. <img
  194. class="bamboo-1_04"
  195. src="@/assets/images/fade-chapter-wood/1_04.png"
  196. alt=""
  197. draggable="false"
  198. >
  199. </div>
  200. </div>
  201. <PaginationComp
  202. class="pagination"
  203. :total="3"
  204. :idx="currentAnchorIdx"
  205. />
  206. <BtnBack
  207. @click="router.push({
  208. name: 'HomeView',
  209. })"
  210. />
  211. <OperationTip
  212. class="operation-tip"
  213. :direction="'h'"
  214. :text="'下一章'"
  215. :is-show="isShowOperationTip"
  216. :color="'green'"
  217. />
  218. <Transition name="fade-in">
  219. <video
  220. v-if="isShowVideoFadeAtShuangGou"
  221. ref="videoFadeAtShuangGouEl"
  222. class="fade-to-other-page"
  223. src="@/assets/videos/fade-at-shuang-gou.mp4"
  224. playsinline
  225. webkit-playsinline="true"
  226. x5-video-player-type="h5"
  227. @ended="router.push({
  228. name: 'ShuanggouDetail',
  229. })"
  230. />
  231. </Transition>
  232. <Transition name="fade-in">
  233. <video
  234. v-if="isShowVideoFadeAtMoZhu"
  235. ref="videoFadeAtMoZhuEl"
  236. class="fade-to-other-page"
  237. src="@/assets/videos/fade-at-mo-zhu.mp4"
  238. playsinline
  239. webkit-playsinline="true"
  240. x5-video-player-type="h5"
  241. />
  242. </Transition>
  243. <Transition name="fade-in">
  244. <video
  245. v-if="isShowVideoFadeAtPage3"
  246. ref="videoFadeAtPage3El"
  247. class="fade-to-other-page"
  248. src="@/assets/videos/fade-from-more-content-to-game.mp4"
  249. playsinline
  250. webkit-playsinline="true"
  251. x5-video-player-type="h5"
  252. />
  253. </Transition>
  254. </div>
  255. </template>
  256. <script setup>
  257. import { ref, computed, watch, onMounted, onBeforeUnmount, inject, nextTick } from "vue"
  258. import { useRoute, useRouter } from "vue-router"
  259. import { useStore } from "vuex"
  260. import PoemList from '@/views/PoemList.vue'
  261. import paintingList from '@/views/PaintingList.vue'
  262. import useSmoothSwipe from '@/useFunctions/useSmoothSwipe.js'
  263. import { useWindowSize } from '@vueuse/core'
  264. import OperationTip from "@/components/OperationTip.vue"
  265. import useSizeAdapt from "@/useFunctions/useSizeAdapt.js"
  266. import PaginationComp from "@/components/PaginationComp.vue"
  267. const route = useRoute()
  268. const router = useRouter()
  269. const store = useStore()
  270. const $env = inject('$env')
  271. const {
  272. windowSizeInCssForRef,
  273. windowSizeWhenDesignForRef,
  274. } = useSizeAdapt()
  275. const windowWidthDesign = 1560
  276. const windowHeightDesign = 844
  277. const scrollTarget = ref(null)
  278. const { width: windowWidth, height: windowHeight } = useWindowSize()
  279. const maxTranslateLength = computed(() => {
  280. return windowHeight.value * windowWidthDesign / windowHeightDesign
  281. })
  282. const { haveSwipedThisTime, translateLength, currentAnchorIdx, goingToAnchorIdx } = useSmoothSwipe({
  283. scrollTargetRef: scrollTarget,
  284. maxTranslateLength,
  285. viewportWidth: windowWidth,
  286. anchorPosList: [
  287. maxTranslateLength.value * 216 / windowWidthDesign - windowWidth.value / 2,
  288. maxTranslateLength.value * 967 / windowWidthDesign - windowWidth.value / 2,
  289. maxTranslateLength.value - windowWidth.value
  290. ],
  291. initialAnchorIdx: Number(route.query.anchorIdx) || 0
  292. })
  293. const bgInitialLeft = 0
  294. const bgLeft = ref(bgInitialLeft)
  295. watch(translateLength, (v) => {
  296. bgLeft.value = bgInitialLeft - v
  297. }, {
  298. immediate: true,
  299. })
  300. const layer4SpeedFactor = 0.8 * 0.8 * 0.8
  301. const layer4InitialLeft = 0
  302. const layer4Left = ref(layer4InitialLeft)
  303. watch(translateLength, (v) => {
  304. layer4Left.value = layer4InitialLeft - v * layer4SpeedFactor
  305. }, {
  306. immediate: true,
  307. })
  308. const layer3SpeedFactor = 0.8 * 0.8
  309. const layer3InitialLeft = 0
  310. const layer3Left = ref(layer3InitialLeft)
  311. watch(translateLength, (v) => {
  312. layer3Left.value = layer3InitialLeft - v * layer3SpeedFactor
  313. }, {
  314. immediate: true,
  315. })
  316. const layer2SpeedFactor = 0.8
  317. const layer2InitialLeft = 0
  318. const layer2Left = ref(layer2InitialLeft)
  319. watch(translateLength, (v) => {
  320. layer2Left.value = layer2InitialLeft - v * layer2SpeedFactor
  321. }, {
  322. immediate: true,
  323. })
  324. const layer1InitialLeft = 0
  325. const layer1Left = ref(layer1InitialLeft)
  326. watch(translateLength, (v) => {
  327. layer1Left.value = layer1InitialLeft - v
  328. }, {
  329. immediate: true,
  330. })
  331. const isShowOperationTip = ref(true)
  332. const unwatch = watch(translateLength, (v) => {
  333. console.log(v)
  334. isShowOperationTip.value = false
  335. unwatch()
  336. // if (Math.abs(v - (scrollerEl.value.scrollHeight - scrollerEl.value.clientHeight)) <= 1) {
  337. // router.push({
  338. // name: 'MoreContent',
  339. // })
  340. // }
  341. })
  342. const videoFadeAtShuangGouEl = ref(null)
  343. const isShowVideoFadeAtShuangGou = ref(false)
  344. function onClickShuangGouEntry() {
  345. isShowVideoFadeAtShuangGou.value = true
  346. nextTick(() => {
  347. videoFadeAtShuangGouEl.value.play()
  348. })
  349. }
  350. const videoFadeAtMoZhuEl = ref(null)
  351. const isShowVideoFadeAtMoZhu = ref(false)
  352. function onClickEntryAtMoZhu(pathName) {
  353. isShowVideoFadeAtMoZhu.value = true
  354. nextTick(() => {
  355. videoFadeAtMoZhuEl.value.addEventListener('ended', () => {
  356. router.push({
  357. name: pathName,
  358. })
  359. })
  360. videoFadeAtMoZhuEl.value.play()
  361. })
  362. }
  363. const videoFadeAtPage3El = ref(null)
  364. const isShowVideoFadeAtPage3 = ref(false)
  365. // function onClickEntryAtMoZhu(pathName) {
  366. // isShowVideoFadeAtMoZhu.value = true
  367. // nextTick(() => {
  368. // videoFadeAtMoZhuEl.value.addEventListener('ended', () => {
  369. // router.push({
  370. // name: pathName,
  371. // })
  372. // })
  373. // videoFadeAtMoZhuEl.value.play()
  374. // })
  375. // }
  376. watch(goingToAnchorIdx, (v) => {
  377. if (v === 2) {
  378. setTimeout(() => {
  379. isShowVideoFadeAtPage3.value = true
  380. nextTick(() => {
  381. videoFadeAtPage3El.value.addEventListener('ended', () => {
  382. router.push({
  383. name: 'Game',
  384. })
  385. })
  386. videoFadeAtPage3El.value.play()
  387. })
  388. }, 850)
  389. }
  390. })
  391. </script>
  392. <style lang="less" scoped>
  393. .button-common-style{
  394. font-family: KaiTi, KaiTi;
  395. font-weight: 400;
  396. font-size: calc(16px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  397. writing-mode: vertical-lr;
  398. letter-spacing: 0.2em;
  399. white-space: pre;
  400. color: #B8AE7A;
  401. }
  402. .group-title-common-style{
  403. font-family: KingHwa_OldSong, KingHwa_OldSong;
  404. font-weight: 400;
  405. font-size: calc(48px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  406. color: #474747;
  407. writing-mode: vertical-lr;
  408. letter-spacing: 0.2em;
  409. white-space: pre;
  410. }
  411. .more-content{
  412. position: absolute;
  413. left: 0;
  414. top: 0;
  415. width: 100%;
  416. height: 100%;
  417. user-select: none;
  418. >.scroll-target{
  419. height: 100%;
  420. width: 100%;
  421. display: flex;
  422. gap: 100px;
  423. overflow: hidden;
  424. >img.bg{
  425. position: absolute;
  426. height: 100%;
  427. }
  428. >.layer-4{
  429. position: absolute;
  430. height: 100%;
  431. >.bamboo-4_01{
  432. position: absolute;
  433. left: calc(0 * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  434. bottom: 0;
  435. height: calc(300px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  436. }
  437. >.bamboo-4_02{
  438. position: absolute;
  439. bottom: 0;
  440. left: calc(120px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  441. height: calc(380px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  442. }
  443. >.bamboo-4_03{
  444. position: absolute;
  445. bottom: 0;
  446. left: calc(1000px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  447. height: calc(518px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  448. }
  449. >.bamboo-4_04{
  450. position: absolute;
  451. bottom: 0;
  452. left: calc(870px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  453. height: 100%;
  454. }
  455. >.bamboo-4_05{
  456. position: absolute;
  457. bottom: 0;
  458. left: calc(450px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  459. height: 100%;
  460. }
  461. >.bamboo-4_06{
  462. position: absolute;
  463. bottom: 0;
  464. left: calc(520px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  465. height: 100%;
  466. }
  467. >.bamboo-4_07{
  468. position: absolute;
  469. bottom: 0;
  470. left: calc(1000px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  471. height: 100%;
  472. }
  473. }
  474. >.layer-3{
  475. position: absolute;
  476. height: 100%;
  477. >.bamboo-3_01{
  478. position: absolute;
  479. top: 0;
  480. height: 100%;
  481. left: calc(393px * v-bind('layer3SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  482. }
  483. >.bamboo-3_02{
  484. position: absolute;
  485. top: 0;
  486. height: 100%;
  487. left: calc(880px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  488. }
  489. }
  490. >.layer-2{
  491. position: absolute;
  492. height: 100%;
  493. >.bamboo-2_01{
  494. position: absolute;
  495. top: 0;
  496. height: 100%;
  497. left: calc(0px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  498. }
  499. >.bamboo-2_03{
  500. position: absolute;
  501. top: 0;
  502. height: 100%;
  503. left: calc(420px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  504. }
  505. >.bamboo-2_02{
  506. position: absolute;
  507. top: 0;
  508. height: 100%;
  509. left: calc(920px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  510. }
  511. }
  512. >.layer-1{
  513. position: absolute;
  514. height: 100%;
  515. >.bamboo-1_01{
  516. position: absolute;
  517. top: 0;
  518. height: 100%;
  519. left: 0;
  520. }
  521. >.hotspot{
  522. position: absolute;
  523. top: calc(385px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  524. left: calc(71px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  525. }
  526. >.shuang-gou-she-se-group{
  527. position: absolute;
  528. top: calc(245px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  529. left: calc(216px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  530. >button.watch-detail{
  531. position: absolute;
  532. top: calc(182px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  533. left: 0;
  534. background-image: url(@/assets/images/fade-chapter-btn-bg-big.png);
  535. background-size: contain;
  536. background-repeat: no-repeat;
  537. background-position: center center;
  538. padding-top: calc(3px / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  539. .button-common-style();
  540. }
  541. >div.group-title{
  542. position: absolute;
  543. top: 0;
  544. left: calc(41px * v-bind('windowHeight') / v-bind('windowHeightDesign'));;
  545. .group-title-common-style();
  546. >img.deco{
  547. position: absolute;
  548. bottom: 0.9em;
  549. right: -0.05em;
  550. width: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  551. height: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  552. }
  553. }
  554. }
  555. >.bamboo-1_02{
  556. position: absolute;
  557. top: 0;
  558. height: 100%;
  559. left: calc(352px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  560. }
  561. >.mo-zhu-group{
  562. position: absolute;
  563. top: calc(245px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  564. left: calc(936px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  565. >.button-group{
  566. position: absolute;
  567. top: calc(75px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  568. left: 0;
  569. display: flex;
  570. flex-direction: column;
  571. gap: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  572. >button{
  573. .button-common-style();
  574. background-image: url(@/assets/images/fade-chapter-btn-bg-small.png);
  575. background-size: contain;
  576. background-repeat: no-repeat;
  577. background-position: center center;
  578. padding-top: calc(3px / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  579. }
  580. }
  581. >div.group-title{
  582. position: absolute;
  583. top: 0;
  584. left: calc(41px * v-bind('windowHeight') / v-bind('windowHeightDesign'));;
  585. .group-title-common-style();
  586. >img.deco{
  587. position: absolute;
  588. bottom: 0.9em;
  589. right: 0.1em;
  590. width: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  591. height: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  592. }
  593. }
  594. }
  595. >.bamboo-1_03{
  596. position: absolute;
  597. top: 0;
  598. height: 100%;
  599. left: calc(960px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  600. }
  601. >.bamboo-1_04{
  602. position: absolute;
  603. top: 0;
  604. height: 100%;
  605. left: calc(1336px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  606. }
  607. }
  608. }
  609. >.pagination {
  610. position: absolute;
  611. left: 50%;
  612. transform: translateX(-50%);
  613. bottom: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  614. }
  615. >.operation-tip{
  616. position: absolute;
  617. right: calc(44 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  618. bottom: calc(74 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  619. }
  620. >.fade-to-other-page{
  621. position: absolute;
  622. left: 0;
  623. top: 0;
  624. width: 100%;
  625. height: 100%;
  626. object-fit: cover;
  627. }
  628. }
  629. </style>