Commit 49118022 authored by 范雪寒's avatar 范雪寒

feat: 初始项目

parent 8a51c964
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,3 +6,23 @@ ...@@ -6,3 +6,23 @@
height: 100%; height: 100%;
} }
.border {
border-radius: 20px;
border-style: dashed;
padding: 20px;
margin: 20px;
/*width: 500px; */
/*//border-radius: 20px;*/
/*//border-width: 2px;*/
/*//border-color: #000000;*/
}
.border-lite {
border: 2px dashed #ddd;
border-radius: 0.5rem;
padding: 10px;
margin: 10px;
}
\ No newline at end of file
<div class="model-content"> <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>
<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>
<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>
<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>
<input style="float: left; width: 50px;" type="text" nz-input [(ngModel)]="wordItem.word" (blur)="save()">
<app-upload-image-with-preview
style="float: left; width:200px;"
[picUrl]="wordItem.img"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')"
></app-upload-image-with-preview>
<div style="position: absolute; left: 200px; top: 100px; width: 800px;"> <app-audio-recorder
style="float: left;"
[audioUrl]="wordItem.audio"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</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"
...@@ -18,7 +47,7 @@ ...@@ -18,7 +47,7 @@
<app-custom-hot-zone></app-custom-hot-zone> <app-custom-hot-zone></app-custom-hot-zone>
<app-upload-video></app-upload-video> <app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config> <app-lesson-title-config></app-lesson-title-config>
</div> </div> -->
</div> </div>
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef} from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
...@@ -15,17 +15,26 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -15,17 +15,26 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
item; item;
constructor(private appRef: ApplicationRef,private changeDetectorRef: ChangeDetectorRef) { constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
} }
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {
wordItem: [{
word: 'p',
audio: 'p.mp3',
img: 'p.png'
}],
rightWord: 'a',
rightNum: 6,
optionNum: 11,
};
// 获取存储的数据 // 获取存储的数据
(<any> window).courseware.getData((data) => { (<any>window).courseware.getData((data) => {
if (data) { if (data) {
this.item = data; this.item = data;
...@@ -60,8 +69,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -60,8 +69,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/ */
onImageUploadSuccess(e, key) { onImageUploadSuccess(e, key) {
this.item[key] = e.url; this.item[key] = e.url;
this.save(); this.save();
} }
/** /**
...@@ -80,7 +89,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -80,7 +89,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存数据 * 储存数据
*/ */
save() { save() {
(<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