"use client" import { useState, useEffect } from "react" import { motion, AnimatePresence } from "framer-motion" interface MatchUser { id: string nickname: string avatar: string tags: string[] matchScore: number concept: string wechat: string commonInterests: Array<{ icon: string; text: string }> } export default function MatchPage() { const [isMatching, setIsMatching] = useState(false) const [currentMatch, setCurrentMatch] = useState(null) const [matchAttempts, setMatchAttempts] = useState(0) const startMatch = () => { setIsMatching(true) setMatchAttempts(0) setCurrentMatch(null) // 模拟匹配过程 const interval = setInterval(() => { setMatchAttempts((prev) => prev + 1) }, 1000) // 3-6秒后匹配成功 setTimeout(() => { clearInterval(interval) setIsMatching(false) setCurrentMatch(getMockMatch()) }, Math.random() * 3000 + 3000) } const getMockMatch = (): MatchUser => { const nicknames = ['阅读爱好者', '创业小白', '私域达人', '书虫一枚', '灵魂摆渡人'] const randomIndex = Math.floor(Math.random() * nicknames.length) const concepts = [ '一个坚持长期主义的私域玩家,擅长内容结构化。', '相信阅读可以改变人生,每天坚持读书1小时。', '在Soul上分享创业经验,希望帮助更多人少走弯路。' ] const wechats = [ 'soul_book_friend_1', 'soul_reader_2024', 'soul_party_fan' ] return { id: `user_${Date.now()}`, nickname: nicknames[randomIndex], avatar: `https://picsum.photos/200/200?random=${randomIndex}`, tags: ['创业者', '私域运营', 'MBTI-INTP'], matchScore: Math.floor(Math.random() * 20) + 80, concept: concepts[randomIndex % concepts.length], wechat: wechats[randomIndex % wechats.length], commonInterests: [ { icon: '📚', text: '都在读《创业实验》' }, { icon: '💼', text: '对私域运营感兴趣' }, { icon: '🎯', text: '相似的职业背景' } ] } } const nextMatch = () => { setCurrentMatch(null) setTimeout(() => startMatch(), 500) } const handleAddWechat = () => { if (!currentMatch) return // 复制微信号 navigator.clipboard.writeText(currentMatch.wechat).then(() => { alert(`微信号已复制:${currentMatch.wechat}\n\n请打开微信添加好友,备注"书友"即可。`) }).catch(() => { alert(`微信号:${currentMatch.wechat}\n\n请手动复制并添加好友。`) }) } const handleJoinGroup = () => { alert('请先添加书友微信,备注"书友群",对方会拉你入群。\n\n群内可以:\n· 深度交流读书心得\n· 参加线下读书会\n· 获取独家资源') } return (
{/* 星空背景 */}
{Array.from({ length: 100 }).map((_, i) => ( ))}
{/* 头部 */}

寻找合作伙伴

找到和你一起创业的灵魂

{/* 匹配状态区 */}
{!isMatching && !currentMatch && ( {/* 中央大星球 */}
🤝
开始匹配
寻找合作伙伴
{/* 匹配提示 */}
💼 共同的创业方向
💬 实时在线交流
🎯 相似的商业洞察
)} {isMatching && ( {/* 匹配动画 */} 🌍 {[1, 2, 3].map((ring) => ( ))}

正在寻找志同道合的书友...

已匹配 {matchAttempts} 次

)} {currentMatch && !isMatching && ( {/* 成功动画 */} {/* 用户卡片 */}
{currentMatch.nickname}

{currentMatch.nickname}

{currentMatch.tags.map((tag) => ( {tag} ))}
{currentMatch.matchScore}%
匹配度
{/* 共同兴趣 */}

共同兴趣

{currentMatch.commonInterests.map((interest, i) => (
{interest.icon} {interest.text}
))}
{/* 核心理念 */}

核心理念

{currentMatch.concept}

{/* 操作按钮 */}
)}
) }