From d4e36e95f38629aec017cc1c65419ce7c8b1929c Mon Sep 17 00:00:00 2001 From: "Eric.Lee" <liwei7016@vip.qq.com> Date: Thu, 17 Sep 2020 20:11:28 +0800 Subject: [PATCH] Bug fix --- .../custom-hot-zone/custom-hot-zone.component.html | 11 +++++++++-- .../custom-hot-zone/custom-hot-zone.component.ts | 12 +++++++----- src/assets/default/formData/defaultData.js | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/app/common/custom-hot-zone/custom-hot-zone.component.html b/src/app/common/custom-hot-zone/custom-hot-zone.component.html index ab005b6..92ead21 100644 --- a/src/app/common/custom-hot-zone/custom-hot-zone.component.html +++ b/src/app/common/custom-hot-zone/custom-hot-zone.component.html @@ -172,11 +172,18 @@ <div style="float: left; margin-left: 10px;"> <div>组åˆ</div> <div> - <nz-select *ngFor="let part of item.combin; let i = index" style="float: left; margin-right: 5px; width: 150px;" (ngModelChange)="handlePartChange($event, item, i)"> + <nz-select *ngFor="let part of item.combin; let i = index" [attr.data-index]="i" [(ngModel)]="bgItem.questions[QI]._combin[i]" style="float: left; margin-right: 5px; width: 150px;" (ngModelChange)="handlePartChange($event, QI, i)"> <nz-option [nzDisabled]="checkDisabel(item.combin, -1, i)" [nzValue]="-1" [nzLabel]="'L-' + bgItem.wordLeft_text"></nz-option> <nz-option [nzDisabled]="checkDisabel(item.combin, -2, i)" [nzValue]="-2" [nzLabel]="'R-' + bgItem.wordRight_text"></nz-option> - <nz-option *ngFor="let hot of hotZoneArr; let j = index;" [nzValue]="j" [nzLabel]="(j + 1) + '-' + hot.text"></nz-option> + <nz-option *ngFor="let hot of hotZoneArr; let j = index;" [attr.data-index]="j" [nzValue]="j" [nzLabel]="(j + 1) + '-' + hot.text"></nz-option> </nz-select> + + <!-- <select *ngFor="let part of item.combin; let i = index" style="float: left; margin-right: 5px; width: 150px;" (change)="handlePartChange($event, QI, i)"> + <option *ngIf="checkDisabel(item.combin, -1, i)" [value]="-1">{{'L-' + bgItem.wordLeft_text}}</option > + <option *ngIf="checkDisabel(item.combin, -2, i)" [value]="-2">{{'R-' + bgItem.wordRight_text}}</option > + <option *ngFor="let hot of hotZoneArr; let j = index;" [value]="j">{{(j + 1) + '-' + hot.text}}</option > + </select> --> + </div> </div> <div style="float: left; margin-left: 10px;"> diff --git a/src/app/common/custom-hot-zone/custom-hot-zone.component.ts b/src/app/common/custom-hot-zone/custom-hot-zone.component.ts index 1a2533f..b043fae 100644 --- a/src/app/common/custom-hot-zone/custom-hot-zone.component.ts +++ b/src/app/common/custom-hot-zone/custom-hot-zone.component.ts @@ -228,9 +228,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { // item.text = "" item.type = "Image" } else { - item.init(`assets/play/bg_70_40_${this.hotZoneItemArr.length}.png`, null, "Image", () => { + item.init(`assets/play/hotZooCard/bg_70_40_${this.hotZoneItemArr.length}.png`, null, "Image", () => { // item.image_url = "assets/play/bg_70_40.png" - console.log(this.canvasWidth, this.canvasHeight) item.x = this.canvasWidth / 2 - 35; item.y = this.canvasHeight / 2 - 20; }, () => this.autoSave()); @@ -358,7 +357,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { addQustion() { this.bgItem.questions.push({ number: 2, - combin: [0,0] + combin: [0, 0], + _combin: [0, 0] }) this.autoSave() } @@ -575,8 +575,10 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { this.curItem.showLineDash(); } - handlePartChange(e, item, index) { - item.combin[index] = Number(e) + handlePartChange(e, QI, index) { + let a = JSON.parse(JSON.stringify(this.bgItem.questions[QI].combin)) + a[index] = Number(e) + this.bgItem.questions[QI].combin = a this.autoSave() } diff --git a/src/assets/default/formData/defaultData.js b/src/assets/default/formData/defaultData.js index ec9a2a0..cdcb85b 100644 --- a/src/assets/default/formData/defaultData.js +++ b/src/assets/default/formData/defaultData.js @@ -1,5 +1,5 @@ export const defaultData = { - "version": "1.1", + "version": "1.2", "dataKey": "DataKey_YM4-11", "dataArray": [ -- 2.21.0