Commit d8312f21 authored by LWD's avatar LWD

代码提交

parent 11a99175
......@@ -8,6 +8,7 @@
</div>
</div>
<nz-form-control [nzSpan]="18">
<span>标题声音: </span>
<app-audio-recorder [audioUrl]="item.audio_url"
......@@ -15,17 +16,15 @@
</app-audio-recorder>
</nz-form-control>
<nz-divider nzText="类别" nzOrientation="left"></nz-divider>
<!-- <div nz-row>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="add-btn" nzNoColon=true>龙巢</nz-form-label>
<nz-form-control [nzXs]='24' [nzSm]='12' [nzMd]='12' [nzLg]='6'>
<button nz-button nzType="dashed" class="add-btn" id="add-btn"
[disabled]="item.sheepfoldArr.length==2" (click)="addSheepfold()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>添加
<button style="margin: 10px;" nz-button nzType="danger" (click)="addSheepfold()">
<span>添加</span>
</button>
</nz-form-control>
</nz-form-item>
</div> -->
<button style="margin: 10px;" nz-button nzType="danger" (click)="delSheepfold(item.sheepfoldArr.length-1)">
<span>删除</span>
</button>
<div nz-row>
<div *ngFor="let data of item.sheepfoldArr;let i = index" style="margin: 2vw;">
<div nz-col [nzXs]='24' [nzSm]='12' [nzMd]='12' [nzLg]='9'>
......@@ -57,7 +56,7 @@
<div nz-row>
<div *ngFor="let data of item.sheepArr;let i = index" style="margin: 1vw;">
<div nz-col [nzXs]='24' [nzSm]='12' [nzMd]='12' [nzLg]='8'>
<nz-card nzTitle="选项-{{i + 1}}" [nzExtra]="extraTemplate1" style="height: 400px; margin: 1vw;">
<nz-card nzTitle="选项-{{i + 1}}" [nzExtra]="extraTemplate1" style="height: 550px; margin: 1vw;">
<nz-form-item>
<nz-form-label [nzSpan]="6">类别</nz-form-label>
<nz-form-control [nzSpan]="12">
......
......@@ -11,7 +11,7 @@ import { Sheepfold, Sheep, Course } from './Course';
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "LST07";
saveKey = "ET26";
// 储存对象
item;
......@@ -46,20 +46,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnDestroy() {
}
init() {
if (!this.item) {
this.item = new Course();
}
if (this.item && (this.item.sheepfoldArr.length < 1)) {
for (var i = 0; i < 2; i++) {
for (var i = 0; i < 3; i++) {
this.addSheepfold();
}
}
}
/**
* 储存图片数据
* @param e
......@@ -80,8 +77,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save();
}
/**
* 储存数据
*/
......@@ -114,6 +109,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
addSheepfold() {
if (this.item.sheepfoldArr.length >= 6) {
return
}
let sheepfold = new Sheepfold();
sheepfold.id = this.randomChar();
......@@ -124,6 +123,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
delSheepfold(index) {
if (index < 3) return
if (index !== -1) {
this.item.sheepfoldArr.splice(index, 1);
this.save();
......
This diff is collapsed.
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