From d42caea57a4f6c92a08d4c30743ec4652cbd840c Mon Sep 17 00:00:00 2001 From: MoonLeeeaf <150461955+MoonLeeeaf@users.noreply.github.com> Date: Fri, 14 Jun 2024 23:50:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=9A=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E8=81=8A=E5=A4=A9(=E5=AE=9E=E9=AA=8C=E6=80=A7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ling_chair_http/chat-message.css | 7 +- ling_chair_http/handler.js | 354 ++++++++++++++++++++++++++----- ling_chair_http/index.html | 5 +- ling_chair_http/utils.js | 10 + server_src/api-users.js | 54 +++-- server_src/ws-api.js | 9 +- 6 files changed, 362 insertions(+), 77 deletions(-) diff --git a/ling_chair_http/chat-message.css b/ling_chair_http/chat-message.css index 33b435b..52b5cdf 100644 --- a/ling_chair_http/chat-message.css +++ b/ling_chair_http/chat-message.css @@ -23,14 +23,14 @@ display: flex; justify-content: flex-end; align-items: flex-start; - margin: 13px; + margin: 13px 13px 13px 10%; } .chat-message-left { display: flex; justify-content: flex-start; align-items: flex-start; - margin: 13px; + margin: 13px 10% 13px 13px; } .message-content { @@ -39,9 +39,10 @@ margin-left: 5px; margin-right: 5px; max-width: 100%; + min-width: 0%; white-space: normal; word-break: break-all; - font-size: medium; + /* font-size: medium; */ /* 使用了 CardView 就不需要边框了 */ /* border: 1.3px solid; */ padding: 15px; diff --git a/ling_chair_http/handler.js b/ling_chair_http/handler.js index d283c49..73e17e5 100644 --- a/ling_chair_http/handler.js +++ b/ling_chair_http/handler.js @@ -188,14 +188,14 @@ class NickCache { * @returns {String} nick */ static async getNick(name) { - return await new Promise((res, rej) => { + return await new Promise((res, _rej) => { // 这个this别摆着不放啊 不然两下就会去世 - let nick = this.data[name] + let nick = NickCache.data[name] if (nick == null) - client.emit("user.getNick", { name: localStorage.userName }, (re) => { + client.emit("user.getNick", { name: name }, (re) => { let nk = re.data != null ? re.data.nick : name if (nk == null) nk = name - this.data[name] = nk + NickCache.data[name] = nk res(nk) }) else @@ -204,6 +204,10 @@ class NickCache { } } +// ================================ +// 联系人 +// ================================ + class ContactsList { /** * 重载联系人列表 @@ -221,7 +225,7 @@ class ContactsList { for (let index in ls) { let name = ls[index] let dick = await NickCache.getNick(name) - $($.parseHTML(`