Commit d2be6932 authored by 李维's avatar 李维

dev completed

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