mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
优化聊天样式
This commit is contained in:
parent
a13c1bc669
commit
3e088cb76f
@ -85,3 +85,11 @@ export function setChat(chat) {
|
|||||||
chatList[chat.id] = chat;
|
chatList[chat.id] = chat;
|
||||||
Storage.set(ChatListKey, chatList);
|
Storage.set(ChatListKey, chatList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function removeChat(chatId) {
|
||||||
|
const chatList = Storage.get(ChatListKey);
|
||||||
|
if (chatList) {
|
||||||
|
delete chatList[chatId];
|
||||||
|
Storage.set(ChatListKey, chatList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,21 +2,14 @@
|
|||||||
<div class="chat-free-page">
|
<div class="chat-free-page">
|
||||||
<div class="sidebar" id="sidebar">
|
<div class="sidebar" id="sidebar">
|
||||||
<nav>
|
<nav>
|
||||||
<div class="new-chat" @click="newChat">
|
<ul>
|
||||||
<a>
|
<li class="new-chat" @click="newChat"><a>
|
||||||
<span class="icon"><el-icon><Plus/></el-icon></span>
|
<span class="icon"><el-icon><Plus/></el-icon></span>
|
||||||
<span class="text">新建会话</span>
|
<span class="text">新建会话</span>
|
||||||
<span class="btn" @click="toggleSidebar"><el-button size="small" type="info" circle><el-icon><CloseBold/></el-icon></el-button></span>
|
<span class="btn" @click="toggleSidebar"><el-button size="small" type="info" circle><el-icon><CloseBold/></el-icon></el-button></span>
|
||||||
</a>
|
</a></li>
|
||||||
</div>
|
<li v-for="chat in chatList" :key="chat.id" @click="changeChat(chat)"
|
||||||
|
:class="chat.id === curChat.id ? 'active' : ''"><a>
|
||||||
<ul>
|
|
||||||
<!-- <li class="new-chat" @click="newChat"><a>-->
|
|
||||||
<!-- <span class="icon"><el-icon><Plus/></el-icon></span>-->
|
|
||||||
<!-- <span class="text">新建会话</span>-->
|
|
||||||
<!-- <span class="btn" @click="toggleSidebar"><el-button size="small" type="info" circle><el-icon><CloseBold/></el-icon></el-button></span>-->
|
|
||||||
<!-- </a></li>-->
|
|
||||||
<li v-for="chat in chatList" :key="chat.id" @click="changeChat(chat)" :class="chat.active ? 'active' : ''"><a>
|
|
||||||
<span class="icon"><el-icon><ChatRound/></el-icon></span>
|
<span class="icon"><el-icon><ChatRound/></el-icon></span>
|
||||||
|
|
||||||
<span class="text" v-if="chat.edit">
|
<span class="text" v-if="chat.edit">
|
||||||
@ -161,7 +154,7 @@ import {
|
|||||||
getChatList,
|
getChatList,
|
||||||
getSessionId,
|
getSessionId,
|
||||||
getUserInfo,
|
getUserInfo,
|
||||||
setLoginUser
|
setLoginUser, removeChat
|
||||||
} from "@/utils/storage";
|
} from "@/utils/storage";
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {isMobile, randString} from "@/utils/libs";
|
import {isMobile, randString} from "@/utils/libs";
|
||||||
@ -549,7 +542,6 @@ export default defineComponent({
|
|||||||
id: randString(32),
|
id: randString(32),
|
||||||
edit: false, // 是否处于编辑模式
|
edit: false, // 是否处于编辑模式
|
||||||
removing: false, // 是否处于删除模式
|
removing: false, // 是否处于删除模式
|
||||||
active: false,
|
|
||||||
title: '新会话 - 0'
|
title: '新会话 - 0'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -571,11 +563,9 @@ export default defineComponent({
|
|||||||
chat.edit = false;
|
chat.edit = false;
|
||||||
setChat(chat)
|
setChat(chat)
|
||||||
} else if (this.curOpt === 'remove') {
|
} else if (this.curOpt === 'remove') {
|
||||||
for (let i = 0; i < this.chatList.length; i++) {
|
delete this.chatList[chat.id];
|
||||||
if (this.chatList[i].id === chat.id) {
|
removeChat(chat.id);
|
||||||
this.chatList.remove(i)
|
chat.removing = false;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -596,8 +586,6 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.curChat.active = false;
|
|
||||||
chat.active = true;
|
|
||||||
this.curChat = chat;
|
this.curChat = chat;
|
||||||
const chatHistory = getChatHistory(chat.id);
|
const chatHistory = getChatHistory(chat.id);
|
||||||
if (!chatHistory) {
|
if (!chatHistory) {
|
||||||
@ -627,50 +615,11 @@ export default defineComponent({
|
|||||||
padding 0
|
padding 0
|
||||||
width 100%
|
width 100%
|
||||||
height calc(100vh - 150px)
|
height calc(100vh - 150px)
|
||||||
border 1px solid red;
|
|
||||||
overflow-y auto
|
overflow-y auto
|
||||||
|
|
||||||
.new-chat {
|
|
||||||
position fixed;
|
|
||||||
color: #ffffff
|
|
||||||
padding 10px;
|
|
||||||
cursor pointer
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color #3E3F49
|
|
||||||
|
|
||||||
a {
|
|
||||||
.btn {
|
|
||||||
display block
|
|
||||||
background-color: #3E3F49;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
border: 1px solid #4A4B4D;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius 5px;
|
|
||||||
width 100%;
|
|
||||||
display flex;
|
|
||||||
padding 10px;
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
display none
|
|
||||||
right -2px;
|
|
||||||
top -2px;
|
|
||||||
|
|
||||||
.el-icon {
|
|
||||||
margin-left 0;
|
|
||||||
color #ffffff
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
list-style-type: none
|
list-style-type: none
|
||||||
padding 50px 5px 5px 5px
|
padding 8px
|
||||||
margin 0
|
margin 0
|
||||||
|
|
||||||
li {
|
li {
|
||||||
@ -935,8 +884,10 @@ export default defineComponent({
|
|||||||
nav {
|
nav {
|
||||||
ul {
|
ul {
|
||||||
li.new-chat {
|
li.new-chat {
|
||||||
.btn {
|
a {
|
||||||
display inline
|
.btn {
|
||||||
|
display inline
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user