refactor(agent): 重构智能对话页面布局和样式

- 重新设计了页面布局,分为左、右两个主要区域
- 左侧区域增加了聊天机器人信息展示,包括头像、名称、描述等
- 右侧区域保留聊天窗口,并增加了顶部栏
-优化了响应式布局,使页面在不同屏幕尺寸下都能良好显示
- 调整了颜色、字体等样式,提升了页面视觉效果
This commit is contained in:
林志军
2025-07-29 17:59:55 +08:00
parent f96b96e11f
commit 5f8ed6928c
2 changed files with 340 additions and 80 deletions

View File

@ -1,43 +1,49 @@
<template> <template>
<div class="chat-wrap"> <div>
<span @click="goChatIndex"> <icon-left /> 返回空间 </span> <span class="back-wap" @click="goChatIndex"> <icon-left /> 返回空间 </span>
<div class="chat-contain"> <div class="workflow-container">
<a-row :gutter="24" class="chat-grid"> <div class="left-wap" v-if="isCollapsed == false">
<!-- 左侧 HistoryChat --> <div class="header">
<a-col <div class="image-body">
:xs="isCollapsed ? 0 : 3" <img :src="cozeInfo?.image_url" />
:sm="isCollapsed ? 0 : 4" </div>
:md="isCollapsed ? 0 : 5" </div>
:lg="isCollapsed ? 0 : 6" <div class="content">
:xl="isCollapsed ? 0 : 7" <div class="title-body">
:xxl="isCollapsed ? 0 : 7" <div class="text">{{ cozeInfo?.name }}</div>
class="history-chat-col" <div class="tag-body">
> <div class="">
<HistoryChat v-if="cozeInfo?.bot_id && !isCollapsed" :cozeInfo="cozeInfo" /> <img class="status-icon" :src="chatbotIcon" />
</a-col> </div>
<div class="text">对话式</div>
</div>
</div>
<div class="use-body">
<div class="num">{{ cozeInfo?.views }}</div>
<div class="text">次使用</div>
</div>
</div>
<div class="description">
<div class="text">
{{ cozeInfo?.description }}
</div>
</div>
<!-- 右侧聊天内容 --> </div>
<a-col <div class="right-wap">
:xs="24" <div class="header">
:sm="isCollapsed ? 24 : 13" <div class="body">
:md="isCollapsed ? 24 : 14" <div class="">
:lg="isCollapsed ? 24 : 15"
:xl="isCollapsed ? 24 : 16"
:xxl="isCollapsed ? 24 : 16"
class="chat-content-col"
>
<a-card :bordered="false">
<div class="chat-content-col" style="min-height: fit-content">
<div class="toggle-btn" @click="toggleCollapse"> <div class="toggle-btn" @click="toggleCollapse">
<a-tooltip :content="isCollapsed ? '展开' : '折叠'"> <a-tooltip :content="isCollapsed ? '展开' : '折叠'">
<img class="status-icon" :src="isCollapsed ? menuUnfold : menuFold" /> <img class="status-icon" :src="isCollapsed ? menuUnfold : menuFold" />
</a-tooltip> </a-tooltip>
</div> </div>
<div id="coze-chat-container"></div>
</div> </div>
</a-card> </div>
</a-col> </div>
</a-row> <div class="content" id="coze-chat-container"></div>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -45,10 +51,11 @@
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { getChatAgent } from '@/api/all/agent'; import { getChatAgent } from '@/api/all/agent';
import HistoryChat from './components/HistoryChat.vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import menuFold from '@/assets/svg/menu-fold.svg'; import menuFold from '@/assets/svg/menu-fold.svg';
import menuUnfold from '@/assets/svg/menu-unfold.svg'; import menuUnfold from '@/assets/svg/menu-unfold.svg';
import workflow from '@/assets/svg/workflow.svg';
import chatbotIcon from '@/assets/svg/chatbot.svg';
const router = useRouter(); const router = useRouter();

View File

