> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akria.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 第7组：ABC 架构 | ABC Architecture

> 测试你对三层架构中各层职责的理解

<a href="quiz" className="text-emerald-600 hover:underline text-sm">← 返回选单</a>

## 📝 词汇测验

export const QuizRunner = () => {
  const questions = [
    {
        "q": "'Crawl' 意为：",
        "o": [
            "跳跃",
            "爬取/抓取",
            "奔跑",
            "飞行"
        ],
        "a": "爬取/抓取",
        "h": "A 层数据采集方式。"
    },
    {
        "q": "'Manual' 意为：",
        "o": [
            "自动的",
            "手动的",
            "机械的",
            "电子的"
        ],
        "a": "手动的",
        "h": "依靠人工录入。"
    },
    {
        "q": "'Aggregate' 意为：",
        "o": [
            "分离",
            "聚合",
            "过滤",
            "转换"
        ],
        "a": "聚合",
        "h": "合并多个来源。"
    },
    {
        "q": "'Compose' 意为：",
        "o": [
            "分解",
            "组合/撰写",
            "删除",
            "复制"
        ],
        "a": "组合/撰写",
        "h": "把多个元素合为一体。"
    },
    {
        "q": "'Review' 指：",
        "o": [
            "预览",
            "审核/复查",
            "忽视",
            "执行"
        ],
        "a": "审核/复查",
        "h": "对候选信号进行确认。"
    },
    {
        "q": "'Approve' 意为：",
        "o": [
            "拒绝",
            "批准/通过",
            "讨论",
            "撤回"
        ],
        "a": "批准/通过",
        "h": "C 层审核通过。"
    },
    {
        "q": "'Reject' 意为：",
        "o": [
            "接受",
            "拒绝/驳回",
            "修改",
            "保留"
        ],
        "a": "拒绝/驳回",
        "h": "C 层审核未通过。"
    },
    {
        "q": "'Dispatching' 指：",
        "o": [
            "收集",
            "下发/分发中",
            "存储",
            "压缩"
        ],
        "a": "下发/分发中",
        "h": "正在创建 Outbox。"
    },
    {
        "q": "'Signal' 意为：",
        "o": [
            "噪音",
            "信号",
            "杂质",
            "数据"
        ],
        "a": "信号",
        "h": "具有价值的信息片段。"
    },
    {
        "q": "'Workflow Engine' 意为：",
        "o": [
            "数据存储器",
            "工作流引擎",
            "网页服务器",
            "搜索机器人"
        ],
        "a": "工作流引擎",
        "h": "管理串行任务的核心。"
    }
];

  const [idx, setIdx] = React.useState(0);
  const [scr, setScr] = React.useState(0);
  const [fin, setFin] = React.useState(false);
  const [sel, setSel] = React.useState(null);
  const [ok, setOk] = React.useState(null);
  const [ready, setReady] = React.useState(false);
  const [sq, setSq] = React.useState([]);

  React.useEffect(() => {
    setReady(true);
    setSq(questions.map(q => ({ ...q, o: [...q.o].sort(() => Math.random() - 0.5) })));
  }, []);

  const onAnswer = (o) => {
    if (sel) return;
    setSel(o);
    const isOk = o === questions[idx].a;
    setOk(isOk);
    if (isOk) setScr(scr + 1);
    setTimeout(() => {
      if (idx + 1 < questions.length) {
        setIdx(idx + 1);
        setSel(null);
        setOk(null);
      } else {
        setFin(true);
      }
    }, 1500);
  };

  if (!ready) return <div className="p-10 text-center opacity-50">Loading...</div>;

  if (fin) {
    return (
      <div className="p-10 rounded-2xl bg-white dark:bg-gray-900 border text-center shadow-xl">
        <div className="text-2xl font-bold text-emerald-600 mb-4">测试完成！</div>
        <div className="text-lg mb-8">得分: {scr} / {questions.length}</div>
        <div className="flex gap-4 justify-center">
            <button className="bg-emerald-600 hover:bg-emerald-700 text-white px-8 py-3 rounded-lg font-bold transition-all" onClick={() => {setIdx(0);setScr(0);setFin(false);setSel(null);setOk(null);}}>重新开始</button>
            <a href="quiz" className="bg-gray-100 hover:bg-gray-200 text-gray-700 px-8 py-3 rounded-lg font-bold transition-all no-underline">返回选单</a>
        </div>
      </div>
    );
  }

  const curr = sq[idx];
  if (!curr) return null;

  return (
    <div className="p-6 rounded-2xl bg-white dark:bg-gray-900 border shadow-lg">
      <div className="mb-4 text-xs opacity-50 font-mono text-right">进度: {idx + 1} / {questions.length}</div>
      
      <div className="h-1 bg-gray-100 rounded-full mb-6 overflow-hidden">
        <div className="h-full bg-emerald-500 transition-all duration-300" style={{width: ((idx + 1) / questions.length * 100) + '%'}}></div>
      </div>

      <div className="text-xl font-bold mb-8 text-gray-900 dark:text-gray-100">{curr.q}</div>
      
      <div className="space-y-3">
        {curr.o.map((o, i) => (
          <button 
            key={i} 
            className={"w-full text-left p-4 rounded-xl border-2 transition-all font-medium " + (sel === o ? (ok ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-700 dark:text-emerald-400" : "bg-red-50 dark:bg-red-900/20 border-red-500 text-red-700 dark:text-red-400") : (sel && o === curr.a ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-700 dark:text-emerald-400 opacity-80" : "bg-gray-50 dark:bg-gray-800 border-gray-100 dark:border-gray-700 hover:border-emerald-500 hover:shadow-md text-gray-700 dark:text-gray-300"))}
            onClick={() => onAnswer(o)}
          >
            {o}
          </button>
        ))}
      </div>
      
      {sel && (
        <div className={"mt-6 p-4 rounded-lg border-l-4 " + (ok ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-800 dark:text-emerald-300" : "bg-red-50 dark:bg-red-900/20 border-red-500 text-red-800 dark:text-red-300")}>
          <div className="font-bold flex items-center gap-2">
            {ok ? "✅ 正确!" : "❌ 错误"}
            <span className="font-normal opacity-70 text-sm ml-auto">正确答案: {curr.a}</span>
          </div>
          <div className="text-sm opacity-80 mt-2">💡 提示: {curr.h}</div>
        </div>
      )}
    </div>
  );
};

<QuizRunner />
