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;