feat: 新功能改进 #20

Merged
hera merged 57 commits from feat/next-improvements into main 2026-04-10 20:30:37 +00:00
2 changed files with 23 additions and 1 deletions
Showing only changes of commit b570ef5093 - Show all commits

View File

@@ -141,6 +141,9 @@ function isReviewable(n) {
}
async function markAdded(n) {
const { showConfirm: confirm } = await import('../composables/useDialog')
const ok = await confirm('确认已添加该配方?将通知其他编辑者和搜索用户。')
if (!ok) return
try {
await api(`/api/notifications/${n.id}/added`, { method: 'POST' })
n.is_read = 1

View File

@@ -996,7 +996,26 @@ async function saveCurrentRecipe() {
return
}
// New recipe: always save to diary (personal)
// New recipe: admin/senior_editor can choose public or personal
if (auth.canManage) {
const toPublic = await showConfirm('保存到哪里?', { okText: '公共配方库', cancelText: '个人配方' })
if (toPublic) {
try {
const pubPayload = {
name: formName.value.trim(),
ingredients: cleanIngs.map(i => ({ oil_name: i.oil, drops: i.drops })),
note: formNote.value,
tags: formTags.value,
}
await recipeStore.saveRecipe(pubPayload)
ui.showToast('已添加到公共配方库')
closeOverlay()
} catch (e) {
ui.showToast('保存失败: ' + (e.message || '未知错误'))
}
return
}
}
try {
await diaryStore.createDiary(diaryPayload)
ui.showToast('已添加到我的配方')