From 7253f0a4ec231ebab41a4a2cba780596e4eb6f94 Mon Sep 17 00:00:00 2001
From: MoonLeeeaf <150461955+MoonLeeeaf@users.noreply.github.com>
Date: Sat, 18 May 2024 14:29:33 +0800
Subject: [PATCH] =?UTF-8?q?chore:=20=E9=A1=B9=E7=9B=AE=E8=AF=B4=E6=98=8E,?=
=?UTF-8?q?=20feat:=20=E6=B7=BB=E5=8A=A0=E5=A5=BD=E5=8F=8B(WIP),=20fix:=20?=
=?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E6=97=A0=E6=B3=95=E7=BD=AE=E5=BA=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ling_chair_http/index.html | 48 +++++++++++++++++++++++++++++--
ling_chair_http/index.js | 22 +++++++++++++-
ling_chair_http/mdui-prettier.css | 3 ++
readme.md | 12 ++++++--
server_src/wsApi.js | 15 ++++++++++
5 files changed, 94 insertions(+), 6 deletions(-)
diff --git a/ling_chair_http/index.html b/ling_chair_http/index.html
index 10684b0..577982c 100644
--- a/ling_chair_http/index.html
+++ b/ling_chair_http/index.html
@@ -67,6 +67,10 @@
account_circle
settings
@@ -114,7 +118,7 @@
+ mdui-tab n-id="chatTab">
常用
通讯录
@@ -140,12 +144,14 @@
-
+
+
+ style="position: sticky;max-width: 100%;margin-bottom: -30px;bottom: 0;z-index: 101;"
+ n-id="inputToolbar">
+
+
+
+
+ 新的好友请求
+
+
+
+
+
+
+
+
+
+
+ 添加好友/群
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ling_chair_http/index.js b/ling_chair_http/index.js
index 02f2ce5..f4c34ea 100644
--- a/ling_chair_http/index.js
+++ b/ling_chair_http/index.js
@@ -125,14 +125,18 @@ $.ajax({
// Toolbar 快捷按钮绑定
viewBinding.contactsRefresh.hide()
+viewBinding.contactsAdd.hide()
viewBinding.tabChatList.on("show.mdui.tab", () => {
viewBinding.contactsRefresh.hide()
+ viewBinding.contactsAdd.hide()
})
viewBinding.tabContacts.on("show.mdui.tab", () => {
viewBinding.contactsRefresh.show()
+ viewBinding.contactsAdd.show()
})
viewBinding.tabChatSeesion.on("show.mdui.tab", () => {
viewBinding.contactsRefresh.hide()
+ viewBinding.contactsAdd.hide()
})
viewBinding.tabChatSeesion.hide()
@@ -319,6 +323,14 @@ class ContactsList {
})
}
+ static add(name, type) {
+ if (type == "single") {
+
+ }
+ }
+ static openAddDialog() {
+ new mdui.Dialog(viewBinding.dialogNewContact.get(0)).open()
+ }
}
// 第一次写前端的消息加载, 代码很乱, 还请原谅~
@@ -494,7 +506,7 @@ class ChatMsgAdapter {
// 吐了啊 原来这样就行了 我何必在子element去整啊
window.scrollBy({
top: 1145141919810,
- behavior: 'smooth'
+ behavior: 'smooth'
});
}
// 从本地加载
@@ -509,6 +521,12 @@ class ChatMsgAdapter {
static saveToLocal() {
localStorage["chat_msg_" + this.target] = JSON.stringify(this.msgList)
}*/
+ // 自动调整使输入框置底 CSS真tm靠不住啊
+ static initInputResizer() {
+ let resize = () => viewBinding.pageChatSeesion.height(window.innerHeight - viewBinding.inputToolbar.height() - $("header.mdui-appbar").height() - viewBinding.chatTab.height() - 90)
+ window.addEventListener("resize", resize)
+ resize()
+ }
// 为消息设置长按/右键事件
static initMsgElementEvents() {
let listeners = {}
@@ -748,3 +766,5 @@ else {
Stickyfill.add($("*").filter((a, b) => $(b).css('position') === 'sticky'))
ChatMsgAdapter.initMsgElementEvents()
+
+ChatMsgAdapter.initInputResizer()
diff --git a/ling_chair_http/mdui-prettier.css b/ling_chair_http/mdui-prettier.css
index e3009e7..c279123 100644
--- a/ling_chair_http/mdui-prettier.css
+++ b/ling_chair_http/mdui-prettier.css
@@ -34,6 +34,9 @@ body {
height: 40px;
border-radius: 40px;
}
+.mdui-select-open {
+ border-radius: 10px;
+}
/* 配色方案 */
diff --git a/readme.md b/readme.md
index 644c8a2..96b038a 100644
--- a/readme.md
+++ b/readme.md
@@ -3,7 +3,7 @@
欢迎来到铃之椅! 这是一个即时通讯项目, 为通讯提供更多的选择, 为人民服务
> [!NOTE]
-> 本项目仍在实验阶段, 为防止源代码丢失, 先留存代码...
+> 本项目仍在实验阶段, [点我](final.md)可查看进展
>
> 如果发现有任何疑问, 欢迎提问
>
@@ -23,10 +23,18 @@
* 克隆本仓库到本地并运行本地 HTTP 服务端
- * 使用本仓库提供的网页 (不推荐, 有跨域问题)
+ * 静态网页 (不推荐, 有跨域问题)
### 鸣谢
WIP
### [你知道吗](.github/do_you_know.md)
+
+### 温馨提示
+
+不建议,不推荐,不赞同用于商业用途, 本项目的设计初衷是为了个人和团队使用, 而非用于圈钱, 因此如果确实需要商业化, 请考虑其他项目
+
+为什么? 因为这个项目还在初级阶段, 还有很多地方不够完善, 甚至有可能被一些 Hacker 抓到漏洞, 造成不必要的损失
+
+因此我更建议个人及团队内部使用, 亦或者加密后放在公网使用
diff --git a/server_src/wsApi.js b/server_src/wsApi.js
index 834f070..b4e6b0e 100644
--- a/server_src/wsApi.js
+++ b/server_src/wsApi.js
@@ -148,6 +148,21 @@ let api = {
cb({ msg: msg, code: 0, data: { friends: friends } })
},
+ // 添加好友
+ // {name: 账号, accessToken: 访问令牌} 返回 {friends: []}
+ // WIP
+ "user.addFriend": (a, cb) => {
+ if (checkEmpty([a.name, a.accessToken]))
+ return cb({ msg: "参数缺失", code: -1 })
+
+ let { msg, code, friends } = users.getFriends(a.name, a.accessToken)
+
+ if (code !== 0)
+ return cb({ msg: msg, code: code })
+
+ cb({ msg: msg, code: 0, data: { friends: friends } })
+ },
+
"user.getNick": (a, cb) => {
if (checkEmpty([a.name]))
return cb({ msg: "参数缺失", code: -1 })