Commit d0773456 authored by 李维's avatar 李维

Bug fix

parent 46aca9f7
...@@ -2,47 +2,47 @@ ...@@ -2,47 +2,47 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" >左上</nz-form-label> <nz-form-label [nzSpan]="2" >左上</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.leftTop" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('leftTop')" [picUrl]="items.leftTop"
(imageUploaded)="onImageUploadSuccess($event, items, 'leftTop')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'leftTop')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
<nz-form-label [nzSpan]="2" >中上</nz-form-label> <nz-form-label [nzSpan]="2" >中上</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.middleTop" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('middleTop')" [picUrl]="items.middleTop"
(imageUploaded)="onImageUploadSuccess($event, items, 'middleTop')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'middleTop')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
<nz-form-label [nzSpan]="2" >右上</nz-form-label> <nz-form-label [nzSpan]="2" >右上</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.rightTop" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('rightTop')" [picUrl]="items.rightTop"
(imageUploaded)="onImageUploadSuccess($event, items, 'rightTop')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'rightTop')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" >左中</nz-form-label> <nz-form-label [nzSpan]="2" >左中</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.leftMiddle" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('leftMiddle')" [picUrl]="items.leftMiddle"
(imageUploaded)="onImageUploadSuccess($event, items, 'leftMiddle')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'leftMiddle')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
<div nz-col nzSpan="8"></div> <div nz-col nzSpan="8"></div>
<nz-form-label [nzSpan]="2" >右中</nz-form-label> <nz-form-label [nzSpan]="2" >右中</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.rightMiddle" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('rightMiddle')" [picUrl]="items.rightMiddle"
(imageUploaded)="onImageUploadSuccess($event, items, 'rightMiddle')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'rightMiddle')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" >左下</nz-form-label> <nz-form-label [nzSpan]="2" >左下</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.leftBottom" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('leftBottom')" [picUrl]="items.leftBottom"
(imageUploaded)="onImageUploadSuccess($event, items, 'leftBottom')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'leftBottom')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
<nz-form-label [nzSpan]="2" >中下</nz-form-label> <nz-form-label [nzSpan]="2" >中下</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.middleBottom" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('middleBottom')" [picUrl]="items.middleBottom"
(imageUploaded)="onImageUploadSuccess($event, items, 'middleBottom')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'middleBottom')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
<nz-form-label [nzSpan]="2">右下</nz-form-label> <nz-form-label [nzSpan]="2">右下</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
<app-upload-image-with-preview style="width: 100%" [picUrl]="items.rightBottom" <app-upload-image-with-preview style="width: 100%" canDelete="true" (delete)="deletePic('rightBottom')" [picUrl]="items.rightBottom"
(imageUploaded)="onImageUploadSuccess($event, items, 'rightBottom')"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event, items, 'rightBottom')"></app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
......
...@@ -16,4 +16,8 @@ export class BackgroundUploadComponent { ...@@ -16,4 +16,8 @@ export class BackgroundUploadComponent {
this.change.emit(items) this.change.emit(items)
} }
deletePic(key) {
this.items[key] = ""
this.change.emit(this.items)
}
} }
...@@ -172,9 +172,9 @@ ...@@ -172,9 +172,9 @@
<div style="float: left; margin-left: 10px;"> <div style="float: left; margin-left: 10px;">
<div>组合</div> <div>组合</div>
<div> <div>
<nz-select *ngFor="let part of item.combin; let i = index" [(ngModel)]="item.combin[i]" style="float: left; margin-right: 5px;" (ngModelChange)="handlePartChange($event, item, i)"> <nz-select *ngFor="let part of item.combin; let i = index" [(ngModel)]="item.combin[i]" style="float: left; margin-right: 5px; width: 150px;" (ngModelChange)="handlePartChange($event, item, i)">
<nz-option [nzValue]="-1" [nzLabel]="'L-' + bgItem.wordLeft_text"></nz-option> <nz-option [nzDisabled]="checkDisabel(item.combin, -1, i)" [nzValue]="-1" [nzLabel]="'L-' + bgItem.wordLeft_text"></nz-option>
<nz-option [nzValue]="-2" [nzLabel]="'R-' + bgItem.wordRight_text"></nz-option> <nz-option [nzDisabled]="checkDisabel(item.combin, -2, i)" [nzValue]="-2" [nzLabel]="'R-' + bgItem.wordRight_text"></nz-option>
<nz-option *ngFor="let hot of hotZoneArr; let j = index;" [nzValue]="j" [nzLabel]="(j + 1) + '-' + hot.text"></nz-option> <nz-option *ngFor="let hot of hotZoneArr; let j = index;" [nzValue]="j" [nzLabel]="(j + 1) + '-' + hot.text"></nz-option>
</nz-select> </nz-select>
</div> </div>
......
...@@ -79,7 +79,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -79,7 +79,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
ngOnInit() { ngOnInit() {
if(!this.bgItem.url){ if(!this.bgItem.url){
this.bgItem.url = "def_window" this.bgItem.url = ""
} }
this.initListener(); this.initListener();
this.update(); this.update();
...@@ -93,6 +93,20 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -93,6 +93,20 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
} }
checkDisabel(items, val, index) {
let valIndex_1 = items.indexOf(-1)
let valIndex_2 = items.indexOf(-2)
if(valIndex_1 == index || valIndex_2 == index) {
return false
} else {
if(valIndex_1 == -1 && valIndex_2 == -1 ) {
return false
} else {
return true
}
}
}
onBackgroundUploadSuccess(e) { onBackgroundUploadSuccess(e) {
this.bgItem.url = e.url; this.bgItem.url = e.url;
this.refreshBackground(() => { this.refreshBackground(() => {
...@@ -206,11 +220,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -206,11 +220,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
item.x = saveRect.x / saveData.scale + newRect.x item.x = saveRect.x / saveData.scale + newRect.x
item.y = saveRect.y / saveData.scale + newRect.y item.y = saveRect.y / saveData.scale + newRect.y
}); });
// item.image_url = saveData.media.image_url item.image_url = saveData.media.image_url
// item.text = saveData.media.text // item.text = saveData.media.text
// item.type = saveData.media.type // item.type = saveData.media.type
item.audio_url = saveData.media.audio_url?saveData.media.audio_url:"" item.audio_url = saveData.media.audio_url?saveData.media.audio_url:""
item.image_url = "assets/play/bg_70_40.png" // item.image_url = "assets/play/bg_70_40.png"
// item.text = "" // item.text = ""
item.type = "Image" item.type = "Image"
} else { } else {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
</div> </div>
</nz-upload> </nz-upload>
<div class="p-btn-delete" *ngIf="canDelete" <div class="p-btn-delete" *ngIf="picUrl && canDelete"
nz-popconfirm nzTitle="Are you sure ?" nz-popconfirm nzTitle="Are you sure ?"
(nzOnConfirm)="onDelete()" (nzOnConfirm)="onDelete()"
> >
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
.p-btn-delete { .p-btn-delete {
position: absolute; position: absolute;
right: -0.5rem; right: -2rem;
top: -0.5rem; top: 0;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
border: 0.2rem solid white; border: 0.2rem solid white;
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
background-color: #fb781a; background-color: #fb781a;
color: white; color: white;
text-align: center; text-align: center;
line-height: 2rem !important;
} }
.p-upload-progress-bg { .p-upload-progress-bg {
...@@ -95,7 +96,6 @@ ...@@ -95,7 +96,6 @@
} }
} }
:host ::ng-deep .ant-upload { :host ::ng-deep .ant-upload {
display: block; display: block;
} }
...@@ -34,10 +34,12 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges { ...@@ -34,10 +34,12 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
constructor(private nzMessageService: NzMessageService) { constructor(private nzMessageService: NzMessageService) {
this.uploadUrl = (<any> window).courseware.uploadUrl(); this.uploadUrl = (<any> window).courseware.uploadUrl();
console.log("constructor", this.uploadUrl)
this.uploadData = (<any> window).courseware.uploadData(); this.uploadData = (<any> window).courseware.uploadData();
window['air'].getUploadCallback = (url, data) => { window['air'].getUploadCallback = (url, data) => {
this.uploadUrl = url; this.uploadUrl = url;
this.uploadData = data; this.uploadData = data;
console.log("getUploadCallback", this.uploadUrl)
}; };
} }
ngOnChanges() { ngOnChanges() {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
></app-custom-hot-zone> ></app-custom-hot-zone>
</div> </div>
</div> </div>
<div class="card-item-content"> <div class="card-item-content" style="margin-top: 10px;">
<div class="title">背景 设置</div> <div class="title">背景 设置</div>
<div class="section"> <div class="section">
<app-background-upload <app-background-upload
......
...@@ -95,3 +95,8 @@ ...@@ -95,3 +95,8 @@
font-family: 'MMTextBook-Italic'; font-family: 'MMTextBook-Italic';
src: url("../../assets/default/font/MMTextBook/MMTextBook-Italic.otf") ; src: url("../../assets/default/font/MMTextBook/MMTextBook-Italic.otf") ;
} }
@font-face{
font-family: 'FuturaBT-Medium';
src: url("../../assets/play/font/Futura.ttc") ;
}
...@@ -273,7 +273,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -273,7 +273,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
}) })
element.ref.x = this.g_partTitle_x - 20 * this.g_mapScale + (57*this.g_mapScale)/2; element.ref.x = this.g_partTitle_x - 20 * this.g_mapScale + (57*this.g_mapScale)/2;
let text = this.g_cartoon.createLabel(this.g_formData.bgItem.NO, "BerlinSansFBDemi-Bold", "#F7CB47", 48) let text = this.g_cartoon.createLabel(this.g_formData.bgItem.NO, "BerlinSansFBDemi-Bold", "#FFFFFF", 48)
element.ref.addChild(text) element.ref.addChild(text)
let partBG = this.g_cartoon.createCartoonElementImageFunc("part-title-background", "part_number_bg", (w, h)=>{ let partBG = this.g_cartoon.createCartoonElementImageFunc("part-title-background", "part_number_bg", (w, h)=>{
...@@ -294,7 +294,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -294,7 +294,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initTitle_Main(){ initTitle_Main(){
let labelWidth = 0 let labelWidth = 0
let text = this.g_cartoon.createCartoonElementLabelFunc("main-title", this.g_formData.bgItem.mainText, "FuturaBT-Bold", "#000000", 36 * this.g_mapScale, (w, h)=>{ let text = this.g_cartoon.createCartoonElementLabelFunc("main-title", this.g_formData.bgItem.mainText, "FuturaBT-Medium", "#000000", 36 * this.g_mapScale, (w, h)=>{
labelWidth = w/2 labelWidth = w/2
return { return {
x: this.g_partTitle_x - 20 * this.g_mapScale + labelWidth * this.g_mapScale, x: this.g_partTitle_x - 20 * this.g_mapScale + labelWidth * this.g_mapScale,
...@@ -557,6 +557,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -557,6 +557,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}) })
let startX = -70 let startX = -70
let totalWidth = 0
let answerIndex = [] let answerIndex = []
this.m_answerAll.push([]) this.m_answerAll.push([])
...@@ -569,11 +570,19 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -569,11 +570,19 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_answerAll[index].push(`word-part-${index}-${item.key}-${partIndex}`) this.m_answerAll[index].push(`word-part-${index}-${item.key}-${partIndex}`)
let textShow = this.g_cartoon.createCartoonElementLabel(`word-part-${index}-${item.key}-${partIndex}`, item.value, "MMTextBook-Bold", color, 48, startX, 0) let textShow = this.g_cartoon.createCartoonElementLabel(`word-part-${index}-${item.key}-${partIndex}`, item.value, "MMTextBook-Bold", color, 48, startX, 0)
textShow.isShown = false; textShow.isShown = false;
textShow.ref.alpha = 0; textShow.ref.alpha = 1;
textShow.ref.x = startX + textShow.ref.width / 2 textShow.ref.x = startX + textShow.ref.width / 2
startX += textShow.ref.width startX += textShow.ref.width
totalWidth += textShow.ref.width
element.ref.addChild(textShow.ref) element.ref.addChild(textShow.ref)
}) })
console.log(totalWidth)
startX = -totalWidth / 2 + 20
this.m_answerAll[index].forEach(element => {
let el = this.g_cartoon.getCartoonElement(element)
el.ref.x = startX + el.ref.width / 2
startX += el.ref.width
});
this.subscribeMapUpEvent(element.id, ()=>{ this.subscribeMapUpEvent(element.id, ()=>{
if(!this.m_elementDraged) { if(!this.m_elementDraged) {
...@@ -596,6 +605,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -596,6 +605,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(!textShow.isShown) { if(!textShow.isShown) {
textShow.isShown = true; textShow.isShown = true;
textShow.ref.alpha = 1; textShow.ref.alpha = 1;
this.g_cartoon.playAudio("sm-choice-correct")
break; break;
} }
} }
...@@ -751,8 +761,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -751,8 +761,8 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
initBackgroundSide() { calcPosition(position, width, height) {
const map = { let map = {
leftTop: {x: 0, y: 0}, leftTop: {x: 0, y: 0},
middleTop: {x: this.g_canvasWidth / 2, y: 0}, middleTop: {x: this.g_canvasWidth / 2, y: 0},
rightTop: {x: this.g_canvasWidth, y: 0}, rightTop: {x: this.g_canvasWidth, y: 0},
...@@ -762,17 +772,52 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -762,17 +772,52 @@ export class PlayComponent implements OnInit, OnDestroy {
middleBottom: {x: this.g_canvasWidth / 2, y: this.g_canvasHeight}, middleBottom: {x: this.g_canvasWidth / 2, y: this.g_canvasHeight},
rightBottom: {x: this.g_canvasWidth, y: this.g_canvasHeight} rightBottom: {x: this.g_canvasWidth, y: this.g_canvasHeight}
} }
switch(position) {
case "leftTop":
map["leftTop"].x += width * this.g_mapScale / 2,
map["leftTop"].y += height * this.g_mapScale / 2;
return map["leftTop"];
case "middleTop":
map["middleTop"].y += height * this.g_mapScale / 2;
return map["middleTop"];
case "rightTop":
map["rightTop"].x -= width * this.g_mapScale / 2,
map["rightTop"].y += height * this.g_mapScale / 2;
return map["rightTop"];
case "leftMiddle":
map["leftMiddle"].x += height * this.g_mapScale / 2;
return map["leftMiddle"];
case "rightMiddle":
map["rightMiddle"].x -= height * this.g_mapScale / 2;
return map["rightMiddle"];
case "leftBottom":
map["leftBottom"].x += width * this.g_mapScale / 2,
map["leftBottom"].y -= height * this.g_mapScale / 2;
return map["leftBottom"];
case "middleBottom":
map["middleBottom"].y -= height * this.g_mapScale / 2;
return map["middleBottom"];
case "rightBottom":
map["rightBottom"].x -= width * this.g_mapScale / 2,
map["rightBottom"].y -= height * this.g_mapScale / 2;
return map["rightBottom"];
}
}
initBackgroundSide() {
for(let key in this.g_formData.bgImages) { for(let key in this.g_formData.bgImages) {
if(!this.g_formData.bgImages[key]) { if(!this.g_formData.bgImages[key]) {
continue continue
} }
let ele = this.g_cartoon.createCartoonElementImageFunc(`background-side-${key}`, this.g_formData.bgImages[key], (w, h)=>{ let ele = this.g_cartoon.createCartoonElementImageFunc(`background-side-${key}`, this.g_formData.bgImages[key], (w, h)=>{
return { return {
sx: 1, sx: this.g_mapScale,
sy: 1, sy: this.g_mapScale,
} }
}, (w, h)=>{ }, (w, h)=>{
return map[key] return this.calcPosition(key, w, h)
}) })
console.log(this.g_formData.bgImages[key]) console.log(this.g_formData.bgImages[key])
this.render(ele.ref, -1) this.render(ele.ref, -1)
......
export const defaultData = { export const defaultData = {
"version": "1.0", "version": "1.1",
"dataKey": "DataKey_YM4-11", "dataKey": "DataKey_YM4-11",
"dataArray": [ "dataArray": [
...@@ -8,7 +8,7 @@ export const defaultData = { ...@@ -8,7 +8,7 @@ export const defaultData = {
], ],
"bgItem": { "bgItem": {
"url": "", "url": "assets/play/hotZooCard/defalut_bg.png",
"questions": [ "questions": [
], ],
...@@ -32,7 +32,7 @@ export const defaultData = { ...@@ -32,7 +32,7 @@ export const defaultData = {
} }
export const demoData = { export const demoData = {
version: "1.0", version: "1.1",
dataKey: "DataKey_YM4-11", dataKey: "DataKey_YM4-11",
dataArray: [], dataArray: [],
hotZoneItemArr: [ hotZoneItemArr: [
......
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