Commit b8c3f0c5 authored by 李维's avatar 李维

添加开放性回答,有内容就算对

parent 1a175f0c
......@@ -1452,9 +1452,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
result.detail.correctText = contentData.inputText;
let right = false;
// 判断是否启用关键词匹配
if(contentData.keyWordMatch) {
// 关键词匹配,只有回答文字中包含全部关键词,就算对
right = this.fuzzyMatchingString(currentInputText, contentData.inputText)
} else if(contentData.openAnswer) {
// 开放型回答 只要有内容就算对
right = currentInputText != ""
} else {
right = currentInputText == contentData.inputText;
}
......@@ -1905,7 +1908,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 判断是否启用关键词匹配
if(contentData.keyWordMatch) {
right = this.fuzzyMatchingString(recordText, evaText)
} else {
} else if(contentData.openAnswer) {
// 开放型回答 只要有内容就算对
right = recordText != ""
}else {
right = recordText == evaText;
}
......@@ -2365,9 +2371,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
fuzzyMatchingString(testString, matchString){
matchString.replace(/,/g,",");
const keyWords = matchString.split(",")
keyWords.forEach(item => {
item.trim();
const _keyWords = matchString.split(",")
const keyWords = _keyWords.map(item => {
return item.trim();
});
const result = keyWords.find(key=>testString.toLocaleLowerCase().indexOf(key.toLocaleLowerCase()) == -1)
......
This diff is collapsed.
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