|
@@ -2,11 +2,15 @@
|
|
|
<div class="imagetext-container">
|
|
|
<div class="metas-imagetext">
|
|
|
<div class="image-content">
|
|
|
+ <!--:free-mode="true" -->
|
|
|
<Swiper
|
|
|
:pagination="{
|
|
|
type: 'fraction',
|
|
|
}"
|
|
|
- :zoom="true"
|
|
|
+ :zoom="{
|
|
|
+ maxRatio: 10,
|
|
|
+ minRatio: 1,
|
|
|
+ }"
|
|
|
class="mySwiper"
|
|
|
:modules="modules"
|
|
|
:slides-per-view="1"
|
|
@@ -17,7 +21,9 @@
|
|
|
v-for="(item, index) in currentTag.imageTextInfo.imageList"
|
|
|
:key="index"
|
|
|
>
|
|
|
- <img :src="item.ossPath" />
|
|
|
+ <div class="swiper-zoom-container">
|
|
|
+ <img :src="item.ossPath" />
|
|
|
+ </div>
|
|
|
</swiper-slide>
|
|
|
</Swiper>
|
|
|
<div class="audio-control" v-if="hasAudio">
|
|
@@ -56,9 +62,11 @@ import {
|
|
|
import { useStore } from "vuex";
|
|
|
import { useI18n, getLocale } from "@/i18n";
|
|
|
import { Swiper, SwiperSlide } from "swiper/vue";
|
|
|
-import { Pagination, Navigation } from "swiper";
|
|
|
+import { Pagination, Navigation, Zoom } from "swiper";
|
|
|
// Import Swiper styles
|
|
|
import "swiper/css";
|
|
|
+import "swiper/css/zoom";
|
|
|
+
|
|
|
// import "swiper/swiper.scss";
|
|
|
// swiper-bundle.min.css 决定了小圆点和左右翻页标签,如果不需要可以不引用
|
|
|
|
|
@@ -67,12 +75,18 @@ const { t } = useI18n({ useScope: "global" });
|
|
|
|
|
|
const currentTag = computed(() => store.getters["tags/currentTag"]);
|
|
|
|
|
|
-const modules = ref([Pagination, Navigation]);
|
|
|
+const modules = ref([Pagination, Navigation, Zoom]);
|
|
|
const hasAudio = computed(
|
|
|
() =>
|
|
|
currentTag.value.imageTextInfo.audio.ossPath &&
|
|
|
currentTag.value.imageTextInfo.audio.ossPath.length > 0
|
|
|
);
|
|
|
+const hasImages = computed(
|
|
|
+ () =>
|
|
|
+ currentTag.value.imageTextInfo.imageList &&
|
|
|
+ currentTag.value.imageTextInfo.imageList.length > 0
|
|
|
+);
|
|
|
+// debugger
|
|
|
const time = ref("00:00");
|
|
|
const audioAllTime = ref("00:00");
|
|
|
const isPlaying = ref(false);
|
|
@@ -92,8 +106,17 @@ function transTime(time) {
|
|
|
}
|
|
|
return minute + isM0 + sec;
|
|
|
}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
const audio = document.querySelector("#audioTag");
|
|
|
+ watchEffect(() => {
|
|
|
+ if (!unref(hasImages)) {
|
|
|
+ const audioControl = document.querySelector(".audio-control");
|
|
|
+ console.log("audioControl", audioControl);
|
|
|
+ audioControl.style.left = "50%";
|
|
|
+ audioControl.style.transform = "translateX(-50%)";
|
|
|
+ }
|
|
|
+ });
|
|
|
nextTick(() => {
|
|
|
if (unref(hasAudio)) {
|
|
|
audio.addEventListener("durationchange", (e) => {
|
|
@@ -137,13 +160,16 @@ const pauseAudio = () => {
|
|
|
audio && audio.pause();
|
|
|
};
|
|
|
onUnmounted(() => {
|
|
|
+ const audio = document.querySelector("#audioTag");
|
|
|
+ if (audio) {
|
|
|
+ }
|
|
|
pauseAudio();
|
|
|
});
|
|
|
|
|
|
function handlePageRender(_, el) {
|
|
|
if (unref(hasAudio)) {
|
|
|
- el.style.left = "20%";
|
|
|
- el.style.transform = "translateX(-20%)";
|
|
|
+ el.style.left = "20px";
|
|
|
+ el.style.transform = "translateX(0)";
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -176,18 +202,22 @@ function handlePageRender(_, el) {
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
-
|
|
|
- .swiper-slide img {
|
|
|
- display: block;
|
|
|
+ .swiper-slide .swiper-zoom-container img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
object-fit: contain;
|
|
|
}
|
|
|
+ // .swiper-slide .main-img {
|
|
|
+ // // display: block;
|
|
|
+ // width: 100%;
|
|
|
+ // height: 100%;
|
|
|
+ // object-fit: contain;
|
|
|
+ // }
|
|
|
|
|
|
.audio-control {
|
|
|
position: absolute;
|
|
|
z-index: 10000;
|
|
|
- bottom: 50px;
|
|
|
+ bottom: 20px;
|
|
|
border-radius: 8px;
|
|
|
background: rgba(0, 0, 0, 0.6);
|
|
|
width: 122px;
|
|
@@ -196,8 +226,9 @@ function handlePageRender(_, el) {
|
|
|
background: rgba(0, 0, 0, 0.4);
|
|
|
opacity: 1;
|
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
|
- left: 75%;
|
|
|
- transform: translateX(-75%);
|
|
|
+ // left: 75%;
|
|
|
+ right: 20px;
|
|
|
+ // transform: translateX(-75%);
|
|
|
line-height: 32px;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
@@ -250,7 +281,10 @@ function handlePageRender(_, el) {
|
|
|
border-radius: 15px;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
- bottom: 50px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ bottom: 20px;
|
|
|
.swiper-pagination-total {
|
|
|
color: #858586;
|
|
|
}
|