模拟数据:技师的详细数据
This commit is contained in:
@@ -183,6 +183,27 @@ export class GirlData extends BaseData {
|
|||||||
return oneData.category;
|
return oneData.category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取主题枚举,根据 id */
|
||||||
|
public getGrilCategoryById(girlId: number): number {
|
||||||
|
const cats = this.ensureCategories();
|
||||||
|
|
||||||
|
for (const bucket of cats.values()) {
|
||||||
|
// 先查简要信息
|
||||||
|
const brief = bucket.briefs.get(girlId);
|
||||||
|
if (brief && brief.category) {
|
||||||
|
return brief.category;
|
||||||
|
}
|
||||||
|
// 兜底:若只缓存了详情,也从详情里的 brief 取
|
||||||
|
const detail = bucket.details.get(girlId);
|
||||||
|
if (detail?.brief && typeof detail.brief.category) {
|
||||||
|
return detail.brief.category;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未找到
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取list头像路径 */
|
/** 获取list头像路径 */
|
||||||
public getGrilListAvatar(categoryId: string, girlId: number): string {
|
public getGrilListAvatar(categoryId: string, girlId: number): string {
|
||||||
let oneData = this.getGrilBrief(categoryId, girlId);
|
let oneData = this.getGrilBrief(categoryId, girlId);
|
||||||
|
|||||||
@@ -137,9 +137,8 @@ export class GirlDetailPanel extends li_BaseView {
|
|||||||
tagKey: string;
|
tagKey: string;
|
||||||
category: number;
|
category: number;
|
||||||
async refresh(index: number) {
|
async refresh(index: number) {
|
||||||
// TODO,暂时这样获取,修改后从GirlData获取
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
const girlConfig = ConfigManager.tables.TbGirls.get(this.id);
|
this.category = girlData.getGrilCategoryById(this.id);
|
||||||
this.category = girlConfig.category;
|
|
||||||
// 请求详细数据
|
// 请求详细数据
|
||||||
const reqData = {
|
const reqData = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
@@ -147,7 +146,6 @@ export class GirlDetailPanel extends li_BaseView {
|
|||||||
let res = await GirlService.I.reqGetGirlDetail(reqData);
|
let res = await GirlService.I.reqGetGirlDetail(reqData);
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
|
||||||
girlData.setGirlDetails(this.category.toString(), res.data);
|
girlData.setGirlDetails(this.category.toString(), res.data);
|
||||||
// 根据数据,刷新界面
|
// 根据数据,刷新界面
|
||||||
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
|
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user