Commit 1f09942a authored by Chen Jiping's avatar Chen Jiping

调整色板处理

parent b5c84a8f
...@@ -37,6 +37,27 @@ ...@@ -37,6 +37,27 @@
</button> </button>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzNoColon=true>图片涂色</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-input-group [nzSize]="'large'">
<div nz-row [nzGutter]="8">
<div nz-col nzSpan="5">
<nz-select [(ngModel)]="curPic" style="width: 110px;" id="type" nzPlaceHolder="picurte" (ngModelChange)="onChangeColor($event)">
<nz-option [nzValue]="option.picUrl" [nzLabel]="'图片-' + (i + 1) " *ngFor="let option of item.picArr;let i = index">
</nz-option>
</nz-select>
</div>
<div nz-col nzSpan="5">
<input nz-input [(ngModel)]="color" (blur)="setColor()"/>
</div>
<div nz-col nzSpan="5">
<input nz-input [(colorPicker)]="color" [style.background]="color" style="cursor: pointer; width:50px;margin-left: 10px;" (colorPickerClose)="setColor()" readonly/>
</div>
</div>
</nz-input-group>
</nz-form-control>
</nz-form-item>
</div> </div>
<div nz-row> <div nz-row>
<div *ngFor="let data of item.picArr;let i = index" nz-col [nzXs]='24' [nzSm]='12' [nzMd]='12' [nzLg]='7' style="margin: 1vw;"> <div *ngFor="let data of item.picArr;let i = index" nz-col [nzXs]='24' [nzSm]='12' [nzMd]='12' [nzLg]='7' style="margin: 1vw;">
...@@ -52,7 +73,7 @@ ...@@ -52,7 +73,7 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzNoColon=true>涂色</nz-form-label> <nz-form-label [nzSpan]="6" nzNoColon=true>涂色</nz-form-label>
<nz-form-control [nzSpan]="18"> <nz-form-control [nzSpan]="18">
<div [(colorPicker)]="data.color" [style.background]="data.color" style="cursor: pointer; width:50px;height:30px;border:1px solid #CCC;float:left;margin-left: 10px;" (colorPickerClose)="save()"></div> <div [ngStyle]="{'background':data.color,'width':'50px','height':'30px','border':'1px solid #CCC'}"></div>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</nz-card> </nz-card>
......
...@@ -16,6 +16,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -16,6 +16,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存对象 // 储存对象
item; item;
curPic;
color = "#f3440d";
colorArr = []; colorArr = [];
courseTypeArr = []; courseTypeArr = [];
...@@ -205,5 +209,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -205,5 +209,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
} }
onChangeColor(event){
this.curPic = null;
for(let i = 0; i < this.item.picArr.length; ++ i){
let pic = this.item.picArr[i];
let picUrl = pic.picUrl;
if(event === picUrl){
this.curPic = this.item.picArr[i];
this.color = pic.color;
break;
}
}
}
setColor(){
if(this.curPic){
this.curPic.color = this.color;
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