From 96d58abc2f837297c078ada2a91cf688378bfd55 Mon Sep 17 00:00:00 2001 From: YiLin <482244139@qq.com> Date: Fri, 7 Aug 2026 17:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BC=9A=E8=AF=9D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=92=8C=E8=BD=AC=E5=8F=91=EF=BC=8C=E8=BD=AC=E5=8F=91?= =?UTF-8?q?=E5=BE=85=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ChatSidebar.vue | 17 +- pages/Chat/Chat.css | 276 ++++++++++- pages/Chat/Chat.vue | 404 +++++++++++++++- static/iconfont/demo_index.html | 52 +- static/iconfont/iconfont.css | 14 +- static/iconfont/iconfont.js | 2 +- static/iconfont/iconfont.json | 14 + static/iconfont/iconfont.ttf | Bin 23104 -> 23604 bytes static/iconfont/iconfont.woff | Bin 12024 -> 12360 bytes static/iconfont/iconfont.woff2 | Bin 9952 -> 10240 bytes unpackage/dist/dev/app-plus/app-service.js | 444 ++++++++++++++---- unpackage/dist/dev/app-plus/app.css | 12 +- .../dist/dev/app-plus/pages/Chat/Chat.css | 401 +++++++++++++++- .../dist/dev/app-plus/pages/text/text.css | 236 +++++++++- .../app-plus/static/iconfont/demo_index.html | 52 +- .../dev/app-plus/static/iconfont/iconfont.css | 14 +- .../dev/app-plus/static/iconfont/iconfont.js | 2 +- .../app-plus/static/iconfont/iconfont.json | 14 + .../dev/app-plus/static/iconfont/iconfont.ttf | Bin 23104 -> 23604 bytes .../app-plus/static/iconfont/iconfont.woff | Bin 12024 -> 12360 bytes .../app-plus/static/iconfont/iconfont.woff2 | Bin 9952 -> 10240 bytes 21 files changed, 1845 insertions(+), 109 deletions(-) diff --git a/components/ChatSidebar.vue b/components/ChatSidebar.vue index b9553fb..865b2e7 100644 --- a/components/ChatSidebar.vue +++ b/components/ChatSidebar.vue @@ -72,10 +72,7 @@ - - {{truncateText(chat.agent_data?.title) || "加载中"}} - - {{truncateText(chat.title)}} + {{truncateText(getConvName(chat))}} maxLength ? text.substring(0, maxLength) + '...' : text } + // 获取会话名称:agent_title > 清理后的title > 格式化时间 + const getConvName = (conv) => { + if (conv.agent_data?.title) return conv.agent_data.title + if (conv.title && !conv.title.startsWith('[文件信息')) return conv.title + if (conv.created_at) { + const t = conv.created_at + const pad = (n) => String(n).padStart(2, '0') + return `${t.year}年${t.month}月${t.day}日 ${pad(t.hour)}:${pad(t.minute)}:${pad(t.second)}` + } + return '未命名会话' + } + onMounted(async () => { UserToken.value = getToken() const UserInfo = await getUserInfo(UserToken.value) diff --git a/pages/Chat/Chat.css b/pages/Chat/Chat.css index 204e5b3..3ea9bb2 100644 --- a/pages/Chat/Chat.css +++ b/pages/Chat/Chat.css @@ -400,6 +400,191 @@ background: #e0e0e0; } +/* ========== 转发消息弹窗 ========== */ +.forward-modal-mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.45); + backdrop-filter: blur(4px); + -webkit-backdrop-filter: blur(4px); + z-index: 1001; + display: flex; + align-items: center; + justify-content: center; +} + +.forward-modal { + width: 85%; + max-height: 72%; + background-color: #fff; + border-radius: 24rpx; + overflow: hidden; + display: flex; + flex-direction: column; + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.12); +} + +.forward-modal-header { + display: flex; + justify-content: center; + align-items: center; + position: relative; + padding: 28rpx 30rpx 20rpx; + border-bottom: 2rpx solid #f0f0f0; +} + +.forward-modal-title { + font-size: 34rpx; + font-weight: 700; + color: #1a1a2e; +} + +.forward-modal-close { + position: absolute; + right: 24rpx; + top: 50%; + transform: translateY(-50%); +} + +.forward-preview-box { + margin: 20rpx 30rpx 8rpx; + padding: 20rpx 24rpx; + background: #f7f8fc; + border-radius: 14rpx; + border-left: 6rpx solid #007aff; +} + +.forward-preview-label { + font-size: 24rpx; + color: #999; + display: block; + margin-bottom: 8rpx; +} + +.forward-preview-text { + font-size: 28rpx; + color: #333; + word-break: break-all; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; +} + +.forward-select-label { + font-size: 26rpx; + color: #666; + padding: 12rpx 30rpx 8rpx; + display: block; +} + +.forward-conv-list { + flex: 1; + max-height: 400rpx; + padding: 0 20rpx; +} + +.forward-empty { + display: flex; + justify-content: center; + align-items: center; + height: 160rpx; + color: #999; + font-size: 26rpx; +} + +.forward-conv-item { + display: flex; + align-items: center; + padding: 22rpx 16rpx; + border-radius: 16rpx; + margin-bottom: 8rpx; + background: #fafafa; + transition: background 0.2s; +} + +.forward-conv-item:active { + background: #eef4ff; +} + +.forward-conv-selected { + background: #e8f0fe; + border: 2rpx solid #007aff; +} + +.forward-conv-avatar { + width: 60rpx; + height: 60rpx; + border-radius: 14rpx; + background: #e8f0fe; + display: flex; + align-items: center; + justify-content: center; + margin-right: 20rpx; + flex-shrink: 0; +} + +.forward-conv-info { + flex: 1; + min-width: 0; +} + +.forward-conv-name { + font-size: 28rpx; + color: #333; + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.forward-conv-check { + flex-shrink: 0; + margin-left: 12rpx; +} + +.forward-modal-footer { + padding: 20rpx 30rpx 30rpx; + border-top: 2rpx solid #f0f0f0; + display: flex; + justify-content: flex-end; + gap: 20rpx; +} + +.forward-modal-btn { + padding: 18rpx 48rpx; + border-radius: 16rpx; + font-size: 28rpx; + font-weight: 500; +} + +.forward-btn-cancel { + background: #f0f0f0; + color: #666; +} + +.forward-btn-cancel:active { + background: #e0e0e0; +} + +.forward-btn-confirm { + background: #007aff; + color: #fff; +} + +.forward-btn-confirm:active { + background: #005fcc; +} + +.forward-btn-disabled { + background: #b0d0f0; + color: #fff; + pointer-events: none; +} + /* ==========新建聊天列表相关====== */ .close-option-card { width: 100%; @@ -619,7 +804,7 @@ .chat-message { display: flex; - align-items: flex-start; + flex-direction: column; margin: 14rpx 0; box-sizing: border-box; animation: msgFadeIn 0.3s ease; @@ -631,6 +816,17 @@ } .message-user { + align-items: flex-end; +} + +/* avatar + 气泡行(上方) */ +.message-row { + display: flex; + align-items: flex-start; + width: 100%; +} + +.message-user .message-row { flex-direction: row-reverse; } @@ -675,6 +871,9 @@ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); background: #ffffff; border: 1rpx solid #eeeef5; + /* 启用文本选择复制 */ + user-select: text; + -webkit-user-select: text; } .chat-content-user { @@ -694,6 +893,81 @@ border-bottom-left-radius: 8rpx; } +/* 消息操作栏 */ +.message-actions { + display: flex; + align-items: center; + justify-content: flex-end; + margin-top: 16rpx; + padding-top: 12rpx; + border-top: 1rpx solid rgba(0, 0, 0, 0.06); + gap: 24rpx; +} + +.message-actions-user { + justify-content: flex-start; + border-top-color: rgba(255, 255, 255, 0.3); +} + +.message-action-item { + display: flex; + align-items: center; + gap: 6rpx; + padding: 8rpx 16rpx; + border-radius: 12rpx; + transition: all 0.2s ease; +} + +.message-action-item:active { + background: rgba(0, 0, 0, 0.05); + transform: scale(0.95); +} + +.message-actions-user .message-action-item:active { + background: rgba(255, 255, 255, 0.2); +} + +.action-text { + font-size: 22rpx; + color: #999; +} + +.message-actions-user .action-text { + color: rgba(255, 255, 255, 0.8); +} + +/* 消息转发弹窗 */ +.msg-actions { + display: flex; + align-items: center; + gap: 16rpx; + margin-top: 10rpx; +} + +.msg-actions-user { + justify-content: flex-end; +} + +.msg-action-btn { + display: flex; + align-items: center; + gap: 6rpx; + padding: 4rpx 0; +} + +.msg-action-icon { + font-size: 26rpx; +} + +.msg-action-label { + font-size: 22rpx; + color: #888; +} + +.msg-action-forward { + margin-left: 8rpx; +} + /* 图片消息 */ .message-image { max-width: 300rpx; diff --git a/pages/Chat/Chat.vue b/pages/Chat/Chat.vue index 003e919..c83514f 100644 --- a/pages/Chat/Chat.vue +++ b/pages/Chat/Chat.vue @@ -78,6 +78,54 @@ + + + + + 转发消息 + + + + + + + 选择目标会话 + + + 暂无其他会话 + + + + + + + {{ getConvName(conv) }} + + + + + + + + + 取消 + + + 确认转发 + + + + + @@ -159,6 +207,7 @@ + + + + + 复制 + + + + 转发 + + @@ -249,7 +309,8 @@ + @click="handleChatContentClick($event, message)" + @longpress="handleLongPress(message)"> @@ -271,6 +332,17 @@ + + + + + 复制 + + + + 转发 + + @@ -288,7 +360,8 @@ + @click="handleChatContentClick($event, message)" + @longpress="handleLongPress(message)"> @@ -310,6 +383,17 @@ + + + + + 复制 + + + + 转发 + + @@ -388,8 +472,8 @@