Commit a651205d authored by 李维's avatar 李维

修改快速创建热区为追加模式

parent fcf83e4c
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -221,6 +221,15 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
addHotZone(itemName) {
// this.imgArr.push({});
// this.hotZoneArr.push({});
const item = this.getHotZoneItem();
item.itemName = itemName;
this.hotZoneArr.push(item);
this.refreshItem(item);
this.refreshHotZoneId();
}
addBtnClick() {
// this.imgArr.push({});
......
......@@ -34,6 +34,7 @@
<h2 >热区位置配置:</h2>
<app-custom-hot-zone
#customHotZone
[bgItem]="item.bgItem"
[hotZoneItemArr]="item.hotZoneItemArr"
(save)="saveHotZone(item, $event)"
......@@ -43,7 +44,7 @@
<h2 style="margin-top: 10px;">快速创建热区:</h2>
<div style="font-size: 16px; border: 2px solid #ccc; border-radius: 10px; padding: 10px 150px 10px 10px;">
<input type="text" nz-input [(ngModel)]="fastHotZoneStr"/>
<button nz-button nzType="danger" [disabled]="fastHotZoneStr==''" (click)="handleFastCreatHotZoneItems();" style="position: absolute; right: 30px; margin-right: 10px;"><i nz-icon nzType="import"></i>生成</button>
<button nz-button nzType="danger" [disabled]="fastHotZoneStr==''" (click)="handleFastCreatHotZoneItems();" style="position: absolute; right: 30px; margin-right: 10px;"><i nz-icon nzType="import"></i>创建</button>
</div>
<h2 style="margin-top: 10px;">热区内容配置:</h2>
......
......@@ -9,7 +9,9 @@ import {
HostListener,
ApplicationRef,
ChangeDetectorRef,
AfterViewInit
AfterViewInit,
ViewChild,
ElementRef
} from '@angular/core';
import { JsonPipe } from '@angular/common';
import { removeItemFromArr } from '../play/Unit';
......@@ -51,7 +53,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
CROSSWORD_PUZZLE = "9";
SORT_WORDS = "10";
@ViewChild('customHotZone', {static: true}) customHotZone: ElementRef;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef, private nzMessageService: NzMessageService, private modal: NzModalService) {
......@@ -80,41 +82,34 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
// 快速创建热区
handleFastCreatHotZoneItems() {
this.modal.confirm({
nzTitle: '<i>确定要快速创建热区吗?</i>',
nzContent: '<b>原有热区会被全部覆盖,此操作不可恢复!</b>',
nzOnOk: () => {
this.fastHotZoneStr = this.fastHotZoneStr.replace(/,/g, ",");
const hotZoneNames = this.fastHotZoneStr.split(",");
const newHotZoneItemArr = [];
hotZoneNames.forEach((hotZoneName, index) => {
newHotZoneItemArr.push({
"index": index,
"itemType": "rect",
"itemName": hotZoneName,
"fontSize": 50,
"fontName": "BRLNSR_1",
"fontColor": "#8f3758",
"fontScale": 0.734375,
"imgScale": 1,
"mapScale": 0.734375,
"rect": {
"x": 0,
"y": 0,
"width": 100,
"height": 100
}
})
this.customHotZone["addHotZone"](hotZoneName)
// newHotZoneItemArr.push({
// "index": index,
// "itemType": "rect",
// "itemName": hotZoneName,
// "fontSize": 50,
// "fontName": "BRLNSR_1",
// "fontColor": "#8f3758",
// "fontScale": 0.734375,
// "imgScale": 1,
// "mapScale": 0.734375,
// "rect": {
// "x": 0,
// "y": 0,
// "width": 100,
// "height": 100
// }
// })
})
const data = this.item;
data.hotZoneItemArr = newHotZoneItemArr;
// const data = this.item;
// data.hotZoneItemArr = newHotZoneItemArr;
this.fastHotZoneStr = "";
this.item = JSON.parse(JSON.stringify(data));
this.save()
}
});
this.nzMessageService.success('创建成功,需要保存热区');
// this.item = JSON.parse(JSON.stringify(data));
// this.save()
}
// 添加热区配置
......
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