123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831 |
- <template>
- <div
- :id="`${direction ? 'myRowBox' : ''}`"
- class="hotspot-detail-2"
- >
- <div
- id="painting-wrap-id"
- :class="`painting-wrap ${direction ? 'swiper-no-swiping' : ''} ${
- isUping ? 'paintion-wrap-top' : ''
- }`"
- :style="{
- top: `${direction && isUping ? '0%' : ''}`,
- transform: `${direction ? 'translate(-50%) rotate(-90deg)' : ''}`,
- left: `${direction && isUping ? '50%' : direction ? '26%' : ''}`,
- }"
- >
- <!-- 横向才有的-->
- <div
- v-if="direction"
- class="myRowBoxImg"
- :style="`height:${
- isOpenNow ? (isAnimating ? AnimationProgress - 4 : 100) : 100
- }%`"
- @click="showBigPainting"
- >
- <div>
- <img
- :src="props.thumb"
- alt=""
- >
- <img
- class="shuZhou"
- src="@/assets/images/painting-border-bottom.png"
- alt=""
- >
- </div>
- </div>
- <!-- 竖向才有的 -->
- <div
- v-if="!direction"
- class="shuBox"
- :style="`height:${isOpenNow ? AnimationProgress : 100}%`"
- >
- <img
- class="painting-border"
- src="@/assets/images/painting-border-new.png"
- alt=""
- draggable="false"
- >
- <div
- ref="paintingWrap2El"
- class="painting-wrap-2"
- >
- <img
- ref="paintingEl"
- class="painting"
- :class="{
- oversize: isOversize,
- }"
- :src="props.thumb"
- alt=""
- draggable="false"
- @click="showBigPainting"
- >
- </div>
- </div>
- <Transition
- v-if="isOpenNow"
- name="fade-out"
- >
- <img
- v-show="isAnimating"
- class="bottom-border-for-animation"
- :style="{
- bottom: `${100 - AnimationProgress}%`,
- }"
- src="@/assets/images/painting-border-bottom.png"
- alt=""
- draggable="false"
- >
- </Transition>
- </div>
- <!-- 底部阴影 -->
- <div
- :class="`desc-text-upShowd ${isUping ? 'desc-text-upShowdShow' : ''}`"
- />
- <div
- ref="descTextEl"
- class="desc-text"
- :class="{ 'desc-text-up': isUping }"
- :style="{
- opacity: isAnimating ? AnimationProgress / 100 : 1,
- }"
- @touchstart="handletouchstartUp"
- @touchend="touchEndUp"
- >
- <div
- class="info-title-content"
- :class="{ 'info-title-content-up': isUping }"
- >
- <h1>{{ props.title }}</h1>
- <p
- class="subtitle"
- style="margin-bottom: 19px"
- >
- {{ `${props.author} (${props.age})` }}
- </p>
- <p class="subtitle">
- {{ props.size.width }} x {{ props.size.height }} 厘米
- </p>
- <p class="subtitle">
- {{ props.subtitle }}
- </p>
- <p class="subtitle">
- {{ props.location }}
- </p>
- </div>
- <div
- v-show="isUping"
- v-touch:swipe.bottom="
- () => {
- isUping = true;
- }
- "
- class="info-content"
- :class="{ 'info-content-up': isUping }"
- >
- <h2 v-if="paintingDesc">
- 作品简介:
- </h2>
- <div class="normal-text">
- {{ paintingDesc }}
- </div>
- <h2 v-if="authorDesc">
- 作者简介:
- </h2>
- <div class="normal-text">
- {{ authorDesc }}
- </div>
- </div>
- </div>
- <OperationTip
- v-if="needOperationTip"
- class="operation-tip"
- text=""
- :is-show="isShowOperationTip"
- />
- <BtnBack
- v-if="canClose"
- @click="emit('close')"
- />
- </div>
- </template>
- <script setup>
- import {
- ref,
- computed,
- watch,
- onMounted,
- onBeforeUnmount,
- onBeforeMount,
- } from "vue"
- import useSizeAdapt from "@/useFunctions/useSizeAdapt"
- import { api as viewerApi } from "v-viewer"
- const emit = defineEmits(["close", "touch-up"])
- const { windowSizeInCssForRef, windowSizeWhenDesignForRef } = useSizeAdapt()
- const props = defineProps({
- // 是否是当前需要展开画轴的
- isOpenNow: {
- type: Boolean,
- required: true,
- },
- thumb: {
- type: String,
- required: true,
- },
- bigPainting: {
- type: String,
- required: true,
- },
- title: {
- type: String,
- required: true,
- },
- author: {
- type: String,
- required: true,
- },
- subtitle: {
- type: String,
- required: true,
- },
- age: {
- type: String,
- required: true,
- },
- location: {
- type: String,
- required: true,
- },
- paintingDesc: {
- type: String,
- default: "",
- },
- authorDesc: {
- type: String,
- default: "",
- },
- canClose: {
- type: Boolean,
- default: true,
- },
- size: {
- type: Object,
- default: () => {
- return {
- width: 1,
- height: 1,
- }
- },
- },
- direction: {
- type: String,
- default: () => {
- return
- },
- },
- needOperationTip: {
- type: Boolean,
- default: false,
- },
- })
- const lastY = ref(0)
- // 开始滑动
- const handletouchstartUp = (event) => {
- emit("touch-up")
- lastY.value = event.changedTouches[0].pageY
- }
- onMounted(() => {
- // console.log('pppppppp', props.direction, props.title)
- })
- const touchEndUp = (event) => {
- let currentY = event.changedTouches[0].pageY
- let ty = currentY - lastY.value
- if (ty > 0) {
- console.log("向下")
- onSwipeDown()
- } else if (ty < 0) {
- console.log("向上")
- onSwipeTop()
- }
- }
- /**
- * 操作提示
- */
- const needOperationTip = computed(() => {
- return props.needOperationTip
- })
- const isShowOperationTip = ref(true)
- const descTextEl = ref(null)
- const descTextElScrollTop = ref(0)
- onMounted(() => {
- descTextEl.value.addEventListener("scroll", () => {
- descTextElScrollTop.value = descTextEl.value.scrollTop
- })
- // 判断图片是否是横向
- })
- const unwatch = watch(descTextElScrollTop, () => {
- isShowOperationTip.value = false
- unwatch()
- })
- const isUping = ref(false)
- // 上滑
- const onSwipeTop = () => {
- // console.log('上滑')
- // 画作缩小
- isUping.value = props.paintingDesc ? true : false
- }
- // 下滑
- const onSwipeDown = () => {
- // 看看文字滚动是否到顶部了
- const topNum = descTextEl.value.scrollTop
- if (topNum <= 0) isUping.value = false
- }
- onBeforeUnmount(() => {
- isUping.value = false
- })
- const isAnimating = ref(true)
- /** 卷轴展开动画的tweening */
- const AnimationProgress = ref(7)
- let timeAA = -1
- onMounted(() => {
- if (props.isOpenNow) {
- timeAA = setInterval(() => {
- if (AnimationProgress.value >= 99) {
- clearInterval(timeAA)
- isAnimating.value = false
- }
- AnimationProgress.value = AnimationProgress.value + 2
- }, 30)
- } else {
- AnimationProgress.value = 100
- isAnimating.value = false
- }
- })
- onBeforeMount(() => {
- clearInterval(timeAA)
- })
- /**
- * 尺寸相关
- */
- const paintingWrapWidth = ref(268)
- const paintingWrapHeight = ref(426)
- let wrapSizeRatio = paintingWrapWidth.value / paintingWrapHeight.value
- if (wrapSizeRatio < 1) {
- wrapSizeRatio = 1 / wrapSizeRatio
- }
- let sizeRatio = props.size.width / props.size.height
- if (sizeRatio < 1) {
- sizeRatio = 1 / sizeRatio
- }
- const isOversize = ref(sizeRatio > wrapSizeRatio)
- const paintingWrap2El = ref(null)
- const paintingEl = ref(null)
- function showBigPainting() {
- viewerApi({
- images: [props.bigPainting],
- })
- }
- </script>
- <style lang="less" scoped>
- ::-webkit-scrollbar {
- display: none;
- }
- .hotspot-detail-2 {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- > .painting-wrap {
- position: absolute;
- left: 50%;
- top: calc(
- 30 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- transform: translate(-50%, 0);
- width: calc(
- 356 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- height: calc(
- 602 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- overflow: hidden;
- transition: top 2s ease, transform 2s ease, left 2s ease;
- .shuBox {
- display: inline-block;
- overflow: hidden;
- position: relative;
- .painting-border {
- width: 100%;
- }
- .painting-wrap-2 {
- position: absolute;
- left: 50%;
- top: calc(
- 110 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- transform: translate(-50%, 0);
- width: calc(
- v-bind("paintingWrapWidth") / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- height: calc(
- v-bind("paintingWrapHeight") / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- overflow: auto;
- &::-webkit-scrollbar {
- display: none;
- }
- > img.painting {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- }
- > img.painting.oversize {
- position: static;
- left: initial;
- top: initial;
- transform: initial;
- }
- }
- }
- > img.bottom-border-for-animation {
- position: absolute;
- z-index: 100;
- left: 0;
- width: 100%;
- -webkit-backface-visibility: hidden;
- -moz-backface-visibility: hidden;
- -ms-backface-visibility: hidden;
- backface-visibility: hidden;
- -webkit-perspective: 1000;
- -moz-perspective: 1000;
- -ms-perspective: 1000;
- perspective: 1000;
- /* Other transform properties here */
- }
- }
- // 上滑动画和状态
- > .paintion-wrap-top {
- animation: paintion-up 2s forwards;
- transform: translate(-50%, 0) scale(0.6);
- top: calc(
- -60 / var(--39efea6f-windowSizeWhenDesignForRef) * var(--39efea6f-windowSizeInCssForRef)
- );
- // @keyframes paintion-up {
- // 0% {
- // transform: translate(-50%, 0);
- // top: calc(70 / var(--39efea6f-windowSizeWhenDesignForRef) * var(--39efea6f-windowSizeInCssForRef));
- // }
- // 100% {
- // transform: translate(-50%, 0) scale(0.6);
- // top: calc(-60 / var(--39efea6f-windowSizeWhenDesignForRef) * var(--39efea6f-windowSizeInCssForRef));
- // }
- // }
- }
- > .desc-text {
- position: absolute;
- left: 50%;
- bottom: 2%;
- transform: translateX(-50%);
- width: calc(
- 306 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- height: calc(
- 150 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- // overflow: auto;
- transition: height 2s ease;
- .info-title-content {
- transition: all 2s ease;
- > h1 {
- text-align: center;
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: #ffffff;
- // margin-bottom: calc(
- // 19 / v-bind("windowSizeWhenDesignForRef") *
- // v-bind("windowSizeInCssForRef")
- // );
- white-space: pre;
- }
- > p.subtitle {
- text-align: center;
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 16 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: rgba(255, 255, 255, 0.8);
- line-height: calc(
- 19 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- margin-bottom: calc(
- 6 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > h2 {
- display: inline-block;
- margin-top: calc(
- 30 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- font-family: KaiTi;
- color: #ffffff;
- margin-top: 2em;
- margin-bottom: 0.5em;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > .normal-text {
- font-family: KaiTi;
- color: #ffffff;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- line-height: calc(
- 25 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- text-align: justify;
- white-space: pre-line;
- }
- }
- // 向上滑动
- .info-title-content-up {
- // animation: title-up 2s forwards;
- opacity: 0;
- height: 0;
- overflow: hidden;
- // @keyframes title-up {
- // 0% {
- // opacity: 1;
- // }
- // 100% {
- // opacity: 0;
- // display: none;
- // }
- // }
- }
- > .info-content {
- > h1 {
- text-align: center;
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: #ffffff;
- margin-bottom: calc(
- 19 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > p.subtitle {
- text-align: center;
- font-family: KaiTi;
- font-weight: 400;
- font-size: calc(
- 16 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- color: rgba(255, 255, 255, 0.8);
- line-height: calc(
- 19 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- margin-bottom: calc(
- 6 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > h2 {
- display: inline-block;
- margin-top: calc(
- 30 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- font-family: KaiTi;
- color: #ffffff;
- margin-top: 2em;
- margin-bottom: 0.5em;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > .normal-text {
- font-family: KaiTi;
- color: #ffffff;
- font-weight: 400;
- font-size: calc(
- 20 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- line-height: calc(
- 25 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- text-align: justify;
- white-space: pre-line;
- }
- }
- > .info-content-up {
- animation: info-up 2s forwards;
- @keyframes info-up {
- 0% {
- opacity: 0;
- }
- 100% {
- opacity: 1;
- // transform: translateY(-50%);
- }
- }
- }
- // >h1 {
- // text-align: center;
- // font-family: KaiTi;
- // font-weight: 400;
- // font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // color: #FFFFFF;
- // margin-bottom: calc(19 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // }
- // >p.subtitle {
- // text-align: center;
- // font-family: KaiTi;
- // font-weight: 400;
- // font-size: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // color: rgba(255, 255, 255, 0.8);
- // line-height: calc(19 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // margin-bottom: calc(6 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // }
- // >h2 {
- // display: inline-block;
- // margin-top: calc(30 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // font-family: KaiTi;
- // color: #FFFFFF;
- // margin-top: 2em;
- // margin-bottom: 0.5em;
- // font-weight: 400;
- // font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // }
- // >.normal-text {
- // font-family: KaiTi;
- // color: #FFFFFF;
- // font-weight: 400;
- // font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // line-height: calc(25 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // text-align: justify;
- // white-space: pre-line;
- // }
- }
- > .desc-text-up {
- overflow: auto;
- &::-webkit-scrollbar {
- display: none;
- }
- height: calc(
- 360 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- bottom: 0;
- padding-bottom: 15px;
- // animation: text-up 2s forwards;
- // @keyframes text-up {
- // 100%{
- // height: calc(400 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- // }
- // }
- }
- .desc-text-upShowd {
- width: 100%;
- height: calc(
- 140 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- position: fixed;
- bottom: 0px;
- left: 50%;
- transform: translateX(-50%);
- z-index: 10;
- pointer-events: none;
- opacity: 0;
- transition: opacity 2s;
- background: linear-gradient(
- rgba(0, 0, 0, 0),
- rgba(0, 0, 0, 0.1),
- rgba(0, 0, 0, 0.4)
- );
- }
- .desc-text-upShowdShow {
- opacity: 1;
- }
- > .operation-tip {
- position: absolute;
- right: calc(
- 39 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- bottom: calc(
- 49 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- > .operation-tip {
- position: absolute;
- right: calc(
- 49 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- bottom: calc(
- 39 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- #myRowBox {
- #painting-wrap-id {
- height: 100vw !important;
- left: 50% !important;
- top: 12%;
- // transform: translate(-50%, 0) rotate(-90deg) scale(0.6) !important;
- .myRowBoxImg {
- height: 100%;
- width: 100%;
- max-height: 100vh;
- overflow-x: auto;
- white-space: nowrap;
- display: inline-block;
- position: relative;
- &::-webkit-scrollbar {
- display: none;
- }
- & > div {
- padding: 28% 10% 28% 10%;
- width: 100%;
- background-image: url("../assets/images/img_painting_heng.png");
- background-size: 100% 100%;
- display: inline-block;
- & > img {
- display: inline-block;
- width: 100%;
- }
- position: relative;
- .shuZhou {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- }
- }
- }
- .painting-wrap-2 {
- overflow: visible;
- }
- }
- .desc-text {
- height: calc(
- 230 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- .desc-text-up {
- height: calc(
- 360 / v-bind("windowSizeWhenDesignForRef") *
- v-bind("windowSizeInCssForRef")
- );
- }
- }
- </style>
|