Commit 825a5dc2 authored by Chen Jiping's avatar Chen Jiping

完成模块

parent 4b326c83
......@@ -128,5 +128,8 @@
}
}
},
"defaultProject": "ng-template-generator"
}
"defaultProject": "ng-template-generator",
"cli": {
"analytics": false
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -10,7 +10,7 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "test_0011";
saveKey = "DF_L204";
// 储存对象
item;
......@@ -31,6 +31,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = data;
}
if(!this.item.exercises){
this.item.exercises = [];
this.addExercisesItem();
}
this.init();
this.refresh();
......@@ -52,28 +58,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
/**
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
onImageUploadSuccess(e, item, key) {
this.item[key] = e.url;
this.save();
item[key] = e.url;
this.save();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key) {
onAudioUploadSuccess(e, item, key) {
this.item[key] = e.url;
item[key] = e.url;
this.save();
}
/**
* 储存数据
*/
......@@ -91,5 +96,72 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, 1);
}
/**
* 添加练习
*/
addExercisesItem(){
let exercises = this.getDefaultExercisesItem();
this.item.exercises.push(exercises);
this.save();
}
delExercisesItem(index){
if (index !== -1) {
this.item.exercises.splice(index, 1);
this.save();
}
}
/**
* 获取缺省的练习题内容
*/
getDefaultExercisesItem(){
let exercises = {
contents:[]
}
return exercises;
}
/**
* 添加练习题内容
*/
addContentItem(contents){
let content = this.getDefaultContentItem();
contents.push(content);
this.save();
}
/**
* 删除练习题内容
* @param contents
* @param index
*/
delContentItem(contents, index){
if (index !== -1) {
contents.splice(index, 1);
this.save();
}
}
/**
* 获取缺省的练习题内容
*/
getDefaultContentItem(){
let content = {
val:"",
pic_url:"",
audio_url:""
}
return content;
}
}
This diff is collapsed.
const res = [
// ['bg', "assets/play/bg.jpg"],
['btn_left', "assets/play/btn_left.png"],
['btn_right', "assets/play/btn_right.png"],
// ['text_bg', "assets/play/text_bg.png"],
['bg', "assets/play/bg.png"],
['btn_go', "assets/play/btn_go.png"],
['card', "assets/play/card.png"],
['card-3x', "assets/play/card@3x.png"]
];
......@@ -12,7 +12,10 @@ const res = [
const resAudio = [
['click', "assets/play/music/click.mp3"],
['playing', "assets/play/music/playing.mp3"],
['begin', "assets/play/music/begin.mp3"],
['stop', "assets/play/music/stop.mp3"],
['pop-up', "assets/play/music/pop-up.mp3"]
];
export {res, resAudio};
This diff is collapsed.
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