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
d216690f
Commit
d216690f
authored
Jan 20, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
bc5dbf09
32469985
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
7 deletions
+79
-7
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+7
-1
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+72
-6
No files found.
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
d216690f
...
...
@@ -73,6 +73,12 @@ namespace Edu.Model.ViewModel.Question
/// <summary>
/// 大类名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
public
string
CategoryName
{
get
{
return
Common
.
Plugin
.
EnumHelper
.
ToName
(
this
.
Category
);
}
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
d216690f
...
...
@@ -99,7 +99,7 @@ namespace Edu.WebApi.Controllers.Course
item
.
CreateByName
,
item
.
CreateTimeStr
,
item
.
DifficultyType
,
CategoryName
=
item
.
Category
.
ToName
()
,
item
.
CategoryName
,
DifficultyTypeName
=
item
.
DifficultyType
.
ToName
(),
});
;
}
...
...
@@ -197,6 +197,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
Failed
(
message
:
shortMessage
);
}
extModel
.
QuestionContent
=
""
;
}
//名词解释
else
if
(
extModel
.
QuestionTypeKey
==
"noun-explanation"
)
...
...
@@ -205,6 +206,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
Failed
(
message
:
"请填写名词解释答案!"
);
}
extModel
.
QuestionContent
=
""
;
}
//论述题
else
if
(
extModel
.
QuestionTypeKey
==
"essay-question"
)
...
...
@@ -213,6 +215,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
Failed
(
message
:
"请填写论述题答案!"
);
}
extModel
.
QuestionContent
=
""
;
}
//计算题
else
if
(
extModel
.
QuestionTypeKey
==
"calculation"
)
...
...
@@ -221,6 +224,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
Failed
(
message
:
"请填写计算题答案!"
);
}
extModel
.
QuestionContent
=
""
;
}
//分录题、资料题
else
if
(
extModel
.
QuestionTypeKey
==
"entry-problem"
||
extModel
.
QuestionTypeKey
==
"data-question"
)
...
...
@@ -260,13 +264,34 @@ namespace Edu.WebApi.Controllers.Course
var
matchList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
List
<
matchingItem
>>>(
extModel
.
QuestionContent
);
if
(
matchList
!=
null
&&
matchList
.
Count
>
0
)
{
if
(
matchList
[
0
]
.
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
if
(
matchList
[
0
]
!=
null
&&
matchList
[
0
].
Count
>
0
)
{
return
ApiResult
.
Failed
(
message
:
"第一组选项内容不能为空!"
);
if
(
matchList
[
0
].
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
{
return
ApiResult
.
Failed
(
message
:
"第一组选项内容不能为空!"
);
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"请添加第一组选项!"
);
}
if
(
matchList
.
Count
>
1
&&
matchList
[
1
]
!=
null
&&
matchList
[
1
].
Count
>
0
)
{
if
(
matchList
[
1
].
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
{
return
ApiResult
.
Failed
(
message
:
"第二组选项内容不能为空!"
);
}
}
if
(
matchList
[
1
].
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
else
{
return
ApiResult
.
Failed
(
message
:
"第二组选项内容不能为空!"
);
return
ApiResult
.
Failed
(
message
:
"请添加第二组选项!"
);
}
if
(
matchList
.
Count
>
2
)
{
if
(
matchList
[
2
].
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
{
return
ApiResult
.
Failed
(
message
:
"请设置答案!"
);
}
}
}
else
...
...
@@ -780,6 +805,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList
.
Add
(
singleModel
);
}
string
f_answer
=
""
;
foreach
(
var
fItem
in
fillInList
)
{
f_answer
+=
"★"
+
fItem
.
Content
;
}
if
(!
string
.
IsNullOrEmpty
(
f_answer
))
{
f_answer
=
f_answer
.
Substring
(
1
);
}
model
.
Answer
=
f_answer
;
model
.
QuestionContent
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
fillInList
);
}
if
(
model
.
QuestionTypeId
==
0
)
...
...
@@ -800,8 +835,19 @@ namespace Edu.WebApi.Controllers.Course
{
Name
=
Common
.
ConvertHelper
.
GetEnChar
(
i
),
Content
=
""
,
IsAnswer
=
item
.
QuestionAnswer
.
Contains
(
Common
.
ConvertHelper
.
GetEnChar
(
i
))
};
if
(
Common
.
Plugin
.
StringHelper
.
IsUpperLetter
(
item
.
QuestionAnswer
))
{
singleModel
.
IsAnswer
=
item
.
QuestionAnswer
.
Contains
(
Common
.
ConvertHelper
.
GetEnChar
(
i
));
}
else
if
(
item
.
QuestionAnswer
.
Contains
(
"对"
))
{
singleModel
.
IsAnswer
=
(
i
==
0
)
?
true
:
false
;
}
else
if
(
item
.
QuestionAnswer
.
Contains
(
"错"
))
{
singleModel
.
IsAnswer
=
(
i
>
0
)
?
true
:
false
;
}
if
(
i
==
0
)
{
singleModel
.
Content
=
item
.
OptionA
;
...
...
@@ -923,6 +969,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList
.
Add
(
singleModel
);
}
string
f_answer
=
""
;
foreach
(
var
fItem
in
fillInList
)
{
f_answer
+=
"★"
+
fItem
.
Content
;
}
if
(!
string
.
IsNullOrEmpty
(
f_answer
))
{
f_answer
=
f_answer
.
Substring
(
1
);
}
model
.
Answer
=
f_answer
;
model
.
QuestionContent
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
fillInList
);
}
if
(
model
.
QuestionTypeId
==
0
)
...
...
@@ -977,6 +1033,16 @@ namespace Edu.WebApi.Controllers.Course
}
fillInList
.
Add
(
singleModel
);
}
string
f_answer
=
""
;
foreach
(
var
fItem
in
fillInList
)
{
f_answer
+=
"★"
+
fItem
.
Content
;
}
if
(!
string
.
IsNullOrEmpty
(
f_answer
))
{
f_answer
=
f_answer
.
Substring
(
1
);
}
model
.
Answer
=
f_answer
;
model
.
QuestionContent
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
fillInList
);
}
if
(
model
.
QuestionTypeId
==
0
)
...
...
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