fix:优化主屏幕
This commit is contained in:
192
frontend/dist/assets/index-B6wMcdCx.js
vendored
Normal file
192
frontend/dist/assets/index-B6wMcdCx.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/dist/assets/index-C-dSv0ph.css
vendored
Normal file
1
frontend/dist/assets/index-C-dSv0ph.css
vendored
Normal file
File diff suppressed because one or more lines are too long
18
frontend/dist/index.html
vendored
Normal file
18
frontend/dist/index.html
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#e8ecf1" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<title>公考助手</title>
|
||||
<script type="module" crossorigin src="/assets/index-B6wMcdCx.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-C-dSv0ph.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
11
frontend/dist/manifest.webmanifest
vendored
Normal file
11
frontend/dist/manifest.webmanifest
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "公考助手",
|
||||
"short_name": "公考助手",
|
||||
"description": "公考学习资源、错题与过程管理",
|
||||
"display": "standalone",
|
||||
"background_color": "#e8ecf1",
|
||||
"theme_color": "#2563eb",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"lang": "zh-CN"
|
||||
}
|
||||
@@ -31,6 +31,64 @@ function formatDate(date) {
|
||||
return new Date(date).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
/** 展示用:难度统一为 易/中/难,不出现 easy/medium/hard */
|
||||
function formatDifficultyDisplay(raw) {
|
||||
if (raw == null || String(raw).trim() === "") return "未设置";
|
||||
const s = String(raw).trim().toLowerCase();
|
||||
const map = {
|
||||
easy: "易",
|
||||
medium: "中",
|
||||
hard: "难",
|
||||
simple: "易",
|
||||
difficult: "难",
|
||||
moderate: "中"
|
||||
};
|
||||
if (map[s]) return map[s];
|
||||
const t = String(raw).trim();
|
||||
if (["易", "中", "难"].includes(t)) return t;
|
||||
return "未设置";
|
||||
}
|
||||
|
||||
/** 展示用:分类统一为中文枚举或常见英文别名映射 */
|
||||
function formatMistakeCategoryDisplay(raw) {
|
||||
if (raw == null || String(raw).trim() === "") return "未分类";
|
||||
const s = String(raw).trim();
|
||||
if (MISTAKE_CATEGORIES.includes(s)) return s;
|
||||
const lower = s.toLowerCase().replace(/\s+/g, " ");
|
||||
const en = {
|
||||
common: "常识",
|
||||
"common sense": "常识",
|
||||
commonsense: "常识",
|
||||
verbal: "言语",
|
||||
"verbal understanding": "言语",
|
||||
quantitative: "数量",
|
||||
quantity: "数量",
|
||||
judgment: "判断",
|
||||
judgement: "判断",
|
||||
reasoning: "判断",
|
||||
"judgment reasoning": "判断",
|
||||
data: "资料",
|
||||
"data analysis": "资料",
|
||||
science: "科学",
|
||||
other: "其他"
|
||||
};
|
||||
if (en[lower]) return en[lower];
|
||||
if (s.includes("常识")) return "常识";
|
||||
if (s.includes("言语")) return "言语";
|
||||
if (s.includes("数量")) return "数量";
|
||||
if (s.includes("判断") || s.includes("推理")) return "判断";
|
||||
if (s.includes("资料")) return "资料";
|
||||
if (s.includes("科学")) return "科学";
|
||||
return s;
|
||||
}
|
||||
|
||||
/** 展示用:错误次数中文表述 */
|
||||
function formatWrongCountDisplay(n) {
|
||||
const x = Number(n);
|
||||
const v = Number.isFinite(x) && x >= 0 ? Math.floor(x) : 0;
|
||||
return `错 ${v} 次`;
|
||||
}
|
||||
|
||||
function getApiErrorMessage(error, fallback = "请求失败,请稍后重试") {
|
||||
return error?.response?.data?.detail || error?.message || fallback;
|
||||
}
|
||||
@@ -962,8 +1020,6 @@ function MistakeModule({ quickCaptureTask, onQuickCaptureHandled }) {
|
||||
};
|
||||
}, [quickCaptureTask?.id]);
|
||||
|
||||
const diffLabel = { easy: "易", medium: "中", hard: "难" };
|
||||
|
||||
return (
|
||||
<div className="module-mistake">
|
||||
<div className="toolbar">
|
||||
@@ -1054,9 +1110,16 @@ function MistakeModule({ quickCaptureTask, onQuickCaptureHandled }) {
|
||||
>
|
||||
<div className="mistake-card-body">
|
||||
<div className="mistake-title">{item.title}</div>
|
||||
<div className="text-muted small">
|
||||
{item.category}
|
||||
{item.difficulty ? ` · ${diffLabel[item.difficulty] || item.difficulty}` : ""} · 错 {item.wrong_count} 次
|
||||
<div className="text-muted small meta-mistake-line">
|
||||
<span>{formatMistakeCategoryDisplay(item.category)}</span>
|
||||
<span className="meta-sep" aria-hidden>
|
||||
·
|
||||
</span>
|
||||
<span>难度 {formatDifficultyDisplay(item.difficulty)}</span>
|
||||
<span className="meta-sep" aria-hidden>
|
||||
·
|
||||
</span>
|
||||
<span>{formatWrongCountDisplay(item.wrong_count)}</span>
|
||||
</div>
|
||||
<div className="text-muted small question-preview">
|
||||
{item.question_content || item.answer || "暂无题干/作答内容(可点查看详情)"}
|
||||
@@ -1434,10 +1497,12 @@ function MistakeModule({ quickCaptureTask, onQuickCaptureHandled }) {
|
||||
<Modal title="错题详情" onClose={() => setDetailItem(null)}>
|
||||
<div className="stack-gap-sm">
|
||||
<div className="field-label">
|
||||
<strong>分类 / 难度 / 错误次数</strong>
|
||||
<span>
|
||||
{detailItem.category} / {detailItem.difficulty || "未设置"} / {detailItem.wrong_count}
|
||||
</span>
|
||||
<strong>分类 · 难度 · 错误次数</strong>
|
||||
<div className="meta-detail-cn">
|
||||
<span>分类:{formatMistakeCategoryDisplay(detailItem.category)}</span>
|
||||
<span>难度:{formatDifficultyDisplay(detailItem.difficulty)}</span>
|
||||
<span>错误次数:{formatWrongCountDisplay(detailItem.wrong_count)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{detailItem.image_url ? (
|
||||
<div className="field-label">
|
||||
|
||||
@@ -486,6 +486,28 @@ a:hover {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.meta-mistake-line {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0 4px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.meta-sep {
|
||||
color: #cbd5e1;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.meta-detail-cn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin-top: 4px;
|
||||
font-size: 0.9375rem;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.question-preview {
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.5;
|
||||
|
||||
Reference in New Issue
Block a user