|
@@ -70,15 +70,19 @@
|
|
|
|
|
|
|
|
<!-- 视频显示区域 -->
|
|
<!-- 视频显示区域 -->
|
|
|
<div v-if="currentDialogue && currentDialogue.type === 'video'" class="video-display">
|
|
<div v-if="currentDialogue && currentDialogue.type === 'video'" class="video-display">
|
|
|
- <video
|
|
|
|
|
- :src="currentDialogue.videoUrl"
|
|
|
|
|
- class="dialogue-video"
|
|
|
|
|
- controls
|
|
|
|
|
- autoplay
|
|
|
|
|
- @ended="handleVideoEnded"
|
|
|
|
|
- >
|
|
|
|
|
- 您的浏览器不支持视频播放
|
|
|
|
|
- </video>
|
|
|
|
|
|
|
+ <div class="video-frame">
|
|
|
|
|
+ <video
|
|
|
|
|
+ :src="currentDialogue.videoUrl"
|
|
|
|
|
+ class="dialogue-video"
|
|
|
|
|
+ controls
|
|
|
|
|
+ autoplay
|
|
|
|
|
+ @ended="handleVideoEnded"
|
|
|
|
|
+ @contextmenu.prevent
|
|
|
|
|
+ controlslist="nodownload"
|
|
|
|
|
+ >
|
|
|
|
|
+ 您的浏览器不支持视频播放
|
|
|
|
|
+ </video>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 用户输入卡片 -->
|
|
<!-- 用户输入卡片 -->
|
|
@@ -130,9 +134,21 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 背景图 -->
|
|
<!-- 背景图 -->
|
|
|
- <img v-if="currentBackgroundType === 'imageAudio'" :src="currentBackgroundImage" alt="背景图" class="background-image">
|
|
|
|
|
|
|
+ <img
|
|
|
|
|
+ v-if="currentBackgroundType === 'imageAudio'"
|
|
|
|
|
+ :src="currentBackgroundImage"
|
|
|
|
|
+ alt="背景图"
|
|
|
|
|
+ class="background-image"
|
|
|
|
|
+ >
|
|
|
<!-- 背景视频 -->
|
|
<!-- 背景视频 -->
|
|
|
- <video v-else-if="currentBackgroundType === 'video'" ref="backgroundVideoRef" :src="currentBackgroundVideo" class="background-video" loop muted playsinline>
|
|
|
|
|
|
|
+ <video
|
|
|
|
|
+ v-else-if="currentBackgroundType === 'video'"
|
|
|
|
|
+ ref="backgroundVideoRef"
|
|
|
|
|
+ :src="currentBackgroundVideo"
|
|
|
|
|
+ class="background-video"
|
|
|
|
|
+ loop
|
|
|
|
|
+ muted
|
|
|
|
|
+ playsinline>
|
|
|
您的浏览器不支持视频播放
|
|
您的浏览器不支持视频播放
|
|
|
</video>
|
|
</video>
|
|
|
</div>
|
|
</div>
|
|
@@ -225,6 +241,7 @@ const currentBackgroundImage = computed(() => {
|
|
|
return currentSection.value.backgroundImage.url
|
|
return currentSection.value.backgroundImage.url
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// 当前背景类型
|
|
// 当前背景类型
|
|
|
const currentBackgroundType = computed(() => {
|
|
const currentBackgroundType = computed(() => {
|
|
|
return currentSection.value?.backgroundType || 'imageAudio'
|
|
return currentSection.value?.backgroundType || 'imageAudio'
|
|
@@ -331,9 +348,6 @@ const stopAllAudio = () => {
|
|
|
dialogueAudio.value.pause()
|
|
dialogueAudio.value.pause()
|
|
|
dialogueAudio.value.currentTime = 0
|
|
dialogueAudio.value.currentTime = 0
|
|
|
}
|
|
}
|
|
|
- if (backgroundVideoRef.value) {
|
|
|
|
|
- backgroundVideoRef.value.pause()
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const playBackgroundAudio = () => {
|
|
const playBackgroundAudio = () => {
|
|
@@ -352,14 +366,11 @@ const playBackgroundAudio = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 处理背景视频
|
|
// 处理背景视频
|
|
|
- if (currentBackgroundType.value === 'video' && isPlaybackStarted.value && isPlaying.value) {
|
|
|
|
|
|
|
+ if (currentBackgroundType.value === 'video' && isPlaybackStarted.value) {
|
|
|
// 视频已经在模板中渲染,这里只需要确保它在播放状态
|
|
// 视频已经在模板中渲染,这里只需要确保它在播放状态
|
|
|
if (backgroundVideoRef.value) {
|
|
if (backgroundVideoRef.value) {
|
|
|
backgroundVideoRef.value.play().catch(e => console.error('背景视频播放失败:', e))
|
|
backgroundVideoRef.value.play().catch(e => console.error('背景视频播放失败:', e))
|
|
|
}
|
|
}
|
|
|
- } else if (backgroundVideoRef.value) {
|
|
|
|
|
- // 暂停视频
|
|
|
|
|
- backgroundVideoRef.value.pause()
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -458,16 +469,12 @@ const togglePlay = () => {
|
|
|
if (isPlaying.value) {
|
|
if (isPlaying.value) {
|
|
|
// 播放背景音
|
|
// 播放背景音
|
|
|
playBackgroundAudio()
|
|
playBackgroundAudio()
|
|
|
- // 继续播放背景视频
|
|
|
|
|
- if (backgroundVideoRef.value) {
|
|
|
|
|
- backgroundVideoRef.value.play().catch(e => console.error('背景视频播放失败:', e))
|
|
|
|
|
- }
|
|
|
|
|
if(!getIsPlaying() && !conversationInProgress.value){
|
|
if(!getIsPlaying() && !conversationInProgress.value){
|
|
|
// 开始播放序列
|
|
// 开始播放序列
|
|
|
playSequence()
|
|
playSequence()
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- // 暂停所有音频和视频
|
|
|
|
|
|
|
+ // 暂停所有音频
|
|
|
stopAllAudio()
|
|
stopAllAudio()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1889,7 +1896,6 @@ onUnmounted(() => {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
- //flex-direction: column;
|
|
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
transition: all 0.5s ease-in-out;
|
|
transition: all 0.5s ease-in-out;
|
|
|
}
|
|
}
|
|
@@ -1914,16 +1920,36 @@ onUnmounted(() => {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
top: 45%;
|
|
top: 45%;
|
|
|
left: 50%;
|
|
left: 50%;
|
|
|
- transform: translate(-50%, -50%);
|
|
|
|
|
|
|
+ transform: translate(-50%, -50%) scale(0.8);
|
|
|
z-index: 5;
|
|
z-index: 5;
|
|
|
- width: 65%;
|
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ opacity: 0;
|
|
|
|
|
+ animation: videoFadeIn 0.8s ease-out forwards;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.video-frame {
|
|
|
|
|
+ width: rpx(420);
|
|
|
|
|
+ height: rpx(250);
|
|
|
|
|
+ padding: rpx(5);
|
|
|
|
|
+ background: linear-gradient(135deg, rgba(160, 220, 240, 0.8), rgba(80, 190, 240, 0.8));
|
|
|
|
|
+ border: rpx(2) solid rgba(0, 100, 192, 0.8);
|
|
|
|
|
+ border-radius: rpx(15);
|
|
|
|
|
+ box-shadow: 0 rpx(8) rpx(25) rgba(0, 0, 0, 0.4);
|
|
|
|
|
+ backdrop-filter: blur(rpx(5));
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.dialogue-video {
|
|
.dialogue-video {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
border-radius: rpx(10);
|
|
border-radius: rpx(10);
|
|
|
- box-shadow: 0 rpx(5) rpx(15) rgba(0, 0, 0, 0.2);
|
|
|
|
|
|
|
+ background-color: #000;
|
|
|
|
|
+ object-fit: contain;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.poem-text::before {
|
|
.poem-text::before {
|
|
@@ -1933,7 +1959,6 @@ onUnmounted(() => {
|
|
|
left: 0;
|
|
left: 0;
|
|
|
right: 0;
|
|
right: 0;
|
|
|
bottom: 0;
|
|
bottom: 0;
|
|
|
- // background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
|
|
|
|
|
animation: poemShine 3s ease-in-out infinite;
|
|
animation: poemShine 3s ease-in-out infinite;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1959,14 +1984,6 @@ onUnmounted(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @keyframes poemShine {
|
|
|
|
|
-// 0% {
|
|
|
|
|
-// transform: translateX(-100%) rotate(45deg);
|
|
|
|
|
-// }
|
|
|
|
|
-// 100% {
|
|
|
|
|
-// transform: translateX(100%) rotate(45deg);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
.poem-text p {
|
|
.poem-text p {
|
|
|
margin: rpx(10) 0;
|
|
margin: rpx(10) 0;
|
|
@@ -2006,4 +2023,20 @@ onUnmounted(() => {
|
|
|
transform: translateY(0);
|
|
transform: translateY(0);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// 对话视频显示动画
|
|
|
|
|
+@keyframes videoFadeIn {
|
|
|
|
|
+ 0% {
|
|
|
|
|
+ opacity: 0;
|
|
|
|
|
+ transform: translate(-50%, -50%) scale(0.8);
|
|
|
|
|
+ }
|
|
|
|
|
+ 70% {
|
|
|
|
|
+ opacity: 1;
|
|
|
|
|
+ transform: translate(-50%, -50%) scale(1.05);
|
|
|
|
|
+ }
|
|
|
|
|
+ 100% {
|
|
|
|
|
+ opacity: 1;
|
|
|
|
|
+ transform: translate(-50%, -50%) scale(1);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|