Commit 36781dfe authored by Li MingZhe's avatar Li MingZhe

feat: 添加下一题按钮

parent 01f5a1a4
...@@ -48,7 +48,14 @@ ...@@ -48,7 +48,14 @@
<div *ngFor="let item of letter;" (click)="add(item)"> <div *ngFor="let item of letter;" (click)="add(item)">
<p>{{item}}</p> <p>{{item}}</p>
</div> </div>
</div> </div>
<div *ngIf="isShowNextBtn" style="position: absolute; bottom: 5%; right: 5%" (click)="enterNext()">
<img src="assets/spelling/btn_next.png" style="cursor: pointer; height: 12vh; width: auto">
</div>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -12,7 +12,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni ...@@ -12,7 +12,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
// 数据 // 数据
data; data;
saveKey = 'spelling'; saveKey = 'spelling';
isShowNextBtn = false;
letter: any[]; letter: any[];
blankindex = []; blankindex = [];
...@@ -154,10 +154,29 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni ...@@ -154,10 +154,29 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
truenum++; truenum++;
} }
}); });
if (truenum === this.blankindex.length) { if (truenum === this.blankindex.length) {
const step = this.leaf[this.num].offsetLeft + this.leaf[this.num].clientWidth / 2 - this.monkey.clientWidth / 2 + this.left; const step = this.leaf[this.num].offsetLeft + this.leaf[this.num].clientWidth / 2 - this.monkey.clientWidth / 2 + this.left;
this.monkey.style.left = step.toString() + 'px'; this.monkey.style.left = step.toString() + 'px';
this.rightAudio.play(); this.rightAudio.play();
if (this.num + 1 < this.wordnum.length) {
this.isShowNextBtn = true;
}
}
this.index = this.blankindex[this.indexnum];
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}
enterNext() {
this.isShowNextBtn = false;
console.log('in enterNext');
if (this.num + 1 >= this.wordnum.length) { if (this.num + 1 >= this.wordnum.length) {
setTimeout(() => { setTimeout(() => {
this.blankindex.forEach((value) => { this.blankindex.forEach((value) => {
...@@ -166,23 +185,19 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni ...@@ -166,23 +185,19 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
this.otherwordnum[s].rigof = false; this.otherwordnum[s].rigof = false;
} }
}); });
}, 1500); }, 0);
this.indexnum = 0; this.indexnum = 0;
} else { } else {
setTimeout(() => { setTimeout(() => {
this.num++; this.num++;
this.indexnum = 0; this.indexnum = 0;
this.blankindex.length = 0; this.blankindex.length = 0;
this.load(); this.load();
this.otherwordnum[this.num - 1].rigof = false; this.otherwordnum[this.num - 1].rigof = false;
}, 1500); }, 0);
} }
} }
this.index = this.blankindex[this.indexnum];
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}
playSpellingAudio() { playSpellingAudio() {
if (this.data.contentObj && this.data.contentObj.wordnum[this.num].spelling_audio) { if (this.data.contentObj && this.data.contentObj.wordnum[this.num].spelling_audio) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment