Commit 145fcce6 authored by 李维's avatar 李维

添加连线PRO历史记录展示

parent e6aebe0f
...@@ -855,6 +855,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -855,6 +855,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
case CONNECTION: case CONNECTION:
this.showConnectionGroup(configItem, resultData); this.showConnectionGroup(configItem, resultData);
break; break;
// 连线PRO
case CONNECTION_PRO:
this.showConnectionPro(configItem, resultData);
break;
// 文字输入 // 文字输入
case TEXTINPUT: case TEXTINPUT:
this.showTextInput(configItem, resultData); this.showTextInput(configItem, resultData);
...@@ -1041,6 +1045,98 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -1041,6 +1045,98 @@ export default class SceneComponent extends MyCocosSceneComponent {
}); });
} }
// 连线PRO - 历史记录
showConnectionPro(configItem, resultData) {
const debugMode = false;
const resultIconShowData = this.data.hotZoneItemArr[configItem.linkResultShowHotZoneIndex];
const resultIconRect = this.newRectNode(resultIconShowData, layer_2, debugMode);
let allRight = true;
resultData[0].results.forEach(item => {
if(item.right == false) {
allRight = false
}
});
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
// 图标太大 缩小一半
errIcon.scale = rightIcon.scale = 0.5;
// 显示在热区的中间
errIcon.x = rightIcon.x = resultIconRect.width / 2;
errIcon.y = rightIcon.y = resultIconRect.height / 2;
if(allRight) {
resultIconRect.addChild(rightIcon);
} else {
resultIconRect.addChild(errIcon);
}
// 连线点都显示出来
const startRects = [];
const endRects = [];
configItem.connectionPRO_startArr.forEach(startIndex => {
if(startIndex >= 0 && this.data.hotZoneItemArr[startIndex]) {
const iconStart = this.getSprNode("icon_connect_start");
const startHotZoneData = this.data.hotZoneItemArr[startIndex];
const startRect = this.newRectNode(startHotZoneData, layer_4, debugMode);
startRect.hotZoneIndex = startIndex;
iconStart.zIndex = layer_2;
iconStart.x = startRect.width / 2;
iconStart.y = startRect.height / 2;
startRect.addChild(iconStart);
startRects.push(startRect)
} else {
startRects.push(null)
}
});
configItem.connectionPRO_endArr.forEach(endIndex => {
if(endIndex >= 0 && this.data.hotZoneItemArr[endIndex]) {
const endHotZoneData = this.data.hotZoneItemArr[endIndex];
const endRect = this.newRectNode(endHotZoneData, layer_5, debugMode);
endRect.hotZoneIndex = endIndex;
const iconEnd = this.getSprNode("icon_connect_end");
iconEnd.zIndex = layer_2;
iconEnd.x = endRect.width / 2;
iconEnd.y = endRect.height / 2;
endRect.addChild(iconEnd);
endRects.push(endRect)
} else {
endRects.push(null)
}
});
// 根据用户结果还原显示
resultData[0].results.forEach((resData, index) => {
if(resData.correctStartIndex < 0 || resData.correctEndIndex < 0) {
return
}
const startRect = startRects.find(item=>item.hotZoneIndex == resData.correctStartIndex)
const endRect = endRects.find(item=>item.hotZoneIndex == resData.correctEndIndex)
if(!startRect || !endRect) {
return
}
const lineNode = new cc.Node();
lineNode.name = 'connect1_' + index;
startRect.addChild(lineNode)
const ctx = lineNode.addComponent(cc.Graphics);
ctx.lineWidth = 4;
const localPos = lineNode.parent.convertToNodeSpaceAR(endRect.parent.convertToWorldSpaceAR(cc.v2(endRect.x + endRect.width / 2, endRect.y + endRect.height / 2)));
// 清除上一次的痕迹
ctx.clear()
// 移动到当前开始节点的中心开始画线
ctx.moveTo(startRect.width / 2, startRect.height / 2);
// 终点坐标在上面已经计算好了 这里使用
ctx.lineTo(localPos.x, localPos.y);
// 画线
ctx.stroke();
})
}
// 判断对错 - 历史记录 // 判断对错 - 历史记录
showRightOrWrongGroup(configItem, resultData) { showRightOrWrongGroup(configItem, resultData) {
const debugMode = false; const debugMode = false;
......
This diff is collapsed.
...@@ -1046,9 +1046,12 @@ export const historyData = { ...@@ -1046,9 +1046,12 @@ export const historyData = {
"index": 13 "index": 13
}, },
{ {
"hotZoneType": "11", "hotZoneType": "18",
"linkHotZoneIndex": 33, "linkHotZoneIndex": 33,
"connectionPRO_startArr": [], "connectionPRO_startArr": [
32,
33
],
"connectionPRO_endtArr": [], "connectionPRO_endtArr": [],
"audio_url": "", "audio_url": "",
"video_url": "", "video_url": "",
...@@ -1079,8 +1082,8 @@ export const historyData = { ...@@ -1079,8 +1082,8 @@ export const historyData = {
"isCorrect": false, "isCorrect": false,
"isCheck": false, "isCheck": false,
"linkedShowText": "A", "linkedShowText": "A",
"selectStartHotZoneIndex": null, "selectStartHotZoneIndex": 32,
"selectEndHotZoneIndex": null, "selectEndHotZoneIndex": 34,
"selectEndHotZoneShowIndex": null, "selectEndHotZoneShowIndex": null,
"selectStartHotZoneIndex_1": null, "selectStartHotZoneIndex_1": null,
"selectEndHotZoneIndex_1": null, "selectEndHotZoneIndex_1": null,
...@@ -1112,8 +1115,8 @@ export const historyData = { ...@@ -1112,8 +1115,8 @@ export const historyData = {
"isCorrect": true, "isCorrect": true,
"isCheck": false, "isCheck": false,
"linkedShowText": "B", "linkedShowText": "B",
"selectStartHotZoneIndex": null, "selectStartHotZoneIndex": 33,
"selectEndHotZoneIndex": null, "selectEndHotZoneIndex": 35,
"selectEndHotZoneShowIndex": null, "selectEndHotZoneShowIndex": null,
"selectStartHotZoneIndex_1": null, "selectStartHotZoneIndex_1": null,
"selectEndHotZoneIndex_1": null, "selectEndHotZoneIndex_1": null,
...@@ -1145,8 +1148,8 @@ export const historyData = { ...@@ -1145,8 +1148,8 @@ export const historyData = {
"isCorrect": false, "isCorrect": false,
"isCheck": false, "isCheck": false,
"linkedShowText": "C", "linkedShowText": "C",
"selectStartHotZoneIndex": null, "selectStartHotZoneIndex": 32,
"selectEndHotZoneIndex": null, "selectEndHotZoneIndex": 36,
"selectEndHotZoneShowIndex": null, "selectEndHotZoneShowIndex": null,
"selectStartHotZoneIndex_1": null, "selectStartHotZoneIndex_1": null,
"selectEndHotZoneIndex_1": null, "selectEndHotZoneIndex_1": null,
...@@ -1167,8 +1170,13 @@ export const historyData = { ...@@ -1167,8 +1170,13 @@ export const historyData = {
"selectHotZoneIndex": 36 "selectHotZoneIndex": 36
} }
], ],
"linkResultShowHotZoneIndex": 32, "linkResultShowHotZoneIndex": 37,
"linkHotZoneShowIndex": 37, "linkHotZoneShowIndex": 37,
"connectionPRO_endArr": [
34,
35,
36
],
"index": 14 "index": 14
} }
], ],
...@@ -1198,7 +1206,7 @@ export const historyData = { ...@@ -1198,7 +1206,7 @@ export const historyData = {
], ],
"ratingSystem": "0", "ratingSystem": "0",
"basicScore": "", "basicScore": "",
"lastModify": "2023-07-12T08:26:37.427Z" "lastModify": "2023-07-12T09:19:34.322Z"
}, },
"details": [ "details": [
{ {
...@@ -1378,16 +1386,44 @@ export const historyData = { ...@@ -1378,16 +1386,44 @@ export const historyData = {
] ]
}, },
{ {
"contentType": "11", "contentType": "18",
"configIndex": 14, "configIndex": 14,
"contentIndex": -1, "contentIndex": -1,
"result": { "results": [
"correctEndIndex": -1, {
"correctEndText": "", "startIndex": 0,
"currentEndIndex": 1, "startText": "",
"currentEndText": "B", "correctStartIndex": 32,
"right": true "correctEndIndex": 34,
} "correctEndText": "",
"currentStartIndex": null,
"currentEndIndex": null,
"currentEndText": "",
"right": true
},
{
"startIndex": 1,
"startText": "",
"correctStartIndex": 33,
"correctEndIndex": 35,
"correctEndText": "",
"currentStartIndex": null,
"currentEndIndex": null,
"currentEndText": "",
"right": true
},
{
"startIndex": 2,
"startText": "",
"correctStartIndex": 32,
"correctEndIndex": 36,
"correctEndText": "",
"currentStartIndex": null,
"currentEndIndex": null,
"currentEndText": "",
"right": true
}
]
} }
], ],
"scoreCconfigArr": [ "scoreCconfigArr": [
...@@ -1419,7 +1455,7 @@ export const historyData = { ...@@ -1419,7 +1455,7 @@ export const historyData = {
"totalScore": 0, "totalScore": 0,
"isAllRight": false, "isAllRight": false,
"isAllWrong": false, "isAllWrong": false,
"startTimestamp": 1689151973011, "startTimestamp": 1689153616958,
"submitTimestamp": 1689151981570, "submitTimestamp": 1689153631321,
"answeringTime": 8559 "answeringTime": 14363
} }
\ No newline at end of file
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