122 lines
2.5 KiB
Vue
122 lines
2.5 KiB
Vue
<template>
|
|
<div class="chat-list">
|
|
<div class="chat-divider">今天 15:14</div>
|
|
|
|
<div v-for="msg in messages" :key="msg.id" class="message-row" :class="{ 'is-user': msg.isUser }">
|
|
<div class="bubble-wrap">
|
|
<div class="bubble">{{ msg.content }}</div>
|
|
<div class="time">{{ msg.time }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue';
|
|
|
|
interface Message {
|
|
id: number;
|
|
content: string;
|
|
time: string;
|
|
isUser: boolean;
|
|
}
|
|
|
|
const messages = ref<Message[]>([
|
|
{
|
|
id: 1,
|
|
content: '你好!我叫知子,很高兴为您服务。您今天想聊些什么呢?',
|
|
time: '09:30',
|
|
isUser: false,
|
|
},
|
|
{
|
|
id: 2,
|
|
content: '你好!我想了解下这个系统都能做什么。',
|
|
time: '09:31',
|
|
isUser: true,
|
|
},
|
|
{
|
|
id: 3,
|
|
content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?',
|
|
time: '09:31',
|
|
isUser: false,
|
|
},
|
|
]);
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.chat-list {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-start;
|
|
gap: 16px;
|
|
padding: 28px 0 10px;
|
|
}
|
|
|
|
.chat-divider {
|
|
align-self: center;
|
|
font-size: 12px;
|
|
color: #64748b;
|
|
line-height: 1;
|
|
padding: 4px 16px;
|
|
background: rgba(255, 255, 255, 0.7);
|
|
border-radius: 999px;
|
|
border: 1px solid rgba(226, 233, 244, 0.8);
|
|
letter-spacing: 0.2px;
|
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
|
|
}
|
|
|
|
.message-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
max-width: 100%;
|
|
|
|
&.is-user {
|
|
justify-content: flex-end;
|
|
}
|
|
}
|
|
|
|
.bubble-wrap {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
max-width: min(84%, 1120px);
|
|
}
|
|
|
|
.bubble {
|
|
font-size: 14px;
|
|
line-height: 1.75;
|
|
padding: 14px 16px;
|
|
border-radius: 16px;
|
|
word-break: break-word;
|
|
color: #1f2937;
|
|
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 255, 0.92) 100%);
|
|
border: 1px solid rgba(226, 233, 244, 0.95);
|
|
backdrop-filter: blur(8px);
|
|
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
|
|
transition: all 0.2s ease;
|
|
|
|
.message-row.is-user & {
|
|
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
|
|
border-color: rgba(59, 130, 246, 0.4);
|
|
color: #fff;
|
|
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
|
|
}
|
|
}
|
|
|
|
.time {
|
|
font-size: 11px;
|
|
color: #8f9aae;
|
|
padding: 4px 6px;
|
|
|
|
.message-row.is-user & {
|
|
text-align: right;
|
|
color: rgba(148, 163, 184, 0.9);
|
|
}
|
|
.message-row:not(.is-user) & {
|
|
padding-left: 2px;
|
|
}
|
|
}
|
|
</style>
|