|
|
@@ -59,6 +59,7 @@ export class StudyRecordsPageComponent implements OnInit {
|
|
|
readonly recordDateCounts = signal<Record<string, number>>({});
|
|
|
readonly scheduleDateCounts = signal<Record<string, { planned: number; missed: number }>>({});
|
|
|
readonly overviewReadingRecord = signal<Item | null>(null);
|
|
|
+ readonly readingLoadingId = signal('');
|
|
|
readonly datePickerMonthLabel = computed(() => new Intl.DateTimeFormat('zh-CN', { year: 'numeric', month: 'long' }).format(this.datePickerMonth()));
|
|
|
readonly datePickerDays = computed<DatePickerDay[]>(() => {
|
|
|
const month = this.datePickerMonth();
|
|
|
@@ -277,7 +278,12 @@ export class StudyRecordsPageComponent implements OnInit {
|
|
|
return;
|
|
|
}
|
|
|
if (['pages/his/his', 'pages/member/myorder'].includes(this.meta.path)) {
|
|
|
- void this.router.navigate(['/pages/his/his_words'], { queryParams: { id: item['GeneralID'] } });
|
|
|
+ const id = this.recordId(item);
|
|
|
+ if (!id) {
|
|
|
+ this.platform.toast('该学习记录缺少编号,暂时无法打开', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ void this.router.navigate(['/pages/his/his_words'], { queryParams: { id } });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -319,10 +325,37 @@ export class StudyRecordsPageComponent implements OnInit {
|
|
|
|
|
|
private navigateToReading(item: Item): void {
|
|
|
const wordList = extractReadingWords(item['xxqs']);
|
|
|
- if (!wordList.length) return;
|
|
|
+ if (wordList.length) {
|
|
|
+ this.openReadingSetup(item, wordList);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = this.recordId(item);
|
|
|
+ if (!id) {
|
|
|
+ this.platform.toast('该学习记录暂无可用单词', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.readingLoadingId.set(id);
|
|
|
+ this.api.post<unknown>('e_record_detail', { id }).pipe(finalize(() => this.readingLoadingId.set(''))).subscribe({
|
|
|
+ next: ({ result }) => {
|
|
|
+ const hydratedWords = extractReadingWords(result);
|
|
|
+ if (!hydratedWords.length) {
|
|
|
+ this.platform.toast('该学习记录暂无可用单词', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.openReadingSetup(item, hydratedWords);
|
|
|
+ },
|
|
|
+ error: (error: ApiError) => this.platform.toast(error.message, 'error'),
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ recordId(item: Item): string {
|
|
|
+ return String(item['GeneralID'] ?? item['generalId'] ?? item['ID'] ?? item['id'] ?? '').trim();
|
|
|
+ }
|
|
|
+
|
|
|
+ private openReadingSetup(item: Item, wordList: string[]): void {
|
|
|
const params = {
|
|
|
wordList: wordList.join(','),
|
|
|
- GeneralID: item['GeneralID'],
|
|
|
+ GeneralID: this.recordId(item),
|
|
|
returnUrl: this.router.url,
|
|
|
t: Date.now(),
|
|
|
};
|