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" }
}] \ No newline at end of file
}],
"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"
}
// let m =
This diff is collapsed.
...@@ -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