diff --git a/components/CoupletDisplay.vue b/components/CoupletDisplay.vue
index 81d1c59..851564e 100644
--- a/components/CoupletDisplay.vue
+++ b/components/CoupletDisplay.vue
@@ -12,7 +12,7 @@
海报加载中...
{
+ if (!imageUrl) {
+ base64Image.value = ''
+ isLoading.value = false
+ return
+ }
+
+ isLoading.value = true
+
+ const img = new Image()
+ img.crossOrigin = 'Anonymous' // 解决跨域问题
+
+ img.onload = () => {
+ const canvas = document.createElement('canvas')
+ canvas.width = img.width
+ canvas.height = img.height
+
+ const ctx = canvas.getContext('2d')
+ ctx.drawImage(img, 0, 0)
+
+ // 将canvas转换为base64
+ base64Image.value = canvas.toDataURL('image/jpeg', 0.9)
+ isLoading.value = false
+ }
+
+ img.onerror = () => {
+ console.error('图片加载失败:', imageUrl)
+ base64Image.value = ''
+ isLoading.value = false
+ }
+
+ img.src = imageUrl
+}
// 监听couplet变化,重新开始加载
watch(() => props.couplet?.image_url, (newImageUrl) => {
if (newImageUrl) {
- isLoading.value = true
+ convertImageToBase64(newImageUrl)
}
})
// 监听visible变化,当显示时重置加载状态
watch(() => props.visible, (newVisible) => {
if (newVisible && props.couplet?.image_url) {
- isLoading.value = true
+ convertImageToBase64(props.couplet.image_url)
}
})
+
+// 组件挂载时初始化
+if (props.couplet?.image_url) {
+ convertImageToBase64(props.couplet.image_url)
+}
diff --git a/components/SinglePageContainer.vue b/components/SinglePageContainer.vue
index 787c503..77a8ce9 100644
--- a/components/SinglePageContainer.vue
+++ b/components/SinglePageContainer.vue
@@ -1204,36 +1204,15 @@ onUnmounted(() => {
transform: scale(1);
}
-.scroll-tip {
- position: absolute;
- bottom: 50px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- flex-direction: column;
- align-items: center;
- animation: bounce 1.5s infinite;
-}
-@keyframes bounce {
- 0%, 20%, 50%, 80%, 100% {
- transform: translateX(-50%) translateY(0);
- }
- 40% {
- transform: translateX(-50%) translateY(-20px);
- }
- 60% {
- transform: translateX(-50%) translateY(-10px);
- }
-}
/* 音乐控制按钮样式 */
.music-control {
position: fixed;
- top: 20px;
- right: 20px;
- width: 50px;
- height: 50px;
+ width: 40px;
+ height: 40px;
+ top: 10px;
+ right: 10px;
border-radius: 50%;
/* background-color: rgba(0, 0, 0, 0.3); */
display: flex;
@@ -1278,35 +1257,4 @@ onUnmounted(() => {
}
}
-/* 响应式设计 */
-@media (max-width: 480px) {
- .scene-title {
- font-size: 24px;
- }
-
- .scene-description {
- font-size: 14px;
- }
-
- .couplet-item {
- font-size: 20px;
- }
-
- .top-couplet, .bottom-couplet {
- margin-right: 20px;
- margin-left: 20px;
- }
-
- .music-control {
- width: 40px;
- height: 40px;
- top: 10px;
- right: 10px;
- }
-
- .music-icon {
- width: 24px;
- height: 24px;
- }
-}
\ No newline at end of file
diff --git a/static/loading/loading_bg.jpg b/static/loading/loading_bg.jpg
index 23136aa..ce37024 100644
Binary files a/static/loading/loading_bg.jpg and b/static/loading/loading_bg.jpg differ