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
1921f49b
Commit
1921f49b
authored
Aug 18, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yemxiug
parent
378ec10d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+17
-1
No files found.
Edu.Module.Exam/PaperModule.cs
View file @
1921f49b
...
...
@@ -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
{
...
...
@@ -485,6 +486,9 @@ 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
)
{
...
...
@@ -503,10 +507,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
;
}
}
}
...
...
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