123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777 |
- <template>
- <!-- pc端才使用 v-touch-->
- <!--
- v-touch:swipe.left="() => onSwipeChange(1)"
- v-touch:swipe.right="() => onSwipeChange(-1)"
- :swipe-options="{ direction: 'horizontal' }"
- -->
- <div
- class="poem-list-page"
- @touchstart="(e) => touchstart(e.touches[0].pageX)"
- @touchmove="(e) => touchmove(e.touches[0].pageX)"
- @touchend="(e) => touchend((val) => onSwipeChange(val))"
- >
- <div
- class="RWbox"
- :style="`width: ${domWidth}px; left:-${
- baseRWboxLeft ? 500 : indexAc * pageWidth}px;
- `"
- >
- <div
- v-for="(item1, index1) in listRes"
- :key="index1"
- :class="`ROW ROW${item1.waiClass + 1} ROWW${index1 + 1}`"
- :style="`width:${pageWidth}px; opacity:${
- index1 === indexAc ? '1' : isOpcMove ? '0' : ''
- }`"
- >
- <img
- v-for="(item2, index2) in item1.imgArr"
- :key="index2"
- :style="`transform: translateX(${isMoveFu(
- index1,
- item2.moveNum
- )}px);`"
- :class="item2.classTxt"
- :src="require(`@/assets/images/RW/${item2.imgName}.png`)"
- alt=""
- >
- <!-- 诗句内容 -->
- <div
- class="ROWtxt"
- :class="[`typesetting-${getTypesettingIdx(item1['类型'])}`]"
- >
- <div class="inner-wrap">
- <div class="title-wrap">
- <h1>《{{ item1["标题"] }}》</h1>
- <div class="sub-title">
- <span class="author">{{ item1["作者"] }}</span>
- <span class="age">{{ item1["朝代"] }}</span>
- </div>
- </div>
- <p>{{ item1["正文"] }}</p>
- </div>
- </div>
- </div>
- </div>
- <!-- 最底部的文字提示 -->
- <div :class="`RWind ${txtTit ? 'RWindShow' : ''}`">
- 暂无更多内容
- </div>
- <!-- 操作提示 -->
- <OperationTip
- class="operation-tip"
- :direction="'h'"
- :text="'下一章'"
- color="green"
- :is-show="isShowOperationTip"
- />
- <!-- 返场视频 -->
- <div :class="`backVideo ${backVideoFlag ? 'backVideoShow' : ''}`">
- <video
- ref="backVideoRef"
- src="@/assets/images/RW/play.mp4"
- playsinline
- muted
- webkit-playsinline="true"
- x5-video-player-type="h5"
- />
- </div>
- <!-- 全局遮罩 -->
- <div class="shandow-box" />
- <!-- 返回按钮 -->
- <div class="RWback">
- <BtnBack
- class="button-back"
- @click="btnBackFu"
- />
- </div>
- <!-- 选择 时代 -->
- <div
- :class="`RWsBtn ${ageFlga ? 'RWsBtnHide' : ''}`"
- @click="ageFlga = true"
- >
- <img
- class=""
- :src="require(`@/assets/images/icon_menu.png`)"
- alt=""
- >
- </div>
- <!-- 选择时代出来的元素 -->
- <div :class="`RWage ${ageFlga ? 'RWageShow' : ''}`">
- <div
- v-for="item in ageList"
- :key="item"
- :class="`RWageRow ${ageAc === item ? 'RWageRowAc' : ''}`"
- @click="cutAgeFu(item)"
- >
- {{ item }}
- </div>
- <div
- class="RWageImg"
- @click="ageFlga = false"
- >
- <img
- class=""
- :src="require(`@/assets/images/icon_close.png`)"
- alt=""
- >
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, onMounted } from "vue"
- import { useRouter } from "vue-router"
- import useSizeAdapt from "@/useFunctions/useSizeAdapt"
- import { arrList } from "./PoemList.js"
- import useMoveFu from "../moveFu"
- const { touchstart, touchmove, touchend } = useMoveFu()
- /**
- * 排版
- */
- function getTypesettingIdx(poemType) {
- switch (poemType) {
- case "七绝":
- return 1
- case "七律":
- return 2
- case "五绝":
- return 3
- case "五律":
- return 4
- default:
- return 2
- }
- }
- // 提示语的显示隐藏
- const titShow = ref(true)
- const router = useRouter()
- // 返场视频ref
- const backVideoRef = ref("")
- const backVideoFlag = ref(false)
- // 点击返回
- const btnBackFu = () => {
- backVideoRef.value.play()
- setTimeout(() => {
- backVideoFlag.value = true
- }, 100)
- setTimeout(() => {
- router.replace({
- name: "MoreContent",
- query: {
- anchorIdx: 1,
- },
- })
- }, 2200)
- }
- const { windowSizeInCssForRef, windowSizeWhenDesignForRef } = useSizeAdapt()
- const listRes = ref(arrList)
- // 元素总宽度
- const domWidth = ref(0)
- const pageWidth = ref(0)
- // 当前选中索引
- const indexAc = ref(0)
- const baseRWboxLeft = ref(true)
- onMounted(() => {
- setTimeout(() => {
- baseRWboxLeft.value = false
- }, 500)
- })
- // 底部文字提示显示和隐藏
- const txtTit = ref(false)
- const poemList = configExcel["诗词"]
- const isOpcMove = ref(true)
- // 时代数组
- const ageList = ref([])
- // 时代选中
- const ageAc = ref(poemList[0]["朝代"])
- // 时代显示隐藏切换
- const ageFlga = ref(false)
- // 切换时代
- const cutAgeFu = (val) => {
- const index = listRes.value.findIndex((v) => v["朝代"] === val)
- if (indexAc.value === index) return
- isShowOperationTip.value = false
- titShow.value = false
- isOpcMove.value = false
- setTimeout(() => {
- isOpcMove.value = true
- }, 500)
- indexAc.value = index
- ageAc.value = val
- }
- onMounted(() => {
- const tempArr = []
- const imgDataLenght = arrList.length
- // 整个数组能分为多少段,向上取整
- const isArrNum = Math.ceil(poemList.length / imgDataLenght)
- for (let i = 0; i < isArrNum; i++) {
- tempArr.push(poemList.slice(i * imgDataLenght, (i + 1) * imgDataLenght))
- }
- const ageListTemp = []
- const arrRes = []
- tempArr.forEach((v1) => {
- v1.forEach((v2, i2) => {
- v2.imgArr = arrList[i2]
- v2.waiClass = i2
- arrRes.push(v2)
- if (!ageListTemp.includes(v2["朝代"])) ageListTemp.push(v2["朝代"])
- })
- })
- // console.log("-----", arrRes)
- ageList.value = ageListTemp
- listRes.value = arrRes
- const fullWidth = window.innerWidth >= 500 ? 500 : window.innerWidth
- pageWidth.value = fullWidth
- // 总盒子的宽度
- domWidth.value = fullWidth * poemList.length
- })
- // 向右是-1
- // 向左是 1
- const indexFlag = ref(0)
- const isShowOperationTip = ref(true)
- // 左右滑动
- const onSwipeChange = (val) => {
- isShowOperationTip.value = false
- let numResTemp = indexAc.value + val
- let indexFlagTemp = -val
- if (val === -1 && indexAc.value === 0) {
- // 第一个页面左滑
- txtTit.value = true
- setTimeout(() => {
- txtTit.value = false
- }, 1000)
- return
- }
- if (val === 1 && indexAc.value === listRes.value.length - 1) {
- // numResTemp = 0
- txtTit.value = true
- setTimeout(() => {
- txtTit.value = false
- }, 1000)
- return
- }
- titShow.value = false
- indexAc.value = numResTemp
- indexFlag.value = indexFlagTemp
- // 底部朝代也要变化
- ageAc.value = listRes.value[numResTemp]["朝代"]
- }
- // 是否触发移动的逻辑
- const isMoveFu = (index, num) => {
- let numRes
- if (index === indexAc.value) numRes = 0
- else numRes = indexFlag.value * num * 2
- return numRes
- }
- </script>
- <style lang="less" scoped>
- .poem-list-page {
- position: relative;
- width: 100%;
- height: 100%;
- background-color: #f3f4ef;
- .RWsBtn {
- position: absolute;
- z-index: 22;
- right: 20px;
- bottom: 20px;
- width: 30px;
- height: 30px;
- border-radius: 50%;
- // background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- opacity: 1;
- transition: all 0.5s;
- & > img {
- width: 40px;
- }
- }
- .RWsBtnHide {
- opacity: 0;
- pointer-events: none;
- }
- .RWage {
- position: absolute;
- z-index: 22;
- right: -220px;
- bottom: 20px;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- width: calc(100% - 70px);
- height: 30px;
- transition: all 0.5s;
- opacity: 0;
- pointer-events: none;
- .RWageRow {
- transition: all 0.5s;
- width: 30px;
- height: 30px;
- border-radius: 4px;
- background-color: rgba(0, 0, 0, 0.5);
- font-family: KingHwa_OldSong;
- font-size: 16px;
- margin-right: 15px;
- text-align: center;
- line-height: 30px;
- color: #fff;
- border: 1px solid transparent;
- }
- .RWageRowAc {
- color: #d6cda1;
- border: 1px solid #d6cda1;
- font-size: 18px;
- }
- .RWageImg {
- width: 30px;
- height: 30px;
- border-radius: 50%;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- & > img {
- width: 20px;
- }
- }
- }
- .RWageShow {
- right: 20px;
- opacity: 1;
- pointer-events: auto;
- }
- .RWbox {
- width: 8000px;
- height: 100%;
- overflow: hidden;
- position: relative;
- display: flex;
- background-image: url("../assets/images/RW/bg_caizhi.jpg");
- background-size: contain;
- transition: left 0.8s;
- .ROW {
- position: relative;
- transition: opacity 1.2s;
- & > img {
- position: absolute;
- bottom: 0;
- height: 100%;
- transition: transform 1s;
- }
- }
- .ROW {
- .ROW1_1 {
- left: 0;
- }
- .ROW1_2 {
- z-index: 2;
- right: 0;
- }
- .ROW1_3 {
- right: 5%;
- }
- .ROW2_1 {
- z-index: 2;
- left: -38%;
- }
- .ROW2_2 {
- right: 5%;
- }
- .ROW2_3 {
- z-index: 3;
- right: -20%;
- }
- .ROW3_1 {
- left: -36%;
- }
- .ROW3_2 {
- height: 15%;
- left: 10%;
- }
- .ROW3_3 {
- z-index: 2;
- height: 15%;
- right: 10%;
- }
- .ROW3_4 {
- right: 0%;
- }
- .ROW3_5 {
- right: -5%;
- }
- .ROW4_1 {
- left: -35%;
- }
- .ROW4_2 {
- left: -40%;
- height: 15%;
- }
- .ROW4_3 {
- left: 10%;
- height: 20%;
- }
- .ROW4_4 {
- right: 6%;
- height: 15%;
- }
- .ROW4_5 {
- right: -17%;
- }
- .ROW5_1 {
- left: -45%;
- }
- .ROW5_2 {
- z-index: 2;
- left: -17%;
- }
- .ROW5_3 {
- z-index: 3;
- left: 5%;
- height: 15%;
- }
- .ROW5_4 {
- z-index: 3;
- left: 30%;
- height: 15%;
- }
- .ROW5_5 {
- right: -6%;
- }
- .ROW6_1 {
- z-index: 3;
- left: 2%;
- height: 15%;
- }
- .ROW6_2 {
- left: -10%;
- }
- .ROW6_3 {
- z-index: 2;
- left: -13%;
- }
- .ROW6_4 {
- right: -10%;
- }
- .ROW6_5 {
- right: -10%;
- }
- }
- .ROWtxt {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100%;
- writing-mode: vertical-rl;
- position: relative;
- z-index: 10;
- .inner-wrap {
- > .title-wrap {
- position: relative;
- width: fit-content;
- height: fit-content;
- > h1 {
- font-family: KingHwa_OldSong;
- font-weight: 400;
- font-size: calc(
- 36 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: black;
- line-height: calc(
- 36 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- white-space: pre;
- letter-spacing: 0.1em;
- }
- > .sub-title {
- position: absolute;
- left: 0;
- top: 50%;
- transform: translate(-140%, -50%);
- display: flex;
- align-items: center;
- > .author {
- white-space: pre;
- font-family: KaiTi;
- font-weight: 400;
- font-size: 20px;
- color: #b9aa70;
- letter-spacing: 0em;
- margin-inline-end: calc(
- 6 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > .age {
- display: inline-block;
- width: calc(
- 21 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- height: calc(
- 21 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- background-color: #b6a261;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 16 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: #ffffff;
- }
- }
- }
- > p {
- margin-right: calc(
- 40 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: black;
- line-height: 1.6em;
- white-space: pre;
- letter-spacing: 0.2em;
- }
- }
- }
- .ROWtxt.typesetting-1 {
- > .inner-wrap {
- transform: translate(10%, -20%);
- > p {
- margin-top: calc(
- 232 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- }
- .ROWtxt.typesetting-2 {
- > .inner-wrap {
- transform: translate(10%, -4%);
- > p {
- margin-top: calc(
- 102 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- }
- .ROWtxt.typesetting-3 {
- > .inner-wrap {
- transform: translate(0, -9%);
- > p {
- margin-top: calc(
- 135 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- }
- .ROWtxt.typesetting-4 {
- > .inner-wrap {
- transform: translate(10%, -10%);
- > p {
- margin-top: calc(
- 200 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- }
- }
- .ROW1 {
- .ROWtxt {
- padding-top: 15%;
- padding-right: 40%;
- }
- }
- .ROW2 {
- .ROWtxt {
- padding-right: 24%;
- }
- }
- .ROW3 {
- .ROWtxt {
- padding-right: 30%;
- }
- }
- .ROWW19 {
- .ROWtxt {
- padding-top: 87%;
- }
- }
- // 底部文字提示
- .RWind {
- position: absolute;
- bottom: 15%;
- left: 50%;
- transform: translateX(-50%);
- z-index: 30;
- font-size: 14px;
- color: #b9aa70;
- letter-spacing: 4px;
- opacity: 0;
- transition: opacity 0.5s;
- pointer-events: none;
- font-family: KingHwa_OldSong;
- }
- .RWindShow {
- opacity: 1;
- }
- // 操作提示
- .operation-tip {
- position: absolute;
- z-index: 30;
- left: 50%;
- bottom: 7%;
- transform: translateX(-50%);
- color: #7f9470;
- font-size: 12px;
- letter-spacing: 3px;
- pointer-events: none;
- display: flex;
- align-items: center;
- opacity: 1;
- transition: opacity 1s;
- img {
- width: 30px;
- }
- }
- .operation-tipHide {
- opacity: 0;
- }
- // 返场视频
- .backVideo {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 30;
- opacity: 0;
- pointer-events: none;
- transition: opacity 2s;
- & > video {
- width: 100%;
- }
- }
- .backVideoShow {
- opacity: 1;
- pointer-events: auto;
- }
- // 返回按钮
- .RWback {
- position: absolute;
- z-index: 22;
- left: 20px;
- bottom: 20px;
- width: 30px;
- height: 30px;
- border-radius: 50%;
- // background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .btn-back {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- max-width: 100%;
- max-height: 100%;
- }
- .shandow-box{
- width: 100%;
- height:130px;
- left:0;
- background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
- position:absolute;
- bottom: 0;
- z-index: 2;
- }
- }
- </style>
|