Commit 162bdb0c authored by 李维's avatar 李维

Bug fix

parent 11829441
......@@ -236,7 +236,7 @@
<div *ngFor="let it of wordArr; let i = index" class="card-item" style="padding: 0.5vw;">
<div class="border">
<div nz-form>
<nz-divider nzText="选项" nzOrientation="left"></nz-divider>
<nz-divider [nzText]="i+1" nzOrientation="left"></nz-divider>
<nz-form-item>
<nz-form-label [nzSpan]="3" nzFor="words">左侧</nz-form-label>
<nz-form-control [nzSpan]="6">
......@@ -268,7 +268,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="3">正确选项</nz-form-label>
<nz-form-label [nzSpan]="3">选项</nz-form-label>
<nz-form-control [nzSpan]="6">
<nz-select [(ngModel)]="it.correctOption" (ngModelChange)="saveItem()">
<nz-option nzValue="left" nzLabel="左选项"></nz-option>
......@@ -279,7 +279,7 @@
<nz-form-item>
<div nz-col [nzSpan]="15" nzOffset="2">
<nz-table [nzData]="it.letters" [nzHideOnSinglePage]="true" [nzBordered]="true">
<nz-table [nzData]="it.letters" [nzHideOnSinglePage]="true" [nzFrontPagination]="false" [nzBordered]="true">
<thead>
<tr>
<th>字母</th>
......
......@@ -491,7 +491,17 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
stopAllAudio() {
if(this.listenPlaying) {
this.listenPlaying = false;
this.listenPlayBtn.alpha = 1;
this.listenPauseBtn.alpha = 0;
}
for(let key in this.audioObj) {
this.audioObj[key].pause();
this.audioObj[key].currentTime = 0;
}
}
loadResources() {
......@@ -742,7 +752,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initPic() {
this.body_bg = new ShapeRoundRect();
this.body_bg.setSize(1083*this.mapScale, 555*this.mapScale, 30*this.mapScale) ;
this.body_bg.x = (this.canvasWidth - this.body_bg.width) / 2 ;
this.body_bg.x = (this.canvasWidth - this.body_bg.width) / 2 - 100 * this.mapScale;
this.body_bg.y = this.canvasHeight - this.body_bg.height - (this.canvasHeight - this.body_bg.height)/3 ;
this.renderArr.push(this.body_bg);
......@@ -750,14 +760,14 @@ export class PlayComponent implements OnInit, OnDestroy {
colorBlock_left.x = 0;
colorBlock_left.y = 0;
colorBlock_left.fillColor = `#${this.saveData.blockColor}`;
colorBlock_left.setSize(560*this.mapScale, 500*this.mapScale, 30)
colorBlock_left.setSize(640*this.mapScale, 500*this.mapScale, 30)
this.body_bg.addChild(colorBlock_left)
let colorBlock_right = new ShapeRoundRect()
colorBlock_right.x = 580*this.mapScale;
colorBlock_right.x = 680*this.mapScale;
colorBlock_right.y = 0;
colorBlock_right.fillColor = `#${this.saveData.blockColor}`;
colorBlock_right.setSize(560*this.mapScale, 500*this.mapScale, 30);
colorBlock_right.setSize(640*this.mapScale, 500*this.mapScale, 30);
this.body_bg.addChild(colorBlock_right);
// 初始化单词显示
......@@ -809,12 +819,12 @@ export class PlayComponent implements OnInit, OnDestroy {
let letterFontSize = 48;
// 单词背景
let word_bg_group = new ShapeRoundRect()
word_bg_group.width = 560;
word_bg_group.width = 640;
word_bg_group.height = 57;
word_bg_group.x = x * this.mapScale;
word_bg_group.y = y * this.mapScale;
word_bg_group.fillColor = "#FFFF00"
word_bg_group.alpha = 0;
word_bg_group.alpha = 1;
let startWidth = 80;
//单词
......@@ -836,7 +846,17 @@ export class PlayComponent implements OnInit, OnDestroy {
let totalWidth = 0;
let height = 0;
let letter_spr_arr = [];
for(let i = 0; i < word_content.letters.length; ++ i) {
let len = word_content.letters.length
let scale = 1
if(len>=13 && len<18) {
scale = 0.9
} else if(len>=18 && len<20) {
scale = 0.85
} else if(len>=20) {
scale = 0.8
}
for(let i = 0; i < len; ++ i) {
//字母
let letter = word_content.letters[i];
let letter_spr = new Label();
......@@ -852,17 +872,17 @@ export class PlayComponent implements OnInit, OnDestroy {
letter_spr.textAlign = 'center';
// letter_spr.fontSize = word_content.word_font_size ? word_content.word_font_size : 110;
letter_spr.fontSize = letterFontSize;
letter_spr.fontSize = letterFontSize * scale;
letter_spr.fontName = 'MMTextBook-Bold';
letter_spr.fontColor = this.getColor(letter.letter_color);
letter_spr.refreshSize();
if(letter.is_=="1") {
letter_spr.width = 35;
letter_spr.width = 35 * scale;
}
letter_spr_arr.push(letter_spr);
let ltBounds = letter_spr.getBoundingBox();
//设置坐标
letter_spr.x = ltBounds.width / 2 + totalWidth + 5;
letter_spr.x = ltBounds.width * scale / 2 + totalWidth * scale + 5;
letter_spr.y = letter_spr.height / 2;
ltBounds = letter_spr.getBoundingBox();
......@@ -900,7 +920,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let x = 0;
let y = 50 + 114 * i;
if(i>3){
x = 580;
x = 680;
y = 50 + 114 * (i - 4);
}
let index_1 = i // this.saveData.recordingIndex.indexOf(tIndex)
......@@ -1017,17 +1037,20 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.checkClickTarget(this.title_bg)) {
// console.log('click the words :' , this.data.words_audio_url) ;
this.stopAllAudio()
this.playAudio(this.saveData.title.t_audio_url) ;
return ;
}
if (this.checkClickTarget(this.words_bg)) {
// console.log('click the words :' , this.data.words_audio_url) ;
this.stopAllAudio()
this.playAudio(this.saveData.words_audio_url) ;
return ;
}
if (this.words_bg_right&&this.checkClickTarget(this.words_bg_right)) {
this.stopAllAudio()
this.playAudio(this.saveData.words_two_audio_url) ;
return ;
}
......@@ -1056,7 +1079,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
word.wordLoaded = true;
this.stopAllAudio()
this.playAudio("sm-choice-correct", false, ()=>{
this.stopAllAudio()
this.playAudio(this.saveData.wordArr[option["index"]].word_audio_url);
})
......@@ -1095,6 +1120,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// } else {
// this.playAudio("sm-choice-correct", false, ()=>{
if(this.saveData.indexAudio[numberStart.index-1]) {
this.stopAllAudio()
this.playAudio(this.saveData.indexAudio[numberStart.index-1], true, ()=>{
this.canTouch = true;
})
......@@ -1126,11 +1152,13 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
word.wordLoaded = true;
this.stopAllAudio()
this.playAudio("sm-choice-correct", false, ()=>{
// this.playAudio(this.saveData.wordArr[i].word_audio_url);
})
return ;
}
this.stopAllAudio()
this.playAudio(this.saveData.wordArr[i].word_audio_url);
}
return ;
......@@ -1172,7 +1200,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.listenPlayBtn.alpha = 0;
this.listenPauseBtn.alpha = 1;
this.stopAllAudio();
this.playAudio(this.saveData.listen_audio_url);
this.listenPlaying = true;
......
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