Commit 6382c08e authored by liujiangnan's avatar liujiangnan

feat:配置完成

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