From df1649e7c564cbe10e8181ad8d8ac814be71b156 Mon Sep 17 00:00:00 2001 From: yangzhe Date: Wed, 17 Dec 2025 09:14:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95):=20?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B9=B6=E6=B7=BB=E5=8A=A0AI=E5=92=A8=E8=AF=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/history/index.vue | 118 ++++++++++++++++++++++------ static/common/images/icon_chat2.png | Bin 0 -> 1251 bytes static/common/images/icon_chat3.png | Bin 0 -> 1174 bytes 3 files changed, 92 insertions(+), 26 deletions(-) create mode 100644 static/common/images/icon_chat2.png create mode 100644 static/common/images/icon_chat3.png diff --git a/pages/home/history/index.vue b/pages/home/history/index.vue index e44797c..5872706 100644 --- a/pages/home/history/index.vue +++ b/pages/home/history/index.vue @@ -46,12 +46,16 @@ - {{ group.header }} + {{ group.id }} - + - B + {{ item.title }} - {{ item.content }} + @@ -178,9 +185,20 @@ export default { type: "human", }, ], + chatHistoryAI: [], // ai咨询历史记录 + chatHistoryTeacher: [], // 人工咨询历史记录 }; }, computed: { + // 当前tab的历史记录 + currentHistoryList() { + if (this.activeTab === "1") { + return this.chatHistoryAI; + } else { + return this.chatHistoryTeacher; + } + }, + // 根据当前tab过滤历史记录 filteredHistoryList() { return this.historyList.filter((item) => { @@ -220,7 +238,58 @@ export default { return groups; }, }, + + onLoad() { + this.getChatHistoryList(); + // this.GetDialogueList_User(); + }, + methods: { + // 获取ai历史记录 + async getChatHistoryList() { + this.$u.api.GetConversationPage().then((res) => { + this.chatHistoryAI = res.data; + // if (this.chatHistoryAI.length > 0) { + // this.chatHistoryAI = res.data.map((group) => { + // // 对每个组的conversation数组进行倒序排序 + // return { + // ...group, + // conversation: group.conversation.sort((a, b) => { + // // 将日期字符串转换为时间戳并比较(倒序) + // return ( + // new Date(b.startTime).getTime() - + // new Date(a.startTime).getTime() + // ); + // }), + // }; + // }); + // } + console.log("this.chatHistoryAI", this.chatHistoryAI); + }); + }, + + // 获取人工咨询数据 + async GetDialogueList_User() { + this.$u.api.GetDialogueList_UserApi().then((res) => { + this.chatHistoryTeacher = res.data; + // if (this.chatHistoryTeacher.length > 0) { + // this.chatHistoryTeacher = res.data.map((group) => { + // // 对每个组的conversation数组进行倒序排序 + // return { + // ...group, + // conversation: group.conversation.sort((a, b) => { + // // 将日期字符串转换为时间戳并比较(倒序) + // return ( + // new Date(b.startTime).getTime() - + // new Date(a.startTime).getTime() + // ); + // }), + // }; + // }); + // } + }); + }, + // 格式化时间显示 formatTime(timestamp) { const now = new Date(); @@ -277,6 +346,12 @@ export default { switchTab(tab) { this.activeTab = tab; + // 切换tab时,刷新当前tab的历史记录 + if (tab === "1") { + this.getChatHistoryList(); + } else { + this.GetDialogueList_User(); + } }, // 显示/隐藏右上角更多菜单 @@ -348,6 +423,10 @@ export default { (item) => !this.selectedItems.includes(item.id) ); + console.log('删除后的历史记录:',this.historyList); + + return + // 重置状态 this.selectedItems = []; this.selectAll = false; @@ -358,18 +437,6 @@ export default { type: "success", }); }, - - handleDelete(item, callback) { - console.log("handleDelete", item); - - setTimeout(() => { - this.$refs.uToast.show({ - title: "撤回成功", - type: "success", - }); - callback(true); - }, 1500); - }, }, }; @@ -543,22 +610,21 @@ export default { .item-header { display: flex; align-items: center; - margin-bottom: 24rpx; + margin-bottom: 30rpx; .item-icon { - width: 48rpx; - height: 48rpx; - background-color: #4f6aff; + width: 50rpx; + height: 50rpx; + background-color: rgba(79, 106, 255, 0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 16rpx; - .icon-text { - color: #ffffff; - font-size: 24rpx; - font-weight: bold; + .icon-image { + width: 26rpx; + height: 26rpx; } } diff --git a/static/common/images/icon_chat2.png b/static/common/images/icon_chat2.png new file mode 100644 index 0000000000000000000000000000000000000000..0dcd7fff288e138286adcef341c28177517d9009 GIT binary patch literal 1251 zcmeAS@N?(olHy`uVBq!ia0vp^;y^6M!3HF?%h*|glw^r(L`iUdT1k0gQ7VIDN`6wR zf@f}GdTLN=VoGJ<$y6H#24>~Vkcg59UmvUF{9L_6kQ%*;+ybC(1_m4Zih{)C?9>v4 zq}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyvDB0U7*i={n4aiL` zNmQuF&B-gas<2f8n`;GRgM{^!6u?SKvTcwn^Gtf;oFfdXux70H< zGch(Z&`~flFf!0LFw!?P)-^D+GBCF?GE#s7C7^9ZDQQ+gE^bh}fIM5JjFOT9D}DX) z@^Za$W4-*MbbUihOG}U$Mn<|o6}rWhc_oPzx_QOQFcVx-i<65o3raHc^AtcPCMM;V zme?u*T?+9+ZUNlbykclD0Rv3GBC$ZMv>2~2MaLa!4}y`Z#^TL84#CABECEH%ZgC_h&L>}RV?+-|YJ zX&zK>3U0Sp;?%1Tbc{YIW|3kVCIn1AASOKB0y*%MpPC0u?nS_K{j_1nUIqrnFi#i9 zkcwMdrta2f2^48hzvi*$klR`zuX+Z>dA%ATyLvM;zVR=(jkw4jd?RatvxQhe)6yCM?rY0PD;_KC~`d_e5=!E){ zjaS@eF6a}yYLTCL%DKDwF^^fzliLRGBBt?QU_QO>6L&>pI{VJEH&>lM@jTI$|DWjd zRk`Uqr(W_A{b?1WHunM(Pw38l9Cz30|ImHzpY{Ayg>Ukc%@^2ZHtzAlGvA+Ax>8gSq`5sT{=&6c zk3_E7JiT_6y+HJQ&dr$p6o8ZZ>kb^JH$ SA6F)**zt7rb6Mw<&;$UzhrwC^ literal 0 HcmV?d00001 diff --git a/static/common/images/icon_chat3.png b/static/common/images/icon_chat3.png new file mode 100644 index 0000000000000000000000000000000000000000..4967e225c52f86d7f17e151534bb8064207232f2 GIT binary patch literal 1174 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoM!3HGxw}u@936!`-lmzFem6RtIr7}3C0@_xTl4cd;;s&(~$g@?-C@Cqh($_C9 zFV`zK*2^zS*Eh7Zv;>)9WTXpJp<7&;SCUwvn^&w1Gr=XbIJqdZpd>RtPXT0NVp4u- ziLDaQr4TRV7Ql_oD~1LWFu?RH5)1SV^$b8>f+_U%#ji9s7p}UvBq$Z(UaSTehg24% z>IbD3=a&{G10ya?8Dv#~m2**QVo82cNPd0}EEEGW@=NlIGx7@*j12V*6*R&#^HTE5 zi#5R-e0{Av^NLFn^O93NU2K(rM(AZ`rdS!9x>*>RnK`;RnmQU9x*0eE!`#`x#N5%) z#Kq0k(gdd0B|o_|H#M&WrZ)wl*9oUyP+G_>0NU)5T9jFqn&MWJpQ`}&vsET;w^-mb z52`l>w_7Z6>eUB2MjsTjNHGl)0wy026P|8?9C*r4%>yR)B4D~Uxf;*Rz`)4q>Eakt zaVzP|`CsP`9XPOorK7n~;>a?wA6!Rl9qt@pQE_Utm~%?3fx%qhI`c-e6GD}2x0oE& z*sK_KML225?PK_uuXN@iLy}*SP9)cnjShe2b9hHI{$LT1o|x6CAmGjLkzYwikS&R^ zsOAytk@IanNBFz0e4TOP%2C!{`$@Vpd5>hOw45+hFjK!OWE!xO`N;jw4K6GlOHY36 zv=xY#^o@Nn?a$(N)%1*vfAR|ZxVwJTI?Q1{vd`fR_YpA{mdDNtbq)&rji>g^boe7P zZPzj?-=Bu9LJtVJ*|6yH~to?@zd~y}^Q~n891JWH3_pr=T6Vm#`T{B`JYD@<);T3K0RTUPhz9@w literal 0 HcmV?d00001