Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat: 优化LivePhoto处理逻辑,增加视频预加载和错feat: 改进LivePhoto视频播放逻辑,增加预加载和错误重试机制;优化状态指示器样式和上传队列管理,统一状态颜色

cuijianzhuange4e9d52e763f
diff --git a/app/components/photo/LivePhotoIndicator.vue b/app/components/photo/LivePhotoIndicator.vue
index 2a2883e0..7a290c74 100644
--- a/app/components/photo/LivePhotoIndicator.vue
+++ b/app/components/photo/LivePhotoIndicator.vue
@@ -43,18 +43,18 @@ const displayText = computed(() => {
return '实况'
})
-// 计算颜色样式 - 更贴近iOS原生设计
+// 计算颜色样式 - 恢复丰富的状态样式
const colorClass = computed(() => {
switch (indicatorState.value) {
case 'playing':
- return 'text-white bg-black/30 border-white/40 shadow-lg'
+ return 'text-white bg-white/20 border-white/30'
case 'processing':
- return 'text-blue-300 bg-black/40 border-blue-300/50 shadow-lg'
+ return 'text-blue-300 bg-blue-300/20 border-blue-300/30'
case 'error':
- return 'text-red-300 bg-black/40 border-red-300/50 shadow-lg'
+ return 'text-red-300 bg-red-300/20 border-red-300/30'
case 'ready':
default:
- return 'text-white bg-black/30 border-white/30 shadow-md'
+ return 'text-white bg-black/40 border-white/20'
}
})
</script>
@@ -62,68 +62,195 @@ const colorClass = computed(() => {
<template>
<motion.div
v-if="photo.isLivePhoto"
- class="relative backdrop-blur-lg rounded-full px-2 py-1 text-[12px] font-medium flex items-center gap-1 leading-none select-none border-0 transition-all duration-300 overflow-hidden"
+ class="relative backdrop-blur-md rounded-full pl-1 pr-1.5 py-1 text-[13px] font-bold flex items-center gap-0.5 leading-0 select-none border transition-all duration-300 overflow-hidden"
:class="colorClass"
:animate="{
- scale: isVideoPlaying ? 1.05 : indicatorState === 'processing' ? 1.02 : 1,
- opacity: isVideoPlaying ? 0.95 : 1,
+ scale: isVideoPlaying ? 1.08 : indicatorState === 'processing' ? 1.02 : 1,
+ rotate: indicatorState === 'error' ? [0, -2, 2, 0] : 0,
}"
:transition="{
- duration: 0.2,
- ease: 'easeOut',
+ duration: indicatorState === 'error' ? 0.5 : 0.3,
+ ease: indicatorState === 'error' ? 'easeInOut' : 'easeOut',
}"
>
- <!-- 简洁的播放状态光效 -->
+ <!-- 背景光效 -->
<motion.div
v-if="isVideoPlaying"
- class="absolute inset-0 rounded-full bg-white/10"
+ class="absolute inset-0 rounded-full"
:animate="{
- opacity: [0.3, 0.1, 0.3]
+ background: [
+ 'radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%)',
+ 'radial-gradient(circle at center, rgba(255, 255, 255, 0.4) 0%, transparent 70%)',
+ 'radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%)'
+ ]
}"
- :transition="{ duration: 2, repeat: Infinity, ease: 'easeInOut' }"
+ :transition="{ duration: 1.5, repeat: Infinity }"
+ />
+
+ <!-- 处理中的流光效果 -->
+ <motion.div
+ v-if="processingState?.isProcessing"
+ class="absolute inset-0 rounded-full"
+ :animate="{
+ background: [
+ 'linear-gradient(45deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%)',
+ 'linear-gradient(135deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%)',
+ 'linear-gradient(225deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%)',
+ 'linear-gradient(315deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%)'
+ ]
+ }"
+ :transition="{ duration: 2, repeat: Infinity, ease: 'linear' }"
+ />
+
+ <!-- 错误状态的警告效果 -->
+ <motion.div
+ v-if="processingState?.error"
+ class="absolute inset-0 rounded-full"
+ :animate="{
+ background: [
+ 'rgba(239, 68, 68, 0.2)',
+ 'rgba(239, 68, 68, 0.4)',
+ 'rgba(239, 68, 68, 0.2)'
+ ]
+ }"
+ :transition="{ duration: 0.8, repeat: Infinity }"
/>
- <!-- 内容区域 - 简化设计 -->
- <div class="relative z-10 flex items-center gap-1">
- <!-- 简化的图标显示 -->
+ <!-- 内容区域 -->
+ <div class="relative z-10 flex items-center gap-0.5">
+ <!-- 处理中状态 -->
<motion.div
- class="size-[14px] relative flex items-center justify-center"
- :animate="{
- rotate: processingState?.isProcessing ? 360 : 0,
+ v-if="processingState?.isProcessing"
+ class="size-[17px] relative"
+ :animate="{
+ rotate: 360,
+ scale: [1, 1.1, 1]
}"
- :transition="{
- duration: processingState?.isProcessing ? 1 : 0.2,
- repeat: processingState?.isProcessing ? Infinity : 0,
- ease: 'linear'
+ :transition="{
+ rotate: { duration: 1.5, repeat: Infinity, ease: 'linear' },
+ scale: { duration: 2, repeat: Infinity, ease: 'easeInOut' }
}"
>
- <!-- 处理中状态 -->
<Icon
- v-if="processingState?.isProcessing"
- name="tabler:loader-2"
- class="size-[14px]"
+ name="tabler:loader"
+ class="size-[17px] drop-shadow-sm"
/>
-
- <!-- 错误状态 -->
+ <!-- 处理进度环 -->
<motion.div
- v-else-if="processingState?.error"
- :animate="{ scale: [1, 1.1, 1] }"
- :transition="{ duration: 1, repeat: Infinity }"
- >
- <Icon
- name="tabler:exclamation-mark"
- class="size-[14px]"
- />
- </motion.div>
-
- <!-- 播放中/正常状态 - 统一使用实况图标 -->
+ class="absolute inset-0 rounded-full border-2 border-transparent border-t-blue-300"
+ :animate="{ rotate: -360 }"
+ :transition="{ duration: 1, repeat: Infinity, ease: 'linear' }"
+ />
+ </motion.div>
+
+ <!-- 错误状态 -->
+ <motion.div
+ v-else-if="processingState?.error"
+ class="size-[17px] relative"
+ :animate="{
+ scale: [1, 1.2, 1],
+ rotate: [0, -5, 5, 0]
+ }"
+ :transition="{
+ duration: 0.8,
+ repeat: Infinity,
+ ease: 'easeInOut'
+ }"
+ >
<Icon
- v-else
- name="tabler:live-photo"
- class="size-[14px]"
- :class="{ 'opacity-90': isVideoPlaying }"
+ name="tabler:alert-triangle"
+ class="size-[17px] drop-shadow-sm"
+ />
+ <!-- 错误脉冲效果 -->
+ <motion.div
+ class="absolute inset-0 rounded-full border border-red-300"
+ :animate="{
+ scale: [1, 1.5],
+ opacity: [0.5, 0]
+ }"
+ :transition="{
+ duration: 1,
+ repeat: Infinity,
+ ease: 'easeOut'
+ }"
/>
</motion.div>
+ <!-- 播放中状态 -->
+ <motion.div
+ v-else-if="isVideoPlaying"
+ class="size-[17px] relative"
+ :animate="{
+ scale: [1, 1.15, 1],
+ rotate: [0, 2, -2, 0]
+ }"
+ :transition="{
+ duration: 1.2,
+ repeat: Infinity,
+ ease: 'easeInOut'
+ }"
+ >
+ <Icon
+ name="tabler:play"
+ class="size-[17px] drop-shadow-lg"
+ />
+ <!-- 播放波纹效果 -->
+ <motion.div
+ class="absolute inset-0 rounded-full border border-white/50"
+ :animate="{
+ scale: [1, 1.8],
+ opacity: [0.6, 0]
+ }"
+ :transition="{
+ duration: 1.5,
+ repeat: Infinity,
+ ease: 'easeOut'
+ }"
+ />
+ <!-- 第二层波纹 -->
+ <motion.div
+ class="absolute inset-0 rounded-full border border-white/30"
+ :animate="{
+ scale: [1, 2.2],
+ opacity: [0.3, 0]
+ }"
+ :transition="{
+ duration: 1.5,
+ repeat: Infinity,
+ ease: 'easeOut',
+ delay: 0.3
+ }"
+ />
+ </motion.div>
+
+ <!-- 正常状态 -->
+ <motion.div
+ v-else
+ class="size-[17px] relative"
+ :whileHover="{
+ scale: 1.1,
+ rotate: [0, -2, 2, 0]
+ }"
+ :transition="{ duration: 0.3 }"
+ >
+ <Icon
+ name="tabler:live-photo"
+ class="size-[17px] drop-shadow-sm"
+ />
+ <!-- 待机呼吸效果 -->
+ <motion.div
+ class="absolute inset-0 rounded-full border border-white/30"
+ :animate="{
+ scale: [1, 1.3],
+ opacity: [0, 0.3, 0]
+ }"
+ :transition="{
+ duration: 3,
+ repeat: Infinity,
+ ease: 'easeInOut'
+ }"
+ />
+ </motion.div>
+
<span class="truncate">{{ displayText }}</span>
</div>