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

页面修改

parent fc3d63a0
...@@ -38,7 +38,7 @@ namespace Edu.Module.Exam ...@@ -38,7 +38,7 @@ namespace Edu.Module.Exam
/// <param name="ChapterId"></param> /// <param name="ChapterId"></param>
/// <param name="NextChapterId"></param> /// <param name="NextChapterId"></param>
/// <returns></returns> /// <returns></returns>
public object CreateCourseExam(int CourseId, int ChapterId, int NextChapterId) public object CreateCourseExamModule(int CourseId, int ChapterId, int NextChapterId)
{ {
object result = new object(); object result = new object();
var list = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend() var list = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
...@@ -52,41 +52,129 @@ namespace Edu.Module.Exam ...@@ -52,41 +52,129 @@ namespace Edu.Module.Exam
List<object> reviewGroupList = new List<object>(); List<object> reviewGroupList = new List<object>();
List<object> prepGroupList = new List<object>(); List<object> prepGroupList = new List<object>();
if (reviewList != null && reviewList.Count > 0) if (reviewList != null && reviewList.Count > 0)
{ {
for (var i = 0; i < reviewList.Count; i++) for (var i = 0; i < reviewList.Count; i++)
{ {
var titleRandomNum= Common.ConvertHelper.CreateRandomNum();
var tempWords = reviewList[i]; var tempWords = reviewList[i];
//选择题 //选择题
if (i % 2 == 0) if (titleRandomNum % 2 == 0)
{ {
string title = "我是问题";
string wordType = tempWords.WordType;
string wordTone = tempWords.WordTone;
List<optionItem> options = new List<optionItem>();
int randNum = Common.ConvertHelper.CreateRandomNum();
var tempList = reviewList.Where(qitem => qitem.Id != tempWords.Id)?.Take(3)?.ToList(); var tempList = reviewList.Where(qitem => qitem.Id != tempWords.Id)?.Take(3)?.ToList();
if (tempList != null && tempList.Count > 2) if (tempList != null && tempList.Count > 2)
{ {
reviewGroupList.Add(CreateSingleModule(tempWords, tempList));
}
else
{
if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
{
reviewGroupList.Add(CreateFillInModule(tempWords));
}
}
}
//填空题
else
{
if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
{
reviewGroupList.Add(CreateFillInModule(tempWords));
}
}
}
}
if (prepList != null && prepList.Count > 0)
{
}
result = new
{
reviewGroupList,
prepGroupList,
};
return result;
}
/// <summary>
/// 创建填空题
/// </summary>
public object CreateFillInModule(RB_Course_Words_Extend item)
{
string title = "我是问题";
List<fillInItem> fillInItems = new List<fillInItem>();
int randNum = Common.ConvertHelper.CreateRandomNum();
//根据日语书写填写单词
if (randNum % 2 == 0)
{
if (!string.IsNullOrEmpty(item.WordWrite))
{
title = string.Format("根据日语书写【{0}】,填写单词.", item.WordWrite);
}
else
{
title = string.Format("根据中文意思【{0}】,填写单词.", item.ChineseMean);
}
}
else
{
if (!string.IsNullOrEmpty(item.ChineseMean))
{
title = string.Format("根据中文意思【{0}】,填写单词.", item.ChineseMean);
}
else
{
title = string.Format("根据日语书写【{0}】,填写单词.", item.WordWrite);
}
}
var fillinObj= new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
QuestionTypeKey = "fill-in",
QuestionContent = "",
Answer = item.WordContent,
Title = title,
item.WordType,
item.WordContent,
item.WordTone,
item.WordWrite,
item.ChineseMean,
item.FileUrl,
};
return fillinObj;
}
/// <summary>
/// 创建单选题
/// </summary>
/// <returns></returns>
public object CreateSingleModule(RB_Course_Words_Extend item,List<RB_Course_Words_Extend> chooseList)
{
string title = "我是问题";
int randNum = Common.ConvertHelper.CreateRandomNum();
List<optionItem> options = new List<optionItem>();
switch (randNum) switch (randNum)
{ {
//根据单词选择中文意思 //根据单词选择中文意思
case 0: case 0:
title = tempWords.WordContent; title = string.Format("请选择【{0}】单词的正确中文意思.", item.WordContent);
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = tempWords.ChineseMean, Content = item.ChineseMean,
IsAnswer = true, IsAnswer = true,
Name = "", Name = "",
ShowName = "" ShowName = ""
}); });
foreach (var item in tempList) foreach (var cItem in chooseList)
{ {
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = item.ChineseMean, Content = cItem.ChineseMean,
IsAnswer = false, IsAnswer = false,
Name = "", Name = "",
ShowName = "", ShowName = "",
...@@ -95,19 +183,19 @@ namespace Edu.Module.Exam ...@@ -95,19 +183,19 @@ namespace Edu.Module.Exam
break; break;
//根据中文意思选择单词 //根据中文意思选择单词
case 1: case 1:
title = tempWords.ChineseMean; title = string.Format("请选择【{0}】所对应的单词.", item.ChineseMean);
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = tempWords.WordContent, Content = item.WordContent,
IsAnswer = true, IsAnswer = true,
Name = "", Name = "",
ShowName = "" ShowName = ""
}); });
foreach (var item in tempList) foreach (var cItem in chooseList)
{ {
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = item.WordContent, Content = cItem.WordContent,
IsAnswer = false, IsAnswer = false,
Name = "", Name = "",
ShowName = "", ShowName = "",
...@@ -116,19 +204,20 @@ namespace Edu.Module.Exam ...@@ -116,19 +204,20 @@ namespace Edu.Module.Exam
break; break;
//根据日语书写选择中文意思 //根据日语书写选择中文意思
case 2: case 2:
title = tempWords.WordWrite; title = item.WordWrite;
title = string.Format("请选择【{0}】所对应的单词.", item.WordWrite);
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = tempWords.ChineseMean, Content = item.WordContent,
IsAnswer = true, IsAnswer = true,
Name = "", Name = "",
ShowName = "" ShowName = ""
}); });
foreach (var item in tempList) foreach (var cItem in chooseList)
{ {
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = item.ChineseMean, Content = cItem.WordContent,
IsAnswer = false, IsAnswer = false,
Name = "", Name = "",
ShowName = "", ShowName = "",
...@@ -137,19 +226,19 @@ namespace Edu.Module.Exam ...@@ -137,19 +226,19 @@ namespace Edu.Module.Exam
break; break;
//根据中文意思选日语书写 //根据中文意思选日语书写
case 3: case 3:
title = tempWords.ChineseMean; title = string.Format("请选择【{0}】所对应日语书写.", item.ChineseMean);
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = tempWords.WordWrite, Content = item.WordWrite,
IsAnswer = true, IsAnswer = true,
Name = "", Name = "",
ShowName = "" ShowName = ""
}); });
foreach (var item in tempList) foreach (var cItem in chooseList)
{ {
options.Add(new optionItem() options.Add(new optionItem()
{ {
Content = item.WordWrite, Content = cItem.WordWrite,
IsAnswer = false, IsAnswer = false,
Name = "", Name = "",
ShowName = "", ShowName = "",
...@@ -157,66 +246,34 @@ namespace Edu.Module.Exam ...@@ -157,66 +246,34 @@ namespace Edu.Module.Exam
} }
break; break;
} }
options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList(); options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
string Answer = "";
for (var j = 1; j <= options.Count; j++) for (var j = 1; j <= options.Count; j++)
{ {
options[j].Name = Common.Plugin.StringHelper.ReturnEnChar(j); options[j - 1].Name = Common.Plugin.StringHelper.ReturnEnChar(j);
options[j].ShowName = Common.Plugin.StringHelper.ReturnEnChar(j); options[j - 1].ShowName = Common.Plugin.StringHelper.ReturnEnChar(j);
if (options[j - 1].IsAnswer)
{
Answer = options[j - 1].Name;
options[j - 1].IsAnswer = false;
} }
}
reviewGroupList.Add(new var singleObj = new
{ {
QuestionTypeName = "单选题", QuestionTypeName = "单选题",
QuestionTypeId = 1, QuestionTypeId = 1,
QuestionTypeKey = "single", QuestionTypeKey = "single",
QuestionContent = options, QuestionContent = options,
Title = title Answer = Answer,
}); Title = title,
} item.WordType,
else item.WordContent,
{ item.WordTone,
item.WordWrite,
List<fillInItem> fillInItems = new List<fillInItem>(); item.ChineseMean,
item.FileUrl,
reviewGroupList.Add(new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
}
}
//填空题
else
{
string title = "我是问题";
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
}
}
}
if (prepList != null && prepList.Count > 0)
{
}
result = new
{
reviewGroupList,
prepGroupList,
}; };
return result; return singleObj;
} }
/// <summary> /// <summary>
......
...@@ -1242,7 +1242,7 @@ namespace Edu.Module.Exam ...@@ -1242,7 +1242,7 @@ namespace Edu.Module.Exam
if (model.ExamEndTime < DateTime.Now) if (model.ExamEndTime < DateTime.Now)
{ {
fileds.Add(nameof(RB_Examination_Publish_ViewModel.ExamineStatus), (int)EduTaskRrocessStatus.Invalid); fileds.Add(nameof(RB_Examination_Publish_ViewModel.ExamineStatus), (int)EduTaskRrocessStatus.Invalid);
fileds.Add(nameof(RB_Examination_Publish_ViewModel.PublishRemark), "考试时间超过当前时间,更新为作废"); fileds.Add(nameof(RB_Examination_Publish_ViewModel.PublishRemark), "考试时间超过当前时间,更新为作废");
flag = examination_PublishRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Publish_ViewModel.Id), model.Id)); flag = examination_PublishRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Publish_ViewModel.Id), model.Id));
return flag; return flag;
} }
......
...@@ -278,6 +278,7 @@ WHERE 1=1 ...@@ -278,6 +278,7 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND t.StuId IN (SELECT StuId FROM rb_student_assist WHERE AssistId={0} AND `Status`=0) ", query.CreateBy); builder.AppendFormat(" AND t.StuId IN (SELECT StuId FROM rb_student_assist WHERE AssistId={0} AND `Status`=0) ", query.CreateBy);
} }
//我下属的
if (query.BelongType == 4 ) if (query.BelongType == 4 )
{ {
if (query.CreateIds != null && query.CreateIds.Count > 0) if (query.CreateIds != null && query.CreateIds.Count > 0)
...@@ -285,7 +286,7 @@ WHERE 1=1 ...@@ -285,7 +286,7 @@ WHERE 1=1
string createIds = string.Join(",", query.CreateIds); string createIds = string.Join(",", query.CreateIds);
if (!string.IsNullOrEmpty(createIds)) if (!string.IsNullOrEmpty(createIds))
{ {
builder.AppendFormat(" AND t.{0} IN({1}) ", nameof(RB_Student_ViewModel.CreateBy), createIds); builder.AppendFormat(" AND (t.{0} IN({1}) OR t.StuId IN (SELECT StuId FROM rb_student_assist WHERE AssistId IN({1}) AND `Status`=0) ", nameof(RB_Student_ViewModel.CreateBy), createIds);
} }
} }
else else
......
...@@ -84,5 +84,19 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -84,5 +84,19 @@ namespace Edu.WebApi.Controllers.Applet
bool flag = courseExamModule.SetStuWordsReviewModule(model); bool flag = courseExamModule.SetStuWordsReviewModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 生成学员单词测试
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CreateCourseExam()
{
var CourseId = base.ParmJObj.GetInt("CourseId");
var ChapterId = base.ParmJObj.GetInt("ChapterId");
var NextChapterId = base.ParmJObj.GetInt("NextChapterId");
var obj = courseExamModule.CreateCourseExamModule(CourseId, ChapterId, NextChapterId);
return ApiResult.Success(data: obj);
}
} }
} }
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