fix: HEIC上传修复 + 去掉保存按钮改为自动保存
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 56s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 56s
- HEIC检测兼容MIME type和文件名 - heic2any返回数组时取第一个 - 转换失败时提示用户手动转JPG - 去掉保存品牌按钮,显示"所有修改自动保存" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -199,7 +199,7 @@
|
||||
</div>
|
||||
|
||||
<div style="display:flex;gap:8px;align-items:center">
|
||||
<button class="btn btn-primary" @click="saveBrandSettings">💾 保存品牌设置</button>
|
||||
<span class="auto-save-hint">所有修改自动保存</span>
|
||||
<button v-if="returnRecipeId" class="btn btn-outline" @click="goBackToRecipe">← 返回配方卡片</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user