Commit 2ffa4d7c authored by 李维's avatar 李维

dev commit

parent 2ea4551e
...@@ -65,19 +65,17 @@ ...@@ -65,19 +65,17 @@
<div style="flex:3"> <div style="flex:3">
<input type="text" nz-input placeholder="" [(ngModel)]="it.text" (blur)="saveItem()"/> <input type="text" nz-input placeholder="" [(ngModel)]="it.text" (blur)="saveItem()"/>
</div> </div>
<div style="flex:8" style="margin-left: 10px;"> <div style="flex:8" style="margin-left: 20px;">
<span>对应下层卡片</span><span> : </span> <span>对应下层卡片</span><span> : </span>
<nz-select nzMode="multiple" nzPlaceHolder="Inserted are removed" [(ngModel)]="it.lineTo" (ngModelChange)="save()" style="min-width: 500px;"> <nz-checkbox-group [(ngModel)]="it.checkOptions" (ngModelChange)="save()"></nz-checkbox-group>
<nz-option *ngFor="let option of options;" [nzLabel]="option+1" [nzValue]="option"></nz-option>
</nz-select>
</div> </div>
<div style="flex:4"> <div style="flex:4">
<div style="float:right; text-align: left; padding-left: 20px;"> <div style="float:right; text-align: left; padding-left: 20px;">
<button style="vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemUp(i)" [disabled]="i==0"> <button style="vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemUp(item.contentObj.textUp, i)" [disabled]="i==0">
<i nz-icon nzType="up" nzTheme="outline" style="float: left; margin-top: 4px;"></i> <i nz-icon nzType="up" nzTheme="outline" style="float: left; margin-top: 4px;"></i>
<span style="float: right;">上移</span> <span style="float: right;">上移</span>
</button> </button>
<button style="margin-left: 10px; vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemDown(i)" [disabled]="i==item.contentObj.textUp.length-1"> <button style="margin-left: 10px; vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemDown(item.contentObj.textUp, i)" [disabled]="i==item.contentObj.textUp.length-1">
<i nz-icon nzType="down" nzTheme="outline" style="float: left; margin-top: 4px;"></i> <i nz-icon nzType="down" nzTheme="outline" style="float: left; margin-top: 4px;"></i>
<span style="float: right;">下移</span> <span style="float: right;">下移</span>
</button> </button>
...@@ -118,11 +116,11 @@ ...@@ -118,11 +116,11 @@
</div> </div>
<div style="flex:4"> <div style="flex:4">
<div style="float:right; text-align: left; padding-left: 20px;"> <div style="float:right; text-align: left; padding-left: 20px;">
<button style="vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemUp(i)" [disabled]="i==0"> <button style="vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemUp(item.contentObj.textDown, i)" [disabled]="i==0">
<i nz-icon nzType="up" nzTheme="outline" style="float: left; margin-top: 4px;"></i> <i nz-icon nzType="up" nzTheme="outline" style="float: left; margin-top: 4px;"></i>
<span style="float: right;">上移</span> <span style="float: right;">上移</span>
</button> </button>
<button style="margin-left: 10px; vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemDown(i)" [disabled]="i==item.contentObj.textDown.length-1"> <button style="margin-left: 10px; vertical-align:baseline;" nz-button nzType="default" (click)="handleMoveItemDown(item.contentObj.textDown, i)" [disabled]="i==item.contentObj.textDown.length-1">
<i nz-icon nzType="down" nzTheme="outline" style="float: left; margin-top: 4px;"></i> <i nz-icon nzType="down" nzTheme="outline" style="float: left; margin-top: 4px;"></i>
<span style="float: right;">下移</span> <span style="float: right;">下移</span>
</button> </button>
......
...@@ -12,7 +12,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -12,7 +12,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any; _item: any;
KEY = 'DataKey_PU03'; KEY = 'DataKey_PU03';
options = [] checkOptionsOne = []
set item(item) { set item(item) {
this._item = item; this._item = item;
...@@ -75,12 +75,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -75,12 +75,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// console.log("使用默认数据", this.contentObj) // console.log("使用默认数据", this.contentObj)
this.item.contentObj = this.contentObj; this.item.contentObj = this.contentObj;
} }
this.updateCheckbox()
this.options = []
this.item.contentObj.textDown.forEach((item, index) => {
this.options.push(index)
});
} }
cardItemData(){ cardItemData(){
...@@ -96,27 +91,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -96,27 +91,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
handleMoveItemUp(items, index){
handleMoveItemUp(index){
if(index!=0){ if(index!=0){
this.item.contentObj.dataArray[index] = this.item.contentObj.dataArray.splice(index-1, 1, this.item.contentObj.dataArray[index])[0]; items[index] = items.splice(index-1, 1, items[index])[0];
}else{ }else{
this.item.contentObj.dataArray.push(this.item.contentObj.dataArray.shift()); items.push(items.shift());
} }
this.save() this.save()
} }
handleMoveItemDown(index){ handleMoveItemDown(items, index){
if(index!=this.item.contentObj.dataArray.length-1){ if(index!=items.length-1){
this.item.contentObj.dataArray[index] = this.item.contentObj.dataArray.splice(index+1, 1, this.item.contentObj.dataArray[index])[0]; items[index] = items.splice(index+1, 1, items[index])[0];
}else{ }else{
this.item.contentObj.dataArray.unshift( this.item.contentObj.dataArray.splice(index,1)[0]); items.unshift( items.splice(index,1)[0]);
} }
this.save() this.save()
} }
deleteItem(item, index){ deleteItem(item, index){
item.splice(index,1) item.splice(index,1)
this.updateCheckbox()
this.save() this.save()
} }
...@@ -126,12 +121,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -126,12 +121,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
case "card": newItem = {text:"", lineTo: []} case "card": newItem = {text:"", lineTo: []}
default: newItem = {text:"", lineTo: []} default: newItem = {text:"", lineTo: []}
} }
this.options = []
this.item.contentObj.textDown.forEach((item, index) => {
this.options.push(index)
});
item.push(newItem); item.push(newItem);
this.updateCheckbox()
this.saveItem(); this.saveItem();
} }
...@@ -152,6 +143,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -152,6 +143,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
save() { save() {
this.item.contentObj.textUp.forEach((item, index) => {
let newLineTo = []
item.checkOptions.forEach( option=> {
if(option.checked){
newLineTo.push(option.value)
}
});
item.lineTo = JSON.parse(JSON.stringify(newLineTo))
});
(<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)
...@@ -162,5 +163,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -162,5 +163,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.appRef.tick(); this.appRef.tick();
}, 1); }, 1);
} }
updateCheckbox(){
let check = []
this.item.contentObj.textDown.forEach((item, index) => {
check.push({label:index+1, value:index, checked:false})
});
this.item.contentObj.textUp.forEach((item, index) => {
item.lineTo.forEach( option=> {
check[Number(option)].checked = true
});
item.checkOptions = JSON.parse(JSON.stringify(check))
});
}
} }
...@@ -357,9 +357,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -357,9 +357,9 @@ export class PlayComponent implements OnInit, OnDestroy {
let enableShortAudio = false; let enableShortAudio = false;
switch(this.g_formData.mainQuestion.type){ switch(this.g_formData.mainQuestion.type){
case "Image": enableImage = true; break; case "Image": enableImage = true; console.log("图片"); break;
case "Text": enableText = true; break; case "Text": enableText = true; console.log("文字"); break;
case "LongAudio": enableLongAudio = true; break; case "LongAudio": enableLongAudio = true; console.log("长音频"); break;
default: enableText = true; break; default: enableText = true; break;
} }
if(this.g_formData.mainQuestion.shortAudio_url){ if(this.g_formData.mainQuestion.shortAudio_url){
...@@ -368,9 +368,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -368,9 +368,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if(enableImage){ if(enableImage){
// 图片内容 // 图片内容
let imageContent = this.g_cartoon.createImage("default_Image", (w, h)=>{ let imageContent = this.g_cartoon.createImage(this.g_formData.mainQuestion.image_url, (w, h)=>{
let sx = 645*0.965 / w let sx = 645*0.92 / w
let sy = 323*0.965 / h let sy = 323*0.92 / h
let s = Math.min(sx, sy) let s = Math.min(sx, sy)
return { return {
sx: s, sx: s,
...@@ -628,8 +628,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -628,8 +628,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// 音乐内容 // 音乐内容
let shortAudio = this.g_cartoon.createCartoonElementImageFunc("main_window_la_play", "btn_laba", (w, h)=>{ let shortAudio = this.g_cartoon.createCartoonElementImageFunc("main_window_la_play", "btn_laba", (w, h)=>{
return { return {
sx: 77 * this.g_mapScale / w, sx: 77 / w,
sy: 260 * this.g_mapScale / h, sy: 260 / h,
} }
}, (w, h)=>{ }, (w, h)=>{
return { return {
...@@ -773,7 +773,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -773,7 +773,7 @@ export class PlayComponent implements OnInit, OnDestroy {
card.ref.dot = dot; card.ref.dot = dot;
// 红色节点 // 红色节点
let dot_red = this.g_cartoon.createImage("icon_dian2", (w, h)=>{ let dot_red = this.g_cartoon.createImage("icon_dian1", (w, h)=>{
return { return {
sx: 37*this.g_mapScale / w, sx: 37*this.g_mapScale / w,
sy: 37*this.g_mapScale / h sy: 37*this.g_mapScale / h
......
src/assets/play/6.png

1.46 KB | W: | H:

src/assets/play/6.png

1.74 KB | W: | H:

src/assets/play/6.png
src/assets/play/6.png
src/assets/play/6.png
src/assets/play/6.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/7.png

1.6 KB | W: | H:

src/assets/play/7.png

1.81 KB | W: | H:

src/assets/play/7.png
src/assets/play/7.png
src/assets/play/7.png
src/assets/play/7.png
  • 2-up
  • Swipe
  • Onion skin
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