ai编写聊天界面
This commit is contained in:
+737
-39
@@ -1,20 +1,168 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="hello">
|
<div class="chat-page">
|
||||||
<el-input placeholder="请输入用户名" v-model="username" clearable>
|
<!-- 左侧导航 -->
|
||||||
</el-input>
|
<aside class="app-sidebar">
|
||||||
<el-input
|
<div class="avatar my-avatar">
|
||||||
placeholder="请输入密码"
|
{{ currentUser.username.charAt(0)}}
|
||||||
v-model="password"
|
</div>
|
||||||
show-password
|
|
||||||
></el-input>
|
<nav class="sidebar-nav" aria-label="功能导航">
|
||||||
<el-button
|
<button class="nav-item active" type="button" title="消息">
|
||||||
class="login-button"
|
💬
|
||||||
type="primary"
|
</button>
|
||||||
native-type="submit"
|
<button class="nav-item" type="button" title="联系人">
|
||||||
@click="handleLogout"
|
👥
|
||||||
>
|
</button>
|
||||||
退出
|
<button class="nav-item" type="button" title="设置">
|
||||||
</el-button>
|
⚙️
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="sidebar-footer">
|
||||||
|
<button class="nav-item" type="button" title="退出" @click="logout">
|
||||||
|
↪
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<!-- 左侧联系人 -->
|
||||||
|
<div class="contact-panel">
|
||||||
|
<!-- 用户信息 -->
|
||||||
|
<div class="user-header">
|
||||||
|
<!-- 用户信息 -->
|
||||||
|
<div class="my-info">
|
||||||
|
<div class="my-name">{{ currentUser.username }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 搜索框 -->
|
||||||
|
<div class="search-box">
|
||||||
|
<input v-model="searchText" type="text" placeholder="搜索联系人" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 联系人列表 -->
|
||||||
|
<div class="contact-list">
|
||||||
|
<div
|
||||||
|
v-for="contact in filteredContacts"
|
||||||
|
:key="contact.id"
|
||||||
|
class="contact-item"
|
||||||
|
:class="{
|
||||||
|
active: currentContact && currentContact.id === contact.id,
|
||||||
|
}"
|
||||||
|
@click="selectContact(contact)"
|
||||||
|
>
|
||||||
|
<div class="avatar">
|
||||||
|
{{ contact.name.charAt(0) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="contact-info">
|
||||||
|
<div class="contact-name">
|
||||||
|
{{ contact.name }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="last-message">
|
||||||
|
{{ getLastMessage(contact.id) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="contact.unread > 0" class="unread">
|
||||||
|
{{ contact.unread }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧聊天区域 -->
|
||||||
|
<div class="chat-panel">
|
||||||
|
<!-- 没有选择联系人 -->
|
||||||
|
<div v-if="!currentContact" class="empty-chat">
|
||||||
|
<div class="empty-icon">💬</div>
|
||||||
|
<div>请选择一个联系人开始聊天</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 当前聊天 -->
|
||||||
|
<template v-else>
|
||||||
|
<!-- 聊天顶部 -->
|
||||||
|
<div class="chat-header">
|
||||||
|
<div class="avatar">
|
||||||
|
{{ currentContact.name.charAt(0) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chat-user-info">
|
||||||
|
<div class="chat-user-name">
|
||||||
|
{{ currentContact.name }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chat-user-status">
|
||||||
|
{{ currentContact.online ? "在线" : "离线" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 消息区域 -->
|
||||||
|
<div ref="messageList" class="message-list">
|
||||||
|
<div
|
||||||
|
v-for="message in currentMessages"
|
||||||
|
:key="message.id"
|
||||||
|
class="message-row"
|
||||||
|
:class="{
|
||||||
|
'message-me': message.from === 'me',
|
||||||
|
'message-other': message.from === 'other',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<!-- 对方头像 -->
|
||||||
|
<div v-if="message.from === 'other'" class="avatar message-avatar">
|
||||||
|
{{ currentContact.name.charAt(0) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="message-content">
|
||||||
|
<div class="message-time">
|
||||||
|
{{ message.time }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="message-bubble">
|
||||||
|
{{ message.content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 我的头像 -->
|
||||||
|
<div
|
||||||
|
v-if="message.from === 'me'"
|
||||||
|
class="avatar message-avatar my-avatar"
|
||||||
|
>
|
||||||
|
我
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 输入区域 -->
|
||||||
|
<div class="input-panel">
|
||||||
|
<div class="toolbar">
|
||||||
|
<button type="button">😊</button>
|
||||||
|
<button type="button">📎</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<textarea
|
||||||
|
v-model="messageText"
|
||||||
|
placeholder="请输入消息..."
|
||||||
|
@keydown.enter.exact.prevent="sendMessage"
|
||||||
|
></textarea>
|
||||||
|
|
||||||
|
<div class="send-area">
|
||||||
|
<span class="enter-tip"> Enter 发送 </span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="send-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!messageText.trim()"
|
||||||
|
@click="sendMessage"
|
||||||
|
>
|
||||||
|
发送
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -22,44 +170,594 @@
|
|||||||
import { getUserInfo } from "@/utils/user";
|
import { getUserInfo } from "@/utils/user";
|
||||||
export default {
|
export default {
|
||||||
name: "ChatPage",
|
name: "ChatPage",
|
||||||
props: {},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
username: "",
|
currentUser: {},
|
||||||
password: "",
|
searchText: "",
|
||||||
|
messageText: "",
|
||||||
|
|
||||||
|
// 联系人
|
||||||
|
contacts: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "张三",
|
||||||
|
online: true,
|
||||||
|
unread: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "李四",
|
||||||
|
online: true,
|
||||||
|
unread: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "王五",
|
||||||
|
online: false,
|
||||||
|
unread: 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "赵六",
|
||||||
|
online: true,
|
||||||
|
unread: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// 当前聊天联系人
|
||||||
|
currentContact: null,
|
||||||
|
|
||||||
|
// 聊天消息
|
||||||
|
messages: {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
from: "other",
|
||||||
|
content: "你好!",
|
||||||
|
time: "15:20",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
from: "me",
|
||||||
|
content: "你好,最近怎么样?",
|
||||||
|
time: "15:21",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
from: "other",
|
||||||
|
content: "挺好的,你呢?",
|
||||||
|
time: "15:22",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
2: [
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
from: "other",
|
||||||
|
content: "晚上一起吃饭吗?",
|
||||||
|
time: "14:30",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
3: [
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
from: "other",
|
||||||
|
content: "明天记得开会。",
|
||||||
|
time: "10:15",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
4: [],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
getUserInfo().then(response => {
|
computed: {
|
||||||
this.username = response.data.username;
|
// 搜索联系人
|
||||||
}).catch(error => {
|
filteredContacts() {
|
||||||
console.error(error);
|
if (!this.searchText.trim()) {
|
||||||
this.$message.error("登录过期,请重新登录");
|
return this.contacts;
|
||||||
})
|
}
|
||||||
|
|
||||||
|
const keyword = this.searchText.trim().toLowerCase();
|
||||||
|
|
||||||
|
return this.contacts.filter((contact) =>
|
||||||
|
contact.name.toLowerCase().includes(keyword),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 当前联系人对应的消息
|
||||||
|
currentMessages() {
|
||||||
|
if (!this.currentContact) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.messages[this.currentContact.id] || [];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
// 默认选择第一个联系人
|
||||||
|
if (this.contacts.length > 0) {
|
||||||
|
this.selectContact(this.contacts[0]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getCurrentUser()
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleLogout() {
|
getCurrentUser() {
|
||||||
this.$store.commit("REMOVE_TOKEN", '');
|
// 获取当前登录用户信息
|
||||||
this.$store.commit("SET_USERNAME", '');
|
getUserInfo()
|
||||||
this.$router.push("/login");
|
.then((response) => {
|
||||||
|
this.currentUser = response.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
this.$message.error("获取用户信息失败,请重新登录");
|
||||||
|
this.$router.push("/login");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 选择联系人
|
||||||
|
selectContact(contact) {
|
||||||
|
this.currentContact = contact;
|
||||||
|
|
||||||
|
// 查看联系人后清除未读数量
|
||||||
|
contact.unread = 0;
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottom();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取最后一条消息
|
||||||
|
getLastMessage(contactId) {
|
||||||
|
const messageList = this.messages[contactId];
|
||||||
|
|
||||||
|
if (!messageList || messageList.length === 0) {
|
||||||
|
return "暂无消息";
|
||||||
|
}
|
||||||
|
|
||||||
|
return messageList[messageList.length - 1].content;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 发送消息
|
||||||
|
sendMessage() {
|
||||||
|
const content = this.messageText.trim();
|
||||||
|
|
||||||
|
if (!content || !this.currentContact) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.messages[this.currentContact.id]) {
|
||||||
|
this.$set(this.messages, this.currentContact.id, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.messages[this.currentContact.id].push({
|
||||||
|
id: Date.now(),
|
||||||
|
from: "me",
|
||||||
|
content: content,
|
||||||
|
time: this.getCurrentTime(),
|
||||||
|
});
|
||||||
|
|
||||||
|
// 清空输入框
|
||||||
|
this.messageText = "";
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottom();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
getCurrentTime() {
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
const hours = String(date.getHours()).padStart(2, "0");
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||||
|
|
||||||
|
return `${hours}:${minutes}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 滚动到底部
|
||||||
|
scrollToBottom() {
|
||||||
|
const messageList = this.$refs.messageList;
|
||||||
|
|
||||||
|
if (messageList) {
|
||||||
|
messageList.scrollTop = messageList.scrollHeight;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
h3 {
|
* {
|
||||||
margin: 40px 0 0;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
ul {
|
|
||||||
list-style-type: none;
|
.chat-page {
|
||||||
padding: 0;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
min-width: 980px;
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #333;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
li {
|
|
||||||
display: inline-block;
|
/* =========================
|
||||||
|
左侧导航栏(微信风格)
|
||||||
|
========================= */
|
||||||
|
|
||||||
|
.app-sidebar {
|
||||||
|
width: 78px;
|
||||||
|
height: 100%;
|
||||||
|
background: #f2f3f5;
|
||||||
|
border-right: 1px solid #e5e5e5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16px 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-logo {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(135deg, #67c23a, #4caf50);
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 22px;
|
||||||
|
box-shadow: 0 6px 14px rgba(103, 194, 58, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-nav {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: transparent;
|
||||||
|
color: #666;
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item:hover {
|
||||||
|
background: #e9edf3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item.active {
|
||||||
|
background: #dfeeff;
|
||||||
|
color: #409eff;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(64, 158, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-footer {
|
||||||
|
margin-top: auto;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================
|
||||||
|
左侧联系人
|
||||||
|
========================= */
|
||||||
|
|
||||||
|
.contact-panel {
|
||||||
|
width: 300px;
|
||||||
|
height: 100%;
|
||||||
|
background: #ffffff;
|
||||||
|
border-right: 1px solid #e5e5e5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-header {
|
||||||
|
height: 72px;
|
||||||
|
padding: 0 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #4c8bf5;
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-avatar {
|
||||||
|
background: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-name {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
padding: 12px;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box input {
|
||||||
|
width: 100%;
|
||||||
|
height: 34px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
border-radius: 4px;
|
||||||
|
outline: none;
|
||||||
|
background: #ffffff;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box input:focus {
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-list {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-item {
|
||||||
|
height: 70px;
|
||||||
|
padding: 0 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-item:hover {
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-item.active {
|
||||||
|
background: #eaf3ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-info {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-message {
|
||||||
|
margin-top: 7px;
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unread {
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0 5px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #f56c6c;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 11px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================
|
||||||
|
右侧聊天
|
||||||
|
========================= */
|
||||||
|
|
||||||
|
.chat-panel {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-header {
|
||||||
|
height: 72px;
|
||||||
|
padding: 0 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: #ffffff;
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-user-info {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-user-name {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-user-status {
|
||||||
|
margin-top: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-chat {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-list {
|
||||||
|
flex: 1;
|
||||||
|
padding: 25px 35px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-row {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-other {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-me {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-avatar {
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content {
|
||||||
|
max-width: 60%;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
a {
|
|
||||||
color: #42b983;
|
.message-time {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-me .message-time {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-bubble {
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #ffffff;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
word-break: break-word;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-me .message-bubble {
|
||||||
|
background: #95ec69;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================
|
||||||
|
输入区域
|
||||||
|
========================= */
|
||||||
|
|
||||||
|
.input-panel {
|
||||||
|
height: 180px;
|
||||||
|
padding: 10px 20px 15px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar button {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-panel textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 75px;
|
||||||
|
padding: 8px 0;
|
||||||
|
resize: none;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-area {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enter-tip {
|
||||||
|
margin-right: 15px;
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button {
|
||||||
|
width: 70px;
|
||||||
|
height: 32px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #409eff;
|
||||||
|
color: #ffffff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button:hover {
|
||||||
|
background: #66b1ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button:disabled {
|
||||||
|
background: #c0c4cc;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条 */
|
||||||
|
.contact-list::-webkit-scrollbar,
|
||||||
|
.message-list::-webkit-scrollbar {
|
||||||
|
width: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-list::-webkit-scrollbar-thumb,
|
||||||
|
.message-list::-webkit-scrollbar-thumb {
|
||||||
|
background: #ddd;
|
||||||
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user