From 0960e67d7412766481413c354291f9583b19e406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Sat, 20 Dec 2025 16:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=A2=E6=9C=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E8=BF=9B=E5=85=A5=E8=81=8A=E5=A4=A9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E6=97=A0=E6=B3=95=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat-detail/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pages/chat-detail/index.js b/pages/chat-detail/index.js index 8ec16c8..aeb7d80 100644 --- a/pages/chat-detail/index.js +++ b/pages/chat-detail/index.js @@ -14,19 +14,26 @@ Page({ }, onLoad: function (options) { - if (options.id) { + // 支持两种参数传递方式: + // 1. 从聊天列表页传递的 id 参数 + // 2. 从客服列表页传递的 userId、userName、phone 参数 + let chatId = options.id || options.userId; + let managerPhone = options.phone; + + if (chatId) { this.setData({ - chatId: options.id, - managerPhone: options.id // 直接将chatId作为managerPhone使用,因为聊天列表页传递的是manager_phone + chatId: chatId, + managerPhone: managerPhone || options.id // 如果没有直接传递phone,则使用chatId作为fallback }); - // 如果有传递name参数,直接使用该名称作为聊天标题 - if (options.name) { + // 如果有传递name或userName参数,使用该名称作为聊天标题 + let chatTitle = options.name || options.userName; + if (chatTitle) { this.setData({ - chatTitle: decodeURIComponent(options.name) + chatTitle: decodeURIComponent(chatTitle) }); } else { - // 如果没有传递name参数,加载聊天标题 + // 如果没有传递名称参数,加载聊天标题 this.loadChatTitle(); } }