feat: 大量管理配方和搜索改进
- 存为我的:修复调用错误API,改用 diaryStore.createDiary - 存为我的:同名检测(我的配方 + 公共配方库) - 我的配方:使用 RecipeCard 统一卡片格式 - 管理配方:按钮缩小、编辑时隐藏智能粘贴、精油搜索框支持拼音跳转 - 管理配方:批量操作改为按钮组(打标签/删除/导出卡片/分享到公共库) - 管理配方:我的配方加勾选框、全选按钮、编辑功能 - 搜索:模糊匹配 + 同义词扩展(37组),精确/相似分层显示 - 搜索:无匹配时通知编辑添加,搜索时隐藏无匹配的收藏/我的配方区 - 搜索:配方按首字母排序 - 共享审核:通知高级编辑+管理员,我的配方显示共享状态 - 通知:搜索未收录→已添加按钮,审核类→去审核按钮跳转 - 贡献统计:非管理员显示已贡献公共配方数 - 登录弹窗:加反馈问题按钮(无需登录) - 精油编辑:右上角加保存按钮,支持回车保存 - 后端:新增 /api/me/contribution 接口 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,14 @@
|
||||
class="notif-item" :class="{ unread: !n.is_read }">
|
||||
<div class="notif-item-header">
|
||||
<div class="notif-title">{{ n.title }}</div>
|
||||
<button v-if="!n.is_read" class="notif-mark-one" @click="markOneRead(n)">已读</button>
|
||||
<div v-if="!n.is_read" class="notif-actions">
|
||||
<!-- 搜索未收录通知:已添加按钮 -->
|
||||
<button v-if="isSearchMissing(n)" class="notif-action-btn notif-btn-added" @click="markAdded(n)">已添加</button>
|
||||
<!-- 审核类通知:去审核按钮 -->
|
||||
<button v-else-if="isReviewable(n)" class="notif-action-btn notif-btn-review" @click="goReview(n)">去审核</button>
|
||||
<!-- 默认:已读按钮 -->
|
||||
<button v-else class="notif-mark-one" @click="markOneRead(n)">已读</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="n.body" class="notif-body">{{ n.body }}</div>
|
||||
<div class="notif-time">{{ formatTime(n.created_at) }}</div>
|
||||
@@ -108,6 +115,29 @@ async function submitBug() {
|
||||
}
|
||||
}
|
||||
|
||||
function isSearchMissing(n) {
|
||||
return n.title && n.title.includes('用户需求')
|
||||
}
|
||||
|
||||
function isReviewable(n) {
|
||||
if (!n.title) return false
|
||||
return n.title.includes('待审核') || n.title.includes('商业认证') || n.title.includes('申请')
|
||||
}
|
||||
|
||||
async function markAdded(n) {
|
||||
await markOneRead(n)
|
||||
}
|
||||
|
||||
function goReview(n) {
|
||||
markOneRead(n)
|
||||
emit('close')
|
||||
if (n.title.includes('配方')) {
|
||||
router.push('/manage')
|
||||
} else if (n.title.includes('商业认证') || n.title.includes('申请')) {
|
||||
router.push('/users')
|
||||
}
|
||||
}
|
||||
|
||||
async function markOneRead(n) {
|
||||
try {
|
||||
await api(`/api/notifications/${n.id}/read`, { method: 'POST', body: '{}' })
|
||||
@@ -209,6 +239,16 @@ onMounted(loadNotifications)
|
||||
font-family: inherit; white-space: nowrap; flex-shrink: 0;
|
||||
}
|
||||
.notif-mark-one:hover { background: #f0faf5; border-color: #7a9e7e; }
|
||||
.notif-actions { display: flex; gap: 4px; flex-shrink: 0; }
|
||||
.notif-action-btn {
|
||||
background: none; border: 1px solid #ccc; border-radius: 6px;
|
||||
font-size: 11px; cursor: pointer; padding: 2px 8px;
|
||||
font-family: inherit; white-space: nowrap;
|
||||
}
|
||||
.notif-btn-added { color: #4a9d7e; border-color: #7ec6a4; }
|
||||
.notif-btn-added:hover { background: #e8f5e9; }
|
||||
.notif-btn-review { color: #e65100; border-color: #ffb74d; }
|
||||
.notif-btn-review:hover { background: #fff3e0; }
|
||||
.notif-body { color: #888; font-size: 12px; margin-top: 2px; white-space: pre-line; }
|
||||
.notif-time { color: #bbb; font-size: 11px; margin-top: 2px; }
|
||||
.notif-empty { text-align: center; color: #ccc; padding: 16px; font-size: 13px; }
|
||||
|
||||
Reference in New Issue
Block a user