feat: 审核体系全面改造 — 多维度评分 + 卖点优先级 + AI 语义匹配 + 品牌方 AI 状态通知
后端: - 审核结果拆分为 4 个独立维度 (法规合规/平台规则/品牌安全/Brief匹配度) - 卖点优先级从 required:bool 改为三级 (core/recommended/reference) - AI 语义匹配卖点覆盖 + AI 整体 Brief 匹配度分析 - BriefMatchDetail 评分详情 (覆盖率+亮点+问题点) - min_selling_points 代理商可配置最少卖点数 + Alembic 迁移 - AI 语境复核过滤误报 - Brief AI 解析 + 规则 AI 解析 - AI 未配置/异常时通知品牌方 - 种子数据更新 (新格式审核结果+brief_match_detail) 前端: - 三端审核页面展示四维度评分卡片 - 卖点编辑改为三级优先级选择器 - BriefMatchDetail 展示 (覆盖率进度条+亮点+问题) - min_selling_points 配置 UI - AI 配置页未配置时静默处理 - 文件预览/下载/签名 URL 优化 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
0c59797d5b
commit
0ef7650c09
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import {
|
||||
@@ -20,6 +21,8 @@ import {
|
||||
MessageSquare
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { api } from '@/lib/api'
|
||||
import { USE_MOCK } from '@/contexts/AuthContext'
|
||||
|
||||
interface NavItem {
|
||||
icon: React.ElementType
|
||||
@@ -40,7 +43,7 @@ const agencyNavItems: NavItem[] = [
|
||||
{ icon: LayoutDashboard, label: '工作台', href: '/agency' },
|
||||
{ icon: Scan, label: '审核台', href: '/agency/review' },
|
||||
{ icon: MessageSquare, label: '申诉处理', href: '/agency/appeals' },
|
||||
{ icon: FileText, label: 'Brief 配置', href: '/agency/briefs' },
|
||||
{ icon: FileText, label: '任务配置', href: '/agency/briefs' },
|
||||
{ icon: Users, label: '达人管理', href: '/agency/creators' },
|
||||
{ icon: BarChart3, label: '数据报表', href: '/agency/reports' },
|
||||
{ icon: Bell, label: '消息中心', href: '/agency/messages' },
|
||||
@@ -66,22 +69,47 @@ interface SidebarProps {
|
||||
|
||||
export function Sidebar({ role = 'creator', aiServiceError = false }: SidebarProps) {
|
||||
const pathname = usePathname() || ''
|
||||
const [unreadCount, setUnreadCount] = useState(0)
|
||||
|
||||
// 根据 aiServiceError 动态设置 AI 配置的徽章
|
||||
const getBrandNavItems = (): NavItem[] => {
|
||||
return brandNavItems.map(item => {
|
||||
const fetchUnreadCount = useCallback(async () => {
|
||||
if (USE_MOCK) return
|
||||
try {
|
||||
const res = await api.getUnreadCount()
|
||||
setUnreadCount(res.count)
|
||||
} catch {
|
||||
// 忽略错误(未登录等)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
fetchUnreadCount()
|
||||
const timer = setInterval(fetchUnreadCount, 30000) // 每 30 秒轮询
|
||||
return () => clearInterval(timer)
|
||||
}, [fetchUnreadCount])
|
||||
|
||||
// 消息中心路径
|
||||
const messagesHref = `/${role}/messages`
|
||||
|
||||
// 根据 aiServiceError 和 unreadCount 动态设置徽章
|
||||
const applyBadges = (items: NavItem[]): NavItem[] => {
|
||||
return items.map(item => {
|
||||
if (item.href === '/brand/ai-config' && aiServiceError) {
|
||||
return { ...item, badge: 'warning' as const }
|
||||
}
|
||||
if (item.href === messagesHref && unreadCount > 0) {
|
||||
return { ...item, badge: 'dot' as const }
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
|
||||
const navItems = role === 'creator'
|
||||
const baseItems = role === 'creator'
|
||||
? creatorNavItems
|
||||
: role === 'agency'
|
||||
? agencyNavItems
|
||||
: getBrandNavItems()
|
||||
: brandNavItems
|
||||
|
||||
const navItems = applyBadges(baseItems)
|
||||
|
||||
const isActive = (href: string) => {
|
||||
if (href === `/${role}`) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { Button } from './Button'
|
||||
import { Modal } from './Modal'
|
||||
import { api } from '@/lib/api'
|
||||
|
||||
// 文件信息类型
|
||||
export interface FileInfo {
|
||||
@@ -98,20 +99,29 @@ export function FileInfoCard({
|
||||
}) {
|
||||
const category = getFileCategory(file)
|
||||
|
||||
const handleDownload = () => {
|
||||
const handleDownload = async () => {
|
||||
if (onDownload) {
|
||||
onDownload()
|
||||
} else {
|
||||
// 默认下载行为
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
try {
|
||||
await api.downloadFile(file.fileUrl, file.fileName)
|
||||
} catch {
|
||||
// 回退到直接链接下载
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleOpenInNewTab = () => {
|
||||
window.open(file.fileUrl, '_blank')
|
||||
const handleOpenInNewTab = async () => {
|
||||
try {
|
||||
const blobUrl = await api.getPreviewUrl(file.fileUrl)
|
||||
window.open(blobUrl, '_blank')
|
||||
} catch {
|
||||
window.open(file.fileUrl, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -300,15 +310,26 @@ export function DocumentPlaceholder({
|
||||
该文件格式暂不支持在线预览
|
||||
</p>
|
||||
<div className="flex gap-2 justify-center">
|
||||
<Button variant="secondary" onClick={() => window.open(file.fileUrl, '_blank')}>
|
||||
<Button variant="secondary" onClick={async () => {
|
||||
try {
|
||||
const blobUrl = await api.getPreviewUrl(file.fileUrl)
|
||||
window.open(blobUrl, '_blank')
|
||||
} catch {
|
||||
window.open(file.fileUrl, '_blank')
|
||||
}
|
||||
}}>
|
||||
<ExternalLink size={16} />
|
||||
在新标签页打开
|
||||
</Button>
|
||||
<Button onClick={() => {
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
<Button onClick={async () => {
|
||||
try {
|
||||
await api.downloadFile(file.fileUrl, file.fileName)
|
||||
} catch {
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
}
|
||||
}}>
|
||||
<Download size={16} />
|
||||
下载文件
|
||||
@@ -380,15 +401,26 @@ export function FilePreviewModal({
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="secondary" onClick={() => window.open(file.fileUrl, '_blank')}>
|
||||
<Button variant="secondary" onClick={async () => {
|
||||
try {
|
||||
const blobUrl = await api.getPreviewUrl(file.fileUrl)
|
||||
window.open(blobUrl, '_blank')
|
||||
} catch {
|
||||
window.open(file.fileUrl, '_blank')
|
||||
}
|
||||
}}>
|
||||
<ExternalLink size={16} />
|
||||
新标签页打开
|
||||
</Button>
|
||||
<Button onClick={() => {
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
<Button onClick={async () => {
|
||||
try {
|
||||
await api.downloadFile(file.fileUrl, file.fileName)
|
||||
} catch {
|
||||
const link = document.createElement('a')
|
||||
link.href = file.fileUrl
|
||||
link.download = file.fileName
|
||||
link.click()
|
||||
}
|
||||
}}>
|
||||
<Download size={16} />
|
||||
下载
|
||||
|
||||
Reference in New Issue
Block a user