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

完成

parent a7e92ed4
This diff is collapsed.
{ {
"name": "ng-template-generator", "name": "ng-template-generator",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"start": "ng serve", "start": "ng serve",
"build": "ng build --build--optimizer --aot --base-href /JGT/v3/", "build": "ng build --build--optimizer --aot --base-href /JGT/v3/",
"publish": "node ./bin/publish.js" "publish": "node ./bin/publish.js"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
"nedb": "^1.8.0", "nedb": "^1.8.0",
"ng-lottie": "^0.3.1", "ng-lottie": "^0.3.1",
"ng-zorro-antd": "^7.2.0", "ng-zorro-antd": "^7.2.0",
"node-sass": "^4.13.1",
"npm": "^6.5.0", "npm": "^6.5.0",
"rxjs": "^6.3.3", "rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3", "rxjs-compat": "^6.3.3",
......
This diff is collapsed.
...@@ -6,3 +6,7 @@ ...@@ -6,3 +6,7 @@
height: 100%; height: 100%;
} }
nz-select {
width: 100%;
}
\ No newline at end of file
...@@ -14,6 +14,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -14,6 +14,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存对象 // 储存对象
item; item;
wordArr = [];
titleArr = [];
constructor(private appRef: ApplicationRef) { constructor(private appRef: ApplicationRef) {
...@@ -31,6 +34,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -31,6 +34,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = data; this.item = data;
} }
if ( !this.item.wordArr ) {
this.item.wordArr = [];
}
if(!this.item.titleArr){
this.item.titleArr = [];
}
this.init(); this.init();
this.refresh(); this.refresh();
...@@ -48,18 +59,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -48,18 +59,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() { init() {
if (this.item.wordArr) {
} this.wordArr = this.item.wordArr;
} else {
this.wordArr = this.getDefaultWordArr();
/** this.item.wordArr = this.wordArr;
* 储存图片数据 }
* @param e
*/ if(this.item.titleArr){
onImageUploadSuccess(e, key) { this.titleArr = this.item.titleArr;
}
this.item[key] = e.url; else{
this.save(); this.titleArr = this.getDefaultTitleArr();
this.item.titleArr = this.titleArr;
}
} }
/** /**
...@@ -69,15 +82,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -69,15 +82,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
onAudioUploadSuccess(e, key) { onAudioUploadSuccess(e, key) {
this.item[key] = e.url; this.item[key] = e.url;
this.save(); this.save();
} }
onAudioUploadSuccessByItem(e, item, key) {
console.log(item);
item[key] = e.url;
this.save();
}
/** /**
* 储存数据 * 储存数据
*/ */
save() { save() {
console.log(this.item);
(<any> window).courseware.setData(this.item, null, this.saveKey); (<any> window).courseware.setData(this.item, null, this.saveKey);
this.refresh(); this.refresh();
} }
...@@ -91,5 +111,88 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -91,5 +111,88 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, 1); }, 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;
}
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
} }
#canvas { #canvas {
} }
...@@ -17,3 +17,8 @@ ...@@ -17,3 +17,8 @@
src: url("../../assets/font/BRLNSDB.TTF") ; 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 = [ ...@@ -3,8 +3,12 @@ const res = [
// ['bg', "assets/play/bg.jpg"], // ['bg', "assets/play/bg.jpg"],
['btn_left', "assets/play/btn_left.png"], ['btn_left', "assets/play/btn_left.png"],
['btn_right', "assets/play/btn_right.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 = [ ...@@ -12,7 +16,7 @@ const res = [
const resAudio = [ const resAudio = [
['click', "assets/play/music/click.mp3"], ['click', "assets/play/music/click.mp3"],
['newpage', "assets/play/music/newpage.mp3"]
]; ];
export {res, resAudio}; 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