Commit 52cca651 authored by 李维's avatar 李维

添加多选组

parent 7442388e
......@@ -195,7 +195,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "77yjWGUj9L9JQjaUmQfZkb",
"sync": false
......@@ -450,7 +450,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "b5NruuQ2FMSa9QQ8+ggECe",
"sync": false
......@@ -628,7 +628,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "c78utlbbBBIbF5yJGy3tEH",
"sync": false
......@@ -734,7 +734,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "64m9RZa4lCJIliv6Qy8ur/",
"sync": false
......@@ -806,7 +806,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "c2OYwxDYFNA4nfuyx+ZyKN",
"sync": false
......@@ -1120,7 +1120,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "71B7P00TRJhZTUdd+0GJM2",
"sync": false
......@@ -1230,7 +1230,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "79+0xTFFdMNbMPbs5f2wKl",
"sync": false
......@@ -1335,7 +1335,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "1ayqMQF8pPIJsypD+Tj9hX",
"sync": false
......@@ -1414,7 +1414,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "43M0qAOatLAqpcP/cXI99s",
"sync": false
......@@ -1486,7 +1486,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "a90SuvXyRNvZtZvMzm8tpA",
"sync": false
......@@ -1497,7 +1497,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "6cmpk1VftCWKqsECTkvrhc",
"sync": false
......@@ -1540,7 +1540,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "8eZucYzN9MZr8kudP4es30",
"sync": false
......@@ -1565,7 +1565,7 @@
"__id__": 1
},
"asset": {
"__id__": 0
"__uuid__": "5df55558-61c8-45bd-8838-81235266b1bb"
},
"fileId": "",
"sync": false
......
......@@ -93,13 +93,13 @@
"_active": true,
"_components": [
{
"__id__": 634
"__id__": 638
},
{
"__id__": 635
"__id__": 639
},
{
"__id__": 636
"__id__": 640
}
],
"_prefab": null,
......@@ -22869,7 +22869,7 @@
"__id__": 616
},
{
"__id__": 631
"__id__": 635
}
],
"_active": false,
......@@ -23105,6 +23105,12 @@
},
{
"__id__": 629
},
{
"__id__": 631
},
{
"__id__": 633
}
],
"_active": true,
......@@ -23787,6 +23793,186 @@
"_atlas": null,
"_id": "f4EIsoWE9P6aWTCYU7/FMu"
},
{
"__type__": "cc.Node",
"_name": "icon_wrong",
"_objFlags": 0,
"_parent": {
"__id__": 616
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 632
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 45
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_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": "39N3KgYa9G/KoO4/lUgqtm"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 631
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "934d254b-29c9-4987-a09b-314198835887"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "d6I4WPSptOLqUb0kY8Syte"
},
{
"__type__": "cc.Node",
"_name": "icon_right",
"_objFlags": 0,
"_parent": {
"__id__": 616
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 634
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 54,
"height": 49
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_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": "4biCQ3VDhFQ6kO4s9/kAAj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 633
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "1ba51e0d-5386-4dc8-b837-9984da6987e7"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "7brjZGrclPOL8ddRVffni9"
},
{
"__type__": "cc.Node",
"_name": "audio",
......@@ -23796,7 +23982,7 @@
},
"_children": [
{
"__id__": 632
"__id__": 636
}
],
"_active": true,
......@@ -23854,13 +24040,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 631
"__id__": 635
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 633
"__id__": 637
}
],
"_prefab": null,
......@@ -23916,7 +24102,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 632
"__id__": 636
},
"_enabled": true,
"_clip": {
......
......@@ -143,6 +143,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
scoreValidater = [];
initHotZoneItem() {
this.picNodeArr = [];
const isDebug = this.data.isDebug?true:false;
// 根据内容配置 生成需要显示的热区
this.data.hotZoneConfigArr.forEach((configItem, index) => {
configItem.index = index;
......@@ -150,21 +151,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
switch (configItem.hotZoneType) {
// 文字选择题
case "0":
validater = this.setOptionList(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
validater = this.setOptionList(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex], isDebug);
this.scoreValidater.push(validater);
break;
// 音频播放按钮
case "2":
this.setOneAudioBtn(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
break;
// 热区选项
// 热区选项(单选)
case "3":
validater = this.setHotZoneRadioGroup(configItem);
validater = this.setHotZoneRadioGroup(configItem, isDebug);
this.scoreValidater.push(validater);
break;
// 文字输入区
case "4":
validater = this.setTextInput(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex]);
validater = this.setHotZoneCheckboxGroup(configItem, isDebug);
this.scoreValidater.push(validater);
break;
// 文字输入区
case "5":
validater = this.setTextInput(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex], isDebug);
this.scoreValidater.push(validater);
break;
}
......@@ -221,16 +226,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
btnReplay = null;
// 设置提交按钮
setSubmitBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_submit", hotZoneData);
const {sprNode} = this.newSprNodeByResName(hotZoneData, "btn_submit");
this.btnSubmit = sprNode;
this.btnSubmit.active = false;
this.btnSubmit.on("click", ()=>{
if(this.submitted) {
return;
}
this.submit();
})
}
setSubmitDisableBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_submit_disable", hotZoneData);
const {sprNode} = this.newSprNodeByResName(hotZoneData, "btn_submit_disable");
this.btnSubmitDisable = sprNode;
this.btnSubmitDisable.active = true;
this.btnSubmitDisable.on("click", ()=>{
......@@ -239,7 +247,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
setReplayBtn(hotZoneData) {
const {sprNode} = this.newSprNodeByResName("btn_replay", hotZoneData);
const {sprNode} = this.newSprNodeByResName(hotZoneData, "btn_replay");
this.btnReplay = sprNode;
this.btnReplay.active = false;
this.btnReplay.on("click", ()=>{
......@@ -257,6 +265,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
const rect = this.newRectNode(hotZoneData, debugMode);
rect.index = index;
rect.on("click", ()=>{
if(this.submitted) {
return;
}
if(currentHighLightRec) {
currentHighLightRec.destroy();
currentHighLightRec = null
......@@ -274,10 +285,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(option.isCorrect) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
return [result]
} else {
// 错误 返回-1分
return result
return [result]
}
}
......@@ -288,12 +299,82 @@ export default class SceneComponent extends MyCocosSceneComponent {
return validater;
}
// 热区多选组
setHotZoneCheckboxGroup(contentData, debugMode=false) {
let currentCheckList = [];
// 正确校验方法 - 默认返null
let validater = () => {
if(currentCheckList.length != contentData.contentList.length) {
// 数组长度不匹配 - 还没有初始化 跳过
return null;
}
const results = [];
contentData.contentList.forEach((option, index) => {
const result = {
configIndex: contentData.index,
rect: currentCheckList[index].rect,
score: -1
}
if(option.isCheck == currentCheckList[index].checked) {
// 正确 返回分数
result.score = option.score && !isNaN(Number(option.score)) ? Number(option.score) : 2;
results.push(result);
} else {
// 错误 返回-1分
results.push(result);
}
});
return results;
};
contentData.contentList.forEach((option, index) => {
const hotZoneData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const rect = this.newRectNode(hotZoneData, debugMode);
currentCheckList.push({
checked: false,
rect: rect,
mask: null
});
rect.index = index;
rect.on("click", ()=>{
if(this.submitted) {
return;
}
if(currentCheckList[index].checked) {
currentCheckList[index].checked = false;
currentCheckList[index].mask.destroy();
currentCheckList[index].mask = null
} else {
// picNode 是 sprNode 的父节点,点击事件需要加载sprNode上面,销毁时,需要销毁父节点 - 否则当用户第二次点击时。会无法点击
const {sprNode, picNode} = this.newSprNodeByResName(hotZoneData, "icon_right", true);
currentCheckList[index].mask = picNode;
currentCheckList[index].checked = true;
sprNode.on("click", ()=>{
currentCheckList[index].checked = false;
currentCheckList[index].mask.destroy();
currentCheckList[index].mask = null
})
}
// 检查是否可以提交
this.checkCanSubmit();
})
});
return validater;
}
// 设置文字输入热区
setTextInput(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, debugMode);
// 正确校验方法 - 默认返null
let validater = () => null;
rect.on("click", async () => {
if(this.submitted) {
return;
}
this.currentInputTarget = rect;
const optionList = [];
contentData.contentList.forEach(option => {
......@@ -331,10 +412,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(text == contentData.inputText) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
return [result]
} else {
// 错误 返回-1分
return result
return [result]
}
}
......@@ -353,6 +434,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 正确校验方法 - 默认返null
let validater = () => null;
rect.on("click", async () => {
if(this.submitted) {
return;
}
this.currentInputTarget = rect;
const optionList = [];
contentData.contentList.forEach(option => {
......@@ -399,10 +483,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(selectData.isCorrect) {
// 正确 返回分数
result.score = contentData.score && !isNaN(Number(contentData.score)) ? Number(contentData.score) : 0;
return result
return [result]
} else {
// 错误 返回-1分
return result
return [result]
}
}
......@@ -415,8 +499,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 设置音频热区
setOneAudioBtn(contentData, hotZoneItemData) {
const {sprNode} = this.newSprNodeByResName("icon_play_audio", hotZoneItemData);
const {sprNode} = this.newSprNodeByResName(hotZoneItemData, "icon_play_audio");
sprNode.on("click", () => {
if(this.submitted) {
return;
}
playAudioByUrl(contentData.audio_url, () => {
})
......@@ -456,7 +543,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 新建素材图片节点 - 需要传入素材名和位置大小数据
newSprNodeByResName(resName, data) {
newSprNodeByResName(data, resName, fitHotZoneSize = false) {
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const picNode = new cc.Node();
picNode.name= 'pic' + data.index;
......@@ -476,6 +563,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
picNode.y = 0 - data.rect.height * scale - data.rect.y * scale;
// 图片填充热区大小
if(fitHotZoneSize) {
sprNode.width = picNode.width;
sprNode.height = picNode.height;
}
sprNode.addComponent(cc.Button);
picNode.addComponent(cc.Button);
......@@ -530,6 +623,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 提交试卷
submitted = false;
submit() {
const scoreCconfigArr = [];
this.data.scoreConfigArr.forEach(scoreGroup => {
......@@ -540,7 +634,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scoreValidater.forEach(validater => {
if(validater) {
let result = validater();
// 返回一个校验集合
let results= validater();
results.forEach(result => {
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
if(result.score >= 0) {
......@@ -555,11 +651,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
result.rect.addChild(errIcon)
};
});
}
})
console.log(scoreCconfigArr);
// 标记已经提交 禁止页面事件
this.submitted = true;
if(this.btnSubmit) {
this.btnSubmit.active = false;
}
......@@ -581,6 +679,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.currentInputTarget = null;
this.onSelectedCallback = null;
this.onKeyboardEnterCallback = null;
this.submitted = false;
this.hotZoneBg.children.forEach(child=>{
child.destroy();
......
......@@ -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":"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}
\ 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":"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
{
"ver": "2.3.5",
"uuid": "3a1f81f0-1a93-48a3-91d5-10f6e3cb2110",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 70,
"platformSettings": {},
"subMetas": {
"icon_right": {
"ver": "1.0.4",
"uuid": "1ba51e0d-5386-4dc8-b837-9984da6987e7",
"rawTextureUuid": "3a1f81f0-1a93-48a3-91d5-10f6e3cb2110",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 8,
"trimY": 10,
"width": 54,
"height": 49,
"rawWidth": 70,
"rawHeight": 70,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "bdee5803-b78d-42d3-8a66-fe73039a89b1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 70,
"platformSettings": {},
"subMetas": {
"icon_wrong": {
"ver": "1.0.4",
"uuid": "934d254b-29c9-4987-a09b-314198835887",
"rawTextureUuid": "bdee5803-b78d-42d3-8a66-fe73039a89b1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": -2.5,
"trimX": 17,
"trimY": 15,
"width": 40,
"height": 45,
"rawWidth": 70,
"rawHeight": 70,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -17,15 +17,16 @@
<span style="position: absolute; right: 50px; top: 0px; font-size: 42px; font-weight: bold;">{{i + 1}}</span>
<div style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">热区内容:</span>
<nz-select [(ngModel)]="it.hotZoneType" style="width: 100px;" (ngModelChange)="save()">
<nz-select [(ngModel)]="it.hotZoneType" style="width: 200px;" (ngModelChange)="save()">
<nz-option nzValue="0" nzLabel="文字选项"></nz-option>
<nz-option nzValue="1" nzLabel="图片选项"></nz-option>
<nz-option nzValue="1" nzLabel="图片选项" nzDisabled></nz-option>
<nz-option nzValue="2" nzLabel="播放音频"></nz-option>
<nz-option nzValue="3" nzLabel="热区选项"></nz-option>
<nz-option nzValue="4" nzLabel="文字输入"></nz-option>
<nz-option nzValue="5" nzLabel="语音评测" nzDisabled></nz-option>
<nz-option nzValue="3" nzLabel="热区选项(单选)"></nz-option>
<nz-option nzValue="4" nzLabel="热区选项(多选)"></nz-option>
<nz-option nzValue="5" nzLabel="文字输入"></nz-option>
<nz-option nzValue="6" nzLabel="语音评测" nzDisabled></nz-option>
</nz-select>
<div *ngIf="it.hotZoneType == '0' || it.hotZoneType == '1' || it.hotZoneType == '3'" style="padding: 10px 0 10px 100px;">
<div *ngIf="it.hotZoneType == '0' || it.hotZoneType == '1' || it.hotZoneType == '3' || it.hotZoneType == '4'" style="padding: 10px 0 10px 100px;">
<div style="margin-bottom: 16px;">
<span style="font-size: 14px; color: #000000d9;">内容清单</span>
<button nz-button nzSize="small" nzType="primary" style="float: right;" (click)="addHotZoneConfigItem(it)">
......@@ -38,9 +39,10 @@
<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 == '0'">文字</th>
<th *ngIf="it.hotZoneType == '1'">图片</th>
<th *ngIf="it.hotZoneType == '3'">热区索引</th>
<th *ngIf="it.hotZoneType == '3' || it.hotZoneType == '4'">热区索引</th>
<th nzWidth="10%">操作</th>
</tr>
</thead>
......@@ -48,13 +50,15 @@
<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 nzWidth="200px" nzAlign="center">{{ data.isCorrect?'正确':'错误' }}</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 == '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;"/>
<span *ngIf="!data.image_url">暂无图片</span>
</td>
<td *ngIf="it.hotZoneType == '3'">
<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%">
......@@ -65,9 +69,15 @@
</ng-container>
<ng-template #editTemplate>
<td nzWidth="100px" nzAlign="center">{{ i + 1 }}</td>
<td nzWidth="200px" nzAlign="center">
<td *ngIf="it.hotZoneType == '3'" nzWidth="200px" nzAlign="center">
<label nz-checkbox [(ngModel)]="editCache[i].data.isCorrect"></label>
</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px" nzAlign="center">
<label nz-checkbox [(ngModel)]="editCache[i].data.isCheck"></label>
</td>
<td *ngIf="it.hotZoneType == '4'" nzWidth="200px">
<input type="text" nz-input [(ngModel)]="editCache[i].data.score" />
</td>
<td *ngIf="it.hotZoneType == '0'">
<input type="text" nz-input [(ngModel)]="editCache[i].data.text" />
</td>
......@@ -79,8 +89,8 @@
</app-upload-image-with-preview>
</div>
</td>
<td *ngIf="it.hotZoneType == '3'">
<nz-select [(ngModel)]="data.selectHotZoneIndex" style="width: 50px;" (ngModelChange)="save()">
<td *ngIf="it.hotZoneType == '3' || it.hotZoneType == '4'">
<nz-select [(ngModel)]="data.selectHotZoneIndex" style="width: 100px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOption of item.hotZoneItemArr" [nzValue]="itOption.index" [nzLabel]="itOption.index + 1"></nz-option>
</nz-select>
<span style="margin-left: 10px;">热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[data.selectHotZoneIndex] ? item.hotZoneItemArr[data.selectHotZoneIndex].itemName : "未配置"}}</span>
......@@ -102,21 +112,22 @@
></app-audio-recorder>
</div>
</div>
<div *ngIf="it.hotZoneType == '4'" style="margin: 10px 10px;">
<div *ngIf="it.hotZoneType == '5'" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">正确文字:</span>
<input type="text" nz-input [(ngModel)]="it.inputText" (blur)="save" style="display: inline-block; width: 300px;">
</div>
<div *ngIf="it.hotZoneType != '3'" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">关联热区:</span>
<nz-select [(ngModel)]="it.linkHotZoneIndex" style="width: 50px;" (ngModelChange)="save()">
<nz-select [(ngModel)]="it.linkHotZoneIndex" style="width: 100px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOption of item.hotZoneItemArr" [nzValue]="itOption.index" [nzLabel]="itOption.index + 1"></nz-option>
</nz-select>
<span style="margin-left: 10px;">热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[it.linkHotZoneIndex] ? item.hotZoneItemArr[it.linkHotZoneIndex].itemName : "未配置"}}</span>
</div>
<div style="margin: 10px 10px;">
<div *ngIf="it.hotZoneType != '4'" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">分数:</span>
<input type="text" nz-input [(ngModel)]="it.score" (blur)="save" style="display: inline-block; width: 150px;">
</div>
<button nz-button nzType="danger" nzDanger nz-popconfirm nzPopconfirmTitle="删除后不可恢复,确定删除吗?" nzPopconfirmPlacement="bottom" (nzOnConfirm)="deleteHotZoneConfig(i)" style="position: absolute; right: 10px; bottom: 10px;">删除</button>
</div>
<button nz-button nzType="dashed" (click)="addHotZoneConfig()" class="add-btn">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
......@@ -126,31 +137,32 @@
<h2 style="margin-top: 10px;">分数配置:</h2>
<div style="font-size: 16px; border: 2px solid #ccc; border-radius: 10px; padding: 10px;">
<div *ngFor="let it of item.scoreConfigArr; let i = index" style="border: 2px dashed #ddd; border-radius: 5px; padding: 10px; margin-bottom: 10px;">
<div *ngFor="let it of item.scoreConfigArr; let i = index" style="border: 2px dashed #ddd; border-radius: 5px; padding: 10px; margin-bottom: 10px; position: relative;">
<div style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">分数显示热区:</span>
<nz-select [(ngModel)]="it.linkHotZoneIndex" style="width: 50px;" (ngModelChange)="save()">
<span style="display: inline-block; text-align: right; width: 200px;">分数显示热区:</span>
<nz-select [(ngModel)]="it.linkHotZoneIndex" style="width: 100px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOPtion of item.hotZoneItemArr" [nzValue]="itOPtion.index" [nzLabel]="itOPtion.index + 1"></nz-option>
</nz-select>
<span style="margin-left: 10px;">热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[it.linkHotZoneIndex] ? item.hotZoneItemArr[it.linkHotZoneIndex].itemName : "未配置"}}</span>
</div>
<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: 200px;">包含的题目内容(序号)</span>
<nz-select [(ngModel)]="it.linkHotZoneIndexArr" nzMode="multiple" style="width: 300px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOPtion of item.hotZoneConfigArr; let i=index;" [nzValue]="i" [nzLabel]="i + 1"></nz-option>
</nz-select>
</div>
<button nz-button nzType="danger" nzDanger nz-popconfirm nzPopconfirmTitle="删除后不可恢复,确定删除吗?" nzPopconfirmPlacement="bottom" (nzOnConfirm)="deleteScoreConfig(i)" style="position: absolute; right: 10px; bottom: 10px;">删除</button>
</div>
<div style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">提交按钮:</span>
<nz-select [(ngModel)]="item.submitHotZoneIndex" style="width: 50px;" (ngModelChange)="save()">
<nz-select [(ngModel)]="item.submitHotZoneIndex" style="width: 100px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOPtion of item.hotZoneItemArr" [nzValue]="itOPtion.index" [nzLabel]="itOPtion.index + 1"></nz-option>
</nz-select>
<span style="margin-left: 10px;">热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[item.submitHotZoneIndex] ? item.hotZoneItemArr[item.submitHotZoneIndex].itemName : "未配置"}}</span>
</div>
<div style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 100px;">重做按钮:</span>
<nz-select [(ngModel)]="item.replayHotZoneIndex" style="width: 50px;" (ngModelChange)="save()">
<nz-select [(ngModel)]="item.replayHotZoneIndex" style="width: 100px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOPtion of item.hotZoneItemArr" [nzValue]="itOPtion.index" [nzLabel]="itOPtion.index + 1"></nz-option>
</nz-select>
<span style="margin-left: 10px;">热区名:{{item.hotZoneItemArr && item.hotZoneItemArr[item.replayHotZoneIndex] ? item.hotZoneItemArr[item.replayHotZoneIndex].itemName : "未配置"}}</span>
......
......@@ -47,11 +47,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
}
saveHotZone(group, e) {
console.log('e: ', e);
const {bgItem, hotZoneItemArr} = e;
group.bgItem = bgItem;
group.hotZoneItemArr = hotZoneItemArr;
this.save();
this.nzMessageService.success('热区数据已保存');
}
// 添加热区配置
......@@ -60,20 +60,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.hotZoneConfigArr = [];
}
this.item.hotZoneConfigArr.push({
linkHotZoneIndex: 1,
linkHotZoneIndex: -1,
contentList: [
{
index: 0,
text: "item-1"
}
]
})
this.save()
}
// 添加热区配置
deleteHotZoneConfig(index) {
if(!this.item.hotZoneConfigArr) {
this.item.hotZoneConfigArr = [];
return
}
this.item.hotZoneConfigArr.splice(index,1)
this.save()
}
// 添加热区内容配置
addHotZoneConfigItem(it) {
console.log(it.contentList)
if(!it.contentList) {
it.contentList = [];
}
......@@ -110,7 +117,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
text: "",
image_url: "",
hotZoneIndex: null,
score: 0
score: 0,
isCorrect: false,
isCheck: false
}
}
......@@ -148,11 +157,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.item.scoreConfigArr = [];
}
this.item.scoreConfigArr.push({
linkHotZoneIndex: 1
linkHotZoneIndex: -1
})
this.save()
}
// 删除分数组
deleteScoreConfig(index) {
if(!this.item.scoreConfigArr) {
this.item.scoreConfigArr = [];
return;
}
this.item.scoreConfigArr.splice(index, 1);
this.save()
}
// 复制数据
copyChangeData() {
const jsonData = this.item;
......@@ -203,7 +222,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
}
onVideoUploadSuccess(e, item=null) {
console.log(' in onVideoUploadSuccess')
if (!item) {
item = this.item;
}
......@@ -217,7 +235,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
save() {
(<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh();
console.log('this.item = ' + JSON.stringify(this.item));
console.log(this.item)
}
/**
......
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