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
3bbe743d
Commit
3bbe743d
authored
Aug 25, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
a81f4904
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
8 deletions
+106
-8
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+1
-1
AnalysisQuestionTypeModule.cs
Edu.Module.Question/AnalysisQuestionTypeModule.cs
+105
-7
No files found.
Edu.Module.Exam/PaperModule.cs
View file @
3bbe743d
...
...
@@ -696,7 +696,7 @@ namespace Edu.Module.Exam
IsMarking
=
0
,
StudentContent
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
sItem
.
QuestionContentObj
)
};
examination_StudentDetailsRepository
.
Insert
(
stuDetailsModel
);
//
examination_StudentDetailsRepository.Insert(stuDetailsModel);
var
qObj
=
new
{
sItem
.
Id
,
...
...
Edu.Module.Question/AnalysisQuestionTypeModule.cs
View file @
3bbe743d
...
...
@@ -11,13 +11,18 @@ namespace Edu.Module.Question
/// </summary>
public
class
AnalysisQuestionTypeModule
{
/// <summary>
/// 字母选项数组
/// </summary>
private
static
string
[]
LetterArray
=
new
string
[
26
]
{
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
/// <summary>
/// 问题解析
/// </summary>
/// <param name="key">问题Key</param>
/// <param name="data">选项内容</param>
/// <param name="isNoAnswer">是否去掉答案</param>
/// <param name="isOptionRandom">是否选项随机</param>
/// <param name="isOptionRandom">是否选项随机
(1-随机选项)
</param>
/// <returns></returns>
public
object
ParsingQuestion
(
string
key
,
string
data
,
bool
isNoAnswer
=
false
,
int
isOptionRandom
=
0
)
{
...
...
@@ -27,24 +32,108 @@ namespace Edu.Module.Question
//单选题
case
"single"
:
var
singleList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
data
);
if
(
isNoAnswer
&&
singleList
!=
null
&&
singleList
.
Count
>
0
)
var
newList
=
new
List
<
optionItem
>();
singleList
.
ForEach
(
item
=>
{
item
.
ShowName
=
item
.
Name
;
});
//选项随机
if
(
isOptionRandom
==
1
)
{
var
tempList
=
singleList
.
OrderBy
(
qitem
=>
Guid
.
NewGuid
()).
ToList
();
for
(
var
i
=
0
;
i
<
tempList
.
Count
;
i
++)
{
var
item
=
new
optionItem
()
{
Name
=
tempList
[
i
].
Name
,
ShowName
=
tempList
[
i
].
ShowName
,
Content
=
tempList
[
i
].
Content
,
IsAnswer
=
tempList
[
i
].
IsAnswer
};
item
.
ShowName
=
LetterArray
[
i
];
newList
.
Add
(
item
);
}
}
//去掉答案
if
(
isNoAnswer
)
{
singleList
.
ForEach
(
item
=>
{
//item.IsAnswer = false;
item
.
IsAnswer
=
false
;
});
newList
.
ForEach
(
item
=>
{
item
.
IsAnswer
=
false
;
});
}
obj
=
singleList
;
if
(
isOptionRandom
==
1
)
{
obj
=
newList
;
}
else
{
obj
=
singleList
;
}
break
;
//多选题
case
"multiple"
:
obj
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
data
);
var
multipleList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
data
);
var
newMultipleList
=
new
List
<
optionItem
>();
newMultipleList
.
ForEach
(
item
=>
{
item
.
ShowName
=
item
.
Name
;
});
//选项随机
if
(
isOptionRandom
==
1
)
{
var
tempList
=
multipleList
.
OrderBy
(
qitem
=>
Guid
.
NewGuid
()).
ToList
();
for
(
var
i
=
0
;
i
<
tempList
.
Count
;
i
++)
{
var
item
=
new
optionItem
()
{
Name
=
tempList
[
i
].
Name
,
ShowName
=
tempList
[
i
].
ShowName
,
Content
=
tempList
[
i
].
Content
,
IsAnswer
=
tempList
[
i
].
IsAnswer
};
item
.
ShowName
=
LetterArray
[
i
];
newMultipleList
.
Add
(
item
);
}
}
//去掉答案
if
(
isNoAnswer
)
{
multipleList
.
ForEach
(
item
=>
{
item
.
IsAnswer
=
false
;
});
newMultipleList
.
ForEach
(
item
=>
{
item
.
IsAnswer
=
false
;
});
}
if
(
isOptionRandom
==
1
)
{
obj
=
newMultipleList
;
}
else
{
obj
=
multipleList
;
}
break
;
//填空题
case
"fill-in"
:
if
(!
string
.
IsNullOrEmpty
(
data
))
{
obj
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
fillInItem
>>(
data
);
var
fillInList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
fillInItem
>>(
data
);
if
(
isNoAnswer
)
{
fillInList
.
ForEach
(
item
=>
{
item
.
Content
=
""
;
});
}
obj
=
fillInList
;
}
else
{
...
...
@@ -53,7 +142,15 @@ namespace Edu.Module.Question
break
;
//判断题
case
"judge"
:
obj
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
data
);
var
judgeList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
optionItem
>>(
data
);
if
(
isNoAnswer
)
{
judgeList
.
ForEach
(
item
=>
{
item
.
IsAnswer
=
false
;
});
}
obj
=
judgeList
;
break
;
//简答题
case
"short-answer"
:
...
...
@@ -200,6 +297,7 @@ namespace Edu.Module.Question
return
obj
;
}
/// <summary>
/// 问题验证
/// </summary>
...
...
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