From f9d13dbaf21fdde310331c7b0b94e89ec3504b1c Mon Sep 17 00:00:00 2001 From: km2025 Date: Tue, 27 Jan 2026 11:06:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20Video=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=20URL=20=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E5=8D=A0=E4=BD=8D=E5=9B=BE=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=8C=E6=9B=B4=E6=96=B0=20Device=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @share/components/Video.tsx | 13 ++++++++----- app/(tabs)/sync.tsx | 11 ++++++----- app/device.tsx | 8 ++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/@share/components/Video.tsx b/@share/components/Video.tsx index 7475872..7f74d40 100644 --- a/@share/components/Video.tsx +++ b/@share/components/Video.tsx @@ -62,8 +62,6 @@ const VideoBox = ({ return } - // 缓存未命中,进行网络请求 - setUrlFinal('') const webpUrl = await mp4ToWebpUrl({ videoUrl: url!, width, height: width }) // 只有当请求未被取消时才缓存和更新状态 @@ -85,6 +83,7 @@ const VideoBox = ({ } useEffect(() => { + // 每次url变化强制刷新 setUrlFinal('') if (!url) { return @@ -93,7 +92,11 @@ const VideoBox = ({ // 用于标记当前请求是否已过期 let cancelled = false - setRedirectUrl(() => cancelled, url!) + setTimeout(() => { + if (!cancelled) { + setRedirectUrl(() => cancelled, url) + } + }, 0) // 清理函数:当 url 变化或组件卸载时,标记当前请求为已取消 return () => { @@ -156,8 +159,8 @@ const VideoBox = ({ {/* 占位图层 - 加载完成后隐藏 */} {showPlaceholder && ( { - + onConnectToggle(device)} @@ -709,7 +709,7 @@ const GridItem = memo( } const imgShow = post.webpPreviewUrl || post.imageUrl - const placeholderSrc = post.coverUrl + const placeholderSrc = null // console.log('imgShow----------', imgShow) // 新数据使用webp 旧数据使用mp4 @@ -952,9 +952,10 @@ const TopCircleSection = observer( ) const GalleryRenderer = memo(({ selectedItem }: { selectedItem: any }) => { - const url = selectedItem?.webpHighPreviewUrl || selectedItem?.url || selectedItem?.imageUrl - const placeholderUrl = selectedItem?.coverUrl - console.log('GalleryRenderer--------------', selectedItem) + // 本地和线上都优先使用imageUrl, 本地上传一开始没有 url + const url = selectedItem?.webpHighPreviewUrl || selectedItem?.imageUrl || selectedItem?.url + const placeholderUrl = selectedItem?.webpPreviewUrl + // console.log('GalleryRenderer--------------', selectedItem) if (!url) return null diff --git a/app/device.tsx b/app/device.tsx index 9a3f99a..1a4e248 100644 --- a/app/device.tsx +++ b/app/device.tsx @@ -193,8 +193,6 @@ const Device = observer(() => { // ✅ 显示设备信息(名称、品牌、分辨率、电池电量、内存等) const renderDeviceInfo = () => { - const [width, height] = deviceInfo?.size?.split('x') || ['未知', '未知'] - return ( {/* 标题栏 */} @@ -209,7 +207,7 @@ const Device = observer(() => { {deviceInfo?.name && ( 设备名称 - {deviceInfo.name} + {deviceInfo.name} )} @@ -225,9 +223,7 @@ const Device = observer(() => { {deviceInfo?.size && ( 分辨率 - - {width} × {height} - + {deviceInfo?.size} )}