feat: 接入我参与的挑战接口以及UI
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
ShareLevelData,
|
||||
CreatedShareItem,
|
||||
CreatedShareListData,
|
||||
ParticipatedShareItem,
|
||||
ParticipatedShareListData,
|
||||
ShareDetailData,
|
||||
SubmitShareData,
|
||||
SubmitShareLevel,
|
||||
@@ -31,6 +33,7 @@ export class ShareManager {
|
||||
private _shareTitle: string = '';
|
||||
private _shareCode: string | null = null;
|
||||
private _createdShares: CreatedShareItem[] = [];
|
||||
private _participatedShares: ParticipatedShareItem[] = [];
|
||||
|
||||
/** 图片缓存:URL -> SpriteFrame */
|
||||
private _imageCache: Map<string, SpriteFrame> = new Map();
|
||||
@@ -52,6 +55,10 @@ export class ShareManager {
|
||||
return [...this._createdShares];
|
||||
}
|
||||
|
||||
get participatedShares(): ParticipatedShareItem[] {
|
||||
return [...this._participatedShares];
|
||||
}
|
||||
|
||||
get shareCode(): string | null {
|
||||
return this._shareCode;
|
||||
}
|
||||
@@ -158,6 +165,27 @@ export class ShareManager {
|
||||
}
|
||||
}
|
||||
|
||||
async fetchParticipatedShares(): Promise<ParticipatedShareItem[] | null> {
|
||||
try {
|
||||
const response = await HttpUtil.get<ApiEnvelope<ParticipatedShareListData>>(
|
||||
API_ENDPOINTS.SHARE_PARTICIPATED,
|
||||
API_TIMEOUT.DEFAULT,
|
||||
);
|
||||
|
||||
if (!response.success || !response.data) {
|
||||
console.error('[ShareManager] 获取我参与的挑战列表失败:', response.message);
|
||||
return null;
|
||||
}
|
||||
|
||||
this._participatedShares = response.data.items ?? [];
|
||||
console.log(`[ShareManager] 获取我参与的挑战列表成功: ${this._participatedShares.length} 条`);
|
||||
return this.participatedShares;
|
||||
} catch (err) {
|
||||
console.error('[ShareManager] 获取我参与的挑战列表异常:', err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async fetchShareDetail(code: string): Promise<ShareDetailData | null> {
|
||||
try {
|
||||
const response = await HttpUtil.get<ApiEnvelope<ShareDetailData>>(
|
||||
|
||||
Reference in New Issue
Block a user