From cf3f22776c6fc33dee4cabce54b6f9ad56c26c3f Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 20 Dec 2024 19:59:18 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/WebSocketDialog.php | 3 +++ resources/assets/js/components/UserSelect.vue | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Models/WebSocketDialog.php b/app/Models/WebSocketDialog.php index bdc3ab75c..082b134c9 100644 --- a/app/Models/WebSocketDialog.php +++ b/app/Models/WebSocketDialog.php @@ -330,6 +330,9 @@ class WebSocketDialog extends AbstractModel } break; } + if (empty($data['pinyin'])) { + $data['pinyin'] = Base::cn2pinyin($data['name']); + } // 已存在的消息类型 if ($hasData === true) { diff --git a/resources/assets/js/components/UserSelect.vue b/resources/assets/js/components/UserSelect.vue index f4de7d0b5..3d3c60b7b 100755 --- a/resources/assets/js/components/UserSelect.vue +++ b/resources/assets/js/components/UserSelect.vue @@ -368,9 +368,7 @@ export default { switch (switchActive) { case 'recent': if (searchKey) { - return recents.filter(item => { - return `${item.name}`.indexOf(searchKey) > -1 - }) + return recents.filter(item => $A.strExists(`${item.name} ${item.email} ${item.pinyin}`, searchKey)) } return recents @@ -517,9 +515,11 @@ export default { return b.todo_num - a.todo_num; } return $A.dayjs(b.last_at) - $A.dayjs(a.last_at); - }).map(({id, name, type, group_type, avatar, dialog_user}) => { + }).map(({id, name, pinyin, email, type, group_type, avatar, dialog_user}) => { return { name, + pinyin, + email, type, group_type, avatar,