Commit d216690f authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents bc5dbf09 32469985
......@@ -73,6 +73,12 @@ namespace Edu.Model.ViewModel.Question
/// <summary>
/// 大类名称
/// </summary>
public string CategoryName { get; set; }
public string CategoryName
{
get
{
return Common.Plugin.EnumHelper.ToName(this.Category);
}
}
}
}
\ No newline at end of file
......@@ -99,7 +99,7 @@ namespace Edu.WebApi.Controllers.Course
item.CreateByName,
item.CreateTimeStr,
item.DifficultyType,
CategoryName = item.Category.ToName(),
item.CategoryName,
DifficultyTypeName = item.DifficultyType.ToName(),
}); ;
}
......@@ -197,6 +197,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.Failed(message: shortMessage);
}
extModel.QuestionContent = "";
}
//名词解释
else if (extModel.QuestionTypeKey == "noun-explanation")
......@@ -205,6 +206,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.Failed(message: "请填写名词解释答案!");
}
extModel.QuestionContent = "";
}
//论述题
else if (extModel.QuestionTypeKey == "essay-question")
......@@ -213,6 +215,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.Failed(message: "请填写论述题答案!");
}
extModel.QuestionContent = "";
}
//计算题
else if (extModel.QuestionTypeKey == "calculation")
......@@ -221,6 +224,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.Failed(message: "请填写计算题答案!");
}
extModel.QuestionContent = "";
}
//分录题、资料题
else if (extModel.QuestionTypeKey == "entry-problem" || extModel.QuestionTypeKey == "data-question")
......@@ -260,13 +264,34 @@ namespace Edu.WebApi.Controllers.Course
var matchList = Common.Plugin.JsonHelper.DeserializeObject<List<List<matchingItem>>>(extModel.QuestionContent);
if (matchList != null && matchList.Count > 0)
{
if (matchList[0].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
if (matchList[0] != null && matchList[0].Count > 0)
{
return ApiResult.Failed(message: "第一组选项内容不能为空!");
if (matchList[0].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{
return ApiResult.Failed(message: "第一组选项内容不能为空!");
}
}
else
{
return ApiResult.Failed(message: "请添加第一组选项!");
}
if (matchList.Count > 1 && matchList[1] != null && matchList[1].Count > 0)
{
if (matchList[1].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{
return ApiResult.Failed(message: "第二组选项内容不能为空!");
}
}
if (matchList[1].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
else
{
return ApiResult.Failed(message: "第二组选项内容不能为空!");
return ApiResult.Failed(message: "请添加第二组选项!");
}
if (matchList.Count > 2)
{
if (matchList[2].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{
return ApiResult.Failed(message: "请设置答案!");
}
}
}
else
......@@ -780,6 +805,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList.Add(singleModel);
}
string f_answer = "";
foreach (var fItem in fillInList)
{
f_answer += "★" + fItem.Content;
}
if (!string.IsNullOrEmpty(f_answer))
{
f_answer = f_answer.Substring(1);
}
model.Answer = f_answer;
model.QuestionContent = Common.Plugin.JsonHelper.Serialize(fillInList);
}
if (model.QuestionTypeId == 0)
......@@ -800,8 +835,19 @@ namespace Edu.WebApi.Controllers.Course
{
Name = Common.ConvertHelper.GetEnChar(i),
Content = "",
IsAnswer= item.QuestionAnswer.Contains(Common.ConvertHelper.GetEnChar(i))
};
if (Common.Plugin.StringHelper.IsUpperLetter(item.QuestionAnswer))
{
singleModel.IsAnswer = item.QuestionAnswer.Contains(Common.ConvertHelper.GetEnChar(i));
}
else if (item.QuestionAnswer.Contains("对"))
{
singleModel.IsAnswer = (i == 0) ? true : false;
}
else if (item.QuestionAnswer.Contains("错"))
{
singleModel.IsAnswer = (i > 0) ? true : false;
}
if (i == 0)
{
singleModel.Content = item.OptionA;
......@@ -923,6 +969,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList.Add(singleModel);
}
string f_answer = "";
foreach (var fItem in fillInList)
{
f_answer += "★" + fItem.Content;
}
if (!string.IsNullOrEmpty(f_answer))
{
f_answer = f_answer.Substring(1);
}
model.Answer = f_answer;
model.QuestionContent = Common.Plugin.JsonHelper.Serialize(fillInList);
}
if (model.QuestionTypeId == 0)
......@@ -977,6 +1033,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList.Add(singleModel);
}
string f_answer = "";
foreach (var fItem in fillInList)
{
f_answer += "★" + fItem.Content;
}
if (!string.IsNullOrEmpty(f_answer))
{
f_answer = f_answer.Substring(1);
}
model.Answer = f_answer;
model.QuestionContent = Common.Plugin.JsonHelper.Serialize(fillInList);
}
if (model.QuestionTypeId == 0)
......
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