Commit 7665afd3 authored by 黄奎's avatar 黄奎

页面修改

parent 5b895040
...@@ -277,7 +277,7 @@ namespace Edu.Common ...@@ -277,7 +277,7 @@ namespace Edu.Common
/// <returns></returns> /// <returns></returns>
public static int CalcMinutes(DateTime start, DateTime end) public static int CalcMinutes(DateTime start, DateTime end)
{ {
int minutes=Convert.ToInt32((end - start).TotalSeconds); int minutes = Convert.ToInt32((end - start).TotalSeconds);
minutes /= 60; minutes /= 60;
return minutes; return minutes;
} }
...@@ -387,7 +387,7 @@ namespace Edu.Common ...@@ -387,7 +387,7 @@ namespace Edu.Common
/// <param name="value"></param> /// <param name="value"></param>
/// <param name="isAddNbsp"></param> /// <param name="isAddNbsp"></param>
/// <returns></returns> /// <returns></returns>
public static string GetSpanString(string value,bool isAddNbsp=false) public static string GetSpanString(string value, bool isAddNbsp = false)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"<span style='text-decoration: underline;'>{1}{0}{1}</span>", value, (isAddNbsp ? "&nbsp;&nbsp;" : "")); builder.AppendFormat(@"<span style='text-decoration: underline;'>{1}{0}{1}</span>", value, (isAddNbsp ? "&nbsp;&nbsp;" : ""));
...@@ -520,5 +520,16 @@ namespace Edu.Common ...@@ -520,5 +520,16 @@ namespace Edu.Common
} }
return FormatDate(last); return FormatDate(last);
} }
/// <summary>
/// 生成随机数
/// </summary>
/// <returns></returns>
public static int CreateRandomNum()
{
Random rd = new Random();
int result = rd.Next(1, 100);
return result % 3;
}
} }
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ using System; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Linq; using System.Linq;
using Edu.Model.ViewModel.Question;
namespace Edu.Module.Exam namespace Edu.Module.Exam
{ {
...@@ -33,9 +34,12 @@ namespace Edu.Module.Exam ...@@ -33,9 +34,12 @@ namespace Edu.Module.Exam
CourseId = CourseId, CourseId = CourseId,
QChapterIds = ChapterId + "," + NextChapterId QChapterIds = ChapterId + "," + NextChapterId
}); });
List<object> GroupList = new List<object>();
var reviewList = list?.Where(qitem => qitem.ChapterId == 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(); var prepList = list?.Where(qitem => qitem.ChapterId == NextChapterId)?.OrderBy(qitem => Guid.NewGuid())?.ToList();
List<object> reviewGroupList = 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++)
...@@ -43,22 +47,45 @@ namespace Edu.Module.Exam ...@@ -43,22 +47,45 @@ namespace Edu.Module.Exam
//选择题 //选择题
if (i % 2 == 0) if (i % 2 == 0)
{ {
string title = "我是问题";
int randNum = Common.ConvertHelper.CreateRandomNum();
switch (randNum)
{
case 0:
break;
case 1:
GroupList.Add(new break;
case 2:
break;
}
List<optionItem> options = new List<optionItem>();
reviewGroupList.Add(new
{ {
GroupName = "单选题", QuestionTypeName = "单选题",
QuestionTypeId = 1, QuestionTypeId = 1,
QuestionTypeKey = "single", QuestionTypeKey = "single",
QuestionContent = options,
Title = title
}); });
} }
//填空题 //填空题
else else
{ {
GroupList.Add(new string title = "我是问题";
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{ {
GroupName = "填空题", QuestionTypeName = "填空题",
QuestionTypeId = 3, QuestionTypeId = 3,
QuestionTypeKey = "fill-in", QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title= title
}); });
} }
} }
...@@ -68,6 +95,11 @@ namespace Edu.Module.Exam ...@@ -68,6 +95,11 @@ namespace Edu.Module.Exam
{ {
} }
result = new
{
reviewGroupList,
prepGroupList,
};
return result; return result;
} }
} }
......
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