forked from wangziqi/gongxue-base
feat: add taro student learning flow
This commit is contained in:
@@ -7,6 +7,8 @@ export interface ContentEntry {
|
||||
route?: string;
|
||||
icon?: string;
|
||||
sortOrder?: number;
|
||||
description?: string;
|
||||
regionId?: string | null;
|
||||
}
|
||||
|
||||
export interface DashboardSnapshot {
|
||||
@@ -30,3 +32,169 @@ export async function loadStudentDashboard(regionId?: string): Promise<Dashboard
|
||||
profile: profile.item || null,
|
||||
};
|
||||
}
|
||||
|
||||
export interface RegionItem {
|
||||
id: string;
|
||||
name: string;
|
||||
code?: string;
|
||||
shortName?: string;
|
||||
isHot?: boolean;
|
||||
}
|
||||
|
||||
export interface ContentNode {
|
||||
id: string;
|
||||
entryId: string;
|
||||
parentId?: string | null;
|
||||
name: string;
|
||||
nodeType?: string;
|
||||
markerType?: string | null;
|
||||
depth?: number;
|
||||
isLeaf?: boolean;
|
||||
isSelectable?: boolean;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface QuestionCollection {
|
||||
id: string;
|
||||
entryId?: string | null;
|
||||
nodeId?: string | null;
|
||||
name: string;
|
||||
collectionType?: string;
|
||||
questionCount?: number;
|
||||
durationMinutes?: number | null;
|
||||
}
|
||||
|
||||
export interface PracticeBlueprint {
|
||||
id: string;
|
||||
entryId?: string | null;
|
||||
nodeId?: string | null;
|
||||
collectionId?: string | null;
|
||||
name: string;
|
||||
mode: string;
|
||||
questionLimit?: number | null;
|
||||
durationMinutes?: number | null;
|
||||
}
|
||||
|
||||
export interface VocabularyUnit {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
wordCount?: number;
|
||||
regionId?: string | null;
|
||||
}
|
||||
|
||||
export interface HandbookSubject {
|
||||
id: string;
|
||||
name: string;
|
||||
type?: string | null;
|
||||
description?: string | null;
|
||||
}
|
||||
|
||||
export interface HandbookChapter {
|
||||
id: string;
|
||||
subjectId: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
}
|
||||
|
||||
export interface HandbookEntry {
|
||||
id: string;
|
||||
chapterId: string;
|
||||
title: string;
|
||||
summary?: string | null;
|
||||
content?: string | null;
|
||||
}
|
||||
|
||||
export interface ScorelineRecord {
|
||||
id: string;
|
||||
year: number;
|
||||
schoolName?: string | null;
|
||||
majorName?: string | null;
|
||||
fieldValues?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ContentAsset {
|
||||
id: string;
|
||||
title?: string | null;
|
||||
assetType?: string;
|
||||
categoryLabel?: string | null;
|
||||
description?: string | null;
|
||||
fileName?: string | null;
|
||||
mimeType?: string | null;
|
||||
visibility?: string;
|
||||
previewStatus?: string;
|
||||
}
|
||||
|
||||
export async function loadRegions() {
|
||||
return apiRequest<{ items?: RegionItem[] }>('/api/catalog/regions');
|
||||
}
|
||||
|
||||
export async function loadContentEntries(regionId?: string, entryType?: string) {
|
||||
return apiRequest<{ items?: ContentEntry[] }>('/api/catalog/content-entries', { query: { regionId, entryType } });
|
||||
}
|
||||
|
||||
export async function loadContentNodes(entryId: string, parentId: string | null = 'root', mode: 'children' | 'flat' = 'children') {
|
||||
return apiRequest<{ items?: ContentNode[] }>('/api/catalog/content-nodes', { query: { entryId, parentId, mode } });
|
||||
}
|
||||
|
||||
export async function loadQuestionCollections(input: { entryId?: string; nodeId?: string; limit?: number }) {
|
||||
return apiRequest<{ items?: QuestionCollection[] }>('/api/catalog/question-collections', {
|
||||
query: { entryId: input.entryId, nodeId: input.nodeId, limit: input.limit || 100 },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadCollectionQuestions(collectionId: string, limit = 200) {
|
||||
return apiRequest<{ items?: import('./learning').QuestionItem[] }>('/api/catalog/question-collections/questions', {
|
||||
query: { collectionId, limit },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadQuestions(query: { entryId?: string; contentNodeId?: string; collectionId?: string; limit?: number }) {
|
||||
return apiRequest<{ items?: import('./learning').QuestionItem[] }>('/api/catalog/questions', {
|
||||
query: { ...query, limit: query.limit || 200 },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadPracticeBlueprints(input: { entryId?: string; nodeId?: string; collectionId?: string; mode?: string }) {
|
||||
return apiRequest<{ items?: PracticeBlueprint[] }>('/api/catalog/practice-blueprints', {
|
||||
query: input,
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadVocabularyUnits(regionId?: string) {
|
||||
return apiRequest<{ items?: VocabularyUnit[] }>('/api/catalog/vocabulary-units', { query: { regionId } });
|
||||
}
|
||||
|
||||
export async function loadVocabularyWords(unitId: string) {
|
||||
return apiRequest<{ items?: import('./learning').VocabularyWord[] }>('/api/catalog/vocabulary-words', { query: { unitId } });
|
||||
}
|
||||
|
||||
export async function loadHandbookSubjects(regionId?: string) {
|
||||
return apiRequest<{ items?: HandbookSubject[] }>('/api/catalog/handbook-subjects', { query: { regionId } });
|
||||
}
|
||||
|
||||
export async function loadHandbookChapters(subjectId: string) {
|
||||
return apiRequest<{ items?: HandbookChapter[] }>('/api/catalog/handbook-chapters', { query: { subjectId } });
|
||||
}
|
||||
|
||||
export async function loadHandbookEntries(chapterId: string, includeContent = true) {
|
||||
return apiRequest<{ items?: HandbookEntry[] }>('/api/catalog/handbook-entries', { query: { chapterId, includeContent } });
|
||||
}
|
||||
|
||||
export async function loadScorelineRecords(query: { regionId?: string; schoolId?: string; majorId?: string; year?: number; pageSize?: number } = {}) {
|
||||
return apiRequest<{ items?: ScorelineRecord[]; total?: number }>('/api/scoreline/records', {
|
||||
query: { ...query, pageSize: query.pageSize || 20 },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadContentAssets(query: { entryId?: string; contentNodeId?: string; assetType?: string; includeLocked?: boolean } = {}) {
|
||||
return apiRequest<{ items?: ContentAsset[] }>('/api/catalog/assets', { query: { ...query, includeLocked: query.includeLocked ?? true } });
|
||||
}
|
||||
|
||||
export async function signAssetPreview(assetId: string) {
|
||||
return apiRequest<{ preview?: { url?: string }; item?: ContentAsset }>('/api/catalog/assets/preview', { query: { assetId } });
|
||||
}
|
||||
|
||||
export async function signAssetDownload(assetId: string) {
|
||||
return apiRequest<{ download?: { url?: string }; item?: ContentAsset }>('/api/catalog/assets/download', { query: { assetId } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user