@ -1,48 +1,301 @@
.chat-wrap { .back-wap {
.chat-contain { width: 100%;
font-family: Avenir, Helvetica, Arial, sans-serif; height: 100%;
-webkit-font-smoothing: antialiased; margin-bottom: 20px;
-moz-osx-font-smoothing: grayscale; padding-left: 24px;
color: #2c3e50; padding-right: 24px;
margin-top: 24px; justify-content: flex-start;
align-items: center;
.span-back { gap: 4px;
color: var(--Text-2, #3C4043); display: inline-flex;
font-size: 14px; }
font-family: Alibaba PuHuiTi;
font-weight: 400; .workflow-container {
line-height: 62px; width: 100%;
word-wrap: break-word height: 100%;
} padding-left: 24px;
} padding-right: 24px;
justify-content: flex-start;
.span-back { align-items: center;
color: var(--Text-2, #3C4043); gap: 24px;
font-size: 14px; display: inline-flex;
font-family: Alibaba PuHuiTi;
font-weight: 400; .left-wap {
line-height: 22px; width: 360px;
word-wrap: break-word align-self: stretch;
} background: var(--BG-100, #F7F8FA);
.custom-sider { overflow: hidden;
width: 20% !important; // 强制覆盖 border-radius: 8px;
} flex-direction: column;
justify-content: flex-start;
@media (min-width: 1400px) and (max-width: 1799px) { align-items: flex-start;
.custom-sider { display: inline-flex;
width: 30% !important;
} .header {
} align-self: stretch;
height: 160px;
@media (min-width: 1800px) { flex-direction: column;
.custom-sider { justify-content: center;
width: 15% !important; align-items: center;
} gap: 10px;
} display: flex;
.toggle-btn{ .image-body {
margin-top: 10px; align-self: stretch;
margin-bottom: 10px; flex: 1 1 0;
} position: relative;
background: #FFEDED;
overflow: hidden;
border-radius: 8px;
img {
width: 408.90px;
height: 218px;
left: -24.45px;
top: -29px;
position: absolute
}
}
}
.content {
align-self: stretch;
padding-top: 15px;
padding-bottom: 15px;
justify-content: space-between;
align-items: flex-start;
display: inline-flex;
.title-body {
justify-content: flex-start;
align-items: center;
gap: 4px;
display: flex;
.text {
justify-content: center;
display: flex;
flex-direction: column;
color: var(--Text-1, #211F24);
font-size: 18px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 26px;
word-wrap: break-word;
}
.tag-body {
height: 20px;
padding-left: 8px;
padding-right: 8px;
background: var(--Functional-Red-1, #F0EDFF);
overflow: hidden;
border-radius: 2px;
justify-content: flex-start;
align-items: center;
gap: 4px;
display: flex;
.text {
color: var(--Functional-Red-6, #6D4CFE);
font-size: 12px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 20px;
word-wrap: break-word
}
}
}
.use-body {
width: 79px;
height: 24px;
position: relative;
.num {
left: 20px;
top: 0px;
position: absolute;
color: var(--Text-2, #3C4043);
font-size: 16px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 24px;
word-wrap: break-word
}
.text {
left: 43px;
top: 3px;
position: absolute;
color: var(--Text-3, #737478);
font-size: 12px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 20px;
word-wrap: break-word;
}
}
}
.description {
align-self: stretch;
overflow: hidden;
flex-direction: column;
justify-content: flex-start;
align-items: center;
gap: 10px;
display: flex;
.text {
align-self: stretch;
color: var(--Text-2, #3C4043);
font-size: 14px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 22px;
word-wrap: break-word;
}
}
.out-line {
align-self: stretch;
height: 40px;
flex-direction: column;
justify-content: center;
align-items: flex-start;
gap: 10px;
display: flex;
.out-line-div {
align-self: stretch;
height: 0px;
outline: 1px var(--Border-2, #E6E6E8) solid;
outline-offset: -0.50px;
}
}
.history {
align-self: stretch;
flex: 1 1 0;
position: relative;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
display: flex;
.section {
align-self: stretch;
height: 40px;
justify-content: flex-start;
align-items: center;
gap: 10px;
display: inline-flex;
.text {
color: var(--Text-3, #737478);
font-size: 14px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 22px;
word-wrap: break-word
}
}
.history-item {
align-self: stretch;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
display: flex;
.item-body {
align-self: stretch;
height: 40px;
padding: 8px;
border-radius: 8px;
justify-content: flex-start;
align-items: center;
gap: 10px;
display: inline-flex;
.text {
flex: 1 1 0;
color: var(--Text-1, #211F24);
font-size: 14px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 22px;
word-wrap: break-word;
}
}
}
}
}
.right-wap {
flex: 1 1 0;
align-self: stretch;
background: var(--BG-White, white);
overflow: hidden;
border-radius: 8px;
flex-direction: column;
.header {
align-self: stretch;
padding-left: 20px;
padding-right: 20px;
padding-top: 28px;
padding-bottom: 28px;
justify-content: flex-start;
align-items: center;
gap: 10px;
display: inline-flex;
.body {
width: 20px;
height: 20px;
position: relative;
overflow: hidden;
}
}
.content {
align-self: stretch;
border-top: 1px var(--Border-1, #D7D7D9) solid;
justify-content: space-between;
align-items: flex-start;
display: inline-flex;
.form {
width: 400px;
height: 796px;
padding: 20px;
position: relative;
border-right: 1px var(--Border-1, #D7D7D9) solid;
flex-direction: column;
justify-content: flex-start;
align-items: center;
gap: 32px;
display: inline-flex;
}
.res {
flex: 1 1 0;
align-self: stretch;
padding-left: 32px;
padding-right: 32px;
padding-top: 20px;
padding-bottom: 20px;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 32px;
display: inline-flex
}
}
}
} }