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
3361ed64
Commit
3361ed64
authored
Aug 18, 2021
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
d8602c30
1a398e12
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
3 deletions
+51
-3
RB_Examination_Paper_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
+5
-0
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+31
-3
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+15
-0
No files found.
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
View file @
3361ed64
...
...
@@ -33,5 +33,10 @@ namespace Edu.Model.ViewModel.Exam
/// 是否查询文件夹
/// </summary>
public
int
IsQueryFolder
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
}
}
Edu.Module.Exam/PaperModule.cs
View file @
3361ed64
...
...
@@ -10,6 +10,7 @@ using Edu.Common.Plugin;
using
Edu.Module.Question
;
using
Edu.Repository.Question
;
using
Edu.Model.ViewModel.Question
;
using
System.Text.RegularExpressions
;
namespace
Edu.Module.Exam
{
...
...
@@ -521,9 +522,13 @@ namespace Edu.Module.Exam
/// <returns></returns>
public
RB_Examination_Paper_ViewModel
GetExaminationPaperModule
(
object
PaperId
)
{
// 定义正则表达式用来匹配 img 标签
string
str
=
@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>"
;
var
extModel
=
examination_PaperRepository
.
GetEntity
<
RB_Examination_Paper_ViewModel
>(
PaperId
);
if
(
extModel
!=
null
&&
extModel
.
PaperId
>
0
)
{
extModel
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
extModel
.
CreateBy
)?.
AccountName
??
""
;
extModel
.
GroupList
=
GetExaminationGroupListModule
(
new
RB_Examination_Group_ViewModel
()
{
PaperId
=
extModel
.
PaperId
...
...
@@ -539,10 +544,22 @@ namespace Edu.Module.Exam
gItem
.
DetailsList
=
detailsList
?.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
gItem
.
QuestionTypeId
)?.
ToList
()
??
new
List
<
RB_Examination_Details_ViewModel
>();
if
(
gItem
.
DetailsList
!=
null
&&
gItem
.
DetailsList
.
Count
>
0
)
{
gItem
.
GScore
=
gItem
?.
DetailsList
?.
Sum
(
qitem
=>
qitem
.
Score
)
??
0
;
foreach
(
var
sItem
in
gItem
.
DetailsList
)
{
sItem
.
QuestionContentObj
=
analysisQuestion
.
ParsingQuestion
(
sItem
.
QuestionTypeKey
,
sItem
.
QuestionContent
);
sItem
.
ShowTitle
=
Common
.
Plugin
.
StringHelper
.
FilterHtml
(
sItem
.
Title
);
string
newTitle
=
sItem
.
Title
;
try
{
newTitle
=
Regex
.
Replace
(
newTitle
,
str
,
"[图片]"
);
newTitle
=
Regex
.
Replace
(
newTitle
,
@"<iframe\s*[^>]*>"
,
"[音频"
,
RegexOptions
.
IgnoreCase
);
newTitle
=
Regex
.
Replace
(
newTitle
,
@"</iframe>"
,
"]"
,
RegexOptions
.
IgnoreCase
);
}
catch
{
newTitle
=
sItem
.
Title
;
}
sItem
.
ShowTitle
=
newTitle
;
}
}
}
...
...
@@ -591,18 +608,29 @@ namespace Edu.Module.Exam
public
bool
RemoveExamnationPaperModule
(
int
PaperId
)
{
var
flag
=
true
;
var
model
=
GetExaminationPaperModule
(
PaperId
);
var
childList
=
examination_PaperRepository
.
GetExaminationPaperChildRepository
(
PaperId
.
ToString
());
if
(
PaperId
>
0
)
{
flag
=
examination_PaperRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
if
(
flag
&&
model
.
GroupList
!=
null
&&
model
.
GroupList
.
Count
>
0
)
{
flag
=
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
if
(
flag
&&
model
.
GroupList
!=
null
&&
model
.
GroupList
.
Count
>
0
&&
model
.
GroupList
[
0
].
DetailsList
!=
null
&&
model
.
GroupList
[
0
].
DetailsList
.
Count
>
0
)
{
flag
=
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
PaperId
));
}
if
(
childList
!=
null
&&
childList
.
Count
>
0
)
{
foreach
(
var
item
in
childList
)
{
examination_PaperRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
item
.
PaperId
));
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
PaperId
),
item
.
PaperId
));
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
item
.
PaperId
));
}
}
return
flag
;
}
...
...
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
3361ed64
...
...
@@ -354,6 +354,20 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Failed
(
message
:
message
);
}
}
//判断题
else
if
(
extModel
.
QuestionTypeKey
==
"judge"
)
{
var
optionItems
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
extModel
.
QuestionContent
);
string
message
=
CheckChoose
(
optionItems
);
if
(!
string
.
IsNullOrEmpty
(
message
))
{
return
ApiResult
.
Failed
(
message
:
message
);
}
if
(
string
.
IsNullOrEmpty
(
extModel
.
Answer
))
{
extModel
.
Answer
=
optionItems
.
Where
(
qitem
=>
qitem
.
IsAnswer
==
true
)?.
FirstOrDefault
()?.
Name
;
}
}
//填空题
else
if
(
extModel
.
QuestionTypeKey
==
"fill-in"
)
{
...
...
@@ -364,6 +378,7 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Failed
(
message
:
fillMessage
);
}
}
//简答题
else
if
(
extModel
.
QuestionTypeKey
==
"short-answer"
)
{
...
...
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