Skip to content

Commit 9a16b2b

Browse files
committed
reactor:【AI 大模型】chat/role 简化成 unocss
1 parent 9a209a8 commit 9a16b2b

File tree

3 files changed

+53
-170
lines changed

3 files changed

+53
-170
lines changed

src/views/ai/chat/index/components/conversation/ConversationList.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
class="conversation-item classify-title"
3232
v-if="conversationMap[conversationKey].length"
3333
>
34-
<el-text class="mx-1" size="small" tag="b">{{ conversationKey }}</el-text>
34+
<el-text class="mx-1" size="small" tag="b">
35+
{{ conversationKey }}
36+
</el-text>
3537
</div>
3638
<div
3739
class="conversation-item"
@@ -193,12 +195,12 @@ const getConversationGroupByCreateTime = async (list: ChatConversationVO[]) => {
193195
// 排序、指定、时间分组(今天、一天前、三天前、七天前、30天前)
194196
// noinspection NonAsciiCharacters
195197
const groupMap = {
196-
置顶: [],
197-
今天: [],
198-
一天前: [],
199-
三天前: [],
200-
七天前: [],
201-
三十天前: []
198+
置顶: [] as ChatConversationVO[],
199+
今天: [] as ChatConversationVO[],
200+
一天前: [] as ChatConversationVO[],
201+
三天前: [] as ChatConversationVO[],
202+
七天前: [] as ChatConversationVO[],
203+
三十天前: [] as ChatConversationVO[]
202204
}
203205
// 当前时间的时间戳
204206
const now = Date.now()
Lines changed: 23 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
<template>
2-
<div class="card-list" ref="tabsRef" @scroll="handleTabsScroll">
3-
<div class="card-item" v-for="role in roleList" :key="role.id">
4-
<el-card class="card" body-class="card-body">
2+
<div
3+
class="flex flex-row flex-wrap relative h-full overflow-auto px-25px pb-140px items-start content-start justify-start"
4+
ref="tabsRef"
5+
@scroll="handleTabsScroll"
6+
>
7+
<div v-for="role in roleList" :key="role.id">
8+
<el-card
9+
class="inline-block mr-20px rounded-10px mb-20px relative"
10+
body-class="max-w-240px w-240px pt-15px px-15px pb-10px flex flex-row justify-start relative"
11+
>
512
<!-- 更多操作 -->
6-
<div class="more-container" v-if="showMore">
13+
<div class="absolute top-0 right-12px" v-if="showMore">
714
<el-dropdown @command="handleMoreClick">
815
<span class="el-dropdown-link">
916
<el-button type="text">
@@ -24,14 +31,18 @@
2431
</div>
2532
<!-- 角色信息 -->
2633
<div>
27-
<img class="avatar" :src="role.avatar" />
34+
<img class="w-40px h-40px rounded-10px overflow-hidden" :src="role.avatar" />
2835
</div>
29-
<div class="right-container">
30-
<div class="content-container">
31-
<div class="title">{{ role.name }}</div>
32-
<div class="description">{{ role.description }}</div>
36+
<div class="ml-10px w-full">
37+
<div class="h-85px">
38+
<div class="text-18px font-bold" style="color: var(--el-text-color-primary)">
39+
{{ role.name }}
40+
</div>
41+
<div class="mt-10px text-14px" style="color: var(--el-text-color-regular)">
42+
{{ role.description }}
43+
</div>
3344
</div>
34-
<div class="btn-container">
45+
<div class="flex flex-row-reverse mt-2px">
3546
<el-button type="primary" size="small" @click="handleUseClick(role)">使用</el-button>
3647
</div>
3748
</div>
@@ -79,7 +90,7 @@ const handleMoreClick = async (data) => {
7990
}
8091
8192
/** 选中 */
82-
const handleUseClick = (role) => {
93+
const handleUseClick = (role: any) => {
8394
emits('onUse', role)
8495
}
8596
@@ -88,87 +99,8 @@ const handleTabsScroll = async () => {
8899
if (tabsRef.value) {
89100
const { scrollTop, scrollHeight, clientHeight } = tabsRef.value
90101
if (scrollTop + clientHeight >= scrollHeight - 20 && !props.loading) {
91-
await emits('onPage')
102+
emits('onPage')
92103
}
93104
}
94105
}
95106
</script>
96-
97-
<style lang="scss">
98-
// 重写 card 组件 body 样式
99-
.card-body {
100-
max-width: 240px;
101-
width: 240px;
102-
padding: 15px 15px 10px 15px;
103-
104-
display: flex;
105-
flex-direction: row;
106-
justify-content: flex-start;
107-
position: relative;
108-
}
109-
</style>
110-
<style scoped lang="scss">
111-
// 卡片列表
112-
.card-list {
113-
display: flex;
114-
flex-direction: row;
115-
flex-wrap: wrap;
116-
position: relative;
117-
height: 100%;
118-
overflow: auto;
119-
padding: 0px 25px;
120-
padding-bottom: 140px;
121-
align-items: start;
122-
align-content: flex-start;
123-
justify-content: start;
124-
125-
.card {
126-
display: inline-block;
127-
margin-right: 20px;
128-
border-radius: 10px;
129-
margin-bottom: 20px;
130-
position: relative;
131-
132-
.more-container {
133-
position: absolute;
134-
top: 0;
135-
right: 12px;
136-
}
137-
138-
.avatar {
139-
width: 40px;
140-
height: 40px;
141-
border-radius: 10px;
142-
overflow: hidden;
143-
}
144-
145-
.right-container {
146-
margin-left: 10px;
147-
width: 100%;
148-
//height: 100px;
149-
150-
.content-container {
151-
height: 85px;
152-
153-
.title {
154-
font-size: 18px;
155-
font-weight: bold;
156-
color: var(--el-text-color-primary);
157-
}
158-
159-
.description {
160-
margin-top: 10px;
161-
font-size: 14px;
162-
color: var(--el-text-color-regular);
163-
}
164-
}
165-
166-
.btn-container {
167-
display: flex;
168-
flex-direction: row-reverse;
169-
margin-top: 2px;
170-
}
171-
}
172-
}
173-
}
174-
</style>

src/views/ai/chat/index/components/role/RoleRepository.vue

Lines changed: 21 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<!-- chat 角色仓库 -->
22
<template>
3-
<el-container class="role-container">
3+
<el-container
4+
class="role-container absolute w-full h-full m-0 p-0 left-0 right-0 top-0 bottom-0 bg-[var(--el-bg-color)] overflow-hidden flex !flex-col"
5+
>
46
<ChatRoleForm ref="formRef" @success="handlerAddRoleSuccess" />
5-
<!-- header -->
7+
<!-- header -->
68
<RoleHeader title="角色仓库" class="relative" />
7-
<!-- main -->
8-
<el-main class="role-main">
9-
<div class="search-container">
9+
<!-- main -->
10+
<el-main class="flex-1 overflow-hidden m-0 !p-0 relative">
11+
<div class="mx-5 mt-5 mb-0 absolute right-0 -top-1.25 z-100">
1012
<!-- 搜索按钮 -->
1113
<el-input
1214
:loading="loading"
1315
v-model="search"
14-
class="search-input"
16+
class="!w-60"
1517
size="default"
1618
placeholder="请输入搜索的内容"
1719
:suffix-icon="Search"
@@ -23,13 +25,21 @@
2325
@click="handlerAddRole"
2426
class="ml-20px"
2527
>
26-
<Icon icon="ep:user" style="margin-right: 5px" />
28+
<Icon icon="ep:user" class="mr-1.25" />
2729
添加角色
2830
</el-button>
2931
</div>
3032
<!-- tabs -->
31-
<el-tabs v-model="activeTab" class="tabs" @tab-click="handleTabsClick">
32-
<el-tab-pane class="role-pane" label="我的角色" name="my-role">
33+
<el-tabs
34+
v-model="activeTab"
35+
@tab-click="handleTabsClick"
36+
class="relative h-full [&_.el-tabs__nav-scroll]:my-2.5 [&_.el-tabs__nav-scroll]:mx-5"
37+
>
38+
<el-tab-pane
39+
label="我的角色"
40+
name="my-role"
41+
class="flex flex-col h-full overflow-y-auto relative"
42+
>
3343
<RoleList
3444
:loading="loading"
3545
:role-list="myRoleList"
@@ -43,7 +53,7 @@
4353
</el-tab-pane>
4454
<el-tab-pane label="公共角色" name="public-role">
4555
<RoleCategoryList
46-
class="role-category-list"
56+
class="mx-6.75"
4757
:category-list="categoryList"
4858
:active="activeCategory"
4959
@on-category-click="handlerCategoryClick"
@@ -220,70 +230,9 @@ onMounted(async () => {
220230
await getActiveTabsRole()
221231
})
222232
</script>
223-
<!-- 覆盖 element ui css -->
233+
<!-- 覆盖 element plus css -->
224234
<style lang="scss">
225-
.el-tabs__content {
226-
position: relative;
227-
height: 100%;
228-
overflow: hidden;
229-
}
230235
.el-tabs__nav-scroll {
231236
margin: 10px 20px;
232237
}
233238
</style>
234-
<!-- 样式 -->
235-
<style scoped lang="scss">
236-
// 跟容器
237-
.role-container {
238-
position: absolute;
239-
width: 100%;
240-
height: 100%;
241-
margin: 0;
242-
padding: 0;
243-
left: 0;
244-
right: 0;
245-
top: 0;
246-
bottom: 0;
247-
background-color: var(--el-bg-color);
248-
overflow: hidden;
249-
display: flex;
250-
flex-direction: column;
251-
252-
.role-main {
253-
flex: 1;
254-
overflow: hidden;
255-
margin: 0;
256-
padding: 0;
257-
position: relative;
258-
259-
.search-container {
260-
margin: 20px 20px 0px 20px;
261-
position: absolute;
262-
right: 0;
263-
top: -5px;
264-
z-index: 100;
265-
}
266-
267-
.search-input {
268-
width: 240px;
269-
}
270-
271-
.tabs {
272-
position: relative;
273-
height: 100%;
274-
275-
.role-category-list {
276-
margin: 0 27px;
277-
}
278-
}
279-
280-
.role-pane {
281-
display: flex;
282-
flex-direction: column;
283-
height: 100%;
284-
overflow-y: auto;
285-
position: relative;
286-
}
287-
}
288-
}
289-
</style>

0 commit comments

Comments
 (0)