feat: 重构移动端用户聊天页面

This commit is contained in:
2026-07-11 16:40:40 +08:00
parent 4f75e11a8d
commit 603fb70715
8 changed files with 1157 additions and 221 deletions

View File

@@ -1098,3 +1098,644 @@ textarea:focus-visible {
box-shadow: none;
}
}
/* 登录后的手机端问答界面 */
:root {
--chat-bg: #f6faf8;
--chat-surface: #ffffff;
--chat-text: #17231f;
--chat-muted: #6f7f79;
--chat-weak: #98a49f;
--chat-brand: #149477;
--chat-brand-dark: #0f705d;
--chat-brand-soft: #eff7f4;
--chat-border: #dfe9e5;
--chat-control-border: #d9e6e1;
--chat-danger: #c65353;
--chat-radius-control: 13px;
--chat-radius-card: 15px;
--chat-shadow: 0 8px 24px rgba(28, 60, 50, 0.055);
}
.phone-frame.chat-mode {
display: grid;
grid-template-rows: auto auto minmax(0, 1fr) auto;
background: var(--chat-bg);
}
.chat-header {
position: relative;
z-index: 5;
min-height: 82px;
display: grid;
grid-template-columns: 44px minmax(0, 1fr) auto 52px;
align-items: center;
gap: 10px;
padding: max(10px, env(safe-area-inset-top)) 14px 10px;
border-bottom: 1px solid var(--chat-border);
background: rgba(255, 255, 255, 0.98);
}
.header-menu-button,
.header-logout-button,
.history-header button {
min-width: 44px;
height: 44px;
display: grid;
place-items: center;
border: 0;
border-radius: 12px;
background: var(--chat-brand-soft);
color: var(--chat-brand-dark);
}
.assistant-summary {
min-width: 0;
}
.assistant-summary h1 {
overflow: hidden;
margin: 0;
color: var(--chat-text);
font-size: 17px;
line-height: 1.35;
font-weight: 720;
text-overflow: ellipsis;
white-space: nowrap;
}
.assistant-summary p {
overflow: hidden;
margin: 3px 0 0;
color: var(--chat-muted);
font-size: 11px;
line-height: 1.45;
text-overflow: ellipsis;
white-space: nowrap;
}
.user-summary {
max-width: 92px;
display: grid;
gap: 2px;
color: var(--chat-muted);
font-size: 10px;
line-height: 1.45;
}
.user-summary span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-logout-button {
min-width: 52px;
padding: 0 8px;
font-size: 13px;
font-weight: 600;
}
.session-quota {
min-height: 46px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin: 12px 16px 0;
padding: 0 14px;
border: 1px solid rgba(217, 230, 225, 0.75);
border-radius: 13px;
background: var(--chat-brand-soft);
color: #365c51;
font-size: 13px;
}
.session-quota > div {
display: flex;
align-items: center;
gap: 8px;
}
.session-quota svg,
.session-quota strong {
color: var(--chat-brand-dark);
}
.session-quota strong {
font-size: 14px;
font-weight: 700;
}
.session-quota.exhausted {
border-color: rgba(198, 83, 83, 0.25);
background: #fff5f4;
}
.session-quota.exhausted strong {
color: var(--chat-danger);
}
.message-list {
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding: 18px 16px 28px;
scroll-behavior: smooth;
overscroll-behavior: contain;
scrollbar-width: thin;
scrollbar-color: #cfddd8 transparent;
}
.chat-empty-state,
.chat-loading-state {
min-height: 48%;
display: grid;
place-content: center;
text-align: center;
}
.chat-empty-state strong {
color: var(--chat-text);
font-size: 18px;
font-weight: 680;
}
.chat-empty-state p,
.chat-loading-state {
margin: 8px 0 0;
color: var(--chat-muted);
font-size: 14px;
line-height: 1.65;
}
.chat-message {
display: grid;
grid-template-columns: 36px minmax(0, 1fr);
align-items: start;
gap: 10px;
margin-bottom: 18px;
scroll-margin-top: 12px;
}
.chat-message.user {
display: flex;
justify-content: flex-end;
}
.assistant-icon {
width: 36px;
height: 36px;
display: grid;
place-items: center;
border-radius: 11px;
background: #e4f1ed;
color: var(--chat-brand-dark);
}
.message-bubble {
min-width: 0;
width: fit-content;
max-width: 100%;
padding: 13px 15px 10px;
border: 1px solid var(--chat-border);
border-radius: var(--chat-radius-card);
background: var(--chat-surface);
box-shadow: var(--chat-shadow);
}
.chat-message.user .message-bubble {
max-width: 82%;
border-color: var(--chat-brand);
border-bottom-right-radius: 5px;
background: var(--chat-brand);
color: #ffffff;
box-shadow: 0 8px 20px rgba(20, 148, 119, 0.15);
}
.message-content {
overflow-wrap: anywhere;
white-space: pre-wrap;
color: inherit;
font-size: 15px;
line-height: 1.78;
letter-spacing: 0;
}
.chat-message time {
display: block;
margin-top: 6px;
color: var(--chat-weak);
font-size: 11px;
line-height: 1.3;
}
.chat-message.user time {
color: rgba(255, 255, 255, 0.72);
text-align: right;
}
.generation-state {
display: flex;
align-items: center;
gap: 4px;
min-height: 28px;
color: var(--chat-muted);
font-size: 13px;
}
.generation-state span {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--chat-brand);
animation: generation-pulse 1.2s ease-in-out infinite;
}
.generation-state span:nth-child(2) { animation-delay: 0.14s; }
.generation-state span:nth-child(3) { animation-delay: 0.28s; margin-right: 4px; }
@keyframes generation-pulse {
0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
35% { opacity: 1; transform: translateY(-2px); }
}
.markdown-content {
white-space: normal;
}
.markdown-content > :first-child { margin-top: 0; }
.markdown-content > :last-child { margin-bottom: 0; }
.markdown-content p { margin: 0 0 12px; }
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
margin: 20px 0 9px;
color: var(--chat-text);
line-height: 1.45;
font-weight: 700;
}
.markdown-content h1 { font-size: 20px; }
.markdown-content h2 { font-size: 18px; }
.markdown-content h3,
.markdown-content h4 { font-size: 16px; }
.markdown-content ul,
.markdown-content ol {
margin: 8px 0 13px;
padding-left: 22px;
}
.markdown-content li + li { margin-top: 6px; }
.markdown-content strong { color: var(--chat-text); font-weight: 700; }
.markdown-content blockquote {
margin: 12px 0;
padding: 8px 12px;
border-left: 3px solid #8cc7b6;
background: var(--chat-brand-soft);
color: #526b63;
}
.markdown-content blockquote p { margin: 0; }
.chat-composer {
position: relative;
z-index: 6;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: end;
gap: 10px;
padding: 12px 14px max(12px, env(safe-area-inset-bottom));
border-top: 1px solid var(--chat-border);
background: rgba(255, 255, 255, 0.98);
}
.chat-composer textarea {
width: 100%;
min-height: 50px;
max-height: 108px;
resize: none;
overflow-y: hidden;
padding: 13px 15px;
border: 1px solid var(--chat-control-border);
border-radius: var(--chat-radius-control);
outline: 0;
background: #ffffff;
color: var(--chat-text);
font-size: 16px;
line-height: 1.45;
transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.chat-composer textarea:focus {
border-color: var(--chat-brand);
box-shadow: 0 0 0 3px rgba(20, 148, 119, 0.1);
}
.chat-composer textarea::placeholder { color: var(--chat-weak); }
.composer-send,
.composer-stop {
min-width: 78px;
min-height: 50px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 7px;
padding: 0 14px;
border: 0;
border-radius: var(--chat-radius-control);
color: #ffffff;
font-size: 15px;
font-weight: 650;
}
.composer-send { background: var(--chat-brand); }
.composer-stop { background: var(--chat-danger); }
.composer-send:disabled {
cursor: not-allowed;
background: #dbe8e3;
color: #93a39d;
}
.history-mask {
position: absolute;
inset: 0;
z-index: 40;
pointer-events: none;
background: rgba(20, 36, 31, 0);
transition: background 0.22s ease;
}
.history-mask.visible {
pointer-events: auto;
background: rgba(20, 36, 31, 0.32);
}
.history-drawer {
position: absolute;
inset: 0 auto 0 0;
z-index: 45;
width: 84%;
max-width: 360px;
display: flex;
flex-direction: column;
padding: max(14px, env(safe-area-inset-top)) 15px max(16px, env(safe-area-inset-bottom));
background: #fbfdfc;
transform: translateX(-102%);
transition: transform 0.22s ease;
box-shadow: 18px 0 50px rgba(20, 36, 31, 0.15);
}
.history-drawer.open { transform: translateX(0); }
.history-header {
min-height: 52px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
}
.history-header h2 {
margin: 0;
color: var(--chat-text);
font-size: 19px;
}
.new-chat-button {
width: 100%;
min-height: 50px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
margin-bottom: 16px;
border: 0;
border-radius: 13px;
background: var(--chat-brand);
color: #ffffff;
font-size: 15px;
font-weight: 680;
}
.history-list {
min-height: 0;
display: grid;
align-content: start;
gap: 10px;
overflow-y: auto;
padding: 1px 2px 8px;
overscroll-behavior: contain;
}
.history-state {
padding: 48px 10px;
color: var(--chat-muted);
font-size: 14px;
text-align: center;
}
.history-item {
padding: 13px 14px 10px;
border: 1px solid var(--chat-border);
border-radius: 12px;
background: #ffffff;
}
.history-item.active {
border-color: var(--chat-brand);
background: #f3faf7;
}
.history-main {
width: 100%;
min-width: 0;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 7px 10px;
padding: 0;
border: 0;
background: transparent;
color: inherit;
text-align: left;
}
.history-main strong {
display: -webkit-box;
overflow: hidden;
color: var(--chat-text);
font-size: 15px;
line-height: 1.45;
font-weight: 680;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.history-main time,
.history-main span {
color: var(--chat-muted);
font-size: 11px;
line-height: 1.45;
}
.history-main time { white-space: nowrap; }
.history-main span { grid-column: 1 / -1; }
.history-actions {
display: flex;
gap: 18px;
margin-top: 8px;
}
.history-actions button {
min-height: 36px;
display: inline-flex;
align-items: center;
gap: 5px;
padding: 0 2px;
border: 0;
background: transparent;
color: var(--chat-brand-dark);
font-size: 13px;
font-weight: 620;
}
.history-actions button.danger { color: var(--chat-danger); }
.session-dialog-form {
display: grid;
gap: 9px;
}
.session-dialog-form label {
color: var(--chat-text);
font-size: 14px;
font-weight: 650;
}
.session-dialog-form input {
width: 100%;
min-height: 48px;
padding: 0 13px;
border: 1px solid var(--chat-control-border);
border-radius: 12px;
outline: 0;
color: var(--chat-text);
font-size: 16px;
}
.session-dialog-form input:focus {
border-color: var(--chat-brand);
box-shadow: 0 0 0 3px rgba(20, 148, 119, 0.1);
}
.session-dialog-form p {
margin: 0;
color: var(--chat-weak);
font-size: 12px;
text-align: right;
}
.confirm-copy {
margin: 0;
color: var(--chat-muted);
font-size: 15px;
line-height: 1.75;
}
.dialog-actions {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.dialog-actions button {
min-height: 46px;
border: 0;
border-radius: 12px;
font-size: 15px;
font-weight: 650;
}
.dialog-secondary { background: #edf3f1; color: var(--chat-muted); }
.dialog-primary { background: var(--chat-brand); color: #ffffff; }
.dialog-danger { background: var(--chat-danger); color: #ffffff; }
.dialog-actions button:disabled {
cursor: not-allowed;
opacity: 0.55;
}
.chat-toast {
position: fixed;
z-index: 100;
left: 50%;
bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
max-width: calc(100vw - 40px);
padding: 11px 16px;
border-radius: 10px;
background: rgba(23, 35, 31, 0.92);
color: #ffffff;
font-size: 14px;
line-height: 1.5;
text-align: center;
transform: translateX(-50%);
box-shadow: 0 10px 30px rgba(20, 34, 29, 0.18);
}
body.drawer-open { overflow: hidden; }
@media (max-width: 390px) {
.chat-header {
grid-template-columns: 44px minmax(0, 1fr) auto 48px;
gap: 7px;
padding-right: 10px;
padding-left: 10px;
}
.assistant-summary h1 { font-size: 15px; }
.assistant-summary p { font-size: 10px; }
.user-summary { max-width: 72px; font-size: 9px; }
.header-logout-button { min-width: 48px; padding: 0 5px; }
.session-quota { margin-right: 12px; margin-left: 12px; }
.message-list { padding-right: 12px; padding-left: 12px; }
.chat-composer { padding-right: 10px; padding-left: 10px; }
.composer-send,
.composer-stop { min-width: 72px; padding: 0 11px; }
}
@media (max-width: 350px) {
.user-summary { display: none; }
.chat-header { grid-template-columns: 44px minmax(0, 1fr) 48px; }
}
@media (max-height: 680px) {
.chat-header { min-height: 70px; }
.session-quota { min-height: 42px; margin-top: 8px; }
.message-list { padding-top: 12px; padding-bottom: 16px; }
.chat-composer { padding-top: 9px; }
}
@media (min-width: 521px) {
.phone-frame.chat-mode {
height: min(860px, calc(100dvh - 48px));
}
.modal-backdrop {
position: absolute;
border-radius: 28px;
}
}
@media (max-width: 520px) {
.phone-frame.chat-mode {
height: 100dvh;
min-height: 0;
}
}