Commit 461b9995 authored by Chen Jiping's avatar Chen Jiping

完成

parent a7e92ed4
This diff is collapsed.
This diff is collapsed.
......@@ -6,3 +6,7 @@
height: 100%;
}
nz-select {
width: 100%;
}
\ No newline at end of file
......@@ -14,6 +14,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存对象
item;
wordArr = [];
titleArr = [];
constructor(private appRef: ApplicationRef) {
......@@ -31,6 +34,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = data;
}
if ( !this.item.wordArr ) {
this.item.wordArr = [];
}
if(!this.item.titleArr){
this.item.titleArr = [];
}
this.init();
this.refresh();
......@@ -48,18 +59,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() {
if (this.item.wordArr) {
this.wordArr = this.item.wordArr;
} else {
this.wordArr = this.getDefaultWordArr();
this.item.wordArr = this.wordArr;
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
this.item[key] = e.url;
this.save();
if(this.item.titleArr){
this.titleArr = this.item.titleArr;
}
else{
this.titleArr = this.getDefaultTitleArr();
this.item.titleArr = this.titleArr;
}
}
/**
......@@ -69,15 +82,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
onAudioUploadSuccess(e, key) {
this.item[key] = e.url;
this.save();
}
onAudioUploadSuccessByItem(e, item, key) {
console.log(item);
item[key] = e.url;
this.save();
}
/**
* 储存数据
*/
save() {
console.log(this.item);
(<any> window).courseware.setData(this.item, null, this.saveKey);
this.refresh();
}
......@@ -91,5 +111,88 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, 1);
}
deleteItem(index) {
if (index !== -1) {
this.wordArr.splice(index, 1);
}
// this.update.emit(this.item);
this.save();
}
addItem() {
let item = this.wordItemData();
this.wordArr.push(item);
this.saveItem();
}
addLetterItem(wordItem){
let letter = this.letterData();
wordItem.letters.push(letter);
this.save();
}
deleteLetterItem(letters, index){
console.log(letters);
if (index !== -1) {
letters.splice(index, 1);
}
this.save();
}
wordItemData(){
return {
word_val: "",
word_audio_url: "",
letters:[]
};
}
letterData(){
return {
letter_val:"",
letter_audio_url:""
};
}
saveItem() {
this.save();
}
getDefaultWordArr() {
let arr = [];
return arr;
}
addTitleItem(){
let titleItem = this.titleItem();
this.titleArr.push(titleItem);
this.saveItem();
}
deleteTitleItem(index) {
if (index !== -1) {
this.titleArr.splice(index, 1);
}
this.save();
}
titleItem(){
return {
title_val:"",
title_audio_url:"",
title_color:"C04"
}
}
getDefaultTitleArr() {
let arr = [];
return arr;
}
}
......@@ -17,3 +17,8 @@
src: url("../../assets/font/BRLNSDB.TTF") ;
}
@font-face
{
font-family: 'GOTHICB';
src: url("../../assets/font/GOTHICB.TTF") ;
}
\ No newline at end of file
This diff is collapsed.
......@@ -3,8 +3,12 @@ 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"],
['text_bg', "assets/play/text_bg.png"],
['lesson_bg', "assets/play/lesson_bg.png"],
['mousedown', "assets/play/mousedown.png"],
['mousemove', "assets/play/mousemove.png"],
['title_bg', "assets/play/title_bg.png"],
['top_bg', "assets/play/top_bg.png"]
];
......@@ -12,7 +16,7 @@ const res = [
const resAudio = [
['click', "assets/play/music/click.mp3"],
['newpage', "assets/play/music/newpage.mp3"]
];
export {res, resAudio};
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