|
|
@@ -766,6 +766,8 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
selectCoursePass(pass: number): void {
|
|
|
if (this.selectionLocked() || pass === this.coursePass() || pass < 0 || pass > 3) return;
|
|
|
+ this.audioRequest++;this.platform.stopAudio();this.audioPreparing.set(false);
|
|
|
+ this.selectionRevealed.set(new Set());
|
|
|
this.bulkSelection.set(null);
|
|
|
this.courseSelectionNeedsRebase = false;
|
|
|
this.selectionRequest?.unsubscribe();
|
|
|
@@ -781,12 +783,14 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
}
|
|
|
|
|
|
revealSelectionWord(word: Word): void {
|
|
|
- this.selectionRevealed.update((current) => {
|
|
|
- const next = new Set(current);
|
|
|
- if (next.has(word.id)) next.delete(word.id);
|
|
|
- else next.add(word.id);
|
|
|
- return next;
|
|
|
- });
|
|
|
+ if (this.isReadOnlySelectionPage) {
|
|
|
+ this.selectionRevealed.update(current => {
|
|
|
+ const next = new Set(current);
|
|
|
+ if (next.has(word.id)) next.delete(word.id); else next.add(word.id);
|
|
|
+ return next;
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.play(word);
|
|
|
}
|
|
|
|
|
|
@@ -964,12 +968,12 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
this.audioPreparing.set(false);
|
|
|
if (this.isHistoryWordView) this.historyAudioWordId.set(word.id);
|
|
|
const playAudio = async (url: string, silentFailure = false) => {
|
|
|
- const status = await (this.isHistoryWordView || this.isNewWordSelectionPage
|
|
|
+ const status = await (this.isHistoryWordView || this.isSelectionPage || this.isStudyListPage
|
|
|
? this.platform.play(url, silentFailure, {
|
|
|
onEnded: () => {
|
|
|
if (!active()) return;
|
|
|
- if (this.isNewWordSelectionPage) this.selectionRevealed.update(current => new Set(current).add(word.id));
|
|
|
- else this.historyWordRevealed.update(current => new Set(current).add(word.id));
|
|
|
+ if (this.isHistoryWordView) this.historyWordRevealed.update(current => new Set(current).add(word.id));
|
|
|
+ else if (!this.isStudyListPage || this.repetitions()[word.id] === 2) this.selectionRevealed.update(current => new Set(current).add(word.id));
|
|
|
this.historyAudioWordId.set('');
|
|
|
},
|
|
|
onError: () => {
|
|
|
@@ -1029,6 +1033,7 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ this.selectionRevealed.update(current => new Set([...current].filter(id => id !== word.id)));
|
|
|
this.play(word);
|
|
|
if (count < 3) {
|
|
|
this.repetitions.update((value) => ({ ...value, [word.id]: count + 1 }));
|
|
|
@@ -1039,6 +1044,8 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
}
|
|
|
|
|
|
shuffleStudyWords(): void {
|
|
|
+ this.audioRequest++;this.platform.stopAudio();this.audioPreparing.set(false);
|
|
|
+ this.selectionRevealed.set(new Set());
|
|
|
this.words.set(shuffledStudy(this.words()));
|
|
|
this.repetitions.set({});
|
|
|
}
|
|
|
@@ -1600,7 +1607,7 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
const failure=(error:ApiError)=>{if(rebaseFromPage!==undefined){this.selectionPage.set(rebaseFromPage);this.platform.toast(error.message,'error');}else if(more){this.selectionPage.update(p=>p-1);this.platform.toast(error.message,'error');}else this.error.set(error.message);};
|
|
|
if (this.meta.path === 'pages/stu/stu_abc') {
|
|
|
const student = this.session.student() ?? this.session.user();this.selectionLoading.set(true);
|
|
|
- this.selectionRequest=this.api.get<unknown>('e_ck_list',{checkwords:2,nids:this.query('nids')||this.query('nid'),pnid:this.query('pnid'),learningPass:this.coursePass(),modelId:52,cpage:this.selectionPage(),psize:100,uid:student?.userId}).pipe(finalize(()=>{this.selectionLoading.set(false);this.loading.set(false);})).subscribe({next:({result,page})=>{
|
|
|
+ this.selectionRequest=this.api.get<unknown>('e_ck_list',{checkwords:2,nids:this.query('nids')||this.query('nid'),pnid:this.query('pnid'),learningPass:this.coursePass(),modelId:52,cpage:this.selectionPage(),psize:100,compact:true,uid:student?.userId}).pipe(finalize(()=>{this.selectionLoading.set(false);this.loading.set(false);})).subscribe({next:({result,page})=>{
|
|
|
accept(result,page?.itemCount);
|
|
|
if (rebaseFromPage !== undefined) this.courseSelectionNeedsRebase = false;
|
|
|
const merged=new Map(this.courseSelectionCache().map(word=>[word.id,word]));
|