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,157 +52,35 @@ namespace Edu.Module.Exam ...@@ -52,157 +52,35 @@ 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)
{ {
switch (randNum) reviewGroupList.Add(CreateSingleModule(tempWords, tempList));
{
//根据单词选择中文意思
case 0:
title = tempWords.WordContent;
options.Add(new optionItem()
{
Content = tempWords.ChineseMean,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var item in tempList)
{
options.Add(new optionItem()
{
Content = item.ChineseMean,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据中文意思选择单词
case 1:
title = tempWords.ChineseMean;
options.Add(new optionItem()
{
Content = tempWords.WordContent,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var item in tempList)
{
options.Add(new optionItem()
{
Content = item.WordContent,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据日语书写选择中文意思
case 2:
title = tempWords.WordWrite;
options.Add(new optionItem()
{
Content = tempWords.ChineseMean,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var item in tempList)
{
options.Add(new optionItem()
{
Content = item.ChineseMean,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据中文意思选日语书写
case 3:
title = tempWords.ChineseMean;
options.Add(new optionItem()
{
Content = tempWords.WordWrite,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var item in tempList)
{
options.Add(new optionItem()
{
Content = item.WordWrite,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
}
options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
for (var j = 1; j <= options.Count; j++)
{
options[j].Name = Common.Plugin.StringHelper.ReturnEnChar(j);
options[j].ShowName = Common.Plugin.StringHelper.ReturnEnChar(j);
}
reviewGroupList.Add(new
{
QuestionTypeName = "单选题",
QuestionTypeId = 1,
QuestionTypeKey = "single",
QuestionContent = options,
Title = title
});
} }
else else
{ {
if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{ {
QuestionTypeName = "填空题", reviewGroupList.Add(CreateFillInModule(tempWords));
QuestionTypeId = 3, }
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
} }
} }
//填空题 //填空题
else else
{ {
string title = "我是问题"; if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{ {
QuestionTypeName = "填空题", reviewGroupList.Add(CreateFillInModule(tempWords));
QuestionTypeId = 3, }
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
} }
} }
} }
...@@ -219,6 +97,185 @@ namespace Edu.Module.Exam ...@@ -219,6 +97,185 @@ namespace Edu.Module.Exam
return result; 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)
{
//根据单词选择中文意思
case 0:
title = string.Format("请选择【{0}】单词的正确中文意思.", item.WordContent);
options.Add(new optionItem()
{
Content = item.ChineseMean,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
{
options.Add(new optionItem()
{
Content = cItem.ChineseMean,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据中文意思选择单词
case 1:
title = string.Format("请选择【{0}】所对应的单词.", item.ChineseMean);
options.Add(new optionItem()
{
Content = item.WordContent,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
{
options.Add(new optionItem()
{
Content = cItem.WordContent,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据日语书写选择中文意思
case 2:
title = item.WordWrite;
title = string.Format("请选择【{0}】所对应的单词.", item.WordWrite);
options.Add(new optionItem()
{
Content = item.WordContent,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
{
options.Add(new optionItem()
{
Content = cItem.WordContent,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据中文意思选日语书写
case 3:
title = string.Format("请选择【{0}】所对应日语书写.", item.ChineseMean);
options.Add(new optionItem()
{
Content = item.WordWrite,
IsAnswer = true,
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
{
options.Add(new optionItem()
{
Content = cItem.WordWrite,
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
}
options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
string Answer = "";
for (var j = 1; j <= options.Count; j++)
{
options[j - 1].Name = 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;
}
}
var singleObj = new
{
QuestionTypeName = "单选题",
QuestionTypeId = 1,
QuestionTypeKey = "single",
QuestionContent = options,
Answer = Answer,
Title = title,
item.WordType,
item.WordContent,
item.WordTone,
item.WordWrite,
item.ChineseMean,
item.FileUrl,
};
return singleObj;
}
/// <summary> /// <summary>
/// 单词学习或复习 /// 单词学习或复习
/// </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