Commit cb223069 authored by Chen Jiping's avatar Chen Jiping

优化

parent d7e354d2
......@@ -54,10 +54,10 @@
<tr *ngFor="let data of answersTable.data;let j = index">
<td>{{j+1}}</td>
<td>
<nz-select [(ngModel)]="data.contentType" nzPlaceHolder="请选择" (ngModelChange)="setAnswerType($event, data)">
<nz-option nzValue="T" nzLabel="文字"></nz-option>
<nz-option nzValue="P" nzLabel="图片"></nz-option>
</nz-select>
<nz-radio-group [(ngModel)]="data.contentType" (ngModelChange)="setAnswerType($event, data)">
<label nz-radio nzValue="T">文字</label>
<label nz-radio nzValue="P">图片</label>
</nz-radio-group>
</td>
<td>
<div *ngIf="data.contentType == 'P'">
......
......@@ -83,8 +83,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/
save() {
(<any> window).courseware.setData(this.item, null, this.saveKey);
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}
......
......@@ -5,7 +5,7 @@ import {
Label
} from './Unit';
export class Exercise{
export class Exercise {
exercise;
......@@ -13,24 +13,30 @@ export class Exercise{
answers = [];
constructor(exercise){
constructor(exercise) {
this.exercise = exercise;
}
addAnswer(answer : Answer){
addAnswer(answer: Answer) {
this.answers.push(answer);
}
set listeningAudio(audio){
set listeningAudio(audio) {
this._listeningAudio = audio;
}
get listeningAudio(){
get listeningAudio() {
return this._listeningAudio;
}
reset() {
for (let i = 0; i < this.answers.length; ++i) {
this.answers[i].reset();
}
}
}
export class Answer{
export class Answer {
bg;
......@@ -54,7 +60,7 @@ export class Answer{
selected = false;
constructor(images, answerContent){
constructor(images, answerContent) {
this.images = images;
......@@ -100,7 +106,7 @@ export class Answer{
let scale = Math.min((parItem.height - 15 * this.scaleX) / h, (parItem.width - 15 * this.scaleY) / w);
//如果小于1,则缩放图片
if(scale < 1){
if (scale < 1) {
content_pic.setScaleXY(scale);
}
......@@ -140,11 +146,11 @@ export class Answer{
}
getWidth(){
getWidth() {
return 234 * this.scaleX;
}
getHeight(){
getHeight() {
return 178 * this.scaleY;
}
......@@ -181,21 +187,21 @@ export class Answer{
* @param callback
*/
moveOut(toX, toY, callback = null) {
if (this.contentType == 'T') {
if (this.contentType == 'T') {
this.bg.x = toX;
this.bg.y = toY;
tweenChange(this.contentSprite, { alpha: 0 }, 0.3, callback);
tweenChange(this.contentSprite, { alpha: 0 }, 0.3, callback);
}
else if (this.contentType == 'P') {
this.bg.x = toX;
this.bg.y = toY;
tweenChange(this.contentSprite, { alpha: 0 }, 0.3, callback);
}
}
reset(){
reset() {
this.selected = false;
}
}
\ No newline at end of file
......@@ -713,16 +713,18 @@ export class PlayComponent implements OnInit, OnDestroy {
return box;
}
const midBox = initBox('mid');
midBox.boxBg.x = (this.canvasWidth - midBox.boxBg.width) / 2;
this.midBox = midBox;
const rightBox = initBox('right');
rightBox.boxBg.x = 869 * this.mapScale;
rightBox.boxBg.x = midBox.boxBg.x + 99 * this.mapScale + midBox.boxBg.width;
this.rightBox = rightBox;
const midBox = initBox('mid');
midBox.boxBg.x = 506 * this.mapScale;
this.midBox = midBox;
const leftBox = initBox('left');
leftBox.boxBg.x = 133 * this.mapScale;
leftBox.boxBg.x = midBox.boxBg.x - 99 * this.mapScale - rightBox.boxBg.width;
this.leftBox = leftBox;
}
......@@ -809,6 +811,10 @@ export class PlayComponent implements OnInit, OnDestroy {
initGame() {
for (let i = 0; i < this.exerciseArr.length; ++i) {
this.exerciseArr[i].reset();
}
this.tempExerciseArr = randomSortByArr(this.exerciseArr);
this.lemonArr = [];
......@@ -905,6 +911,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
if (this.checkClickTarget(this.restartBtn.bg)) {
this.canTouch = false;
this.restartBtn.click(() => {
this.player.reset();
......
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