Files
offerpai_web/src/assets/styles/components/ai-chat.scss
T

391 lines
7.6 KiB
SCSS

@use '../variables' as *;
.ai-chat {
font-size: 0.14rem;
width: var(--chat-width, 3.6rem);
height: var(--app-height, 100vh);
background: $bg-white;
display: flex;
flex-direction: column;
box-sizing: border-box;
flex-shrink: 0;
// ==================== 顶部头部区域 ====================
&__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.16rem;
height: 0.80rem;
box-sizing: border-box;
}
&__header-left {
display: flex;
align-items: center;
gap: 0.12rem;
}
&__avatar {
width: 0.44rem;
height: 0.44rem;
border-radius: 50%;
object-fit: cover;
}
&__info {
display: flex;
flex-direction: column;
}
&__name {
font-size: 0.15rem;
font-weight: 620;
line-height: 0.22rem;
color: $text-dark;
}
&__desc {
font-size: 0.12rem;
font-weight: 330;
line-height: 0.18rem;
color: #99A1AF;
}
// 在线状态标签
&__online-tag {
display: flex;
align-items: center;
justify-content: center;
padding: 0.04rem 0.08rem;
gap: 0.04rem;
background: #52CAD1;
border-radius: 0.12rem;
font-size: 0.12rem;
font-weight: 330;
line-height: 0.16rem;
color: $bg-white;
}
&__online-dot {
width: 0.06rem;
height: 0.06rem;
background: $bg-white;
border-radius: 50%;
}
// ==================== 聊天消息区域 ====================
&__messages {
flex: 1;
overflow-y: auto;
padding: 0 0.16rem;
padding-bottom: 0.16rem;
}
// 欢迎气泡
&__welcome-bubble {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 0.16rem;
gap: 0.08rem;
background: #F4FBFB;
border: 1px solid #AEE6EA;
border-radius: 0.12rem;
margin-bottom: 0.17rem;
}
&__welcome-title {
font-size: 0.14rem;
font-weight: 620;
line-height: 0.16rem;
color: $text-dark;
}
&__welcome-text {
font-size: 0.12rem;
font-weight: 330;
line-height: 0.18rem;
color: #99A1AF;
}
// ==================== 消息气泡 ====================
&__msg {
margin-bottom: 0.17rem;
display: flex;
&--ai {
justify-content: flex-start;
}
&--user {
justify-content: flex-end;
}
}
&__msg-bubble {
max-width: 2.8rem;
padding: 0.08rem 0.12rem;
font-size: 0.14rem;
font-weight: 330;
line-height: 0.24rem;
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.04);
// Markdown 渲染样式
p {
margin: 0 0 0.08rem;
&:last-child { margin-bottom: 0; }
}
h1, h2, h3, h4, h5, h6 {
margin: 0.12rem 0 0.06rem;
font-weight: 600;
line-height: 1.4;
}
h1 { font-size: 0.18rem; }
h2 { font-size: 0.16rem; }
h3 { font-size: 0.14rem; }
ul, ol {
padding-left: 0.2rem;
margin: 0.06rem 0;
}
li {
margin-bottom: 0.04rem;
}
code {
background: #f1f5f9;
padding: 0.01rem 0.04rem;
border-radius: 0.03rem;
font-size: 0.12rem;
font-family: 'Courier New', monospace;
}
pre {
background: #1e293b;
color: #e2e8f0;
padding: 0.1rem 0.12rem;
border-radius: 0.06rem;
overflow-x: auto;
margin: 0.08rem 0;
code {
background: none;
padding: 0;
color: inherit;
font-size: 0.11rem;
}
}
blockquote {
border-left: 3px solid #cbd5e1;
padding-left: 0.1rem;
margin: 0.08rem 0;
color: #64748b;
}
a {
color: #2563eb;
text-decoration: underline;
}
table {
border-collapse: collapse;
margin: 0.08rem 0;
width: 100%;
font-size: 0.12rem;
th, td {
border: 1px solid #e5e7eb;
padding: 0.06rem 0.1rem;
text-align: left;
line-height: 1.6;
}
th {
background: #f8fafc;
font-weight: 600;
}
}
}
// 用户消息气泡 — 品牌色背景,右上圆角小
&__msg--user &__msg-bubble {
background: #52CAD1;
color: $bg-white;
border-radius: 0.12rem 0.04rem 0.12rem 0.12rem;
}
// AI 消息气泡 — 白色背景绿色边框,左上圆角小
&__msg--ai &__msg-bubble {
background: $bg-white;
color: $text-dark;
border: 1px solid #AEE6EA;
box-shadow: 0px 2px 4px rgba(82, 202, 209, 0.1);
border-radius: 0.04rem 0.12rem 0.12rem 0.12rem;
}
// ==================== 三点等待动效 ====================
&__typing-indicator {
display: flex;
align-items: center;
padding: 0.14rem 0.12rem;
gap: 0.06rem;
background: $bg-white;
border: 1px solid #AEE6EA;
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.04);
border-radius: 0.04rem 0.12rem 0.12rem 0.12rem;
}
&__typing-dot {
width: 0.06rem;
height: 0.06rem;
border-radius: 50%;
background: #AEE6EA;
animation: typingBounce 1.4s infinite ease-in-out both;
&:nth-child(1) {
animation-delay: 0s;
}
&:nth-child(2) {
animation-delay: 0.2s;
background: rgba(174, 230, 234, 0.6);
}
&:nth-child(3) {
animation-delay: 0.4s;
background: rgba(174, 230, 234, 0.4);
}
}
@keyframes typingBounce {
0%, 80%, 100% {
transform: scale(1);
opacity: 0.6;
}
40% {
transform: scale(1.3);
opacity: 1;
}
}
// ==================== 话题推荐模块 ====================
&__topics {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 0.16rem 0.16rem 0.16rem 0.16rem;
gap: 0.12rem;
background: linear-gradient(180deg, #EDF9FA 0%, #FFFFFF 20.63%);
border: 1px solid #AEE6EA;
border-radius: 0.12rem;
margin: 0 0.16rem;
margin-bottom: 0.12rem;
}
&__topics-header {
display: flex;
align-items: center;
gap: 0.04rem;
}
&__topics-icon {
width: 0.16rem;
height: 0.16rem;
}
&__topics-title {
font-size: 0.14rem;
font-weight: 620;
line-height: 0.19rem;
color: #52CAD1;
}
&__topic-btn {
display: flex;
align-items: center;
padding: 0.08rem 0.12rem;
background: $bg-white;
border: 1px solid #F0F0F0;
border-radius: 0.08rem;
font-size: 0.12rem;
font-weight: 330;
line-height: 0.16rem;
color: $text-middle;
cursor: pointer;
transition: background 0.2s;
&:hover {
background: $accent;
color: #fff;
}
// 第一个按钮用品牌色
&--primary {
background: #52CAD1;
border-color: #52CAD1;
color: $bg-white;
&:hover {
background: #47b8bf;
}
}
}
// ==================== 底部输入框 ====================
&__input-area {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.08rem 0.12rem;
gap: 0.08rem;
margin: 0 0.16rem;
margin-bottom: 0.16rem;
background: rgba(255, 255, 255, 0.95);
border: 1px solid #AEE6EA;
border-radius: 0.08rem;
backdrop-filter: blur(12px);
box-sizing: border-box;
}
&__input {
flex: 1;
border: none;
outline: none;
background: transparent;
font-size: 0.12rem;
font-weight: 400;
line-height: 0.15rem;
color: $text-dark;
&::placeholder {
color: #99A1AF;
}
}
&__send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 0.32rem;
height: 0.32rem;
background: #52CAD1;
border-radius: 0.08rem;
border: none;
cursor: pointer;
flex-shrink: 0;
transition: background 0.2s;
&:hover {
background: #47b8bf;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}