Commit d8312f21 authored by LWD's avatar LWD

代码提交

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