Commit a43b8308 authored by 黄奎's avatar 黄奎

页面修改

parent 381765f3
......@@ -19,5 +19,10 @@ namespace Edu.Model.ViewModel.Course
/// 章节编号
/// </summary>
public string QChapterIds { get; set; }
/// <summary>
/// 小于等于当前章节
/// </summary>
public int LessThanOrEqualChapterId { get; set; }
}
}
......@@ -57,6 +57,11 @@ namespace Edu.Module.Exam
QChapterIds = ChapterId + "," + NextChapterId
});
var totalList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = CourseId,
LessThanOrEqualChapterId = ChapterId,
})?.OrderBy(qitem => Guid.NewGuid())?.ToList();
var reviewList = list?.Where(qitem => qitem.ChapterId == ChapterId)?.OrderBy(qitem => Guid.NewGuid())?.ToList();
var prepList = list?.Where(qitem => qitem.ChapterId == NextChapterId)?.OrderBy(qitem => Guid.NewGuid())?.ToList();
List<object> reviewGroupList = new List<object>();
......@@ -66,32 +71,34 @@ namespace Edu.Module.Exam
{
for (var i = 0; i < reviewList.Count; i++)
{
var titleRandomNum= Common.ConvertHelper.CreateRandomNum();
var titleRandomNum = Common.ConvertHelper.CreateRandomNum();
var tempWords = reviewList[i];
//选择题
if (titleRandomNum % 2 == 0)
{
var tempList = reviewList.Where(qitem => qitem.Id != tempWords.Id)?.Take(3)?.ToList();
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));
}
}
reviewGroupList.Add(CreateSingleModule(tempWords,totalList));
////选择题
//if (titleRandomNum % 2 == 0)
//{
//
// 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));
// }
//}
}
}
......@@ -141,7 +148,7 @@ namespace Edu.Module.Exam
}
}
var fillinObj= new
var fillinObj = new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
......@@ -155,7 +162,7 @@ namespace Edu.Module.Exam
item.WordWrite,
item.ChineseMean,
item.FileUrl,
IsTrue=0,
IsTrue = 0,
};
return fillinObj;
}
......@@ -164,33 +171,17 @@ namespace Edu.Module.Exam
/// 创建单选题
/// </summary>
/// <returns></returns>
public object CreateSingleModule(RB_Course_Words_Extend item,List<RB_Course_Words_Extend> chooseList)
public object CreateSingleModule(RB_Course_Words_Extend item, List<RB_Course_Words_Extend> totalList)
{
string title = "我是问题";
int randNum = Common.ConvertHelper.CreateRandomNum();
List<optionItem> options = new List<optionItem>();
var tempList = totalList?.OrderBy(qitem => Guid.NewGuid())?.ToList();
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 = "",
});
}
title = CreateDefaultQuestion(item, tempList, options);
break;
//根据中文意思选择单词
case 1:
......@@ -202,20 +193,23 @@ namespace Edu.Module.Exam
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
for (var i = 0; i < 3; i++)
{
var cItem = tempList[i];
options.Add(new optionItem()
{
Content = cItem.WordContent,
Content = !string.IsNullOrEmpty(cItem.WordContent) ? cItem.WordContent : (totalList?.FirstOrDefault(qitem => !string.IsNullOrEmpty(qitem.WordContent))?.WordContent ?? ""),
IsAnswer = false,
Name = "",
ShowName = "",
});
}
break;
//根据日语书写选择中文意思
case 2:
title = item.WordWrite;
if (!string.IsNullOrEmpty(item.WordWrite) && !string.IsNullOrEmpty(item.WordContent))
{
title = string.Format("请选择【{0}】所对应的单词.", item.WordWrite);
options.Add(new optionItem()
{
......@@ -224,19 +218,27 @@ namespace Edu.Module.Exam
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
for (var i = 0; i < 3; i++)
{
var cItem = tempList[i];
options.Add(new optionItem()
{
Content = cItem.WordContent,
Content = !string.IsNullOrEmpty(cItem.WordContent) ? cItem.WordContent : (totalList?.FirstOrDefault(qitem => !string.IsNullOrEmpty(qitem.WordContent))?.WordContent ?? ""),
IsAnswer = false,
Name = "",
ShowName = "",
});
}
}
else
{
title = CreateDefaultQuestion(item, totalList, options);
}
break;
//根据中文意思选日语书写
case 3:
if (!string.IsNullOrEmpty(item.WordWrite)&&!string.IsNullOrEmpty(item.ChineseMean))
{
title = string.Format("请选择【{0}】所对应日语书写.", item.ChineseMean);
options.Add(new optionItem()
{
......@@ -245,19 +247,28 @@ namespace Edu.Module.Exam
Name = "",
ShowName = ""
});
foreach (var cItem in chooseList)
for (var i = 0; i < 3; i++)
{
var cItem = tempList[i];
options.Add(new optionItem()
{
Content = cItem.WordWrite,
Content = !string.IsNullOrEmpty(cItem.WordWrite) ? cItem.WordWrite : (totalList?.FirstOrDefault(qitem => !string.IsNullOrEmpty(qitem.WordWrite))?.WordWrite ?? ""),
IsAnswer = false,
Name = "",
ShowName = "",
});
}
}
else
{
title = CreateDefaultQuestion(item, totalList, options);
}
break;
}
options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
string Answer = "";
for (var j = 1; j <= options.Count; j++)
{
......@@ -288,6 +299,30 @@ namespace Edu.Module.Exam
return singleObj;
}
public string CreateDefaultQuestion(RB_Course_Words_Extend item, List<RB_Course_Words_Extend> totalList, List<optionItem> options)
{
string title = string.Format("请选择【{0}】单词的正确中文意思.", item.WordContent);
options.Add(new optionItem()
{
Content = item.ChineseMean,
IsAnswer = true,
Name = "",
ShowName = ""
});
for (var i = 0; i < 3; i++)
{
var cItem = totalList[i];
options.Add(new optionItem()
{
Content = !string.IsNullOrEmpty(cItem.ChineseMean) ? cItem.ChineseMean : (totalList?.FirstOrDefault(qitem => !string.IsNullOrEmpty(qitem.ChineseMean))?.ChineseMean ?? ""),
IsAnswer = false,
Name = "",
ShowName = "",
});
}
return title;
}
/// <summary>
/// 单词学习或复习
/// </summary>
......@@ -295,18 +330,18 @@ namespace Edu.Module.Exam
/// <param name="ChapterId">当前章节编号</param>
/// <param name="ReviewChapterId">复习章节编号</param>
/// <returns></returns>
public object GetStudyCourseWords(int CourseId, int ChapterId, int ReviewChapterId,int Stu_Account_Id)
public object GetStudyCourseWords(int CourseId, int ChapterId, int ReviewChapterId, int Stu_Account_Id)
{
List<object> list = new List<object>();
List<object> reviewList = new List<object>();
var dataList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = CourseId,
QChapterIds = ChapterId+","+ ReviewChapterId
QChapterIds = ChapterId + "," + ReviewChapterId
});
if (dataList != null && dataList.Count > 0)
{
foreach (var item in dataList.Where(qitem=>qitem.ChapterId==ChapterId))
foreach (var item in dataList.Where(qitem => qitem.ChapterId == ChapterId))
{
list.Add(new
{
......@@ -376,7 +411,7 @@ namespace Edu.Module.Exam
var wordsList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = model.CourseId,
QChapterIds = model.ChapterId+","+model.ReviewCourseChapterId
QChapterIds = model.ChapterId + "," + model.ReviewCourseChapterId
});
//当前章节单词总数
var currentChapterCount = wordsList?.Where(qitem => qitem.ChapterId == model.ChapterId)?.Count() ?? 0;
......@@ -402,7 +437,7 @@ namespace Edu.Module.Exam
else
{
fileds.Add(nameof(RB_StuWords_Prep_Extend.ReviewNum), model.ReviewNum);
model.StudyNum =oldModel.PrepNum+ model.ReviewNum;
model.StudyNum = oldModel.PrepNum + model.ReviewNum;
}
fileds.Add(nameof(RB_StuWords_Prep_Extend.StudyNum), model.StudyNum);
model.Score = GetScoreModule(model.PrepNum, currentChapterCount);
......@@ -438,7 +473,7 @@ namespace Edu.Module.Exam
int score = 0;
if (TotalNum > 0)
{
var progress= Convert.ToDecimal(StartNum) / Convert.ToDecimal(TotalNum) * 100;
var progress = Convert.ToDecimal(StartNum) / Convert.ToDecimal(TotalNum) * 100;
if (progress > 0 && progress <= 33)
{
score = 1;
......
......@@ -86,6 +86,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Course_Words_Extend.ChapterId), query.QChapterIds);
}
if (query.LessThanOrEqualChapterId > 0)
{
builder.AppendFormat(" AND A.{0}<={1} ", nameof(RB_Course_Words_Extend.ChapterId), query.LessThanOrEqualChapterId);
}
}
return Get<RB_Course_Words_Extend>(builder.ToString()).ToList();
}
......
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