From 07a40977e14e3164ff2658914834923615075423 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Fri, 10 Apr 2026 17:29:15 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20HEIC=E4=B8=8A=E4=BC=A0=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20+=20=E5=8E=BB=E6=8E=89=E4=BF=9D=E5=AD=98=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - HEIC检测兼容MIME type和文件名 - heic2any返回数组时取第一个 - 转换失败时提示用户手动转JPG - 去掉保存品牌按钮,显示"所有修改自动保存" Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/views/MyDiary.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/MyDiary.vue b/frontend/src/views/MyDiary.vue index 9a3db5d..81b1599 100644 --- a/frontend/src/views/MyDiary.vue +++ b/frontend/src/views/MyDiary.vue @@ -199,7 +199,7 @@
- + 所有修改自动保存
@@ -577,11 +577,19 @@ async function handleUpload(type, event) { if (!file) return try { // Convert HEIC/HEIF to JPEG - if (file.name.toLowerCase().match(/\.hei[cf]$/)) { + const isHeic = file.name.toLowerCase().match(/\.hei[cf]$/) || + file.type === 'image/heic' || file.type === 'image/heif' + if (isHeic) { ui.showToast('正在转换HEIC格式...') - const heic2any = (await import('heic2any')).default - const blob = await heic2any({ blob: file, toType: 'image/jpeg', quality: 0.8 }) - file = new File([blob], file.name.replace(/\.hei[cf]$/i, '.jpg'), { type: 'image/jpeg' }) + try { + const heic2any = (await import('heic2any')).default + let blob = await heic2any({ blob: file, toType: 'image/jpeg', quality: 0.8 }) + if (Array.isArray(blob)) blob = blob[0] + file = new File([blob], 'photo.jpg', { type: 'image/jpeg' }) + } catch (e) { + ui.showToast('HEIC转换失败,请手动转为JPG后上传') + return + } } let base64 = await readFileAsBase64(file) @@ -1158,6 +1166,8 @@ async function applyBusiness() { margin-bottom: 12px; } +.auto-save-hint { font-size: 12px; color: #999; font-style: italic; } + .verified-badge { padding: 12px; background: #e8f5e9;