Commit 112eb3c0 authored by Chen Jiping's avatar Chen Jiping

feat:调整逻辑,增加引导音频

parent 0ad8a900
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<tr> <tr>
<th>序号</th> <th>序号</th>
<th>字母</th> <th>字母</th>
<th>引导音频</th>
<th>音频</th> <th>音频</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
...@@ -79,6 +80,11 @@ ...@@ -79,6 +80,11 @@
<tr *ngFor="let row of wordTable.data;let j = index"> <tr *ngFor="let row of wordTable.data;let j = index">
<td>{{ j+1 }}</td> <td>{{ j+1 }}</td>
<td><input type="text" nz-input [(ngModel)]="row.val" (blur)="save()" maxlength="1"></td> <td><input type="text" nz-input [(ngModel)]="row.val" (blur)="save()" maxlength="1"></td>
<td>
<app-audio-recorder [audioUrl]="row.guideAudioUrl"
(audioUploaded)="onAudioUploadSuccess($event, row, 'guideAudioUrl')">
</app-audio-recorder>
</td>
<td> <td>
<app-audio-recorder [audioUrl]="row.audioUrl" <app-audio-recorder [audioUrl]="row.audioUrl"
(audioUploaded)="onAudioUploadSuccess($event, row, 'audioUrl')"> (audioUploaded)="onAudioUploadSuccess($event, row, 'audioUrl')">
......
...@@ -116,6 +116,9 @@ cc.Class({ ...@@ -116,6 +116,9 @@ cc.Class({
this._audioResList.push({ url: wordArr[i].audioUrl }); this._audioResList.push({ url: wordArr[i].audioUrl });
} }
if(wordArr[i].guideAudioUrl){
this._audioResList.push({ url: wordArr[i].guideAudioUrl });
}
} }
} }
...@@ -216,7 +219,7 @@ cc.Class({ ...@@ -216,7 +219,7 @@ cc.Class({
this._cantouch = false; this._cantouch = false;
//播放动 //播放动
this.playAni('begin', 0); this.playAni('begin', 0);
const begin = () => { const begin = () => {
...@@ -224,6 +227,8 @@ cc.Class({ ...@@ -224,6 +227,8 @@ cc.Class({
this._cantouch = true; this._cantouch = true;
this._canClickCat = true;
this.begin(); this.begin();
} }
console.log(this.data.guideAudioUrl1); console.log(this.data.guideAudioUrl1);
...@@ -264,6 +269,7 @@ cc.Class({ ...@@ -264,6 +269,7 @@ cc.Class({
//有空格,取2 * index节点值 //有空格,取2 * index节点值
let wordNode = textNode.wordNodeArr[2 * index]; let wordNode = textNode.wordNodeArr[2 * index];
this.playAudioByUrl(word.guideAudioUrl, () => {
//播放音频 //播放音频
this.playAudioByUrl(word.audioUrl, ()=>{ this.playAudioByUrl(word.audioUrl, ()=>{
...@@ -272,7 +278,7 @@ cc.Class({ ...@@ -272,7 +278,7 @@ cc.Class({
//显示文本动画 //显示文本动画
this.textTwinkle(wordNode); this.textTwinkle(wordNode);
})
}, },
maskNode: null, maskNode: null,
...@@ -358,6 +364,8 @@ cc.Class({ ...@@ -358,6 +364,8 @@ cc.Class({
const state = this.playAni('begin', 0); const state = this.playAni('begin', 0);
this.playAudioByUrl(wordArr[i].guideAudioUrl, () => {
//播放音频 //播放音频
this.playAudioByUrl(wordArr[i].audioUrl, ()=>{ this.playAudioByUrl(wordArr[i].audioUrl, ()=>{
...@@ -369,7 +377,7 @@ cc.Class({ ...@@ -369,7 +377,7 @@ cc.Class({
//显示文本动画 //显示文本动画
this.textTwinkle(label); this.textTwinkle(label);
})
}) })
//其余字母 //其余字母
...@@ -396,6 +404,25 @@ cc.Class({ ...@@ -396,6 +404,25 @@ cc.Class({
let wordArr = this.data.exercises.word2Arr; let wordArr = this.data.exercises.word2Arr;
const play = () => {
if (!this._cantouch) {
return;
}
this._cantouch = false;
const state = this.playAni('begin', 0);
//播放单词音频
this.playTextAutio(() => {
state.stop();
this.playAni('normal', 0);
});
}
for (let i = 0; i < wordArr.length; ++i) { for (let i = 0; i < wordArr.length; ++i) {
if (!wordArr[i].val) { if (!wordArr[i].val) {
...@@ -407,12 +434,19 @@ cc.Class({ ...@@ -407,12 +434,19 @@ cc.Class({
let label = this.getWord(initial, 80, true); let label = this.getWord(initial, 80, true);
label.isInitial = true; label.isInitial = true;
wordNodeArr.push(label); wordNodeArr.push(label);
label.addComponent(cc.Button);
label.on('click', () => {
play();
});
//其余字母 //其余字母
let last = wordArr[i].val.substr(1); let last = wordArr[i].val.substr(1);
let lastLabel = this.getWord(last, 80, false); let lastLabel = this.getWord(last, 80, false);
wordNodeArr.push(lastLabel); wordNodeArr.push(lastLabel);
lastLabel.addComponent(cc.Button);
lastLabel.on('click', () => {
play();
});
} }
...@@ -427,6 +461,8 @@ cc.Class({ ...@@ -427,6 +461,8 @@ cc.Class({
_showStandby: null, _showStandby: null,
initBtn() { initBtn() {
this._canClickCat = false;
const catBtn = cc.find('Canvas/Main Camera/catFrame/cat/ClickBtn'); const catBtn = cc.find('Canvas/Main Camera/catFrame/cat/ClickBtn');
catBtn.addComponent(cc.Button); catBtn.addComponent(cc.Button);
...@@ -635,11 +671,6 @@ cc.Class({ ...@@ -635,11 +671,6 @@ cc.Class({
} }
}, (audioId) => { }, (audioId) => {
//显示完成,不再播放动画
if (this._shown) {
return;
}
//设置可播放动画 //设置可播放动画
this._stopAni = false; this._stopAni = false;
......
...@@ -3,11 +3,13 @@ export const defaultData = { ...@@ -3,11 +3,13 @@ export const defaultData = {
"wordArr":[ "wordArr":[
{ {
"val":"A", "val":"A",
"audioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3" "audioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3",
"guideAudioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3"
}, },
{ {
"val":"a", "val":"a",
"audioUrl":"http://staging-teach.cdn.ireadabc.com/607af37644501e678de6cbafee555948.mp3" "audioUrl":"http://staging-teach.cdn.ireadabc.com/607af37644501e678de6cbafee555948.mp3",
"guideAudioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3"
} }
], ],
"word2Arr":[ "word2Arr":[
......
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