MoreContent.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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. <div class="pagination">
  202. <div
  203. v-for="index in 3"
  204. :key="index"
  205. class="page-icon"
  206. :class="{
  207. active: index === currentAnchorIdx + 1
  208. }"
  209. />
  210. </div>
  211. <BtnBack
  212. @click="router.push({
  213. name: 'HomeView',
  214. })"
  215. />
  216. <OperationTip
  217. class="operation-tip"
  218. :direction="'h'"
  219. :text="'下一章'"
  220. :is-show="isShowOperationTip"
  221. :color="'green'"
  222. />
  223. <Transition name="fade-in">
  224. <video
  225. v-if="isShowVideoFadeAtShuangGou"
  226. ref="videoFadeAtShuangGouEl"
  227. class="fade-to-other-page"
  228. src="@/assets/videos/fade-at-shuang-gou.mp4"
  229. playsinline
  230. webkit-playsinline="true"
  231. x5-video-player-type="h5"
  232. @ended="router.push({
  233. name: 'ShuanggouDetail',
  234. })"
  235. />
  236. </Transition>
  237. <Transition name="fade-in">
  238. <video
  239. v-if="isShowVideoFadeAtMoZhu"
  240. ref="videoFadeAtMoZhuEl"
  241. class="fade-to-other-page"
  242. src="@/assets/videos/fade-at-mo-zhu.mp4"
  243. playsinline
  244. webkit-playsinline="true"
  245. x5-video-player-type="h5"
  246. />
  247. </Transition>
  248. </div>
  249. </template>
  250. <script setup>
  251. import { ref, computed, watch, onMounted, onBeforeUnmount, inject, nextTick } from "vue"
  252. import { useRoute, useRouter } from "vue-router"
  253. import { useStore } from "vuex"
  254. import PoemList from '@/views/PoemList.vue'
  255. import paintingList from '@/views/PaintingList.vue'
  256. import useSmoothSwipe from '@/useFunctions/useSmoothSwipe.js'
  257. import { useWindowSize } from '@vueuse/core'
  258. import OperationTip from "@/components/OperationTip.vue"
  259. import useSizeAdapt from "@/useFunctions/useSizeAdapt.js"
  260. const route = useRoute()
  261. const router = useRouter()
  262. const store = useStore()
  263. const $env = inject('$env')
  264. const {
  265. windowSizeInCssForRef,
  266. windowSizeWhenDesignForRef,
  267. } = useSizeAdapt()
  268. const windowWidthDesign = 1560
  269. const windowHeightDesign = 844
  270. const scrollTarget = ref(null)
  271. const { width: windowWidth, height: windowHeight } = useWindowSize()
  272. const maxTranslateLength = computed(() => {
  273. return windowHeight.value * windowWidthDesign / windowHeightDesign
  274. })
  275. const { haveSwipedThisTime, translateLength, currentAnchorIdx } = useSmoothSwipe({
  276. scrollTargetRef: scrollTarget,
  277. maxTranslateLength,
  278. viewportWidth: windowWidth,
  279. anchorPosList: [
  280. maxTranslateLength.value * 216 / windowWidthDesign - windowWidth.value / 2,
  281. maxTranslateLength.value * 967 / windowWidthDesign - windowWidth.value / 2,
  282. maxTranslateLength.value - windowWidth.value
  283. ],
  284. initialAnchorIdx: Number(route.query.anchorIdx)
  285. })
  286. const bgInitialLeft = 0
  287. const bgLeft = ref(bgInitialLeft)
  288. watch(translateLength, (v) => {
  289. bgLeft.value = bgInitialLeft - v
  290. }, {
  291. immediate: true,
  292. })
  293. const layer4SpeedFactor = 0.8 * 0.8 * 0.8
  294. const layer4InitialLeft = 0
  295. const layer4Left = ref(layer4InitialLeft)
  296. watch(translateLength, (v) => {
  297. layer4Left.value = layer4InitialLeft - v * layer4SpeedFactor
  298. }, {
  299. immediate: true,
  300. })
  301. const layer3SpeedFactor = 0.8 * 0.8
  302. const layer3InitialLeft = 0
  303. const layer3Left = ref(layer3InitialLeft)
  304. watch(translateLength, (v) => {
  305. layer3Left.value = layer3InitialLeft - v * layer3SpeedFactor
  306. }, {
  307. immediate: true,
  308. })
  309. const layer2SpeedFactor = 0.8
  310. const layer2InitialLeft = 0
  311. const layer2Left = ref(layer2InitialLeft)
  312. watch(translateLength, (v) => {
  313. layer2Left.value = layer2InitialLeft - v * layer2SpeedFactor
  314. }, {
  315. immediate: true,
  316. })
  317. const layer1InitialLeft = 0
  318. const layer1Left = ref(layer1InitialLeft)
  319. watch(translateLength, (v) => {
  320. layer1Left.value = layer1InitialLeft - v
  321. }, {
  322. immediate: true,
  323. })
  324. const isShowOperationTip = ref(true)
  325. const unwatch = watch(translateLength, (v) => {
  326. console.log(v)
  327. isShowOperationTip.value = false
  328. unwatch()
  329. // if (Math.abs(v - (scrollerEl.value.scrollHeight - scrollerEl.value.clientHeight)) <= 1) {
  330. // router.push({
  331. // name: 'MoreContent',
  332. // })
  333. // }
  334. })
  335. const videoFadeAtShuangGouEl = ref(null)
  336. const isShowVideoFadeAtShuangGou = ref(false)
  337. function onClickShuangGouEntry() {
  338. isShowVideoFadeAtShuangGou.value = true
  339. nextTick(() => {
  340. videoFadeAtShuangGouEl.value.play()
  341. })
  342. }
  343. const videoFadeAtMoZhuEl = ref(null)
  344. const isShowVideoFadeAtMoZhu = ref(false)
  345. function onClickEntryAtMoZhu(pathName) {
  346. isShowVideoFadeAtMoZhu.value = true
  347. nextTick(() => {
  348. videoFadeAtMoZhuEl.value.addEventListener('ended', () => {
  349. router.push({
  350. name: pathName,
  351. })
  352. })
  353. videoFadeAtMoZhuEl.value.play()
  354. })
  355. }
  356. /**
  357. * 跳转下一个页面
  358. */
  359. // const fingerPosXWhenTouchStart = ref(0)
  360. // const isAtBorderWhenTouchStart = ref(false)
  361. // const handletouchstart = (event) => {
  362. // fingerPosXWhenTouchStart.value = event.changedTouches[0].pageX
  363. // if (Math.abs(maxTranslateLength.value - translateLength.value - windowWidth.value) < 1) {
  364. // isAtBorderWhenTouchStart.value = true
  365. // } else {
  366. // isAtBorderWhenTouchStart.value = false
  367. // }
  368. // }
  369. // const touchMove = (event) => {
  370. // let currentX = event.changedTouches[0].pageX
  371. // let tX = currentX - fingerPosXWhenTouchStart.value
  372. // if (tX < -1 && isAtBorderWhenTouchStart.value) {
  373. // router.push({
  374. // name: 'Game',
  375. // })
  376. // }
  377. // }
  378. watch(currentAnchorIdx, (v) => {
  379. if (v === 2) {
  380. router.push({
  381. name: 'Game',
  382. })
  383. }
  384. }, {
  385. immediate: true,
  386. })
  387. </script>
  388. <style lang="less" scoped>
  389. .button-common-style{
  390. font-family: KaiTi, KaiTi;
  391. font-weight: 400;
  392. font-size: calc(16px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  393. writing-mode: vertical-lr;
  394. letter-spacing: 0.2em;
  395. white-space: pre;
  396. color: #B8AE7A;
  397. }
  398. .group-title-common-style{
  399. font-family: KingHwa_OldSong, KingHwa_OldSong;
  400. font-weight: 400;
  401. font-size: calc(48px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  402. color: #474747;
  403. writing-mode: vertical-lr;
  404. letter-spacing: 0.2em;
  405. white-space: pre;
  406. }
  407. .more-content{
  408. position: absolute;
  409. left: 0;
  410. top: 0;
  411. width: 100%;
  412. height: 100%;
  413. user-select: none;
  414. >.scroll-target{
  415. height: 100%;
  416. width: 100%;
  417. display: flex;
  418. gap: 100px;
  419. overflow: hidden;
  420. >img.bg{
  421. position: absolute;
  422. height: 100%;
  423. }
  424. >.layer-4{
  425. position: absolute;
  426. height: 100%;
  427. >.bamboo-4_01{
  428. position: absolute;
  429. left: calc(0 * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  430. bottom: 0;
  431. height: calc(300px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  432. }
  433. >.bamboo-4_02{
  434. position: absolute;
  435. bottom: 0;
  436. left: calc(120px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  437. height: calc(380px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  438. }
  439. >.bamboo-4_03{
  440. position: absolute;
  441. bottom: 0;
  442. left: calc(1000px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  443. height: calc(518px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  444. }
  445. >.bamboo-4_04{
  446. position: absolute;
  447. bottom: 0;
  448. left: calc(870px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  449. height: 100%;
  450. }
  451. >.bamboo-4_05{
  452. position: absolute;
  453. bottom: 0;
  454. left: calc(450px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  455. height: 100%;
  456. }
  457. >.bamboo-4_06{
  458. position: absolute;
  459. bottom: 0;
  460. left: calc(520px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  461. height: 100%;
  462. }
  463. >.bamboo-4_07{
  464. position: absolute;
  465. bottom: 0;
  466. left: calc(1000px * v-bind('layer4SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  467. height: 100%;
  468. }
  469. }
  470. >.layer-3{
  471. position: absolute;
  472. height: 100%;
  473. >.bamboo-3_01{
  474. position: absolute;
  475. top: 0;
  476. height: 100%;
  477. left: calc(393px * v-bind('layer3SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  478. }
  479. >.bamboo-3_02{
  480. position: absolute;
  481. top: 0;
  482. height: 100%;
  483. left: calc(880px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  484. }
  485. }
  486. >.layer-2{
  487. position: absolute;
  488. height: 100%;
  489. >.bamboo-2_01{
  490. position: absolute;
  491. top: 0;
  492. height: 100%;
  493. left: calc(0px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  494. }
  495. >.bamboo-2_03{
  496. position: absolute;
  497. top: 0;
  498. height: 100%;
  499. left: calc(420px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  500. }
  501. >.bamboo-2_02{
  502. position: absolute;
  503. top: 0;
  504. height: 100%;
  505. left: calc(920px * v-bind('layer2SpeedFactor') * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  506. }
  507. }
  508. >.layer-1{
  509. position: absolute;
  510. height: 100%;
  511. >.bamboo-1_01{
  512. position: absolute;
  513. top: 0;
  514. height: 100%;
  515. left: 0;
  516. }
  517. >.hotspot{
  518. position: absolute;
  519. top: calc(385px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  520. left: calc(71px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  521. }
  522. >.shuang-gou-she-se-group{
  523. position: absolute;
  524. top: calc(245px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  525. left: calc(216px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  526. >button.watch-detail{
  527. position: absolute;
  528. top: calc(182px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  529. left: 0;
  530. background-image: url(@/assets/images/fade-chapter-btn-bg-big.png);
  531. background-size: contain;
  532. background-repeat: no-repeat;
  533. background-position: center center;
  534. padding-top: calc(3px / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  535. .button-common-style();
  536. }
  537. >div.group-title{
  538. position: absolute;
  539. top: 0;
  540. left: calc(41px * v-bind('windowHeight') / v-bind('windowHeightDesign'));;
  541. .group-title-common-style();
  542. >img.deco{
  543. position: absolute;
  544. bottom: 0.9em;
  545. right: -0.05em;
  546. width: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  547. height: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  548. }
  549. }
  550. }
  551. >.bamboo-1_02{
  552. position: absolute;
  553. top: 0;
  554. height: 100%;
  555. left: calc(352px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  556. }
  557. >.mo-zhu-group{
  558. position: absolute;
  559. top: calc(245px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  560. left: calc(936px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  561. >.button-group{
  562. position: absolute;
  563. top: calc(75px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  564. left: 0;
  565. display: flex;
  566. flex-direction: column;
  567. gap: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  568. >button{
  569. .button-common-style();
  570. background-image: url(@/assets/images/fade-chapter-btn-bg-small.png);
  571. background-size: contain;
  572. background-repeat: no-repeat;
  573. background-position: center center;
  574. padding-top: calc(3px / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  575. }
  576. }
  577. >div.group-title{
  578. position: absolute;
  579. top: 0;
  580. left: calc(41px * v-bind('windowHeight') / v-bind('windowHeightDesign'));;
  581. .group-title-common-style();
  582. >img.deco{
  583. position: absolute;
  584. bottom: 0.9em;
  585. right: 0.1em;
  586. width: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  587. height: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  588. }
  589. }
  590. }
  591. >.bamboo-1_03{
  592. position: absolute;
  593. top: 0;
  594. height: 100%;
  595. left: calc(960px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  596. }
  597. >.bamboo-1_04{
  598. position: absolute;
  599. top: 0;
  600. height: 100%;
  601. left: calc(1336px * v-bind('windowHeight') / v-bind('windowHeightDesign'));
  602. }
  603. }
  604. }
  605. >.pagination {
  606. position: absolute;
  607. left: 50%;
  608. transform: translateX(-50%);
  609. bottom: calc(22 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  610. display: flex;
  611. align-items: center;
  612. gap: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  613. >.page-icon{
  614. width: calc(9 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  615. height: calc(9 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  616. border-radius: 50%;
  617. border: 1px solid #7B916B;
  618. min-width: 6px;
  619. min-height: 6px;
  620. }
  621. >.page-icon.active{
  622. background: #7B916B;
  623. }
  624. }
  625. >.operation-tip{
  626. position: absolute;
  627. right: calc(44 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  628. bottom: calc(74 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  629. }
  630. >.fade-to-other-page{
  631. position: absolute;
  632. left: 0;
  633. top: 0;
  634. width: 100%;
  635. height: 100%;
  636. object-fit: cover;
  637. }
  638. }
  639. </style>