4
4
:class =" classObj"
5
5
v-loading =" loading"
6
6
:style =" {
7
- '--el-color-primary': applicationDetail?.custom_theme?.theme_color,
8
- '--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
7
+ '--el-color-primary': applicationDetail?.custom_theme?.theme_color,
8
+ '--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
9
9
}"
10
10
>
11
- <div class =" flex" >
12
- <div class =" chat-pc__left border-r" >
13
- <div class =" p-16-24 pb-0" >
14
- <div class =" flex align-center mb-16" >
15
- <div class =" flex" >
11
+ <div class =" flex h-full w-full" >
12
+ <div class =" chat-pc__left" >
13
+ <el-menu class =" w-full h-full" :default-active =" currentChatId" :collapse =" isPcCollapse" collapse-transition popper-class =" chat-pc-popper" >
14
+ <div style =" padding : 16px 18px 0 18px ;" >
15
+ <div class =" flex align-center mb-16" >
16
+ <div class =" flex" >
16
17
<el-avatar
17
18
v-if =" isAppIcon(applicationDetail?.icon)"
18
19
shape =" square"
23
24
</el-avatar >
24
25
<LogoIcon v-else height =" 28px" style =" width : 28px ; height : 28px ; display : block " />
25
26
</div >
26
- <h4 >{{ applicationDetail?.name }}</h4 >
27
+ <h4 v-show = " !isPcCollapse " >{{ applicationDetail?.name }}</h4 >
27
28
</div >
28
- <el-button class =" add-button w-full primary" @click =" newChat" >
29
+ <el-button v-show = " !isPcCollapse " class =" add-button w-full primary" @click =" newChat" >
29
30
<AppIcon iconName =" app-create-chat" ></AppIcon >
30
31
<span class =" ml-4" >{{ $t('chat.createChat') }}</span >
31
32
</el-button >
32
- <p class =" mt-20 mb-8" >{{ $t('chat.history') }}</p >
33
- </div >
34
- <div class =" left-height pt-0" >
35
- <el-scrollbar >
36
- <div class =" p-8 pt-0" >
37
- <common-list
38
- :style =" {
39
- '--el-color-primary': applicationDetail?.custom_theme?.theme_color,
40
- '--el-color-primary-light-9': hexToRgba(
41
- applicationDetail?.custom_theme?.theme_color,
42
- 0.1,
43
- ),
44
- }"
45
- :data =" chatLogData"
46
- class =" mt-8"
47
- v-loading =" left_loading"
48
- :defaultActive =" currentChatId"
49
- @click =" clickListHandle"
50
- @mouseenter =" mouseenter"
51
- @mouseleave =" mouseId = ''"
52
- >
53
- <template #default =" { row } " >
54
- <div class =" flex-between" >
55
- <span :title =" row.abstract" >
56
- {{ row.abstract }}
57
- </span >
58
- <div @click.stop v-show =" mouseId === row.id && row.id !== 'new'" >
59
- <el-dropdown trigger =" click" :teleported =" false" >
60
- <el-icon class =" rotate-90 mt-4" ><MoreFilled /></el-icon >
61
- <template #dropdown >
62
- <el-dropdown-menu >
63
- <el-dropdown-item @click.stop =" editLogTitle(row)" >
64
- <el-icon ><EditPen /></el-icon >
65
- {{ $t('common.edit') }}
66
- </el-dropdown-item >
67
- <el-dropdown-item @click.stop =" deleteLog(row)" >
68
- <el-icon ><Delete /></el-icon >
69
- {{ $t('common.delete') }}
70
- </el-dropdown-item >
71
- </el-dropdown-menu >
72
- </template >
73
- </el-dropdown >
33
+ <p v-show =" !isPcCollapse" class =" mt-20 mb-8" >{{ $t('chat.history') }}</p >
34
+ </div >
35
+ <div v-show =" !isPcCollapse" class =" left-height pt-0" >
36
+ <el-scrollbar >
37
+ <div class =" p-8 pt-0" >
38
+ <common-list
39
+ :style =" {
40
+ '--el-color-primary': applicationDetail?.custom_theme?.theme_color,
41
+ '--el-color-primary-light-9': hexToRgba(
42
+ applicationDetail?.custom_theme?.theme_color,
43
+ 0.1,
44
+ ),
45
+ }"
46
+ :data =" chatLogData"
47
+ class =" mt-8"
48
+ v-loading =" left_loading"
49
+ :defaultActive =" currentChatId"
50
+ @click =" clickListHandle"
51
+ @mouseenter =" mouseenter"
52
+ @mouseleave =" mouseId = ''"
53
+ >
54
+ <template #default =" { row } " >
55
+ <div class =" flex-between" >
56
+ <span :title =" row.abstract" >
57
+ {{ row.abstract }}
58
+ </span >
59
+ <div @click.stop v-show =" mouseId === row.id && row.id !== 'new'" >
60
+ <el-dropdown trigger =" click" :teleported =" false" >
61
+ <el-icon class =" rotate-90 mt-4" ><MoreFilled /></el-icon >
62
+ <template #dropdown >
63
+ <el-dropdown-menu >
64
+ <el-dropdown-item @click.stop =" editLogTitle(row)" >
65
+ <el-icon ><EditPen /></el-icon >
66
+ {{ $t('common.edit') }}
67
+ </el-dropdown-item >
68
+ <el-dropdown-item @click.stop =" deleteLog(row)" >
69
+ <el-icon ><Delete /></el-icon >
70
+ {{ $t('common.delete') }}
71
+ </el-dropdown-item >
72
+ </el-dropdown-menu >
73
+ </template >
74
+ </el-dropdown >
75
+ </div >
74
76
</div >
75
- </div >
76
- </template >
77
+ </template >
77
78
78
- <template #empty >
79
- <div class =" text-center" >
80
- <el-text type =" info" >{{ $t('chat.noHistory') }}</el-text >
79
+ <template #empty >
80
+ <div class =" text-center" >
81
+ <el-text type =" info" >{{ $t('chat.noHistory') }}</el-text >
82
+ </div >
83
+ </template >
84
+ </common-list >
85
+ </div >
86
+ <div v-if =" chatLogData?.length" class =" gradient-divider lighter mt-8" >
87
+ <span >{{ $t('chat.only20history') }}</span >
88
+ </div >
89
+ </el-scrollbar >
90
+ </div >
91
+ <el-menu-item index =" 1" v-show =" isPcCollapse" @click =" newChat" >
92
+ <AppIcon iconName =" app-create-chat" ></AppIcon >
93
+ <template #title >{{ $t('chat.createChat') }}</template >
94
+ </el-menu-item >
95
+ <el-sub-menu v-show =" isPcCollapse" index =" 2" >
96
+ <template #title >
97
+ <el-icon >
98
+ <location />
99
+ </el-icon >
100
+ </template >
101
+ <el-menu-item-group v-loading =" left_loading" >
102
+ <template #title ><span >{{ $t('chat.history') }}</span ></template >
103
+ <el-menu-item v-for =" row in chatLogData" :index =" row.id" :key =" row.id" @click =" clickListHandle(row)" >
104
+ <div class =" flex-between w-full lighter" >
105
+ <span :title =" row.abstract" >
106
+ {{ row.abstract }}
107
+ </span >
108
+ <div @click.stop class =" flex" v-show =" mouseId === row.id && row.id !== 'new'" >
109
+ <el-dropdown trigger =" click" :teleported =" false" >
110
+ <el-icon class =" rotate-90 mt-4" >
111
+ <MoreFilled />
112
+ </el-icon >
113
+ <template #dropdown >
114
+ <el-dropdown-menu >
115
+ <el-dropdown-item @click.stop =" editLogTitle(row)" >
116
+ <el-icon >
117
+ <EditPen />
118
+ </el-icon >
119
+ {{ $t('common.edit') }}
120
+ </el-dropdown-item >
121
+ <el-dropdown-item @click.stop =" deleteLog(row)" >
122
+ <el-icon >
123
+ <Delete />
124
+ </el-icon >
125
+ {{ $t('common.delete') }}
126
+ </el-dropdown-item >
127
+ </el-dropdown-menu >
128
+ </template >
129
+ </el-dropdown >
81
130
</div >
82
- </template >
83
- </common-list >
131
+ </div >
132
+ </el-menu-item >
133
+ </el-menu-item-group >
134
+ <div v-if =" !chatLogData?.length" class =" text-center" >
135
+ <el-text type =" info" >{{ $t('chat.noHistory') }}</el-text >
84
136
</div >
85
- <div v-if =" chatLogData?.length" class =" gradient-divider lighter mt-8" >
86
- <span >{{ $t('chat.only20history') }}</span >
87
- </div >
88
- </el-scrollbar >
89
- </div >
137
+ </el-sub-menu >
138
+ </el-menu >
139
+ <el-button v-if =" !common.isMobile()" class =" pc-collapse" circle size =" small" @click =" isPcCollapse = !isPcCollapse" >
140
+ <el-icon >
141
+ <component :is =" isPcCollapse ? 'Fold' : 'Expand'" />
142
+ </el-icon >
143
+ </el-button >
90
144
</div >
91
145
<div class =" chat-pc__right" >
92
146
<div class =" mb-24 p-16-24 flex-between" >
150
204
</template >
151
205
152
206
<script setup lang="ts">
153
- import { ref , onMounted , nextTick , computed } from ' vue'
207
+ import { ref , onMounted , nextTick , computed , watch } from ' vue'
154
208
import { marked } from ' marked'
155
209
import { saveAs } from ' file-saver'
156
210
import chatAPI from ' @/api/chat/chat'
@@ -167,6 +221,12 @@ const { user, chatLog, common } = useStore()
167
221
const EditTitleDialogRef = ref ()
168
222
169
223
const isCollapse = ref (false )
224
+ const isPcCollapse = ref (false )
225
+ watch (()=> common .device , () => {
226
+ if (common .isMobile ()) {
227
+ isPcCollapse .value = false
228
+ }
229
+ })
170
230
171
231
const customStyle = computed (() => {
172
232
return {
@@ -383,14 +443,15 @@ const init = () => {
383
443
// ) {
384
444
// getChatLog(applicationDetail.value.id)
385
445
// }
386
- getChatLog (applicationDetail .value .id )
446
+ getChatLog (applicationDetail .value ? .id )
387
447
}
388
448
onMounted (() => {
389
449
init ()
390
450
})
391
451
</script >
392
452
<style lang="scss">
393
453
.chat-pc {
454
+ height : 100% ;
394
455
overflow : hidden ;
395
456
background : #eef1f4 ;
396
457
@@ -408,11 +469,40 @@ onMounted(() => {
408
469
}
409
470
410
471
& __left {
411
- background :
412
- linear-gradient (187.61deg , rgba (235 , 241 , 255 , 0.5 ) 39.6% , rgba (231 , 249 , 255 , 0.5 ) 94.3% ),
413
- #eef1f4 ;
472
+ position : relative ;
473
+
474
+ .el-menu {
475
+ background :
476
+ linear-gradient (187.61deg , rgba (235 , 241 , 255 , 0.5 ) 39.6% , rgba (231 , 249 , 255 , 0.5 ) 94.3% ),
477
+ #eef1f4 ;
478
+
479
+ & :not (.el-menu--collapse ) {
480
+ width : 280px ;
481
+ }
414
482
415
- width : 280px ;
483
+ .el-menu-item :hover {
484
+ background : transparent ;
485
+ }
486
+
487
+ & .el-menu--collapse {
488
+ .el-menu-item ,.el-menu-tooltip__trigger ,.el-sub-menu__title {
489
+ padding : 0 ;
490
+ }
491
+
492
+ .el-menu-item .el-menu-tooltip__trigger ,.el-sub-menu__title {
493
+ position : static ;
494
+ width : 40px ;
495
+ height : 40px ;
496
+ border-radius : 6px ;
497
+ align-items : center ;
498
+ justify-content : center ;
499
+ margin : 0 auto ;
500
+ }
501
+ .el-menu-item :hover .el-menu-tooltip__trigger ,.el-sub-menu__title :hover {
502
+ background-color : #1F23291A ;
503
+ }
504
+ }
505
+ }
416
506
417
507
.add-button {
418
508
border : 1px solid var (--el-color-primary );
@@ -421,10 +511,17 @@ onMounted(() => {
421
511
.left-height {
422
512
height : calc (100vh - 140px );
423
513
}
514
+
515
+ .pc-collapse {
516
+ position : absolute ;
517
+ top : 20px ;
518
+ right : -12px ;
519
+ box-shadow : 0px 5px 10px 0px #1F23291A ;
520
+ }
424
521
}
425
522
426
523
& __right {
427
- width : calc ( 100 % - 280 px ) ;
524
+ flex : 1 ;
428
525
overflow : hidden ;
429
526
position : relative ;
430
527
box-sizing : border-box ;
@@ -464,6 +561,27 @@ onMounted(() => {
464
561
display : none ;
465
562
}
466
563
}
564
+
565
+ .chat-pc-popper {
566
+ .el-menu-item-group__title {
567
+ padding-bottom : 16px ;
568
+ font-weight : 500 ;
569
+ color : var (--app-text-color-secondary );
570
+ }
571
+ .el-menu-item {
572
+ border-radius : 6px ;
573
+ height : 40px ;
574
+ margin : 0 8px ;
575
+ padding-left : 8px ;
576
+ padding-right : 8px ;
577
+ & :hover {
578
+ background-color : #1F23291A ;
579
+ }
580
+ & .is-active {
581
+ background-color : #3370FF1A ;
582
+ }
583
+ }
584
+ }
467
585
// 适配移动端
468
586
.mobile {
469
587
.chat-pc {
@@ -489,6 +607,9 @@ onMounted(() => {
489
607
width : 100% ;
490
608
z-index : 99 ;
491
609
height : calc (100vh );
610
+ .el-menu {
611
+ width : 100% ;
612
+ }
492
613
}
493
614
}
494
615
.collapse {
0 commit comments