Commit b5a53f3b authored by Tt's avatar Tt

数据调整

parent 2b0a6994
export const defaultData = {
"title": "捕捞海星",
"title": "听音选择",
"questions": [
{
"audio": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"text": "text",
"audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3",
"time": null,
"duration": 20,
"audioName": "complete.mp3"
},
{
"audio": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"text": "test",
"time": null,
"duration": 15,
"audioName": "excellent.mp3"
},
{
"audio": "http://staging-teach.cdn.ireadabc.com/fd75d456ec85f8c90ffd03f1d9d8d10f_l.mp3",
"text": "apple",
"time": null,
"duration": 20,
"audioName": "try again.mp3"
},
{
"audio": "http://staging-teach.cdn.ireadabc.com/a053d5915bc3b6f0ec8a42912891c538_l.mp3",
"text": "add",
"time": null,
"duration": 10,
"audioName": "jiasu.mp3"
}
]
"duration": "",
"audioName": "进入下一题.mp3",
"options": [
{
"type": "text",
"audio": "",
"image": "",
"word": "",
"text": "apple"
},
{
"type": "text",
"audio": "",
"image": "",
"word": "",
"text": "banner"
}, { "type": "text", "audio": "", "image": "", "word": "", "text": "pie" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "test" }]
}, { "audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3", "time": null, "duration": "", "audioName": "进入下一题.mp3", "options": [{ "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/07c89b4a6a1a18b0c0a3029720fdfdbc.png", "word": "" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/d20b34eac11f5687d3386389aea170a2.png", "word": "" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/639ada88f3e52966103caca156f720d6.png", "word": "" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/38408b9ce048508830086c5e5cd2f384.png", "word": "" }] }]
}
\ No newline at end of file
......@@ -76,27 +76,8 @@
<div style="padding: 10px;background-color: #fff;">
<!-- 标题区 -->
<div class="border-dashed" style="margin: 20px;width: 1000px;">
<!-- <span style="font-size: 20px;">选项分数: </span>
<input type="text" nz-input [(ngModel)]="item.score" (blur)="save()"> -->
<span style="font-size: 20px;">标题文字: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()">
<!-- <span style="font-size: 20px;">标题图片: </span>
<div style="width:300px">
<app-upload-image-with-preview [picUrl]="item.image"
(imageUploaded)="onImageUploadSuccess($event,'image', item.top)"></app-upload-image-with-preview>
</div> -->
<!-- <span style="font-size: 20px;">题目说明: </span>
<input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()">
<span style="font-size: 20px;">标题音频: </span>
<div style="display:flex ;">
<div>
<app-audio-recorder [audioUrl]="item.questionTextAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'questionTextAudio',item,'audioName')"></app-audio-recorder>
</div>
<div style="margin: 5px">
<span>{{ item.audioName}}</span>
</div>
</div> -->
</div>
</div>
<!-- 题目区 -->
......@@ -107,29 +88,6 @@
<div class="word-type-title">
题目{{i+1}}
</div>
<!-- <div style="margin-top: 20px;">
<div class="word-type-option-title">
选项类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="question.type" (ngModelChange)="ngChange()">
<label nz-radio nzValue="img">
<span [style]="{color:question.type=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="txt">
<span [style]="{color:question.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
</div> -->
<!-- <div *ngIf="question.type=='img'">
<span style="font-size: 20px;">标题图片: </span>
<div style="width:300px">
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event,'image',question)"></app-upload-image-with-preview>
</div>
</div> -->
<div class="option-audio">
<div class="word-input-title">
题目音频:
......@@ -147,47 +105,79 @@
</div>
</div>
</div>
<div class=" option-text">
<div class="word-input-title">
<span style="color:red;margin-left:-15px">* </span>
<span>文本: </span>
</div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder="必填,根据文本内容去判断对错"
(blur)="save()">
</div>
<div class="option-time">
<div class="word-input-title">
<span>录音时间: </span>
<div *ngFor="let option of question.options; let m = index">
<div style="display: flex;margin-top: 20px;">
<div class="border-dashed" style="min-width: 700px;">
<div style="margin-top: 20px;">
<div class="word-type-option-title">
选项类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="option.type">
<label nz-radio nzValue="img">
<span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="text">
<span [style]="{color:option.type=='text' ? '#169BD5':'#000'}">文字</span>
</label>
<label nz-radio nzValue="img_text">
<span [style]="{color:option.type=='img_text' ? '#169BD5':'#000'}">文字+图片</span>
</label>
</nz-radio-group>
</div>
</div>
<div style="margin-top: 25px;">
<div class="option-img">
<div *ngIf="option.type=='img' || option.type =='img_text'" style="width: 200px;">
<span style="font-size: 20px;">图片:</span>
<app-upload-image-with-preview [picUrl]="option.image"
(imageUploaded)="onImageUploadSuccess($event, 'image',option)">
</app-upload-image-with-preview>
</div>
</div>
<div class="option-text">
<div *ngIf="option.type=='text' || option.type =='img_text'" style="width: 200px">
<span style="font-size: 20px;">文本</span>
<input type="text" nz-input [(ngModel)]="option.text" (blur)="save()">
</div>
</div>
<!-- <div class="option-audio">
<span style="font-size: 20px;">选项音频:</span>
<app-audio-recorder [audioUrl]="option.audio"
(audioUploaded)="onAssetUploadSuccess($event, 'questions', i, 'options', j, 'audio')">
</app-audio-recorder>
</div> -->
</div>
</div>
<div style="margin-left: 10px;">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeOption(i,m)">删除选项</button>
</div>
</div>
<input type="number" placeholder="录音超过时间将自动提交成绩" nz-input [(ngModel)]="question.duration" (blur)="save()">
</div>
</div>
<div style="margin:0 20px">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeQuestion(i)">删除题目</button>
<button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger
(click)="copyQuestion(i)">复制题目</button>
<button *ngIf="question.options.length < 4" class="btn-blue" style="margin-top: 10px;" nz-button
nzType="default" nzDanger (click)="addOption(i)">增加选项</button>
</div>
</div>
</div>
</div>
<div style="margin-top: 20px;">
<button class="btn-blue" style="width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
(click)="addQuestion()">+增加题目</button>
</div>
</div>
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="null" [nzContent]="modalContent" [nzFooter]="modalFooter"
(nzOnCancel)="handleCancel()">
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="null" [nzContent]="modalContent" [nzFooter]="modalFooter"
(nzOnCancel)="handleCancel()">
<ng-template #modalContent>
<p>{{deleteTitle}}</p>
</ng-template>
<ng-template #modalContent>
<p>{{deleteTitle}}</p>
</ng-template>
<ng-template #modalFooter>
<button nz-button nzType="default" (click)="handleCancel()">取消</button>
<button nz-button nzType="primary" (click)="handleOk()">确定</button>
</ng-template>
</nz-modal>
</div>
\ No newline at end of file
<ng-template #modalFooter>
<button nz-button nzType="default" (click)="handleCancel()">取消</button>
<button nz-button nzType="primary" (click)="handleOk()">确定</button>
</ng-template>
</nz-modal>
</div>
\ No newline at end of file
......@@ -11,23 +11,13 @@ import { ComponentBase } from './ComponentBase';
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "dg08_hx";
saveKey = "dg10_ty";
// 储存对象
item: any = {
// score: 0,
title: '捕捞海星',
// questionText: "彩蛋里藏了哪些魔法卡牌呢?亲爱的小玩家,快用锤子砸开彩蛋,魔法卡牌就会露出来,只要正确地说出魔法咒语,你就能获得这张魔法卡牌。 游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
// questionTextAudio: "http://staging-teach.cdn.ireadabc.com/61b41f87fffc8390a519668fece764d3_l.mp3",
title: '听音选择',
questions: [],
};
// item: any = {
// title: '幸运大转盘',
// questionText: "亲爱的小玩家,游戏马上就要开始啦!请动动手指转动转盘,当转盘停止,注意观察指针指向的魔法图片,并大声说出魔法咒语,魔法咒语正确,你就可以获得一张魔法卡牌。 游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
// questionTextAudio: "http://staging-teach.cdn.ireadabc.com/18ebee93b3eabcd55649a01366431af7.mp3",
// questions: [],
// };
isVisible = false;
deleteTitle = "是否删除题目";
deleteCallback = function () { };
......@@ -46,15 +36,14 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addQuestion() {
this.item.questions.push({
// type: 'img',
audio: '',
text: '',
// image: '',
time: null,
duration: "",
// word: '',
audioName: "",
options: []
});
this.addOption(this.item.questions.length - 1)
this.addOption(this.item.questions.length - 1)
this.save();
}
......@@ -74,23 +63,25 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.item.audioBgName = "";
this.save();
}
// addOption(idx) {
// if (this.item.questions[idx].options.length == 4) return;
// this.item.questions[idx].options.push({
// text: '',
// audio: '',
// image: '',
// word: '',
// });
// this.save();
// }
addOption(idx) {
if (this.item.questions[idx].options.length > 4) return;
this.item.questions[idx].options.push({
type: 'img',
audio: '',
image: '',
});
this.save();
}
// removeOption(idx, n) {
// this.openDelete("确定删除选项?", () => {
// this.item.questions[idx].options.splice(n, 1);
// this.save();
// })
// }
removeOption(idx, n) {
this.openDelete("确定删除选项?", () => {
this.item.questions[idx].options.splice(n, 1);
if (this.item.questions[idx].options.length < 2) {
this.addOption(idx)
}
this.save();
})
}
ngChange() {
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