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,28 +154,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni ...@@ -154,28 +154,16 @@ 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) {
setTimeout(() => { if (this.num + 1 < this.wordnum.length) {
this.blankindex.forEach((value) => { this.isShowNextBtn = true;
this.words[value].istrue = false;
for (let s = 0; s < this.wordnum.length; s++) {
this.otherwordnum[s].rigof = false;
}
});
}, 1500);
this.indexnum = 0;
} else {
setTimeout(() => {
this.num++;
this.indexnum = 0;
this.blankindex.length = 0;
this.load();
this.otherwordnum[this.num - 1].rigof = false;
}, 1500);
} }
} }
this.index = this.blankindex[this.indexnum]; this.index = this.blankindex[this.indexnum];
...@@ -184,6 +172,33 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni ...@@ -184,6 +172,33 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
this.refresh(); this.refresh();
} }
enterNext() {
this.isShowNextBtn = false;
console.log('in enterNext');
if (this.num + 1 >= this.wordnum.length) {
setTimeout(() => {
this.blankindex.forEach((value) => {
this.words[value].istrue = false;
for (let s = 0; s < this.wordnum.length; s++) {
this.otherwordnum[s].rigof = false;
}
});
}, 0);
this.indexnum = 0;
} else {
setTimeout(() => {
this.num++;
this.indexnum = 0;
this.blankindex.length = 0;
this.load();
this.otherwordnum[this.num - 1].rigof = false;
}, 0);
}
}
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) {
this.Spelling_audio.src = this.data.contentObj.wordnum[this.num].spelling_audio; this.Spelling_audio.src = 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