mirror of
https://github.com/wasrusgen/wasrusgen1-crm.git
synced 2026-06-03 15:04:47 +00:00
fix(cabinet): чат интервью открывается сразу внизу, без «пролёта» сверху
Причина: addMsg скроллил .chat (без своего скролла), реальный контейнер .scroll оставался вверху, потом уезжал вниз скролл-анкерингом. Теперь скроллим .scroll, прыжок вниз после показа sv1 (rAF), overflow-anchor:none против дрейфа.
This commit is contained in:
parent
a27ab5b27e
commit
024c3fb500
@ -63,7 +63,7 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);displ
|
||||
.btn{font-family:'Inter';font-weight:600;border:none;cursor:pointer;border-radius:10px;display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
|
||||
.btn-p{background:var(--primary);color:#fff;font-size:13px;padding:10px 18px}
|
||||
.btn-p:hover{background:var(--dark)}.btn-p:disabled{opacity:.5;cursor:default}
|
||||
.scroll{flex:1;overflow-y:auto}
|
||||
.scroll{flex:1;overflow-y:auto;overflow-anchor:none}
|
||||
/* Chat */
|
||||
.chat{padding:24px 26px;display:flex;flex-direction:column;gap:14px}
|
||||
/* Спросить Елену — док на этапах 3-5 */
|
||||
@ -389,6 +389,7 @@ function go(n){
|
||||
document.querySelectorAll('.si').forEach(s=>s.classList.remove('active'));
|
||||
document.getElementById('si'+n).classList.add('active');
|
||||
if(PCTS[n]!=null){document.getElementById('pbPct').textContent=PCTS[n]+'%';document.getElementById('pbFill').style.width=PCTS[n]+'%';}
|
||||
if(n===1)requestAnimationFrame(scrollChatBottom); // sv1 уже видим — высота посчитана, прыгаем вниз без «пролёта»
|
||||
if(n===3)renderDocs();
|
||||
if(n===4)renderAnalysis();
|
||||
if(n===5)renderSpecPane();
|
||||
@ -431,8 +432,10 @@ function startMic(){recording=true;document.getElementById("micBtn").classList.a
|
||||
function stopMic(){recording=false;document.getElementById("micBtn").classList.remove("rec");document.getElementById("micHint").classList.remove("show");try{recog.stop()}catch(e){}inp.focus()}
|
||||
|
||||
/* ── Chat ── */
|
||||
function addMsg(role,text){const m=document.createElement("div");m.className="msg "+(role==="user"?"user":"");m.innerHTML=`<div class="av ${role==='user'?'u':'e'}">${role==='user'?'Я':'Е'}</div><div class="bb ${role==='user'?'out':'in'}">${fmt(text)}</div>`;chat.appendChild(m);chat.scrollTop=chat.scrollHeight}
|
||||
function showTyping(){const t=document.createElement("div");t.className="msg";t.id="typing";t.innerHTML=`<div class="av e">Е</div><div class="typing"><span></span><span></span><span></span></div>`;chat.appendChild(t);chat.scrollTop=chat.scrollHeight}
|
||||
// Скроллит реальный контейнер (.scroll), а не .chat (у него нет своего скролла). Мгновенно, без анимации.
|
||||
function scrollChatBottom(){const sc=chat.parentElement;if(sc)sc.scrollTop=sc.scrollHeight;}
|
||||
function addMsg(role,text){const m=document.createElement("div");m.className="msg "+(role==="user"?"user":"");m.innerHTML=`<div class="av ${role==='user'?'u':'e'}">${role==='user'?'Я':'Е'}</div><div class="bb ${role==='user'?'out':'in'}">${fmt(text)}</div>`;chat.appendChild(m);scrollChatBottom()}
|
||||
function showTyping(){const t=document.createElement("div");t.className="msg";t.id="typing";t.innerHTML=`<div class="av e">Е</div><div class="typing"><span></span><span></span><span></span></div>`;chat.appendChild(t);scrollChatBottom()}
|
||||
function hideTyping(){const t=document.getElementById("typing");if(t)t.remove()}
|
||||
|
||||
/* ── Спросить Елену (этапы 3-5) ── */
|
||||
|
||||
@ -35,7 +35,7 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);displ
|
||||
.cl-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}
|
||||
.sb-new{margin:8px 10px;display:flex;align-items:center;justify-content:center;gap:7px;padding:10px;border-radius:9px;background:var(--primary);color:#fff;border:none;cursor:pointer;font-family:'Inter';font-weight:700;font-size:13px}
|
||||
.main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
|
||||
.scroll{flex:1;overflow-y:auto;padding:24px 28px}
|
||||
.scroll{flex:1;overflow-y:auto;padding:24px 28px;overflow-anchor:none}
|
||||
/* Dashboard */
|
||||
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:16px}
|
||||
.kpi{background:var(--white);border:1.5px solid var(--border);border-radius:10px;padding:13px 16px}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user