细节优化

This commit is contained in:
kron
2025-11-10 13:43:25 +08:00
parent 2cf55dcdde
commit 7e1a3be510
8 changed files with 39 additions and 415 deletions

View File

@@ -10,23 +10,6 @@ export const formatTimestamp = (timestamp) => {
return `${year}-${month}-${day}`;
};
export const checkConnection = () => {
uni.sendSocketMessage({
data: JSON.stringify({ event: "ping", data: {} }),
fail: () => {
websocket.closeWebSocket();
const token = uni.getStorageSync(
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
);
if (!token) return;
// 如果发送失败,说明连接已断开,需要重新连接
websocket.createWebSocket(token, (content) => {
uni.$emit("socket-inbox", content);
});
},
});
};
export const debounce = (fn, delay = 300) => {
let timer = null;
return async (...args) => {