Commit a6048583 authored by huoshizhe's avatar huoshizhe

feat: 表单页更新

parent 49118022
<div class="model-content">
<div class="border" style="position: absolute; left: 200px; top: 100px; width: 800px;">
<span style="float: left; height: 30px; font-size: 18px;">正确字母:</span>
<input style="float: left; width: 50px;" type="text" nz-input [(ngModel)]="item.rightWord" (blur)="save()">
<br>
<br>
<input style="float: left; width: 50px;" type="text" nz-input [(ngModel)]="item.rightWord" (blur)="save()">
<br>
<br>
<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()">
<br>
<br>
<input style="float: left; width: 100px;" type="number" nz-input [(ngModel)]="item.rightNum" (blur)="save()">
<br>
<br>
<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()">
<br>
<br>
<input style="float: left; width: 100px;" type="number" nz-input [(ngModel)]="item.optionNum" (blur)="save()">
<br>
<br>
<!--
<div *ngFor="let wordItem of item.wordItem; let i = index" style="float: left;">
<div class="border" style="float: left; width: 230px;">
<span style="float: left; height: 30px; font-size: 18px;">字母:</span>
......@@ -30,10 +29,10 @@
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</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
[picUrl]="item.pic_url"
......@@ -48,7 +47,6 @@
<app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config>
</div> -->
</div>
\ No newline at end of file
......@@ -23,16 +23,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit() {
this.item = {
wordItem: [{
word: 'p',
audio: 'p.mp3',
img: 'p.png'
}],
wordItem: [],
rightWord: 'a',
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) => {
......@@ -83,14 +87,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.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);
console.log('this.item = ' + JSON.stringify(this.item))
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