Files
template-10556/src/pages/ai/index.scss
2025-07-09 10:19:03 +08:00

303 lines
6.0 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ... existing code ...
html {
font-size: calc(100vw / 375 * 16); // 假设设计稿宽度为375px设置基础字体大小为16px
@media screen and (max-width: 375px) {
font-size: 16px; // 最小字体大小
}
@media screen and (min-width: 768px) {
font-size: 24px; // 平板或大屏设备上的字体大小
}
}
.ai-chat {
height: 98vh;
display: flex;
flex-direction: column;
background-color: #f5f5f5;
.chat-header {
background: linear-gradient(135deg, #a6ea66 0%, #ead1ff 100%);
color: white;
padding: 16px;
text-align: center;
font-size: 1.2rem; // 使用 rem 单位
font-weight: bold;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.chat-container {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.messages-container {
flex: 1;
padding: 16px;
overflow-y: auto;
scroll-behavior: smooth;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.2);
border-radius: 2px;
}
}
.message {
margin-bottom: 16px;
display: flex;
align-items: flex-start;
animation: fadeInUp 0.3s ease-out;
&.user {
flex-direction: row-reverse;
.message-content {
background: linear-gradient(135deg, #ff3535 0%, #FF0000 100%);
color: white;
margin-left: 0;
margin-right: 12px;
}
}
&.ai {
flex-direction: row;
.message-content {
background: white;
color: #333;
margin-left: 12px;
margin-right: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
}
.avatar {
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px; // 可以保持不变或调整为 rem 单位
flex-shrink: 0;
&.user-avatar {
background: linear-gradient(135deg, #df2626 0%, #d10a0a 100%);
color: white;
}
&.ai-avatar {
background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
color: white;
}
}
.message-content {
max-width: 70%;
padding: 12px 16px;
border-radius: 18px;
word-wrap: break-word;
line-height: 1.5;
font-size: 1rem; // 使用 rem 单位
position: relative;
.typing-indicator {
display: flex;
align-items: center;
gap: 4px;
.dot {
width: 6px;
height: 6px;
border-radius: 50%;
background-color: #999;
animation: typing 1.4s infinite ease-in-out;
&:nth-child(1) { animation-delay: -0.32s; }
&:nth-child(2) { animation-delay: -0.16s; }
&:nth-child(3) { animation-delay: 0s; }
}
}
}
}
.input-container {
background: white;
padding: 16px;
border-top: 1px solid #e0e0e0;
display: flex;
align-items: flex-end;
gap: 12px;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
.input-wrapper {
flex: 1;
position: relative;
}
.message-input {
width: 100%;
min-height: 90px;
max-height: 120px;
padding: 10px 16px;
border: 1px solid #e0e0e0;
border-radius: 20px;
font-size: 1.2rem; // 使用 rem 单位
line-height: 1.8;
resize: none;
outline: none;
transition: all 0.3s ease;
&:focus {
border-color: #ffc6c6;
background: white;
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}
&::placeholder {
color: #999;
}
}
.send-button {
width: 40px;
height: 40px;
border-radius: 50%;
background: linear-gradient(135deg, #ff0000 0%, #af1403 100%);
border: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
flex-shrink: 0;
&:hover {
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
&:active {
transform: scale(0.95);
}
&:disabled {
background: #ccc;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
}
}
.quick-questions {
padding: 16px;
background: white;
border-top: 1px solid #e0e0e0;
.quick-title {
font-size: 1rem; // 使用 rem 单位
color: #666;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.questions-list {
display: flex;
flex-direction: column;
gap: 8px;
.question-item {
padding: 12px 16px;
background: #f9f9f9;
border: 1px solid #e0e0e0;
border-radius: 12px;
font-size: 1rem; // 使用 rem 单位
color: #333;
cursor: pointer;
transition: all 0.3s ease;
text-align: left;
&:hover {
background: #667eea;
color: white;
border-color: #667eea;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}
&:active {
transform: translateY(0);
}
}
}
}
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
text-align: center;
.empty-icon {
font-size: 4rem; // 使用 rem 单位
margin-bottom: 16px;
opacity: 0.5;
}
.empty-title {
font-size: 1.5rem; // 使用 rem 单位
font-weight: bold;
color: #333;
margin-bottom: 8px;
}
.empty-desc {
font-size: 1rem; // 使用 rem 单位
color: #666;
line-height: 1.5;
}
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes typing {
0%, 80%, 100% {
transform: scale(0);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
}
}