feat: 接入我参与的挑战接口以及UI
This commit is contained in:
@@ -178,7 +178,7 @@ export class PagePKDetail extends BaseView {
|
||||
return;
|
||||
}
|
||||
|
||||
this._setLabel(this._findLabelIn(panel, 'UserName'), this._getParticipantName(champion) || '暂无参与');
|
||||
this._setLabel(this._findLabelIn(panel, 'UserName'), this._getParticipantDisplayName(champion, '暂无参与'));
|
||||
this._setLabel(this._findLabelIn(panel, 'RightInfo'), this._formatCorrectText(champion, shareInfo));
|
||||
this._setLabel(this._findLabelIn(panel, 'UsedTime'), this._formatTimeText(champion, shareInfo));
|
||||
this._loadAvatar(champion?.avatarUrl ?? '', this._findAvatarSprite(panel), version);
|
||||
@@ -222,7 +222,7 @@ export class PagePKDetail extends BaseView {
|
||||
this._setLabel(rankNumberNode.getComponent(Label), rank > 0 ? `${rank}` : '-');
|
||||
}
|
||||
|
||||
this._setLabel(this._findLabelIn(item, 'UserName'), this._getParticipantName(participant) || '微信用户');
|
||||
this._setLabel(this._findLabelIn(item, 'UserName'), this._getParticipantDisplayName(participant, '微信用户'));
|
||||
this._setLabel(this._findLabelIn(item, 'RightInfo'), this._formatCorrectText(participant, null));
|
||||
this._setLabel(this._findLabelIn(item, 'UsedTime'), this._formatTimeText(participant));
|
||||
this._loadAvatar(participant.avatarUrl ?? '', this._findAvatarSprite(item), version);
|
||||
@@ -312,13 +312,23 @@ export class PagePKDetail extends BaseView {
|
||||
return participant?.nickname || participant?.nickName || '';
|
||||
}
|
||||
|
||||
private _getParticipantDisplayName(
|
||||
participant: ShareParticipantRankSummary | null,
|
||||
emptyParticipantFallback: string,
|
||||
): string {
|
||||
if (!participant) {
|
||||
return emptyParticipantFallback;
|
||||
}
|
||||
|
||||
return this._getParticipantName(participant) || '微信用户';
|
||||
}
|
||||
|
||||
private _loadAvatar(url: string, sprite: Sprite | null, version: number): void {
|
||||
if (!sprite) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
sprite.spriteFrame = null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user