已发生产环境

This commit is contained in:
梁泽军 2025-03-17 09:29:46 +08:00
parent 74b2d4db5e
commit 8c78ec3c01
3 changed files with 129 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

View File

@ -1,5 +1,5 @@
<template>
<div class="IndexPage">
<div class="IndexPage" @click.once="playMusic">
<div class="index-title">
<div class="title-flower"></div>
</div>
@ -51,17 +51,20 @@
<div class="click-tips" v-if="locationId == 0"></div>
<div class="tips-text" v-if="locationId == 0"></div>
<!-- 背景音乐 -->
<div class="music_icon" @click="musicIconPlay">
<audio style="display: none; height: 0" id="bg-music" autoplay="autoplay" preload="auto" :src="bgm"
loop="loop"></audio>
</div>
</div>
<div class="video-popup" @touchmove.prevent>
<div class="video-box">
<video class="plyr" id="player" controls>
<source src="https://cdn.plyr.io/static/our-video.mp4" type="video/mp4">
<!-- 你可以根据需要添加多个source标签支持不同的视频格式 -->
</video>
</div>
<div class="cls-btn" @click="hideVideo"></div>
</div>
<!-- <Line /> -->
</template>
<script setup>
@ -70,10 +73,9 @@ import Plyr from 'plyr';
import 'plyr/dist/plyr.css'; // Plyr
import ImageFramePlayer from 'image-frame-player';
import { showSuccessToast } from "vant";
import Line from './Line.vue';
import { gsap } from 'gsap'
import { MotionPathPlugin } from 'gsap/MotionPathPlugin'
import { isAndriod } from "@/plugins"
gsap.registerPlugin(MotionPathPlugin)
@ -91,6 +93,10 @@ const xflIconRef = ref(null)
const currentProgress = ref(0) //
const debounce = ref(true)
let animation = null
const firstClick = ref(true)
const isCloseMusic = ref(false)
const bgm = new URL(`../assets/media/bgm.mp3`, import.meta.url).href
//
const videoList = [
@ -107,6 +113,7 @@ const frameList = Array.from({ length: 35 }, (_, index) => {
});
onMounted(() => {
iosMusic()
initSvgAnimation()
animationFn();
// palyFrame()
@ -117,7 +124,7 @@ onMounted(() => {
fallback: true, // 退
iosNative: true, // iOS
},
autoplay: true, //
autoplay: false, //
mute: false, //
loop: { //
active: false
@ -126,36 +133,24 @@ onMounted(() => {
})
//
// const palyFrame = () => {
// imageFramePlayer.value = new ImageFramePlayer({
// dom: document.getElementById("frameBox"),
// imgArr: frameList,
// fps: 25,
// useCanvas: true,
// loop: -1,
// yoyo: true
// });
// imageFramePlayer.value.play();
// };
//
const playFn = (index) => {
if (firstClick.value) return
if (debounce.value) return
debounce.value = true
if (locationId.value == 0) {
if(!isCloseMusic.value) pauseMusic()
gsap.set('.xfl-icon', { autoAlpha: 1 })
}
if (locationId.value !== index) {
//
const setpNum = Math.abs(index - locationId.value)
const direction = index - locationId.value > 0 ? 1 : -1
console.log('setpNum', setpNum);
locationId.value = index;
if(!isCloseMusic.value) pauseMusic()
playerRef.value.source = {
type: 'video',
sources: [
@ -165,23 +160,35 @@ const playFn = (index) => {
}
]
};
playerRef.value.pause();
console.log('playerRef.value', playerRef.value);
handleMove(progressArr[index - 1], setpNum, direction)
} else {
locationId.value = index
playerRef.value.source = {
type: 'video',
sources: [
{
src: videoList[locationId.value - 1],
type: 'video/mp4'
}
]
};
gsap.to(".video-popup", {
autoAlpha: 1,
duration: 0.3,
onComplete: () => {
debounce.value = false
playerRef.value.source = {
type: 'video',
sources: [
{
src: videoList[locationId.value - 1],
type: 'video/mp4'
}
]
};
playerRef.value.play()
},
onStart: () => {
pauseMusic()
}
});
@ -189,15 +196,17 @@ const playFn = (index) => {
}
//
const hideVideo = () => {
// playerRef.value.fullscreen.enter();
playerRef.value.stop();
gsap.to(".video-popup", {
autoAlpha: 0,
duration: 0.5
duration: 0.5, onComplete: () => {
if(!isCloseMusic.value) musicPlay()
}
});
if (isDone.value && !isShowDone.value) {
@ -205,9 +214,6 @@ const hideVideo = () => {
isShowDone.value = true
}
}
//
const convertCoordinates = (point) => {
const svg = document.querySelector('.path-svg')
@ -300,19 +306,28 @@ const handleMove = (percent, setpNum,) => {
console.log(`当前进度: ${currentProgress.value}%`)
//
isMarkList.value[locationId.value - 1] = true
gsap.to(".video-popup", {
autoAlpha: 1,
duration: 0.3,
onStart: () => {
},
onComplete: () => {
debounce.value = false
setTimeout(() => {
playerRef.value.play()
console.log('ssddd');
}, 500);
}
});
}
})
}
//
const animationFn = () => {
const tl = gsap.timeline({
@ -454,6 +469,74 @@ const animationFn = () => {
}
// ios
const musicBtnAni = gsap.timeline();
const playStatu = ref(true);
const musicPlay = () => {
let audio = document.getElementById("bg-music");
musicBtnAni.play();
audio.play();
};
const musicIconPlay = () => {
let audio = document.getElementById("bg-music");
musicBtnAni.play();
audio.play();
if (playStatu.value == true) {
musicBtnAni.pause();
audio.pause();
playStatu.value = false;
console.log("暂停");
isCloseMusic.value = true
} else {
musicBtnAni.play();
audio.play();
playStatu.value = true;
console.log("播放");
isCloseMusic.value = false
}
};
//
const pauseMusic = () => {
let audio = document.getElementById("bg-music");
audio.pause();
musicBtnAni.pause();
}
const iosMusic = () => {
// ios
var audio = document.getElementById("bg-music");
audio.play();
document.addEventListener(
"WeixinJSBridgeReady",
function () {
WeixinJSBridge.invoke("getNetworkType", {}, function (e) {
audio.play();
});
},
false
);
musicBtnAni.fromTo(
".music_icon",
{ rotation: "0" },
{ rotation: "+=360", repeat: -1, duration: 7, ease: "none" }
);
musicBtnAni.play();
};
const playMusic = () => {
var audio = document.getElementById("bg-music");
audio.play();
firstClick.value = false
};
</script>
@ -464,6 +547,12 @@ const animationFn = () => {
overflow: hidden;
position: relative;
.music_icon {
@include pos(50px, 50px, 73px, 100px);
@include bgSrc("index/music.png");
}
.index-title {
@include bgSrc("index/title.png");
@include pos(602px, 372px, 74px, -10px);