Commit 15844363 authored by 李维's avatar 李维

添加文字输入题型历史记录显示

parent 81e5273d
......@@ -756,7 +756,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
validater = this.setConnectionPro(configItem, isDebug);
this.scoreValidater.push(validater);
break;
// 文字输入区
// 文字输入区 [做题 - 显示]
case TEXTINPUT:
validater = this.setTextInput(configItem, this.data.hotZoneItemArr[configItem.linkHotZoneIndex], isDebug);
this.scoreValidater.push(validater);
......@@ -855,6 +855,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
case CONNECTION:
this.showConnectionGroup(configItem, resultData);
break;
// 文字输入
case TEXTINPUT:
this.showTextInput(configItem, resultData);
break;
}
})
......@@ -873,7 +877,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.newDecorativeFrame(hotZoneItemData, layer_1, "#FFFFFF", "#6dbef6", debugMode);
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const historyItem = resultData.find(item=>item.contentIndex == index)
const textShow = historyItem.currentSelectIndex ? configItem.selectOptionList[historyItem.currentSelectIndex].text : ""
const textShow = historyItem.currentSelectIndex != undefined && historyItem.currentSelectIndex >= 0 ? configItem.selectOptionList[historyItem.currentSelectIndex].text : ""
const inputLabel = this.newInputTextNode(textShow + "", 0);
inputLabel.x = rect.width / 2;
inputLabel.y = rect.height / 2;
......@@ -1240,6 +1244,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
}
// 文字输入 - 结果展示
showTextInput(configItem, resultData) {
const debugMode = false;
const hotZoneItemData = this.data.hotZoneItemArr[configItem.linkHotZoneIndex];
const resultRect = this.newRectNode(hotZoneItemData, layer_2, debugMode);
this.newDecorativeFrame(hotZoneItemData, layer_1, "#FFFFFF", "#6dbef6", debugMode);
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const inputLabel = this.newInputTextNode(resultData[0].currentInputText ? resultData[0].currentInputText : "", 0);
const labelCom = inputLabel.getComponent(cc.Label);
inputLabel.x = rect.width / 2;
inputLabel.y = rect.height / 2;
inputLabel.width = rect.width;
inputLabel.height = rect.height;
// 文字根据设置是否居左对齐
if(configItem.textAlignLeft) {
labelCom.horizontalAlign = 0;
} else {
labelCom.horizontalAlign = 1;
}
// 超出宽度换行
labelCom.overflow = 3;
rect.addChild(inputLabel);
// 对错号
const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right");
// 图标太大 缩小一半
errIcon.scale = rightIcon.scale = 0.5;
// 显示在热区的中间
errIcon.x = rightIcon.x = resultRect.width / 2;
errIcon.y = rightIcon.y = resultRect.height / 2;
if(resultData[0].right) {
resultRect.addChild(rightIcon);
} else {
resultRect.addChild(errIcon);
}
}
// 初始化分数牌
subScorePanels = [];
totalScorePanel = null;
......
......@@ -975,15 +975,15 @@ export const historyData = {
"contentType": "5",
"configIndex": 0,
"contentIndex": -1,
"currentInputText": "",
"currentInputText": "lay",
"correctText": "lay",
"right": false
"right": true
},
{
"contentType": "5",
"configIndex": 1,
"contentIndex": -1,
"currentInputText": "",
"currentInputText": "ocker",
"correctText": "occer",
"right": false
},
......@@ -1077,28 +1077,28 @@ export const historyData = {
"contentType": "0",
"configIndex": 12,
"contentIndex": 0,
"currentSelectIndex": 0,
"currentSelectText": "can",
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 0,
"correctSelectText": "",
"right": true
"right": false
},
{
"contentType": "0",
"configIndex": 12,
"contentIndex": 1,
"currentSelectIndex": 1,
"currentSelectText": "can't",
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 1,
"correctSelectText": "",
"right": true
"right": false
},
{
"contentType": "0",
"configIndex": 12,
"contentIndex": 2,
"currentSelectIndex": 0,
"currentSelectText": "can",
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 2,
"correctSelectText": "",
"right": false
......@@ -1107,8 +1107,8 @@ export const historyData = {
"contentType": "0",
"configIndex": 12,
"contentIndex": 3,
"currentSelectIndex": 1,
"currentSelectText": "can't",
"currentSelectIndex": null,
"currentSelectText": "",
"correctSelectIndex": 3,
"correctSelectText": "",
"right": false
......@@ -1170,14 +1170,14 @@ export const historyData = {
15,
16
],
"score": 2
"score": 0.5
}
],
"basicScore": 0,
"totalScore": 2,
"totalScore": 0.5,
"isAllRight": false,
"isAllWrong": false,
"startTimestamp": 1689057318710,
"submitTimestamp": 1689058114291,
"answeringTime": 795581
"startTimestamp": 1689061179336,
"submitTimestamp": 1689061205879,
"answeringTime": 26543
}
\ 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