Commit 6382c08e authored by liujiangnan's avatar liujiangnan

feat:配置完成

parent 1de9a314
...@@ -4,56 +4,37 @@ ...@@ -4,56 +4,37 @@
<div class="border" style="width: 1000px;"> <div class="border" style="width: 1000px;">
<span style="font-size: 20px;">标题: </span> <span style="font-size: 20px;">标题: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.title" (blur)="save()">
<span style="font-size: 20px;">题目说明: </span>
<input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()">
<span style="font-size: 20px;">题目说明音频: </span>
<app-audio-recorder
[audioUrl]="item.questionTextAudio"
(audioUploaded)="onAssetUploadSuccess($event, 'questionTextAudio')"
[_audioName]="item.audioFileName"
(audioName)="saveAudioFileName($event)"
></app-audio-recorder>
</div> </div>
<div class="border" style="width: 1000px;"> <div class="border" style="width: 1000px;">
<div *ngFor="let question of item.questions; let i = index"> <div *ngFor="let page of item.pages; let i = index">
<div class="border" style="width: 950px;"> <div class="border" style="width: 950px;">
<span style="font-size: 20px;">选项类型: </span> <div>
<div *ngIf="question.type=='img'"> <span>副标题: </span>
<button class="button-right">图片</button> <input type="text" nz-input [(ngModel)]="page.sub_title" (blur)="save()">
&nbsp;
<button class="button-disable" (click)="question.type='txt'; save();">文字</button>
</div>
<div *ngIf="question.type=='txt'">
<button class="button-disable" (click)="question.type='img'; save();">图片</button>
&nbsp;
<button class="button-right">文字</button>
</div> </div>
<div>
<div *ngIf="question.type=='img'"> <span>图片:</span>
图片:
<div style="width: 300px;"> <div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="question.image" <app-upload-image-with-preview [picUrl]="page.image"
(imageUploaded)="onAssetUploadSuccess($event, 'questions', i, 'image')"> (imageUploaded)="onAssetUploadSuccess($event, 'pages', i, 'image')">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
</div> </div>
<span>音频: </span> <span>音频: </span>
<app-audio-recorder [audioUrl]="question.audio" <app-audio-recorder [audioUrl]="page.audio"
(audioUploaded)="onAssetUploadSuccess($event, 'questions', i, 'audio')"> (audioUploaded)="onAssetUploadSuccess($event, 'pages', i, 'audio')">
</app-audio-recorder> </app-audio-recorder>
<div *ngIf="question.type=='txt'"> <div>
<span>文本: </span> <span>文本: </span>
<input type="text" nz-input [(ngModel)]="question.text" (blur)="save()"> <textarea rows="4" nz-input [(ngModel)]="page.text" (blur)="save()"></textarea>
</div> </div>
<br> <br>
<button style="width: 900px; height: 30px; color: red;" (click)="removeQuestion(i)">删除题目</button> <button style="width: 900px; height: 30px; color: red;" (click)="removePage(i)">删除页面</button>
</div> </div>
</div> </div>
<div class="border" style="width: 950px;"> <div class="border" style="width: 950px;">
<button style="width: 900px; height: 100px;" (click)="addQuestion()">增加题目</button> <button style="width: 900px; height: 100px;" (click)="addPage()">增加页面</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -11,19 +11,16 @@ import { ComponentBase } from './ComponentBase'; ...@@ -11,19 +11,16 @@ import { ComponentBase } from './ComponentBase';
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy { export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "card_machine"; saveKey = "sn_config";
// 储存对象 // 储存对象
item: any = { item: any = {
title: '', title: '',
questionText: '', pages: [],
questionTextAudio: '',
audioFileName: '',
questions: [],
}; };
addQuestion() { addPage() {
this.item.questions.push({ this.item.pages.push({
type: 'img', sub_title: '',
audio: '', audio: '',
text: '', text: '',
image: '' image: ''
...@@ -31,13 +28,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -31,13 +28,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.save(); this.save();
} }
removeQuestion(idx) { removePage(idx) {
this.item.questions.splice(idx, 1); this.item.pages.splice(idx, 1);
this.save();
}
saveAudioFileName(name) {
this.item.audioFileName=name;
this.save(); this.save();
} }
......
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