已发生产环境

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> <template>
<div class="IndexPage"> <div class="IndexPage" @click.once="playMusic">
<div class="index-title"> <div class="index-title">
<div class="title-flower"></div> <div class="title-flower"></div>
</div> </div>
@ -51,17 +51,20 @@
<div class="click-tips" v-if="locationId == 0"></div> <div class="click-tips" v-if="locationId == 0"></div>
<div class="tips-text" 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>
<div class="video-popup" @touchmove.prevent> <div class="video-popup" @touchmove.prevent>
<div class="video-box"> <div class="video-box">
<video class="plyr" id="player" controls> <video class="plyr" id="player" controls>
<source src="https://cdn.plyr.io/static/our-video.mp4" type="video/mp4"> <source src="https://cdn.plyr.io/static/our-video.mp4" type="video/mp4">
<!-- 你可以根据需要添加多个source标签支持不同的视频格式 -->
</video> </video>
</div> </div>
<div class="cls-btn" @click="hideVideo"></div> <div class="cls-btn" @click="hideVideo"></div>
</div> </div>
<!-- <Line /> -->
</template> </template>
<script setup> <script setup>
@ -70,10 +73,9 @@ import Plyr from 'plyr';
import 'plyr/dist/plyr.css'; // Plyr import 'plyr/dist/plyr.css'; // Plyr
import ImageFramePlayer from 'image-frame-player'; import ImageFramePlayer from 'image-frame-player';
import { showSuccessToast } from "vant"; import { showSuccessToast } from "vant";
import Line from './Line.vue';
import { gsap } from 'gsap' import { gsap } from 'gsap'
import { MotionPathPlugin } from 'gsap/MotionPathPlugin' import { MotionPathPlugin } from 'gsap/MotionPathPlugin'
import { isAndriod } from "@/plugins"
gsap.registerPlugin(MotionPathPlugin) gsap.registerPlugin(MotionPathPlugin)
@ -91,6 +93,10 @@ const xflIconRef = ref(null)
const currentProgress = ref(0) // const currentProgress = ref(0) //
const debounce = ref(true) const debounce = ref(true)
let animation = null 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 = [ const videoList = [
@ -107,6 +113,7 @@ const frameList = Array.from({ length: 35 }, (_, index) => {
}); });
onMounted(() => { onMounted(() => {
iosMusic()
initSvgAnimation() initSvgAnimation()
animationFn(); animationFn();
// palyFrame() // palyFrame()
@ -117,7 +124,7 @@ onMounted(() => {
fallback: true, // 退 fallback: true, // 退
iosNative: true, // iOS iosNative: true, // iOS
}, },
autoplay: true, // autoplay: false, //
mute: false, // mute: false, //
loop: { // loop: { //
active: false 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) => { const playFn = (index) => {
if (firstClick.value) return
if (debounce.value) return if (debounce.value) return
debounce.value = true debounce.value = true
if (locationId.value == 0) { if (locationId.value == 0) {
if(!isCloseMusic.value) pauseMusic()
gsap.set('.xfl-icon', { autoAlpha: 1 }) gsap.set('.xfl-icon', { autoAlpha: 1 })
} }
if (locationId.value !== index) { if (locationId.value !== index) {
// //
const setpNum = Math.abs(index - locationId.value) const setpNum = Math.abs(index - locationId.value)
const direction = index - locationId.value > 0 ? 1 : -1 const direction = index - locationId.value > 0 ? 1 : -1
console.log('setpNum', setpNum);
locationId.value = index; locationId.value = index;
if(!isCloseMusic.value) pauseMusic()
playerRef.value.source = { playerRef.value.source = {
type: 'video', type: 'video',
sources: [ sources: [
@ -165,23 +160,35 @@ const playFn = (index) => {
} }
] ]
}; };
playerRef.value.pause();
console.log('playerRef.value', playerRef.value);
handleMove(progressArr[index - 1], setpNum, direction) handleMove(progressArr[index - 1], setpNum, direction)
} else { } else {
locationId.value = index locationId.value = index
playerRef.value.source = {
type: 'video',
sources: [
{
src: videoList[locationId.value - 1],
type: 'video/mp4'
}
]
};
gsap.to(".video-popup", { gsap.to(".video-popup", {
autoAlpha: 1, autoAlpha: 1,
duration: 0.3, duration: 0.3,
onComplete: () => { onComplete: () => {
debounce.value = false 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 = () => { const hideVideo = () => {
// playerRef.value.fullscreen.enter(); // playerRef.value.fullscreen.enter();
playerRef.value.stop(); playerRef.value.stop();
gsap.to(".video-popup", { gsap.to(".video-popup", {
autoAlpha: 0, autoAlpha: 0,
duration: 0.5 duration: 0.5, onComplete: () => {
if(!isCloseMusic.value) musicPlay()
}
}); });
if (isDone.value && !isShowDone.value) { if (isDone.value && !isShowDone.value) {
@ -205,9 +214,6 @@ const hideVideo = () => {
isShowDone.value = true isShowDone.value = true
} }
} }
// //
const convertCoordinates = (point) => { const convertCoordinates = (point) => {
const svg = document.querySelector('.path-svg') const svg = document.querySelector('.path-svg')
@ -300,19 +306,28 @@ const handleMove = (percent, setpNum,) => {
console.log(`当前进度: ${currentProgress.value}%`) console.log(`当前进度: ${currentProgress.value}%`)
// //
isMarkList.value[locationId.value - 1] = true isMarkList.value[locationId.value - 1] = true
gsap.to(".video-popup", { gsap.to(".video-popup", {
autoAlpha: 1, autoAlpha: 1,
duration: 0.3, duration: 0.3,
onStart: () => {
},
onComplete: () => { onComplete: () => {
debounce.value = false debounce.value = false
setTimeout(() => {
playerRef.value.play()
console.log('ssddd');
}, 500);
} }
}); });
} }
}) })
} }
// //
const animationFn = () => { const animationFn = () => {
const tl = gsap.timeline({ 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> </script>
@ -464,6 +547,12 @@ const animationFn = () => {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
.music_icon {
@include pos(50px, 50px, 73px, 100px);
@include bgSrc("index/music.png");
}
.index-title { .index-title {
@include bgSrc("index/title.png"); @include bgSrc("index/title.png");
@include pos(602px, 372px, 74px, -10px); @include pos(602px, 372px, 74px, -10px);