重构ProfileCard组件以增强选项卡管理并改善用户体验。引入基于可用键的动态选项卡呈现,并更新选项卡标题的样式。调整活动关键帧和渲染关键帧的状态管理。更新QuickWords和ProfileModules集成。修改GroupModal和QuickReplyModal以使用“destroyOnHidden”以获得更好的模式处理。
This commit is contained in:
@@ -60,6 +60,8 @@ export interface ChatSession {
|
||||
chatroomOwner?: string; // 群主
|
||||
selfDisplayName?: string; // 群内昵称
|
||||
notice?: string; // 群公告
|
||||
phone?: string; // 联系人电话
|
||||
region?: string; // 联系人地区
|
||||
}
|
||||
|
||||
// ==================== 统一联系人表(兼容好友和群聊) ====================
|
||||
@@ -128,15 +130,14 @@ class CunkebaoDatabase extends Dexie {
|
||||
constructor(dbName: string) {
|
||||
super(dbName);
|
||||
|
||||
// 版本1:统一表结构
|
||||
this.version(1).stores({
|
||||
// 会话表索引:支持按用户、类型、时间、置顶等查询
|
||||
chatSessions:
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], [userId+lastUpdateTime], sortKey, nickname, conRemark, avatar, content, lastUpdateTime",
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], [userId+lastUpdateTime], [userId+aiType], sortKey, nickname, conRemark, avatar, content, lastUpdateTime, aiType, phone, region",
|
||||
|
||||
// 联系人表索引:支持按用户、类型、标签、搜索等查询
|
||||
contactsUnified:
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], sortKey, searchKey, nickname, conRemark, avatar, lastUpdateTime, groupId",
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], [userId+aiType], sortKey, searchKey, nickname, conRemark, avatar, lastUpdateTime, groupId, aiType, phone, region",
|
||||
|
||||
// 联系人标签映射表索引:支持按用户、标签、联系人、类型查询
|
||||
contactLabelMap:
|
||||
@@ -146,47 +147,6 @@ class CunkebaoDatabase extends Dexie {
|
||||
userLoginRecords:
|
||||
"serverId, userId, lastLoginTime, loginCount, createTime, lastActiveTime",
|
||||
});
|
||||
|
||||
// 版本2:添加 aiType 字段
|
||||
this.version(2)
|
||||
.stores({
|
||||
// 会话表索引:添加 aiType 索引
|
||||
chatSessions:
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], [userId+lastUpdateTime], [userId+aiType], sortKey, nickname, conRemark, avatar, content, lastUpdateTime, aiType",
|
||||
|
||||
// 联系人表索引:添加 aiType 索引
|
||||
contactsUnified:
|
||||
"serverId, userId, id, type, wechatAccountId, [userId+type], [userId+wechatAccountId], [userId+aiType], sortKey, searchKey, nickname, conRemark, avatar, lastUpdateTime, groupId, aiType",
|
||||
|
||||
// 联系人标签映射表索引:保持不变
|
||||
contactLabelMap:
|
||||
"serverId, userId, labelId, contactId, contactType, [userId+labelId], [userId+contactId], [userId+labelId+sortKey], sortKey, searchKey, avatar, nickname, conRemark, unreadCount, lastUpdateTime",
|
||||
|
||||
// 用户登录记录表索引:保持不变
|
||||
userLoginRecords:
|
||||
"serverId, userId, lastLoginTime, loginCount, createTime, lastActiveTime",
|
||||
})
|
||||
.upgrade(tx => {
|
||||
// 数据迁移:为现有数据添加 aiType 默认值
|
||||
return tx
|
||||
.table("chatSessions")
|
||||
.toCollection()
|
||||
.modify(session => {
|
||||
if (session.aiType === undefined) {
|
||||
session.aiType = 0; // 默认为普通类型
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
return tx
|
||||
.table("contactsUnified")
|
||||
.toCollection()
|
||||
.modify(contact => {
|
||||
if (contact.aiType === undefined) {
|
||||
contact.aiType = 0; // 默认为普通类型
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,6 +304,8 @@ export class DatabaseService<T> {
|
||||
const dataToInsert = {
|
||||
...data,
|
||||
serverId: data.id, // 使用接口的id作为serverId主键
|
||||
phone: data.phone ?? "",
|
||||
region: data.region ?? "",
|
||||
};
|
||||
return await this.table.add(dataToInsert as T);
|
||||
}
|
||||
@@ -407,6 +369,8 @@ export class DatabaseService<T> {
|
||||
const processedData = newData.map(item => ({
|
||||
...item,
|
||||
serverId: item.id, // 使用接口的id作为serverId主键
|
||||
phone: item.phone ?? "",
|
||||
region: item.region ?? "",
|
||||
}));
|
||||
|
||||
return await this.table.bulkAdd(processedData as T[], { allKeys: true });
|
||||
|
||||
Reference in New Issue
Block a user