Commit 349cbbd5 authored by 李维's avatar 李维

添加页头页尾图片配置

parent 52cca651
......@@ -866,7 +866,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 138
"height": 142
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -878,7 +878,7 @@
"ctor": "Float64Array",
"array": [
0,
531,
529,
0,
0,
0,
......@@ -979,9 +979,7 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "cddea2ff-d29d-46e9-a62d-22fd51f0514a"
},
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
......@@ -1201,9 +1199,7 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ed9aebd7-be72-4a8c-9cf0-05e55d7e82e5"
},
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
......
import {
asyncDelay,
onHomeworkFinish,
playAudioByUrl,
loadImageByUrl,
getSprNode,
} from "../script/util_DG_FAF";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG_FAF";
......@@ -34,6 +33,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(this.data);
this.initSize();
this.initEventListener();
this.initHeaderAndFooter();
await this.initHotZoneBg();
this.initHotZoneItem();
}
......@@ -107,7 +107,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 检查是否可以提交
this.checkCanSubmit();
})
}
// 初始化头部和底部图片
initHeaderAndFooter() {
loadImageByUrl(this.data.header_image_url, (sf)=>{
const imgNode = cc.find("Canvas/Header/img");
const sfSize = sf.getOriginalSize();
const sx = imgNode.parent.width / sfSize.width;
const sy = imgNode.parent.height / sfSize.height;
imgNode.scale = Math.min(sx, sy)
imgNode.getComponent(cc.Sprite).spriteFrame = sf;
})
loadImageByUrl(this.data.footer_image_url, (sf)=>{
const imgNode = cc.find("Canvas/Footer/img");
const sfSize = sf.getOriginalSize();
const sx = imgNode.parent.width / sfSize.width;
const sy = imgNode.parent.height / sfSize.height;
imgNode.scale = Math.min(sx, sy)
imgNode.getComponent(cc.Sprite).spriteFrame = sf;
})
}
hotZoneBg = null;
......
......@@ -135,4 +135,4 @@
// "typeArr": []
// }
export const defaultData = {"hotZoneConfigArr":[{"linkHotZoneIndex":0,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"2","audio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"1","isCorrect":true},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":2,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":2,"isCorrect":true},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"selectHotZoneIndex":3}],"hotZoneType":"3","score":"2"},{"linkHotZoneIndex":4,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"5","inputText":"Hello World"},{"linkHotZoneIndex":9,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":10,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":11,"isCorrect":true,"isCheck":true,"score":"4"},{"text":"","image_url":"","hotZoneIndex":null,"score":"3","selectHotZoneIndex":12,"isCorrect":true,"isCheck":true},{"text":"","image_url":"","hotZoneIndex":null,"score":"2","selectHotZoneIndex":13,"isCorrect":true,"isCheck":false}],"hotZoneType":"4"}],"scoreConfigArr":[{"linkHotZoneIndex":7,"linkHotZoneIndexArr":[4,5,1]},{"linkHotZoneIndex":8,"linkHotZoneIndexArr":[2]},{"linkHotZoneIndex":14,"linkHotZoneIndexArr":[6]}],"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/5c84b987ea2291c8d6013fffd39dda32.png","rect":{"x":114.9517453798768,"y":0,"width":807.0965092402464,"height":1136}},"hotZoneItemArr":[{"index":0,"itemType":"rect","itemName":"1-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":299.5,"y":147.37,"width":30.7,"height":30.7}},{"index":1,"itemType":"rect","itemName":"1-1选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":154.51,"y":303.95,"width":27.3,"height":27.3}},{"index":2,"itemType":"rect","itemName":"2-1Alex","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":112.21,"y":390.95,"width":42.3,"height":25.25}},{"index":3,"itemType":"rect","itemName":"2-1Anna","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":159.97,"y":391.62,"width":53.21,"height":23.88}},{"index":4,"itemType":"rect","itemName":"3-1输入文本","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":336.69,"y":715.71,"width":136.45,"height":26.61}},{"index":5,"itemType":"rect","itemName":"提交按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":455.88,"y":1030.33,"width":102.33,"height":30.7}},{"index":6,"itemType":"rect","itemName":"重做按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":236.78,"y":1032.21,"width":90.06,"height":27.97}},{"index":7,"itemType":"rect","itemName":"1得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":709.9,"y":148.05,"width":50.48,"height":27.97}},{"index":8,"itemType":"rect","itemName":"2得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":709.9,"y":354.79,"width":51.85,"height":26.61}},{"index":9,"itemType":"rect","itemName":"1-2选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":271.38,"y":304.38,"width":25.45,"height":25.45}},{"index":10,"itemType":"rect","itemName":"1-3选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":384.57,"y":302.97,"width":29.65,"height":29.65}},{"index":11,"itemType":"rect","itemName":"1-4","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":499.8,"y":302.98,"width":28.47,"height":28.47}},{"index":12,"itemType":"rect","itemName":"1-5","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":615.03,"y":302.3,"width":29.82,"height":29.82}},{"index":13,"itemType":"rect","itemName":"1-6","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":730.25,"y":302.98,"width":28.47,"height":28.47}},{"index":14,"itemType":"rect","itemName":"得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":714.66,"y":660.86,"width":36.6,"height":36.6}}],"submitHotZoneIndex":5,"replayHotZoneIndex":6,"isDebug":true}
\ No newline at end of file
export const defaultData = {"hotZoneConfigArr":[{"linkHotZoneIndex":0,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"2","audio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"1","isCorrect":true},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":2,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":2,"isCorrect":true},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"selectHotZoneIndex":3}],"hotZoneType":"4","score":"2"},{"linkHotZoneIndex":4,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"5","inputText":"Hello World"},{"linkHotZoneIndex":9,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":10,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":11,"isCorrect":true,"isCheck":true,"score":"4"},{"text":"","image_url":"","hotZoneIndex":null,"score":"3","selectHotZoneIndex":12,"isCorrect":true,"isCheck":true},{"text":"","image_url":"","hotZoneIndex":null,"score":"2","selectHotZoneIndex":13,"isCorrect":true,"isCheck":false}],"hotZoneType":"4"}],"scoreConfigArr":[{"linkHotZoneIndex":7,"linkHotZoneIndexArr":[4,5,1]},{"linkHotZoneIndex":8,"linkHotZoneIndexArr":[2]},{"linkHotZoneIndex":14,"linkHotZoneIndexArr":[6]}],"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/5c84b987ea2291c8d6013fffd39dda32.png","rect":{"x":114.9517453798768,"y":0,"width":807.0965092402464,"height":1136}},"hotZoneItemArr":[{"index":0,"itemType":"rect","itemName":"1-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":299.5,"y":147.37,"width":30.7,"height":30.7}},{"index":1,"itemType":"rect","itemName":"1-1选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":154.51,"y":303.95,"width":27.3,"height":27.3}},{"index":2,"itemType":"rect","itemName":"2-1Alex","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":112.21,"y":390.95,"width":42.3,"height":25.25}},{"index":3,"itemType":"rect","itemName":"2-1Anna","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":159.97,"y":391.62,"width":53.21,"height":23.88}},{"index":4,"itemType":"rect","itemName":"3-1输入文本","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":336.69,"y":715.71,"width":136.45,"height":26.61}},{"index":5,"itemType":"rect","itemName":"提交按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":455.88,"y":1030.33,"width":102.33,"height":30.7}},{"index":6,"itemType":"rect","itemName":"重做按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":236.78,"y":1032.21,"width":90.06,"height":27.97}},{"index":7,"itemType":"rect","itemName":"1得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":709.9,"y":148.05,"width":50.48,"height":27.97}},{"index":8,"itemType":"rect","itemName":"2得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":709.9,"y":354.79,"width":51.85,"height":26.61}},{"index":9,"itemType":"rect","itemName":"1-2选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":271.38,"y":304.38,"width":25.45,"height":25.45}},{"index":10,"itemType":"rect","itemName":"1-3选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":384.57,"y":302.97,"width":29.65,"height":29.65}},{"index":11,"itemType":"rect","itemName":"1-4","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":499.8,"y":302.98,"width":28.47,"height":28.47}},{"index":12,"itemType":"rect","itemName":"1-5","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":615.03,"y":302.3,"width":29.82,"height":29.82}},{"index":13,"itemType":"rect","itemName":"1-6","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":730.25,"y":302.98,"width":28.47,"height":28.47}},{"index":14,"itemType":"rect","itemName":"得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.81015625,"imgScale":1,"mapScale":0.81015625,"rect":{"x":714.66,"y":660.86,"width":36.6,"height":36.6}}],"submitHotZoneIndex":5,"replayHotZoneIndex":6,"isDebug":false,"header_image_url":"http://staging-teach.cdn.ireadabc.com/a4427e34c15b3360ff0554071d676455.png","footer_image_url":"http://staging-teach.cdn.ireadabc.com/bac2bf6c1a9acb0abdeddde3289442e6.png"}
\ No newline at end of file
......@@ -113,6 +113,16 @@ export function playAudioByUrl(audio_url, cb=null) {
}
}
export function loadImageByUrl(image_url, cb=null) {
if (image_url) {
cc.assetManager.loadRemote(image_url, (err, texture) => {
if (cb) {
const spriteFrame = new cc.SpriteFrame(texture)
cb(spriteFrame);
}
});
}
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
btn.tmpScale = btn.scale;
......
......@@ -3,6 +3,26 @@
<app-formula-input [(ngfModel)]="item.title" (ngfBlur)="save()"></app-formula-input><br> -->
<div style="padding: 20px;">
<div style="margin: 30px;"></div>
<h2 style="margin-top: 10px;">页头-页尾配置</h2>
<div style="font-size: 16px; border: 2px solid #ccc; border-radius: 10px; padding: 10px; display: flex; height: 180px;">
<div style="width: 200px; height: 112px;">
<h5>页头图片:</h5>
<app-upload-image-with-preview
[picUrl]="item.header_image_url"
(imageUploaded)="onImageUploadSuccess($event, 'header_image_url', item)">
</app-upload-image-with-preview>
</div>
<div style="width: 200px; height: 112px; margin-left: 20px;">
<h5>页尾图片:</h5>
<app-upload-image-with-preview
[picUrl]="item.footer_image_url"
(imageUploaded)="onImageUploadSuccess($event, 'footer_image_url', item)">
</app-upload-image-with-preview>
</div>
</div>
<h2 >热区位置配置:</h2>
<app-custom-hot-zone
[bgItem]="item.bgItem"
......@@ -38,21 +58,21 @@
<thead>
<tr>
<th nzWidth="100px" nzAlign="center">序号</th>
<th nzWidth="200px" nzAlign="center">正确答案</th>
<th *ngIf="it.hotZoneType == '4'" nzWidth="200px" nzAlign="center">分数</th>
<th *ngIf="it.hotZoneType == '3' || it.hotZoneType == '4'" nzWidth="100px" nzAlign="center">正确答案</th>
<th *ngIf="it.hotZoneType == '4'" nzWidth="100px" nzAlign="center">分数</th>
<th *ngIf="it.hotZoneType == '0'">文字</th>
<th *ngIf="it.hotZoneType == '1'">图片</th>
<th *ngIf="it.hotZoneType == '3' || it.hotZoneType == '4'">热区索引</th>
<th nzWidth="10%">操作</th>
<th nzWidth="150px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of contentTable.data; let i = index;">
<ng-container *ngIf="!(editCache[i] && editCache[i].edit); else editTemplate">
<td nzWidth="100px" nzAlign="center">{{ i + 1 }}</td>
<td *ngIf="it.hotZoneType == '3'" nzWidth="200px" nzAlign="center">{{ data.isCorrect?'正确':'错误' }}</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px" nzAlign="center">{{ data.isCheck?'勾选':'不勾选' }}</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px" nzAlign="center">{{ data.score }}</td>
<td *ngIf="it.hotZoneType == '3'" nzWidth="100px" nzAlign="center">{{ data.isCorrect?'正确':'错误' }}</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="100px" nzAlign="center">{{ data.isCheck?'勾选':'不勾选' }}</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="100px" nzAlign="center">{{ data.score }}</td>
<td *ngIf="it.hotZoneType == '0'">{{ data.text }}</td>
<td *ngIf="it.hotZoneType == '1'">
<img *ngIf="data.image_url" [src]="data.image_url" width="200" height="200" style="object-fit: contain;"/>
......@@ -61,7 +81,7 @@
<td *ngIf="it.hotZoneType == '3' || it.hotZoneType == '4'">
<span style="margin-left: 10px;">索引: {{data.selectHotZoneIndex + 1}} 热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[data.selectHotZoneIndex] ? item.hotZoneItemArr[data.selectHotZoneIndex].itemName : "未配置"}}</span>
</td>
<td nzWidth="10%">
<td nzWidth="150px">
<a (click)="startHotZoneConfigEdit(i, data)">编辑</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="deleteHotZoneConfigItem(it, i)">删除</a>
......@@ -69,13 +89,13 @@
</ng-container>
<ng-template #editTemplate>
<td nzWidth="100px" nzAlign="center">{{ i + 1 }}</td>
<td *ngIf="it.hotZoneType == '3'" nzWidth="200px" nzAlign="center">
<td *ngIf="it.hotZoneType == '3'" nzWidth="100px" nzAlign="center">
<label nz-checkbox [(ngModel)]="editCache[i].data.isCorrect"></label>
</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px" nzAlign="center">
<td *ngIf="it.hotZoneType == '4'" nzWidth="100px" nzAlign="center">
<label nz-checkbox [(ngModel)]="editCache[i].data.isCheck"></label>
</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px">
<td *ngIf="it.hotZoneType == '4'" nzWidth="100px">
<input type="text" nz-input [(ngModel)]="editCache[i].data.score" />
</td>
<td *ngIf="it.hotZoneType == '0'">
......@@ -98,7 +118,7 @@
<td nzWidth="10%">
<a (click)="saveHotZoneConfigEdit(i, it)" class="save">保存</a>
<nz-divider nzType="vertical"></nz-divider>
<a nz-popconfirm nzPopconfirmTitle="Sure to cancel?" (nzOnConfirm)="cancelHotZoneConfigEdit(i, data)">取消</a>
<a nz-popconfirm nzPopconfirmTitle="确定取消?" (nzOnConfirm)="cancelHotZoneConfigEdit(i, data)">取消</a>
</td>
</ng-template>
</tr>
......
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