聊天数据bug修复

This commit is contained in:
2025-10-14 11:34:09 +08:00
parent 0088515f2a
commit 34d07ec143
5 changed files with 36 additions and 15 deletions
+15 -1
View File
@@ -155,8 +155,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
}
async refresh() {
const newRoleId = NavigationManager.Instance.getSelectedGirlId();
// 请求详细数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const newRoleId = NavigationManager.Instance.getSelectedGirlId();
this.waitingAI.active = false;
// 检查是否是切换角色
const isRoleSwitch = this.id && this.id !== newRoleId;
@@ -165,6 +167,18 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.categoryId =
NavigationManager.Instance.getSelectedCategoryId().toString();
const detail = girlData.getGrilDetail(this.categoryId, this.id);
if (!detail) {
const reqData = {
id: this.id,
};
let res = await GirlService.I.reqGetGirlDetail(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
girlData.setGirlDetailData(this.categoryId.toString(), res.data);
}
}
// 获取ChatController单例并绑定当前Panel
this.chatController = ChatController.Instance;
this.chatController.bindView(this);
@@ -326,8 +326,7 @@ export class GirlDetailPanel extends li_BaseView {
OnClickChatBtn() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const isRelease = girlData.getIsRelease(this.category.toString(), this.id);
const isFree = girlData.isGirlFreeType(this.category.toString(), this.id);
//if (isRelease || isFree) {
// 直接在当前页面打开ChatPanel作为子页面
const currentPanel = NavigationManager.Instance.getCurrentActivePanelNode();
@@ -278,6 +278,6 @@ export class SettingPanel extends li_BaseView {
}
onClickClose() {
NavigationManager.Instance.closeSubPanel(this);
NavigationManager.Instance.closePopupPanel(this.node);
}
}