Commit a6048583 authored by huoshizhe's avatar huoshizhe

feat: 表单页更新

parent 49118022
<div class="model-content"> <div class="model-content">
<div class="border" style="position: absolute; left: 200px; top: 100px; width: 800px;"> <div class="border" style="position: absolute; left: 200px; top: 100px; width: 800px;">
<span style="float: left; height: 30px; font-size: 18px;">正确字母:</span> <span style="float: left; height: 30px; font-size: 18px;">正确字母:</span>
...@@ -6,14 +5,14 @@ ...@@ -6,14 +5,14 @@
<br> <br>
<br> <br>
<span style="float: left; height: 30px; font-size: 18px;">正确字母个数:</span> <span style="float: left; height: 30px; font-size: 18px;">正确字母个数:</span>
<input style="float: left; width: 50px;" type="text" nz-input [(ngModel)]="item.rightNum" (blur)="save()"> <input style="float: left; width: 100px;" type="number" nz-input [(ngModel)]="item.rightNum" (blur)="save()">
<br> <br>
<br> <br>
<span style="float: left; height: 30px; font-size: 18px;">总字母个数:</span> <span style="float: left; height: 30px; font-size: 18px;">总字母个数:</span>
<input style="float: left; width: 50px;" type="text" nz-input [(ngModel)]="item.optionNum" (blur)="save()"> <input style="float: left; width: 100px;" type="number" nz-input [(ngModel)]="item.optionNum" (blur)="save()">
<br> <br>
<br> <br>
<!--
<div *ngFor="let wordItem of item.wordItem; let i = index" style="float: left;"> <div *ngFor="let wordItem of item.wordItem; let i = index" style="float: left;">
<div class="border" style="float: left; width: 230px;"> <div class="border" style="float: left; width: 230px;">
<span style="float: left; height: 30px; font-size: 18px;">字母:</span> <span style="float: left; height: 30px; font-size: 18px;">字母:</span>
...@@ -30,10 +29,10 @@ ...@@ -30,10 +29,10 @@
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" (audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder> ></app-audio-recorder>
</div> </div>
</div> </div> -->
</div> </div>
<!-- <input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <!-- <input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.pic_url" [picUrl]="item.pic_url"
...@@ -51,4 +50,3 @@ ...@@ -51,4 +50,3 @@
</div> </div>
\ No newline at end of file
...@@ -23,16 +23,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -23,16 +23,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit() { ngOnInit() {
this.item = { this.item = {
wordItem: [{ wordItem: [],
word: 'p',
audio: 'p.mp3',
img: 'p.png'
}],
rightWord: 'a', rightWord: 'a',
rightNum: 6, rightNum: 6,
optionNum: 11, optionNum: 11
}; };
let stingList = 'abcdefghijklmnopqrstuvwxyz';
stingList.split('').forEach(str => {
this.item.wordItem.push({
word: str,
audio: str
})
});
// 获取存储的数据 // 获取存储的数据
(<any>window).courseware.getData((data) => { (<any>window).courseware.getData((data) => {
...@@ -83,14 +87,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -83,14 +87,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
/** /**
* 储存数据 * 储存数据
*/ */
save() { save() {
this.item.rightNum = Math.max(1, this.item.rightNum);
this.item.optionNum = Math.max(1, this.item.optionNum);
this.item.optionNum = Math.min(12, this.item.optionNum);
this.item.rightNum = Math.min(this.item.rightNum, this.item.optionNum);
(<any>window).courseware.setData(this.item, null, this.saveKey); (<any>window).courseware.setData(this.item, null, this.saveKey);
console.log('this.item = ' + JSON.stringify(this.item))
this.refresh(); this.refresh();
} }
......
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