Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
7665afd3
Commit
7665afd3
authored
3 years ago
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
5b895040
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
7 deletions
+50
-7
ConvertHelper.cs
Edu.Common/Plugin/ConvertHelper.cs
+13
-2
CourseExamModule.cs
Edu.Module.Exam/CourseExamModule.cs
+37
-5
No files found.
Edu.Common/Plugin/ConvertHelper.cs
View file @
7665afd3
...
...
@@ -277,7 +277,7 @@ namespace Edu.Common
/// <returns></returns>
public
static
int
CalcMinutes
(
DateTime
start
,
DateTime
end
)
{
int
minutes
=
Convert
.
ToInt32
((
end
-
start
).
TotalSeconds
);
int
minutes
=
Convert
.
ToInt32
((
end
-
start
).
TotalSeconds
);
minutes
/=
60
;
return
minutes
;
}
...
...
@@ -387,7 +387,7 @@ namespace Edu.Common
/// <param name="value"></param>
/// <param name="isAddNbsp"></param>
/// <returns></returns>
public
static
string
GetSpanString
(
string
value
,
bool
isAddNbsp
=
false
)
public
static
string
GetSpanString
(
string
value
,
bool
isAddNbsp
=
false
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"<span style='text-decoration: underline;'>{1}{0}{1}</span>"
,
value
,
(
isAddNbsp
?
" "
:
""
));
...
...
@@ -520,5 +520,16 @@ namespace Edu.Common
}
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
This diff is collapsed.
Click to expand it.
Edu.Module.Exam/CourseExamModule.cs
View file @
7665afd3
...
...
@@ -4,6 +4,7 @@ using System;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq
;
using
Edu.Model.ViewModel.Question
;
namespace
Edu.Module.Exam
{
...
...
@@ -33,9 +34,12 @@ namespace Edu.Module.Exam
CourseId
=
CourseId
,
QChapterIds
=
ChapterId
+
","
+
NextChapterId
});
List
<
object
>
GroupList
=
new
List
<
object
>();
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
>();
List
<
object
>
prepGroupList
=
new
List
<
object
>();
if
(
reviewList
!=
null
&&
reviewList
.
Count
>
0
)
{
for
(
var
i
=
0
;
i
<
reviewList
.
Count
;
i
++)
...
...
@@ -43,22 +47,45 @@ namespace Edu.Module.Exam
//选择题
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
{
Group
Name
=
"单选题"
,
QuestionType
Name
=
"单选题"
,
QuestionTypeId
=
1
,
QuestionTypeKey
=
"single"
,
QuestionContent
=
options
,
Title
=
title
});
}
//填空题
else
{
GroupList
.
Add
(
new
string
title
=
"我是问题"
;
List
<
fillInItem
>
fillInItems
=
new
List
<
fillInItem
>();
reviewGroupList
.
Add
(
new
{
Group
Name
=
"填空题"
,
QuestionType
Name
=
"填空题"
,
QuestionTypeId
=
3
,
QuestionTypeKey
=
"fill-in"
,
QuestionContent
=
fillInItems
,
Title
=
title
});
}
}
...
...
@@ -68,6 +95,11 @@ namespace Edu.Module.Exam
{
}
result
=
new
{
reviewGroupList
,
prepGroupList
,
};
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment