Commit 3bbe743d authored by 黄奎's avatar 黄奎

页面修改

parent a81f4904
......@@ -696,7 +696,7 @@ namespace Edu.Module.Exam
IsMarking=0,
StudentContent=Common.Plugin.JsonHelper.Serialize(sItem.QuestionContentObj)
};
examination_StudentDetailsRepository.Insert(stuDetailsModel);
//examination_StudentDetailsRepository.Insert(stuDetailsModel);
var qObj = new
{
sItem.Id,
......
......@@ -11,13 +11,18 @@ namespace Edu.Module.Question
/// </summary>
public class AnalysisQuestionTypeModule
{
/// <summary>
/// 字母选项数组
/// </summary>
private static string [] LetterArray= new string[26] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
/// <summary>
/// 问题解析
/// </summary>
/// <param name="key">问题Key</param>
/// <param name="data">选项内容</param>
/// <param name="isNoAnswer">是否去掉答案</param>
/// <param name="isOptionRandom">是否选项随机</param>
/// <param name="isOptionRandom">是否选项随机(1-随机选项)</param>
/// <returns></returns>
public object ParsingQuestion(string key, string data,bool isNoAnswer=false,int isOptionRandom=0)
{
......@@ -27,24 +32,108 @@ namespace Edu.Module.Question
//单选题
case "single":
var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
if (isNoAnswer && singleList != null && singleList.Count > 0)
var newList = new List<optionItem>();
singleList.ForEach(item =>
{
item.ShowName = item.Name;
});
//选项随机
if (isOptionRandom == 1)
{
var tempList = singleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
{
var item = new optionItem()
{
Name = tempList[i].Name,
ShowName = tempList[i].ShowName,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = LetterArray[i];
newList.Add(item);
}
}
//去掉答案
if (isNoAnswer)
{
singleList.ForEach(item =>
{
//item.IsAnswer = false;
item.IsAnswer = false;
});
newList.ForEach(item =>
{
item.IsAnswer = false;
});
}
obj = singleList;
if (isOptionRandom == 1)
{
obj = newList;
}
else
{
obj = singleList;
}
break;
//多选题
case "multiple":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var multipleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newMultipleList = new List<optionItem>();
newMultipleList.ForEach(item =>
{
item.ShowName = item.Name;
});
//选项随机
if (isOptionRandom == 1)
{
var tempList = multipleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
{
var item = new optionItem()
{
Name = tempList[i].Name,
ShowName = tempList[i].ShowName,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = LetterArray[i];
newMultipleList.Add(item);
}
}
//去掉答案
if (isNoAnswer)
{
multipleList.ForEach(item =>
{
item.IsAnswer = false;
});
newMultipleList.ForEach(item =>
{
item.IsAnswer = false;
});
}
if (isOptionRandom == 1)
{
obj = newMultipleList;
}
else
{
obj = multipleList;
}
break;
//填空题
case "fill-in":
if (!string.IsNullOrEmpty(data))
{
obj = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(data);
var fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(data);
if (isNoAnswer)
{
fillInList.ForEach(item =>
{
item.Content = "";
});
}
obj = fillInList;
}
else
{
......@@ -53,7 +142,15 @@ namespace Edu.Module.Question
break;
//判断题
case "judge":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var judgeList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
if (isNoAnswer)
{
judgeList.ForEach(item =>
{
item.IsAnswer = false;
});
}
obj = judgeList;
break;
//简答题
case "short-answer":
......@@ -200,6 +297,7 @@ namespace Edu.Module.Question
return obj;
}
/// <summary>
/// 问题验证
/// </summary>
......
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