Commit 7c94c4d1 authored by 李维's avatar 李维

完成判断对错逻辑

parent d1a0b3fe
...@@ -88,21 +88,18 @@ ...@@ -88,21 +88,18 @@
}, },
{ {
"__id__": 206 "__id__": 206
},
{
"__id__": 218
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 221 "__id__": 218
}, },
{ {
"__id__": 222 "__id__": 219
}, },
{ {
"__id__": 223 "__id__": 220
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6285,7 +6282,7 @@ ...@@ -6285,7 +6282,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1920, "width": 1920,
"height": -3800 "height": 1080
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -8422,163 +8419,6 @@ ...@@ -8422,163 +8419,6 @@
"preload": false, "preload": false,
"_id": "dey05oKrBIspvsDa6pOIQz" "_id": "dey05oKrBIspvsDa6pOIQz"
}, },
{
"__type__": "cc.Node",
"_name": "New Node",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 219
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "91i2wGBUNO/aVEV0M402zJ"
},
{
"__type__": "cc.Node",
"_name": "New Label",
"_objFlags": 0,
"_parent": {
"__id__": 218
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 220
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 22.25,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
50,
50,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6cCRKENvFE5I9978OAy3iB"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 219
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "3",
"_N$string": "3",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "d8hatUvWxAi5F+od2lb3r1"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",
......
...@@ -31,6 +31,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -31,6 +31,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
async onLoadEnd() { async onLoadEnd() {
// TODO 加载完成后的逻辑写在这里 // TODO 加载完成后的逻辑写在这里
console.log(this.data);
this.initSize(); this.initSize();
this.initEventListener(); this.initEventListener();
await this.initHotZoneBg(); await this.initHotZoneBg();
...@@ -81,6 +82,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -81,6 +82,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// la.string = text; // la.string = text;
this.currentInputTarget = null; this.currentInputTarget = null;
} }
// 检查是否可以提交
this.checkCanSubmit();
}) })
this.selectModal.on("onSelected", (e)=>{ this.selectModal.on("onSelected", (e)=>{
...@@ -90,6 +93,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -90,6 +93,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// la.string = event.value; // la.string = event.value;
this.currentInputTarget = null; this.currentInputTarget = null;
} }
// 检查是否可以提交
this.checkCanSubmit();
}) })
this.selectModal.on("onCancel", (e)=>{ this.selectModal.on("onCancel", (e)=>{
...@@ -99,6 +104,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -99,6 +104,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// la.string = event.value; // la.string = event.value;
this.currentInputTarget = null; this.currentInputTarget = null;
} }
// 检查是否可以提交
this.checkCanSubmit();
}) })
} }
...@@ -133,48 +140,159 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -133,48 +140,159 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
picNodeArr = []; picNodeArr = [];
scoreValidater = [];
initHotZoneItem() { initHotZoneItem() {
this.picNodeArr = []; this.picNodeArr = [];
this.data.hotZoneConfigArr.forEach(configItem => { // 根据内容配置 生成需要显示的热区
this.data.hotZoneConfigArr.forEach((configItem, index) => {
configItem.index = index;
let validater = null;
switch (configItem.hotZoneType) { switch (configItem.hotZoneType) {
// 文字选择题 // 文字选择题
case "0": this.setOptionList(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]); break; case "0":
validater = this.setOptionList(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
this.scoreValidater.push(validater);
break;
// 音频播放按钮 // 音频播放按钮
case "2": this.setOneAudioBtn(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]); break; case "2":
this.setOneAudioBtn(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
break;
// 热区选项 // 热区选项
case "3": this.setHotZoneRadioGroup(configItem); break; case "3":
validater = this.setHotZoneRadioGroup(configItem);
this.scoreValidater.push(validater);
break;
// 文字输入区 // 文字输入区
case "4": this.setTextInput(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]); break; case "4":
validater = this.setTextInput(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
this.scoreValidater.push(validater);
break;
} }
}); });
// 根据分数配置 生成提交和重做按钮
this.data.scoreConfigArr.forEach(scoreConfig => {
scoreConfig.linkHotZoneIndexArr.forEach(scoreItemIndex => {
});
});
// 配置提交按钮
this.setSubmitBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]);
this.setSubmitDisableBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]);
// 配置重新开始按钮
this.setReplayBtn(this.data.hotZoneItemArr[this.data.replayHotZoneIndex]);
// 检查是否可以提交
this.checkCanSubmit();
}; };
// 检查是否可以提交 - 完成全部配置的问题
checkCanSubmit() {
let result = true;
this.scoreValidater.some(validater =>{
if(!validater) {
result = false;
return true;
} else {
// 若果校验结果返回 null 证明校验方法没有被覆写过 可能用户没有进行答题
if(validater() === null) {
result = false;
return true
}
}
})
// 如果可以提交 启用提交按钮
if(result) {
if(this.btnSubmit) {
this.btnSubmit.active = true;
}
if(this.btnSubmitDisable) {
this.btnSubmitDisable.active = false;
}
}
return result;
}
btnSubmit = null;
btnSubmitDisable = null;
btnReplay = null;
// 设置提交按钮
setSubmitBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_submit", hotZoneData);
this.btnSubmit = sprNode;
this.btnSubmit.active = false;
this.btnSubmit.on("click", ()=>{
this.submit();
})
}
setSubmitDisableBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_submit_disable", hotZoneData);
this.btnSubmitDisable = sprNode;
this.btnSubmitDisable.active = true;
this.btnSubmitDisable.on("click", ()=>{
})
}
setReplayBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_replay", hotZoneData);
this.btnReplay = sprNode;
this.btnReplay.active = false;
this.btnReplay.on("click", ()=>{
this.replay();
})
}
// 热区单选组 // 热区单选组
setHotZoneRadioGroup(contentData, debugMode=false) { setHotZoneRadioGroup(contentData, debugMode=false) {
const radioGroup = [];
let currentHighLightRec = null; let currentHighLightRec = null;
// 正确校验方法 - 默认返null
let validater = () => null;
contentData.contentList.forEach((option, index) => { contentData.contentList.forEach((option, index) => {
const hotZoneData = this.data.hotZoneItemArr[option.selectHotZoneIndex]; const hotZoneData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const rect = this.newRectNode(hotZoneData, debugMode); const rect = this.newRectNode(hotZoneData, debugMode);
rect.index = index; rect.index = index;
radioGroup.push(rect);
rect.on("click", ()=>{ rect.on("click", ()=>{
if(currentHighLightRec) { if(currentHighLightRec) {
currentHighLightRec.destroy(); currentHighLightRec.destroy();
currentHighLightRec = null currentHighLightRec = null
} }
currentHighLightRec = this.newMaskRectNode(hotZoneData); currentHighLightRec = this.newMaskRectNode(hotZoneData);
})
});
radioGroup // 覆盖校验方法
const validaterIndex = this.scoreValidater.indexOf(validater)
validater = this.scoreValidater[validaterIndex] = () => {
const result = {
configIndex: contentData.index,
rect: rect,
score: -1
}
if(option.isCorrect) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
} else {
// 错误 返回-1分
return result
}
}
// 检查是否可以提交
this.checkCanSubmit();
})
});
return validater;
} }
// 设置文字输入热区 // 设置文字输入热区
setTextInput(contentData, hotZoneItemData, debugMode=false) { setTextInput(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, debugMode); const rect = this.newRectNode(hotZoneItemData, debugMode);
// 正确校验方法 - 默认返null
let validater = () => null;
rect.on("click", async () => { rect.on("click", async () => {
this.currentInputTarget = rect; this.currentInputTarget = rect;
const optionList = []; const optionList = [];
...@@ -202,18 +320,44 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -202,18 +320,44 @@ export default class SceneComponent extends MyCocosSceneComponent {
return text; return text;
} }
// 覆盖校验方法
const validaterIndex = this.scoreValidater.indexOf(validater)
validater = this.scoreValidater[validaterIndex] = () => {
const result = {
configIndex: contentData.index,
rect: rect,
score: -1
}
if(text == contentData.inputText) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
} else {
// 错误 返回-1分
return result
}
}
// 检查是否可以提交
this.checkCanSubmit();
rect.addChild(inputLabel); rect.addChild(inputLabel);
}) })
return validater
} }
// 设置选项菜单热区 // 设置选项菜单热区
setOptionList(contentData, hotZoneItemData, debugMode=false) { setOptionList(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, debugMode); const rect = this.newRectNode(hotZoneItemData, debugMode);
// 正确校验方法 - 默认返null
let validater = () => null;
rect.on("click", async () => { rect.on("click", async () => {
this.currentInputTarget = rect; this.currentInputTarget = rect;
const optionList = []; const optionList = [];
contentData.contentList.forEach(option => { contentData.contentList.forEach(option => {
optionList.push({ optionList.push({
isCorrect: option.isCorrect ? true : false,
label: option.text, label: option.text,
value: option.text value: option.text
}) })
...@@ -244,14 +388,35 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -244,14 +388,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
return selectData.value; return selectData.value;
} }
// 覆盖校验方法
const validaterIndex = this.scoreValidater.indexOf(validater)
validater = this.scoreValidater[validaterIndex] = () => {
const result = {
configIndex: contentData.index,
rect: rect,
score: -1
}
if(selectData.isCorrect) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
} else {
// 错误 返回-1分
return result
}
}
rect.addChild(inputLabel); rect.addChild(inputLabel);
}) });
// 返回分数校验器
return validater
} }
// 设置音频热区 // 设置音频热区
setOneAudioBtn(contentData, hotZoneItemData) { setOneAudioBtn(contentData, hotZoneItemData) {
const btn = this.newAudioSpr(hotZoneItemData); const {sprNode} = this.newSprNodeByResName("icon_play_audio", hotZoneItemData);
btn.on("click", () => { sprNode.on("click", () => {
playAudioByUrl(contentData.audio_url, () => { playAudioByUrl(contentData.audio_url, () => {
}) })
...@@ -290,15 +455,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -290,15 +455,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
return rectNode return rectNode
} }
// 新建音频节点 使用默认音乐播放按钮 大小不变 只取热区位置 // 新建素材图片节点 - 需要传入素材名和位置大小数据
newAudioSpr(data) { newSprNodeByResName(resName, data) {
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width; const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const picNode = new cc.Node(); const picNode = new cc.Node();
picNode.name= 'pic' + data.index; picNode.name= 'pic' + data.index;
picNode.data = data;
this.hotZoneBg.addChild(picNode); this.hotZoneBg.addChild(picNode);
const sprNode = getSprNode("icon_play_audio"); const sprNode = getSprNode(resName);
sprNode.anchorX = 0; sprNode.anchorX = 0;
sprNode.anchorY = 0; sprNode.anchorY = 0;
...@@ -312,10 +476,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -312,10 +476,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale; picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
picNode.y = 0 - data.rect.height * scale - data.rect.y * scale; picNode.y = 0 - data.rect.height * scale - data.rect.y * scale;
sprNode.addComponent(cc.Button);
picNode.addComponent(cc.Button); picNode.addComponent(cc.Button);
return picNode; return {sprNode, picNode};
}; }
// 新建输入文字节点 // 新建输入文字节点
newInputTextNode(text, styleType) { newInputTextNode(text, styleType) {
...@@ -364,6 +529,67 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -364,6 +529,67 @@ export default class SceneComponent extends MyCocosSceneComponent {
return rectNode return rectNode
} }
// 提交试卷
submit() {
const scoreCconfigArr = [];
this.data.scoreConfigArr.forEach(scoreGroup => {
let item = JSON.parse(JSON.stringify(scoreGroup));
item.score = 0;
scoreCconfigArr.push(item);
});
this.scoreValidater.forEach(validater => {
if(validater) {
let result = validater();
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
if(result.score >= 0) {
// 回答正确
result.rect.addChild(rightIcon)
// 找到对应的组 计算该组得分
scoreCconfigArr.forEach(item=>{
if(item.linkHotZoneIndexArr.indexOf(result.configIndex) != -1) {
item.score += result.score;
}
})
} else {
result.rect.addChild(errIcon)
};
}
})
console.log(scoreCconfigArr);
if(this.btnSubmit) {
this.btnSubmit.active = false;
}
if(this.btnSubmitDisable) {
this.btnSubmitDisable.active = false;
}
if(this.btnReplay) {
this.btnReplay.active = true;
}
}
// 重新玩
async replay() {
this.btnSubmit = null;
this.btnSubmitDisable = null;
this.btnReplay = null;
this.picNodeArr = [];
this.scoreValidater = [];
this.currentInputTarget = null;
this.onSelectedCallback = null;
this.onKeyboardEnterCallback = null;
this.hotZoneBg.children.forEach(child=>{
child.destroy();
})
await this.initHotZoneBg();
this.initHotZoneItem();
}
// 同步方式显示选择模态框 // 同步方式显示选择模态框
asyncShowSelectModal(option) { asyncShowSelectModal(option) {
return new Promise((resovle, reject) => { return new Promise((resovle, reject) => {
......
...@@ -135,172 +135,4 @@ ...@@ -135,172 +135,4 @@
// "typeArr": [] // "typeArr": []
// } // }
export const defaultData = { 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":"4","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"}],"scoreConfigArr":[{"linkHotZoneIndex":7,"linkHotZoneIndexArr":[4,5,1]},{"linkHotZoneIndex":8,"linkHotZoneIndexArr":[2]}],"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/5c84b987ea2291c8d6013fffd39dda32.png","rect":{"x":208.36755646817255,"y":0,"width":1361.264887063655,"height":1916}},"hotZoneItemArr":[{"index":0,"itemType":"rect","itemName":"1-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":505.14,"y":248.57,"width":51.78,"height":51.78}},{"index":1,"itemType":"rect","itemName":"1-1选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":260.6,"y":512.66,"width":46.04,"height":46.04}},{"index":2,"itemType":"rect","itemName":"2-1Alex","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":189.26,"y":659.38,"width":71.35,"height":42.58}},{"index":3,"itemType":"rect","itemName":"2-1Anna","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":269.81,"y":660.52,"width":89.75,"height":40.27}},{"index":4,"itemType":"rect","itemName":"3-1输入文本","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":567.86,"y":1207.14,"width":230.14,"height":44.88}},{"index":5,"itemType":"rect","itemName":"提交按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":768.9,"y":1737.78,"width":172.6,"height":51.78}},{"index":6,"itemType":"rect","itemName":"重做按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":399.37,"y":1740.94,"width":151.9,"height":47.18}},{"index":7,"itemType":"rect","itemName":"1得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":1197.33,"y":249.71,"width":85.15,"height":47.18}},{"index":8,"itemType":"rect","itemName":"2得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":1197.33,"y":598.4,"width":87.45,"height":44.88}},{"index":9,"itemType":"rect","itemName":"1-2选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":457.71,"y":513.38,"width":42.93,"height":42.93}},{"index":10,"itemType":"rect","itemName":"1-3选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.3890625,"imgScale":1,"mapScale":1.3890625,"rect":{"x":648.63,"y":511,"width":50,"height":50}}],"submitHotZoneIndex":5,"replayHotZoneIndex":6}
hotZoneConfigArr: [ \ No newline at end of file
{
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: "4",
inputText: "Hello World",
score: "1",
},
],
scoreConfigArr: [
{ linkHotZoneIndex: 7, linkHotZoneIndexArr: [1] },
{ linkHotZoneIndex: 8, linkHotZoneIndexArr: [2, 3] },
],
bgItem: {
url: "http://staging-teach.cdn.ireadabc.com/5c84b987ea2291c8d6013fffd39dda32.png",
rect: {
x: 178.53182751540032,
y: 0,
width: 1182.9363449691994,
height: 1665,
},
},
hotZoneItemArr: [
{
index: 0,
itemType: "rect",
itemName: "1-音频",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 438.97, y: 216, width: 45, height: 45 },
},
{
index: 1,
itemType: "rect",
itemName: "1-1选项",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 226.47, y: 445.5, width: 40, height: 40 },
},
{
index: 2,
itemType: "rect",
itemName: "2-1Alex",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 164.47, y: 573, width: 62, height: 37 },
},
{
index: 3,
itemType: "rect",
itemName: "2-1Anna",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 234.47, y: 574, width: 78, height: 35 },
},
{
index: 4,
itemType: "rect",
itemName: "3-1输入文本",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 493.47, y: 1049, width: 200, height: 39 },
},
{
index: 5,
itemType: "rect",
itemName: "提交按钮",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 553.47, y: 1511, width: 150, height: 45 },
},
{
index: 6,
itemType: "rect",
itemName: "重做按钮",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 755.47, y: 1512, width: 132, height: 41 },
},
{
index: 7,
itemType: "rect",
itemName: "1得分",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 1040.47, y: 217, width: 74, height: 41 },
},
{
index: 8,
itemType: "rect",
itemName: "2得分",
fontSize: 50,
fontName: "BRLNSR_1",
fontColor: "#8f3758",
fontScale: 1.203125,
imgScale: 1,
mapScale: 1.203125,
rect: { x: 1040.47, y: 520, width: 76, height: 39 },
},
],
submitHotZoneIndex: 5,
replayHotZoneIndex: 6,
};
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<div style="margin: 10px 10px;"> <div style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">包含分数的热区:</span> <span style="display: inline-block; text-align: right; width: 150px;">包含分数的热区:</span>
<nz-select [(ngModel)]="it.linkHotZoneIndexArr" nzMode="multiple" style="width: 300px;" (ngModelChange)="save()"> <nz-select [(ngModel)]="it.linkHotZoneIndexArr" nzMode="multiple" style="width: 300px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOPtion of item.hotZoneItemArr" [nzValue]="itOPtion.index" [nzLabel]="itOPtion.index + 1"></nz-option> <nz-option *ngFor="let itOPtion of item.hotZoneConfigArr; let i=index;" [nzValue]="i" [nzLabel]="i + 1"></nz-option>
</nz-select> </nz-select>
</div> </div>
</div> </div>
......
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