Commit d2be6932 authored by 李维's avatar 李维

dev completed

parent 0cb0e9f7
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div style="flex:2"> <div style="flex:2">
<div> <div>
<nz-select [(ngModel)]="item.contentObj.cardContainerSetting.type" (ngModelChange)="saveItem()"> <nz-select [(ngModel)]="contentObj.cardContainerSetting.type" (ngModelChange)="saveItem()">
<nz-option *ngFor="let p of containerType" [nzValue]="p" [nzLabel]="containerTypeMap[p]"></nz-option> <nz-option *ngFor="let p of containerType" [nzValue]="p" [nzLabel]="containerTypeMap[p]"></nz-option>
</nz-select> </nz-select>
</div> </div>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
</div> </div>
<div style="float:right; text-align: right; padding-right: 20px;"> <div style="float:right; text-align: right; padding-right: 20px;">
<button style="margin-bottom: 10px;" nz-button nzType="danger" (click)="deleteItem(i)" > <button style="margin-bottom: 10px;" nz-button nzType="danger" (click)="deleteItem(i)" >
<span>删除本题</span> <span>删除</span>
</button> </button>
</div> </div>
</div> </div>
......
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core'; import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core';
const defaultData = { const defaultData = {
version: "1.3",
bgMusic:"", bgMusic:"",
dataArray:[], dataArray:[],
cardContainerSetting: { cardContainerSetting: {
...@@ -19,7 +20,14 @@ const defaultData = { ...@@ -19,7 +20,14 @@ const defaultData = {
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any; _item: any;
contentObj contentObj = {
bgMusic:"",
dataArray:[],
cardContainerSetting: {
type: "A",
image_url: ""
}
}
hotZoneItemArr: Array<Object> = []; hotZoneItemArr: Array<Object> = [];
bgItem: Object; bgItem: Object;
containerTypeMap = { containerTypeMap = {
...@@ -71,17 +79,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -71,17 +79,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
init() { init() {
if (Object.keys(this.item.contentObj).length != 0) { if (Object.keys(this.item.contentObj).length != 0 && this.item.contentObj.version && this.item.contentObj.version==defaultData.version) {
// console.log("读取数据", this.item.contentObj)
this.contentObj = this.item.contentObj; this.contentObj = this.item.contentObj;
} else { } else {
this.contentObj = this.getDefaultPicArr(); this.contentObj = this.getDefaultPicArr();
// console.log("使用默认数据", this.contentObj)
this.item.contentObj = this.contentObj; this.item.contentObj = this.contentObj;
} }
console.log(this.contentObj)
} }
cardItemData(){ cardItemData(){
return {audio_url:"", displayType:"text", text:"", image_url:""} return {audio_url:"", type:"text", text:"", image_url:""}
} }
cardChoiceData(){ cardChoiceData(){
...@@ -141,8 +150,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -141,8 +150,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
onTitleAudioUploadSuccess(e) { onTitleAudioUploadSuccess(e) {
this.item.contentObj.bgMusic = e.url; this.contentObj.bgMusic = e.url;
this.save(); this.save();
} }
...@@ -162,14 +171,13 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -162,14 +171,13 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
saveItem() { saveItem() {
console.log(this.item.contentObj.bgMusic)
this.save(); this.save();
} }
save() { save() {
(<any> window).courseware.setData(this.item, null, this.KEY); (<any> window).courseware.setData(this.item, null, this.KEY);
this.refresh(); this.refresh();
console.log("保存", this.item) // console.log("保存", this.item)
} }
refresh() { refresh() {
......
...@@ -384,8 +384,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -384,8 +384,6 @@ export class PlayComponent implements OnInit, OnDestroy {
pos.sy = 228*this.g_mapScale; pos.sy = 228*this.g_mapScale;
break; break;
} }
console.log(this.g_cartoon.images.get(this.g_formData.cardContainerSetting.image_url))
let element = this.g_cartoon.createCartoonElementImageFunc('card-container', pos.image, (w,h)=>{ let element = this.g_cartoon.createCartoonElementImageFunc('card-container', pos.image, (w,h)=>{
return { return {
sx: pos.sx/w, sx: pos.sx/w,
...@@ -397,7 +395,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -397,7 +395,6 @@ export class PlayComponent implements OnInit, OnDestroy {
y: this.g_cartoon.getOrigin().y - (h/2)*this.g_mapScale + pos.y y: this.g_cartoon.getOrigin().y - (h/2)*this.g_mapScale + pos.y
} }
}) })
console.log(element)
this.render(element.ref) this.render(element.ref)
} }
...@@ -898,7 +895,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -898,7 +895,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.subscribeMapDownEvent("start-button", ()=>{ this.subscribeMapDownEvent("start-button", ()=>{
console.log("Ok - Clikc")
element.click() element.click()
}) })
...@@ -921,7 +917,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -921,7 +917,6 @@ export class PlayComponent implements OnInit, OnDestroy {
element.ref.scaleX = 0; element.ref.scaleX = 0;
element.ref.scaleY = 0; element.ref.scaleY = 0;
element.show = ()=>{ element.show = ()=>{
console.log("Show")
element.ref.scaleX = element.ref.initScaleX; element.ref.scaleX = element.ref.initScaleX;
element.ref.scaleY = element.ref.initScaleY; element.ref.scaleY = element.ref.initScaleY;
} }
...@@ -932,7 +927,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -932,7 +927,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.subscribeMapDownEvent("restart-button", ()=>{ this.subscribeMapDownEvent("restart-button", ()=>{
console.log("Res - click")
element.hide() element.hide()
this.restartGame() this.restartGame()
}) })
...@@ -1076,7 +1070,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1076,7 +1070,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ---------------------------------- // ----------------------------------
initDefaultData() { initDefaultData() {
if ( Object.keys(this.g_formData).length===0 ) { if ( Object.keys(this.g_formData).length===0 ) {
console.log("Init default form data") // console.log("Init default form data")
this.g_formData = defauleFormData; this.g_formData = defauleFormData;
} }
} }
......
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