Commit 4dbcfc45 authored by Chen Jiping's avatar Chen Jiping

fix:修复选项只能有一个正确答案;fix:修复重玩气泡偏移的问题

parent dc9d8f9a
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
</app-upload-image-with-preview> </app-upload-image-with-preview>
</td> </td>
<td> <td>
<nz-radio-group [(ngModel)]="answer.isRight" (ngModelChange)="save()"> <nz-radio-group [(ngModel)]="answer.isRight" (ngModelChange)="radioChange($event, data, answer)">
<label nz-radio nzValue="1"></label> <label nz-radio nzValue="1"></label>
<label nz-radio nzValue="0"></label> <label nz-radio nzValue="0"></label>
</nz-radio-group> </nz-radio-group>
......
...@@ -152,6 +152,26 @@ onAudioUploadSuccess(e, item, key) { ...@@ -152,6 +152,26 @@ onAudioUploadSuccess(e, item, key) {
} }
} }
radioChange(e, exercises, answer){
//如果正确答案,则将其它答案置成否
if( e == '1'){
let answers = exercises.answers;
for(let m = 0; m < answers.length; ++ m){
if(answers[m] == answer){
continue;
}
answers[m].isRight = '0';
}
exercises['answers'] = [...exercises['answers']];
}
this.save();
}
saveData(e, i) { saveData(e, i) {
console.log('savedata e:', e); console.log('savedata e:', e);
......
...@@ -140,7 +140,7 @@ cc.Class({ ...@@ -140,7 +140,7 @@ cc.Class({
let answers = exercises.answers; let answers = exercises.answers;
for (let j = 0; j < answers.length; ++j) { for (let j = 0; j < answers.length; ++j) {
let answer = answers[j]; let answer = answers[j];
console.log(answer);
if (answer.audioUrl) { if (answer.audioUrl) {
this._audioResList.push({ url: answer.audioUrl }); this._audioResList.push({ url: answer.audioUrl });
} }
...@@ -501,15 +501,16 @@ cc.Class({ ...@@ -501,15 +501,16 @@ cc.Class({
bubbleSpr.node.parent = bubble_bg; bubbleSpr.node.parent = bubble_bg;
let rate = bubble_bg.width / this.data.bg.rect.width; let rate = bubble_bg.width / this.data.bg.rect.width;
console.log(rate);
hotZoneItem.rect.x *= rate;
hotZoneItem.rect.y *= rate;
hotZoneItem.rect.width *= rate;
hotZoneItem.rect.height *= rate;
let x = hotZoneItem.rect.x + hotZoneItem.rect.width / 2 - bubble_bg.width / 2; let rect = {};
console.log(hotZoneItem.rect, x); rect.x = hotZoneItem.rect.x * rate;
let y = bubble_bg.height / 2 - (hotZoneItem.rect.y + hotZoneItem.rect.height / 2); rect.y = hotZoneItem.rect.y * rate;
rect.width = hotZoneItem.rect.width * rate;
rect.height = hotZoneItem.rect.height * rate;
let x = rect.x + rect.width / 2 - bubble_bg.width / 2;
let y = bubble_bg.height / 2 - (rect.y + rect.height / 2);
bubbleSpr.node.x = x; bubbleSpr.node.x = x;
bubbleSpr.node.y = y; bubbleSpr.node.y = y;
...@@ -698,7 +699,8 @@ cc.Class({ ...@@ -698,7 +699,8 @@ cc.Class({
sprNode.on('click', () => { sprNode.on('click', () => {
this.showSoundAnima(sprNode); this.showSoundAnima(sprNode);
playAudioByUrl(item.audioUrl, () => { console.log(item.data);
playAudioByUrl(item.data.audioUrl, () => {
this.stopSoundAnima(sprNode); this.stopSoundAnima(sprNode);
}); });
}); });
......
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