"use client" import { useState, useEffect } from "react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { ArrowLeft, Download, Mail, Share2, Users, MessageCircle, BarChart2, PieChart } from "lucide-react" import { useRouter } from "next/navigation" import { Badge } from "@/components/ui/badge" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" interface AnalysisReport { id: string name: string wechatId: string deviceName: string createdAt: string completedAt: string keywords: string[] promptWords: string[] type: "friends" | "moments" | "both" summary: string friendsAnalysis: { totalFriends: number matchedFriends: number categories: { name: string count: number percentage: number }[] demographics: { gender: { male: number; female: number; unknown: number } ageGroups: { [key: string]: number } regions: { [key: string]: number } } } momentsAnalysis: { totalPosts: number analyzedPosts: number topTopics: { topic: string; count: number }[] sentiment: { positive: number; neutral: number; negative: number } activityTrend: { month: string; count: number }[] } } export default function AnalysisReportPage({ params }: { params: { id: string } }) { const router = useRouter() const [report, setReport] = useState(null) const [isLoading, setIsLoading] = useState(true) useEffect(() => { // 模拟加载报告数据 const fetchReport = async () => { await new Promise((resolve) => setTimeout(resolve, 1500)) const mockReport: AnalysisReport = { id: params.id, name: "美妆用户分析", wechatId: "wxid_abc123", deviceName: "设备1", createdAt: "2023-12-15T10:30:00Z", completedAt: "2023-12-15T11:45:00Z", keywords: ["美妆", "护肤", "彩妆"], promptWords: ["人群属性", "喜好分析", "消费能力"], type: "both", summary: "该微信账号的好友中有约32%与美妆相关,主要集中在25-34岁的女性用户,地域分布以一线城市为主。朋友圈内容分析显示,美妆相关话题互动率较高,用户对高端护肤品牌表现出较强的兴趣,消费能力中上。建议针对这部分用户推送高端护肤品和彩妆新品信息,重点关注节假日促销活动的反馈。", friendsAnalysis: { totalFriends: 287, matchedFriends: 92, categories: [ { name: "美妆爱好者", count: 48, percentage: 52 }, { name: "偶尔关注", count: 31, percentage: 34 }, { name: "专业人士", count: 13, percentage: 14 }, ], demographics: { gender: { male: 12, female: 76, unknown: 4 }, ageGroups: { "18-24": 15, "25-34": 53, "35-44": 19, "45+": 5 }, regions: { 北京: 21, 上海: 18, 广州: 14, 深圳: 12, 其他: 27 }, }, }, momentsAnalysis: { totalPosts: 1240, analyzedPosts: 850, topTopics: [ { topic: "护肤品", count: 127 }, { topic: "彩妆", count: 98 }, { topic: "美容仪器", count: 76 }, { topic: "品牌活动", count: 65 }, { topic: "新品上市", count: 52 }, ], sentiment: { positive: 68, neutral: 27, negative: 5 }, activityTrend: [ { month: "7月", count: 78 }, { month: "8月", count: 92 }, { month: "9月", count: 85 }, { month: "10月", count: 110 }, { month: "11月", count: 125 }, { month: "12月", count: 142 }, ], }, } setReport(mockReport) setIsLoading(false) } fetchReport() }, [params.id]) const getTypeLabel = (type: string) => { switch (type) { case "friends": return "好友信息分析" case "moments": return "朋友圈内容分析" case "both": return "综合分析" default: return "未知类型" } } return (
{/* 头部 */}

分析报告

{/* 主内容区域 */}
{isLoading ? (
) : report ? (
{/* 报告头部 */}
{report.name}

{new Date(report.completedAt).toLocaleString()} 完成

{getTypeLabel(report.type)}

分析好友

{report.friendsAnalysis.matchedFriends} / {report.friendsAnalysis.totalFriends}

分析朋友圈

{report.momentsAnalysis.analyzedPosts} / {report.momentsAnalysis.totalPosts}

关键词

{report.keywords.map((keyword, index) => ( {keyword} ))}

分析摘要

{report.summary}

{/* 详细分析 */} 好友分析 朋友圈分析 好友分类分析

好友分类

{report.friendsAnalysis.categories.map((category, index) => (
{category.name} {category.count} ({category.percentage}%)
))}

性别分布

女性
{report.friendsAnalysis.demographics.gender.female} ( {Math.round( (report.friendsAnalysis.demographics.gender.female / report.friendsAnalysis.matchedFriends) * 100, )} %)
男性
{report.friendsAnalysis.demographics.gender.male} ( {Math.round( (report.friendsAnalysis.demographics.gender.male / report.friendsAnalysis.matchedFriends) * 100, )} %)
未知
{report.friendsAnalysis.demographics.gender.unknown} ( {Math.round( (report.friendsAnalysis.demographics.gender.unknown / report.friendsAnalysis.matchedFriends) * 100, )} %)

年龄分布

{Object.entries(report.friendsAnalysis.demographics.ageGroups).map(([age, count], index) => (
{age}岁 {count} ({Math.round((count / report.friendsAnalysis.matchedFriends) * 100)}%)
))}

地域分布

{Object.entries(report.friendsAnalysis.demographics.regions).map(([region, count], index) => (
{region} {count} ({Math.round((count / report.friendsAnalysis.matchedFriends) * 100)}%)
))}
朋友圈内容分析

热门话题

{report.momentsAnalysis.topTopics.map((topic, index) => (
{topic.topic} {topic.count} 次提及
))}

情感分析

积极
{report.momentsAnalysis.sentiment.positive}%
中性
{report.momentsAnalysis.sentiment.neutral}%
消极
{report.momentsAnalysis.sentiment.negative}%

活跃度趋势

{report.momentsAnalysis.activityTrend.map((item, index) => (
i.count))) * 180)}px`, }} >
{item.month}
))}
AI 洞察

用户兴趣洞察

根据朋友圈内容分析,该用户对高端护肤品牌表现出较强的兴趣,尤其关注新品上市和限时促销活动。用户经常分享美容心得和产品使用体验,互动率较高的内容多与护肤品和彩妆相关。

消费能力分析

用户消费能力属于中上水平,对高端美妆品牌有明显偏好。朋友圈中提及的产品价格区间多在300-1000元,节假日期间有较高的购买意愿和分享欲望。

社交特征分析

用户社交活跃度高,朋友圈更新频率平均为每周3-4次。内容多以分享生活、美妆心得为主,互动性强,对评论和点赞有较高的回应率。用户倾向于在晚间19:00-22:00发布内容,周末活跃度高于工作日。

) : (

未找到报告数据

)}
) }