更新 index.html 和 manifest.json 中的脚本文件名,替换为新的构建版本 index-ROCKxzay.js,以确保正确加载最新的资源。

This commit is contained in:
2025-09-22 16:40:33 +08:00
parent 0c846a86b9
commit c6adee4502
5 changed files with 30 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>客宝</title> <title>客宝</title>
<style> <style>
html { html {
font-size: 16px; font-size: 16px;

View File

@@ -1,9 +1,6 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Layout, Button, Avatar, Space, Dropdown, Menu, Tooltip } from "antd"; import { Layout, Button, Avatar, Space, Tooltip } from "antd";
import { import {
PhoneOutlined,
VideoCameraOutlined,
MoreOutlined,
UserOutlined, UserOutlined,
TeamOutlined, TeamOutlined,
InfoCircleOutlined, InfoCircleOutlined,

View File

@@ -61,6 +61,7 @@ export interface CkChatState {
clearkfUserList: () => void; clearkfUserList: () => void;
addChatSession: (session: any) => void; addChatSession: (session: any) => void;
deleteChatSession: (sessionId: number) => void; deleteChatSession: (sessionId: number) => void;
pinChatSessionToTop: (sessionId: number) => void;
setUserInfo: (userInfo: CkUserInfo) => void; setUserInfo: (userInfo: CkUserInfo) => void;
clearUserInfo: () => void; clearUserInfo: () => void;
updateAccount: (account: Partial<CkAccount>) => void; updateAccount: (account: Partial<CkAccount>) => void;

View File

@@ -375,11 +375,11 @@ export const useCkChatStore = createPersistStore<CkChatState>(
set(state => { set(state => {
// 检查是否已存在相同id的会话 // 检查是否已存在相同id的会话
const exists = state.chatSessions.some(item => item.id === session.id); const exists = state.chatSessions.some(item => item.id === session.id);
// 如果已存在则不添加,否则添加到列表 // 如果已存在则不添加,否则添加到列表顶部
return { return {
chatSessions: exists chatSessions: exists
? state.chatSessions ? state.chatSessions
: [...state.chatSessions, session as ContractData | weChatGroup], : [session as ContractData | weChatGroup, ...state.chatSessions],
}; };
}); });
}, },
@@ -399,6 +399,24 @@ export const useCkChatStore = createPersistStore<CkChatState>(
//当前选中的客户清空 //当前选中的客户清空
getClearCurrentContact(); getClearCurrentContact();
}, },
// 置顶聊天会话到列表顶部
pinChatSessionToTop: (sessionId: number) => {
set(state => {
const sessionIndex = state.chatSessions.findIndex(
item => item.id === sessionId,
);
if (sessionIndex === -1) return state; // 会话不存在
const session = state.chatSessions[sessionIndex];
const otherSessions = state.chatSessions.filter(
item => item.id !== sessionId,
);
return {
chatSessions: [session, ...otherSessions],
};
});
},
// 设置用户信息 // 设置用户信息
setUserInfo: (userInfo: CkUserInfo) => { setUserInfo: (userInfo: CkUserInfo) => {
set({ userInfo, isLoggedIn: true }); set({ userInfo, isLoggedIn: true });
@@ -524,4 +542,6 @@ export const clearSearchKeyword = () =>
useCkChatStore.getState().clearSearchKeyword(); useCkChatStore.getState().clearSearchKeyword();
export const searchContactsAndGroups = () => export const searchContactsAndGroups = () =>
useCkChatStore.getState().searchContactsAndGroups(); useCkChatStore.getState().searchContactsAndGroups();
export const pinChatSessionToTop = (sessionId: number) =>
useCkChatStore.getState().pinChatSessionToTop(sessionId);
useCkChatStore.getState().getKfSelectedUser(); useCkChatStore.getState().getKfSelectedUser();

View File

@@ -18,6 +18,7 @@ import {
addChatSession, addChatSession,
updateChatSession, updateChatSession,
useCkChatStore, useCkChatStore,
pinChatSessionToTop,
} from "@/store/module/ckchat/ckchat"; } from "@/store/module/ckchat/ckchat";
/** /**
@@ -285,6 +286,8 @@ export const useWeChatStore = create<WeChatState>()(
if (session) { if (session) {
session.unreadCount = Number(session.unreadCount) + 1; session.unreadCount = Number(session.unreadCount) + 1;
updateChatSession(session); updateChatSession(session);
// 将接收到新消息的会话置顶到列表顶部
pinChatSessionToTop(getMessageId);
} else { } else {
// 如果会话不存在,创建新会话 // 如果会话不存在,创建新会话
if (isWechatGroup) { if (isWechatGroup) {
@@ -294,6 +297,7 @@ export const useWeChatStore = create<WeChatState>()(
...group, ...group,
unreadCount: 1, unreadCount: 1,
}); });
// 新创建的会话会自动添加到列表顶部,无需额外置顶
} }
} else { } else {
const [user] = await contractService.findByIds(getMessageId); const [user] = await contractService.findByIds(getMessageId);
@@ -301,6 +305,7 @@ export const useWeChatStore = create<WeChatState>()(
...user, ...user,
unreadCount: 1, unreadCount: 1,
}); });
// 新创建的会话会自动添加到列表顶部,无需额外置顶
} }
} }
} }