From d9b40635aa2193ebf4bba9ed47d27426b64bfd1e Mon Sep 17 00:00:00 2001 From: langxm Date: Wed, 14 Oct 2026 09:54:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(M7):=20=E5=88=9D=E5=A7=8B=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=8E=BB=E9=A2=98=E5=8C=96+=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E5=BC=8F=E5=B8=83=E5=B1=80=E2=80=94=E2=80=94=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E8=87=AA=E5=8A=A8=E5=8A=A0=E8=BD=BD=E9=A2=98=E7=9B=AE?= =?UTF-8?q?/=E6=AC=A2=E8=BF=8E=E8=AF=AD=E5=8F=AA=E6=8F=90=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E5=AD=A6=E7=A7=91/crumb=E5=8A=A8=E6=80=81=EF=BC=9B?= =?UTF-8?q?=E5=AE=BD<860=E6=88=96=E9=AB=98=E2=89=A51000=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E5=B8=83=E5=B1=80(=E5=8E=BB=E5=AF=B9=E8=AF=9D=E6=B5=81?= =?UTF-8?q?=E5=B0=8F=E8=BE=93=E5=85=A5=E6=A1=86)+=E7=AA=84=E5=B1=8F?= =?UTF-8?q?=E4=BE=A7=E6=A0=8F=E6=8A=BD=E5=B1=89=EF=BC=9BloadProblem?= =?UTF-8?q?=E6=94=B9=E6=89=8B=E5=8A=A8=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/index.html | 54 +++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 83491c5..513afde 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -53,15 +53,20 @@ body{font-family:var(--sans);background:var(--bg);color:var(--text);font-size:14 .modal-body{padding:14px 16px} .modal-body label{display:block;font-size:12px;color:var(--text2);margin-bottom:5px} .modal-foot{padding:10px 16px;border-top:1px solid var(--line2);display:flex;justify-content:flex-end} -/* 高窗口(≥760px):上下布局 —— 上对话流(含输入框,贴近普通 AI 工具体验),下编辑器 */ -.main-inner{flex:1;display:flex;min-height:0;flex-direction:column} -.chat{width:100%;min-width:0;border-right:none;border-bottom:1px solid var(--line);background:var(--card);display:flex;flex-direction:column;min-height:0;flex:5} -.editor{flex:4;min-height:180px} -/* 低窗口:左右布局(屏幕高度不足的折中) */ -@media (max-height:759px){ - .main-inner{flex-direction:row} - .chat{width:46%;min-width:400px;border-right:1px solid var(--line);border-bottom:none;flex:none} - .editor{flex:1;min-height:0} +/* 布局规则(响应式):宽<860 或 高≥1000 → 上下布局;其余(宽屏矮窗)→ 左右分屏 + 上下布局时去掉对话流下方小输入框(输入统一走底部编辑器),侧栏收起为抽屉 */ +.main-inner{flex:1;display:flex;min-height:0;flex-direction:row} +.chat{width:46%;min-width:400px;border-right:1px solid var(--line);border-bottom:none;background:var(--card);display:flex;flex-direction:column;min-height:0;flex:none} +.editor{flex:1;min-height:0} +@media (max-width:859px), (min-height:1000px){ + .main-inner{flex-direction:column} + .chat{width:100%;min-width:0;border-right:none;border-bottom:1px solid var(--line);flex:5} + .editor{flex:4;min-height:180px} + .chat-input{display:none} /* 上下布局:输入统一走底部编辑器,去掉对话流下小输入框 */ + .side{position:fixed;left:0;top:52px;bottom:0;z-index:60;width:224px;transform:translateX(-102%);transition:transform .2s ease;box-shadow:4px 0 18px rgba(20,28,40,.16)} + .side.open{transform:translateX(0)} + #sideToggle{display:inline-flex} + #sideMask{display:block} } .chat-head{flex:none;padding:10px 16px;border-bottom:1px solid var(--line2);font-size:12px;color:var(--text2);display:flex;gap:10px;align-items:center} .chat-head .prog{flex:1;height:5px;background:var(--line2);border-radius:3px;overflow:hidden} @@ -121,8 +126,8 @@ body{font-family:var(--sans);background:var(--bg);color:var(--text);font-size:14 .chat-input input{flex:1;border:1.5px solid var(--line);border-radius:8px;padding:9px 12px;font-size:13px;outline:none;font-family:var(--sans)} .chat-input input:focus{border-color:var(--blue)} /* ===== 右:统一输入区 ===== */ -.editor{flex:4;min-width:0;display:flex;flex-direction:column;background:var(--card);min-height:180px} -@media (max-height:759px){ .editor{flex:1;min-height:0} } +.editor{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--card);min-height:0} +@media (max-width:859px), (min-height:1000px){ .editor{flex:4;min-height:180px} } .editor-head{flex:none;display:flex;align-items:center;gap:10px;padding:9px 16px;border-bottom:1px solid var(--line2);background:var(--line2);font-size:12px;color:var(--text2)} .editor-head .morph{display:flex;gap:4px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:2px;font-size:11.5px} .editor-head .morph span{padding:3px 12px;border-radius:13px;color:var(--text3)} @@ -192,8 +197,9 @@ body{font-family:var(--sans);background:var(--bg);color:var(--text);font-size:14
+
ffluent-learn
-
AP CSA · 方法入门 › 01 方法入门 › 1021 makes10(热身 106)
+
🎯 今日 0/8 · 距目标还差 8 题 · 连续打卡 0 天
@@ -209,6 +215,8 @@ body{font-family:var(--sans);background:var(--bg);color:var(--text);font-size:14
+ +
@@ -379,9 +387,8 @@ function init(){ document.getElementById('dialogArea').addEventListener('keydown', function(e){ if(e.key==='Enter' && !e.shiftKey){ e.preventDefault(); sendDialog(); } }); - // 初始欢迎:先加载历史对话(有则渲染,无则欢迎语) + // 初始:加载会话历史(有则恢复,无则干净欢迎语);不自动加载题目(学科窗口建立后由 AI 出题/题库路由产生) initConv(); - loadProblem(); loadProgress(); loadLatexChips(); // LaTeX 常用公式合集(按学科) latexLive(); // 预览区默认示例 @@ -571,11 +578,23 @@ function loadConvHistory(convId, isFirst){ fetch(url,{headers:authHeaders({})}).then(function(r){return r.json();}).then(function(d){ var msgs=d.messages||[]; if(msgs.length){ msgs.forEach(renderHistoryMsg); } - else if(isFirst){ addMsg('ai','👋 你好,我是 fluent-learn 的 AI 助手。
直接打字问我任何问题都可以——学习、概念、方法、闲聊都行;写代码或 LaTeX 会自动切换到对应输入模式。左侧可新建「学科窗口」会话,让每个学科有自己的学习流。'); } + else if(isFirst){ addMsg('ai','👋 欢迎来到 fluent-learn
点击左上角「+ 新建」开启学科窗口:USACO · AP CSA 可选,其余学科即将上线。
每个会话一个学科,可续接进度;直接打字问我任何问题都可以——学习、概念、方法、闲聊都行,写代码或 LaTeX 会自动切换到对应输入模式。'); } var cf=document.querySelector('.chat-flow'); if(cf) cf.scrollTop=cf.scrollHeight; msgs.forEach(function(m){ if(m.meta && m.meta.announcement) LAST_ANN_ID=Math.max(LAST_ANN_ID, m.id); }); if(!ANN_POLL){ ANN_POLL=setInterval(pollAnn, 6000); pollAnn(); } - }).catch(function(){ if(isFirst) addMsg('ai','👋 你好,我是 fluent-learn 的 AI 助手。
直接打字问我任何问题都可以。'); }); + }).catch(function(){ if(isFirst) addMsg('ai','👋 欢迎来到 fluent-learn
点击左上角「+ 新建」开启学科窗口:USACO · AP CSA 可选。'); }); +} +/* 侧栏抽屉开关(窄屏时顶栏 ☰ 与遮罩点击) */ +function toggleSide(){ + var s=document.querySelector('.side'), m=document.getElementById('sideMask'); + if(!s) return; + var open=s.classList.toggle('open'); + if(m) m.style.display=open?'block':'none'; +} +function setCrumb(title){ + var c=document.getElementById('crumb'); if(!c) return; + if(title){ c.innerHTML='学习流 › '+escapeHtml(title)+''; c.style.display=''; } + else { c.style.display='none'; } } function openNewConv(){ var sel=document.getElementById('convCourse'); @@ -1000,6 +1019,7 @@ function loadProblemByPid(hpid){ if(!p||!p.id){ toast('未找到题目 '+hpid); return; } CUR_PROBLEM=p; if(p.course){ CUR_COURSE=p.course; loadLatexChips(); latexLive(); } + setCrumb(p.title+' · '+p.hydro_pid); addMsg('ai', mdRender('📌 **'+p.title+' · '+p.hydro_pid+'**\n\n'+p.statement_md)); if(p.latex_explain) addMsg('judge','
🧮 公式小课堂
'+mdRender(p.latex_explain)+'
'); if(p.quiz && p.quiz.length) renderQuiz(p.quiz); @@ -1093,12 +1113,12 @@ function loadProblem(){ if(!list||!list.length){ addMsg('ai','⚠️ 后端暂无题目(请确认已导入题库)。'); return; } CUR_PROBLEM=list[0]; if(CUR_PROBLEM.course){ CUR_COURSE=CUR_PROBLEM.course; loadLatexChips(); latexLive(); } + setCrumb(CUR_PROBLEM.title+' · '+CUR_PROBLEM.hydro_pid); addMsg('ai', mdRender('**'+CUR_PROBLEM.title+' · '+CUR_PROBLEM.hydro_pid+'**\n\n'+CUR_PROBLEM.statement_md)); if(CUR_PROBLEM.latex_explain){ addMsg('judge','
🧮 公式小课堂 题面 LaTeX 用法解释(新手友好)
'+mdRender(CUR_PROBLEM.latex_explain)+'
'); } if(CUR_PROBLEM.quiz && CUR_PROBLEM.quiz.length) renderQuiz(CUR_PROBLEM.quiz); - addMsg('ai','👋 欢迎来到 fluent-learn 学习工作台
想学哪个方向?USACO(竞赛算法)· AP CSA(Java 编程)· AP 微积分 / 物理 / 化学 / 生物
当前已为你加载 '+CUR_PROBLEM.title+'(AP CSA 热身题),右侧可直接写代码提交评测。
也可以直接问我任何问题——概念、学习方法、别的科目都行,我随时在。'); }).catch(function(){ addMsg('ai','⚠️ 后端不可达:判题与 AI 为本地演示模式。'); renderChoiceQ1();