From f6aa6d9a97ae86a41ce76bc04981cb9c58b0f74d Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 23 Jul 2026 09:45:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9B=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniapp/pages/chat/chat.js | 14 ++++++++++++++ miniapp/pages/chat/chat.wxml | 29 ++++++++++++++++++++--------- miniapp/pages/chat/chat.wxss | 22 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/miniapp/pages/chat/chat.js b/miniapp/pages/chat/chat.js index e19bb6b..59ce1ab 100644 --- a/miniapp/pages/chat/chat.js +++ b/miniapp/pages/chat/chat.js @@ -267,6 +267,20 @@ Page({ } }, + // 点击参考来源标题, 折叠/展开链接和摘要 + toggleRef(e) { + const mkey = e.currentTarget.dataset.mkey + const idx = Number(e.currentTarget.dataset.idx) + const list = this.data.messages.slice() + const i = list.findIndex((m) => m.key === mkey) + if (i === -1) return + const refs = (list[i].references || []).slice() + if (!refs[idx]) return + refs[idx] = Object.assign({}, refs[idx], { expanded: !refs[idx].expanded }) + list[i] = Object.assign({}, list[i], { references: refs }) + this.setData({ messages: list }) + }, + // 参考文档带 source_url 时(共享文档)点击复制链接到剪贴板。 // 小程序无法直接打开任意外链, 复制后由用户粘贴到浏览器。 onRefLinkTap(e) { diff --git a/miniapp/pages/chat/chat.wxml b/miniapp/pages/chat/chat.wxml index 8d44654..a6a7a98 100644 --- a/miniapp/pages/chat/chat.wxml +++ b/miniapp/pages/chat/chat.wxml @@ -72,18 +72,29 @@ 参考来源 - [{{idx + 1}}] {{ref.source_title}} - 🔗 - {{ref.source_url}} + [{{idx + 1}}] {{ref.source_title}} + - {{ref.snippet}} + + + 🔗 + {{ref.source_url}} + + {{ref.snippet}} + diff --git a/miniapp/pages/chat/chat.wxss b/miniapp/pages/chat/chat.wxss index bbc6dea..08e8eae 100644 --- a/miniapp/pages/chat/chat.wxss +++ b/miniapp/pages/chat/chat.wxss @@ -211,11 +211,33 @@ flex-direction: column; padding: 10rpx 0; } +.ref-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12rpx; + padding: 4rpx 0; +} +.ref-head-hover { + opacity: 0.7; +} .ref-title { + flex: 1; font-size: 24rpx; color: var(--brand); font-weight: 500; } +.ref-arrow { + flex: 0 0 auto; + font-size: 28rpx; + line-height: 1; + color: var(--brand); + transform: rotate(90deg); + transition: transform 0.2s ease; +} +.ref-arrow.expanded { + transform: rotate(270deg); +} .ref-link { display: flex; flex-direction: row;