Commit a064a309 authored by Tt's avatar Tt

数据处理完成

parent af2553f3
No preview for this file type
...@@ -93,3 +93,20 @@ npm start ...@@ -93,3 +93,20 @@ npm start
* 开发者新建的脚本文件(.js/.ts)的文件名必须包含项目名称,例如在 test_01 项目中添加一个脚本文件(如想命名为 hello.ts );则需要命名为 hello_test_01.ts * 开发者新建的脚本文件(.js/.ts)的文件名必须包含项目名称,例如在 test_01 项目中添加一个脚本文件(如想命名为 hello.ts );则需要命名为 hello_test_01.ts
* 项目里尽量不要使用setTimeout、setInterval等定时器,如果使用了记得在onDestroy中释放掉(onDestroy 是指CocosCreator的生命周期钩子) * 项目里尽量不要使用setTimeout、setInterval等定时器,如果使用了记得在onDestroy中释放掉(onDestroy 是指CocosCreator的生命周期钩子)
* 理论上禁止使用全局变量,因为模板到线上会进行组装,常见问题是一个模板使用多次造成全局变量被读脏 * 理论上禁止使用全局变量,因为模板到线上会进行组装,常见问题是一个模板使用多次造成全局变量被读脏
let question = [
{
title: "",
options :
[
{
type: "",
image : "",
text:"",
}
]
}
]
\ No newline at end of file
...@@ -25,48 +25,32 @@ export const defaultData = ...@@ -25,48 +25,32 @@ export const defaultData =
let m = { let m = {
"recordFlag": 2, "title": "",
"title": "test",
"questionText": "",
"questionTextAudio": "",
"questions": [ "questions": [
{ {
"questionAudio": "", "title": "Which animal have wings?",
"duration": 120,
"options": [ "options": [
{ {
"type": "img_txt_audio", "type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/cadf4f62024a1e932aa8c108de0d0a27.jpg", "image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3", "text": "bird"
"text": "This is Annie's apple tree?", },
"duration": 5, {
"content": "yes,It is Annie's apple tree.", "type": "img",
"right": false, "image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png",
"imageBig": 3, "text": ""
"audioName": "btn_hy01_danci.mp3", },
npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3", {
npcAudioName: "right_sn17_danci.mp3" "type": "img_txt",
}, { "image": "http://staging-teach.cdn.ireadabc.com/a71f2b71e45ff2525714494f6edd624b.jpg",
"type": "img_txt_audio", "text": "wind"
"image": "http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "clound in air", "duration": 10, },
"content": "clound is cloud", "right": false, "audioName": "敲碎蛋的声音.mp3", "imageBig": 2, {
npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3", "type": "txt",
npcAudioName: "right_sn17_danci.mp3" "image": "",
}, { "text": "dog"
"type": "img_txt_audio", "imageBig": 1, }
"image": "http://staging-teach.cdn.ireadabc.com/ef1e6f871b37ad482e268809e91d20b7.png", ]
"audio": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3", }
"text": "", "duration": 10, "content": "", "right": false, ]
"audioName": "excellent_dg10_ty.mp3"
}]
}],
"bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "test",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/fd75d456ec85f8c90ffd03f1d9d8d10f_l.mp3", "npcAudioName": "tryagain_dg10_ty.mp3", "word_count": "20", "sentence_count": "11", "zi_count": "33"
} }
\ No newline at end of file
// let m =
...@@ -76,9 +76,9 @@ ...@@ -76,9 +76,9 @@
<div class="model-content"> <div class="model-content">
<div style="padding: 10px;background-color: #fff;"> <div style="padding: 10px;background-color: #fff;">
<div class="border-dashed" style="margin: 20px;width: 1000px;"> <div class="border-dashed" style="margin: 20px;width: 1000px;display: none">
<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;">npc音频: </span> <!-- <span style="font-size: 20px;">npc音频: </span>
<div style="display:flex ;"> <div style="display:flex ;">
<div> <div>
...@@ -114,7 +114,9 @@ ...@@ -114,7 +114,9 @@
</div>--> </div>-->
</div> </div>
<div style="margin: 20px;width: 1000px;">
<div style=" margin: 20px;width: 1400px;">
<div *ngFor="let question of item.questions; let i = index"> <div *ngFor="let question of item.questions; let i = index">
<div style="display: flex;margin-top: 20px;"> <div style="display: flex;margin-top: 20px;">
<div class="border-solid" style="min-width: 1000px;"> <div class="border-solid" style="min-width: 1000px;">
...@@ -122,113 +124,64 @@ ...@@ -122,113 +124,64 @@
题目{{i+1}} 题目{{i+1}}
</div> </div>
<div>
</div> <span style="font-size: 20px;">标题文字: </span>
<input type="text" nz-input [(ngModel)]="question.title" (blur)="save()">
<!-- <div>
<div class="word-type-option-title" style="margin-top:10px;">题目音频:</div> <div *ngFor="let option of question.options; let j = index">
<div style="display:flex ;"> <div style="display: flex;margin-top:20px">
<div> <div class="options-title">
<app-audio-recorder [audioUrl]="question.questionAudio" 选项{{j+1}}
(audioUploaded)="onAudioUploadSuccess($event, 'questionAudio',question,'audioName')">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>{{ question.audioName}}</span>
</div>
</div> </div>
</div> -->
<!-- <div style="margin-top:20px"> <!-- <div class="options-content" style="padding: 15px 30px;">
<div class="word-type-option-title">倒计时: </div> 字母:<input type="text" maxlength="1" [(ngModel)]="options.text" (ngModelChange)="save()">
<input type="number" nz-input [(ngModel)]="question.duration" (blur)="save()">
</div> --> </div> -->
<div class="letterList-content" style="padding: 15px 30px;">
<div style="margin-top: 20px;">
<div class="word-type-option-title">
<div class="word-type-option-title" style="display: flex; margin-top:20px;"> 选项类型:
题干: </div>
<!-- <div *ngFor="let question of question; let j = index" style="margin-left: 30px;"> --> <div style="margin-top: 5px;">
<div> <nz-radio-group [(ngModel)]="option.type" (ngModelChange)="ngChange()">
<!-- <div style="margin-left: 30px;">
<nz-radio-group [(ngModel)]="question.type" (ngModelChange)="ngChange(i)">
<label nz-radio nzValue="img"> <label nz-radio nzValue="img">
<span [style]="{color:question.type=='img' ? '#169BD5':'#000'}">图片</span> <span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span>
</label> </label>
<label nz-radio nzValue="imgVideo"> <label nz-radio nzValue="txt">
<span [style]="{color:question.type=='imgVideo' ? '#169BD5':'#000'}">图片+音频</span> <span [style]="{color:option.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label>
<label nz-radio nzValue="img_txt">
<span [style]="{color:option.type=='img_txt' ? '#169BD5':'#000'}">图片+文字</span>
</label> </label>
</nz-radio-group> </nz-radio-group>
</div> -->
<div style="margin-top: 15px;margin-left: 28px;">
<div class="option-img">
<div *ngIf="question.type=='img'" style="width: 200px;">
<!-- <span style="font-size: 20px;">图片:</span> -->
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event, 'image',question)">
</app-upload-image-with-preview>
</div>
</div>
<div class="option-text">
<div *ngIf="question.type=='imgVideo'" style="width: 200px">
<span style="font-size: 20px;">图片</span>
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event, 'image',question)">
</app-upload-image-with-preview>
<div class="option-audio">
<span style="font-size: 20px;">选项音频:</span>
<div style="display: flex">
<div>
<app-audio-recorder [audioUrl]="question.audio"
(audioUploaded)="onAudioUploadSuccess($event,'audio',question,'audioName')">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>
{{ question.audioName}}
</span>
</div>
</div> </div>
</div> </div>
<div *ngIf="option.type!='txt'">
<span style="font-size: 20px;">标题图片: </span>
<div style="width:300px">
<app-upload-image-with-preview [picUrl]="option.image"
(imageUploaded)="onImageUploadSuccess($event,'image',option)"></app-upload-image-with-preview>
</div> </div>
</div> </div>
<div *ngIf="option.type!='img'" class=" option-text">
<div class="word-input-title">
<!-- <div class="option-time"> <span style="color:red;margin-left:-15px">* </span>
</div> --> <span>文本: </span>
</div> </div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="option.text" placeholder=""
(blur)="save()">
</div> </div>
<!-- </div> -->
</div> </div>
<div style="display: flex; margin-top: 20px;">
<span style="font-size: 18px;">预览:</span>
<div type="text" name="" id="" style="margin-left: 32px;font-size: 24px;" class="letterList-content">
<span *ngFor="let letterList of question.letterList; let j = index">{{letterList.text}} </span>
</div>
</div>
<div *ngFor="let letterList of question.letterList; let j = index">
<div style="display: flex;margin-top:20px">
<div class="letterList-title">
选项{{j+1}}
</div>
<div class="letterList-content" style="padding: 15px 30px;"> <div style="display: block;">
<!-- <div style="margin:-15px -30px;width: calc(100%+60px);height: 40px;padding:10px 20px;" [style]="{ <div>
backgroundColor: option.right ?'#169BD5':'#eee'}">
<label nz-checkbox [(ngModel)]="option.right"
[style]="{color: option.right ?'#fff':'#000'}">正确答案</label>
</div> -->
<span>单词:</span><input type="text" [(ngModel)]="letterList.text" (ngModelChange)="save()">
</div>
<div class="letterList-btns">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeoption(i,j)">减少选项</button> <button class="btn-red" nz-button nzType="default" nzDanger (click)="removeoption(i,j)">减少选项</button>
</div>
<button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger <button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger
(click)="copyOption(i,j)">复制选项</button> (click)="copyoption(i,j)">复制选项</button>
</div> </div>
</div> </div>
...@@ -237,16 +190,24 @@ ...@@ -237,16 +190,24 @@
<div style="margin-left: 69px;margin-top: 15px;"> <div style="margin-left: 69px;margin-top: 15px;">
<button class="btn-blue" nz-button nzType="default" nzDanger (click)="addoption(i)">+增加选项</button> <button class="btn-blue" nz-button nzType="default" nzDanger (click)="addoption(i)">+增加选项</button>
</div> </div>
</div> </div>
<div style="margin:0 20px"> <div style="margin:0 20px">
<!-- <div>
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removequestion(i)">删除题目</button> <button class="btn-red" nz-button nzType="default" nzDanger (click)="removequestion(i)">删除题目</button>
</div> </div>
<div>
<button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger
(click)="copyquestion(i)">复制题目</button>
</div> -->
</div>
</div> </div>
</div> </div>
<button class="btn-blue" style="margin-top:10px;width: 1000px; height: 50px;" nz-button nzType="default" nzDanger <!-- <div style="margin-top: 20px;">
<button class="btn-blue" style="width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
(click)="addquestion()">+增加题目</button> (click)="addquestion()">+增加题目</button>
</div> -->
</div> </div>
...@@ -254,6 +215,7 @@ ...@@ -254,6 +215,7 @@
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="null" [nzContent]="modalContent" [nzFooter]="modalFooter" <nz-modal [(nzVisible)]="isVisible" [nzTitle]="null" [nzContent]="modalContent" [nzFooter]="modalFooter"
(nzOnCancel)="handleCancel()"> (nzOnCancel)="handleCancel()">
......
...@@ -9,24 +9,11 @@ import { MetaFormCreator } from './mataFormCreator'; ...@@ -9,24 +9,11 @@ import { MetaFormCreator } from './mataFormCreator';
}) })
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy { export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "jj_16"; saveKey = "jj_15";
item = { item = {
onlineFlg: false,
npcTitle: "",
npcAudio: "",
npcAudioName: '',
title: "", title: "",
questionText: "",
questionTextAudio: "",
questions: [], questions: [],
bgAudio: "",
bgAudioName: "",
word_count: '0',
sentence_count: '0',
zi_count: '0',
showKuang: '1',
audioName: ""
}; };
isVisible = false; isVisible = false;
deleteTitle = "是否删除题目"; deleteTitle = "是否删除题目";
...@@ -46,29 +33,28 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -46,29 +33,28 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
init(): void { init(): void {
if (!this.item.npcTitle) this.item.npcTitle = '';
if (!this.item.npcAudio) this.item.npcAudio = '';
if (!this.item.npcAudioName) this.item.npcAudioName = '';
if (!this.item.word_count) this.item.word_count = '0';
if (!this.item.sentence_count) this.item.sentence_count = '0';
if (!this.item.zi_count) this.item.zi_count = '0';
// console.log(new MetaFormCreator().create()); // console.log(new MetaFormCreator().create());
if (this.item.questions.length == 0) {
this.addquestion();
}
} }
removeoption(i, j) { removeoption(i, j) {
this.openDelete("确定减少选项?", () => { this.openDelete("确定减少选项?", () => {
this.item.questions[i].letterList.splice(j, 1); this.item.questions[i].options.splice(j, 1);
this.save(); this.save();
}) })
} }
copyOption(i, j) { copyoption(i, j) {
let data = this.item.questions[i].letterList[j]; let data = this.item.questions[i].options[j];
this.item.questions[i].letterList.push(JSON.parse(JSON.stringify(data))); this.item.questions[i].options.push(JSON.parse(JSON.stringify(data)));
this.save(); this.save();
} }
addoption(i) { addoption(i) {
this.item.questions[i].letterList.push({ this.item.questions[i].options.push({
type: 'img',
image: '',
text: '' text: ''
}) })
this.save(); this.save();
...@@ -83,24 +69,17 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -83,24 +69,17 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion() { addquestion() {
this.item.questions.push({ this.item.questions.push({
questionAudio: "", title: "",
duration: 120, options: [],
type: "img",
image: "",
audio: "",
text: "",
right: false,
letterList: [],
}); });
this.addoption(this.item.questions.length - 1);
this.save(); this.save();
} }
deleteBgAudio() { deleteBgAudio() {
this.item.bgAudio = "";
this.item.bgAudioName = "";
this.save(); this.save();
} }
ngChange(i) { ngChange() {
this.save(); this.save();
} }
} }
\ No newline at end of file
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