Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
4898b7f5
Commit
4898b7f5
authored
Mar 31, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新建试卷联调
parent
3cfa93ca
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
353 additions
and
148 deletions
+353
-148
src/data-source/questionBank/request-apis.ts
+1
-5
src/domains/basic-domain/constants.ts
+2
-2
src/domains/question-bank-domain/QuestionBankService.ts
+2
-7
src/modules/teach-tool/components/CourseCategoryManage.jsx
+15
-11
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
+11
-8
src/modules/teach-tool/examination-paper/ExaminationPaperIndex.jsx
+2
-2
src/modules/teach-tool/examination-paper/NewExaminationPaper.jsx
+280
-102
src/modules/teach-tool/examination-paper/NewExaminationPaper.less
+18
-1
src/modules/teach-tool/examination-paper/modal/SelectQuestionModal.jsx
+17
-7
src/modules/teach-tool/modal/NewEditCourseCategoryModal.jsx
+3
-1
src/modules/teach-tool/question-bank/QuestionBankIndex.jsx
+2
-2
No files found.
src/data-source/questionBank/request-apis.ts
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-03 15:13:12
* @LastEditors: yuananting
* @LastEditTime: 2021-03-
17 11:40:41
* @LastEditTime: 2021-03-
31 18:14:09
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -29,10 +29,6 @@ export function editCategoryTree(params: object) {
return
Service
.
Hades
(
"public/hades/editCategoryTree"
,
params
);
}
export
function
queryQuestionCategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
"public/hades/queryQuestionCategoryTree"
,
params
);
}
export
function
queryQuestionPageList
(
params
:
object
)
{
return
Service
.
Hades
(
"public/hades/queryQuestionPageList"
,
params
);
}
...
...
src/domains/basic-domain/constants.ts
View file @
4898b7f5
/*
* @Author: 陈剑宇
* @Date: 2020-05-07 14:43:01
* @LastEditTime: 2021-03-
27 14:25:54
* @LastEditTime: 2021-03-
31 18:26:22
* @LastEditors: yuananting
* @Description:
* @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts
...
...
@@ -9,7 +9,7 @@
import
{
MapInterface
}
from
'@/domains/basic-domain/interface'
// 默认是 dev 环境
const
ENV
:
string
=
process
.
env
.
DEPLOY_ENV
||
'dev'
;
const
ENV
:
string
=
process
.
env
.
DEPLOY_ENV
||
'dev
1
'
;
console
.
log
(
"process.env.DEPLOY_ENV"
,
process
)
const
BASIC_HOST_MAP
:
MapInterface
=
{
dev
:
'https://dev-heimdall.xiaomai5.com/'
,
...
...
src/domains/question-bank-domain/QuestionBankService.ts
View file @
4898b7f5
...
...
@@ -2,11 +2,11 @@
* @Author: yuananting
* @Date: 2021-03-11 11:34:37
* @LastEditors: yuananting
* @LastEditTime: 2021-03-
16 15:12:09
* @LastEditTime: 2021-03-
31 18:14:42
* @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
{
queryCategoryTree
,
addCategory
,
delCategory
,
editCategory
,
editCategoryTree
,
queryQuestionCategoryTree
,
addQuestion
,
queryQuestionPageList
,
deleteQuestion
,
queryQuestionDetails
,
editQuestion
,
batchImport
}
from
'@/data-source/questionBank/request-apis'
;
import
{
queryCategoryTree
,
addCategory
,
delCategory
,
editCategory
,
editCategoryTree
,
addQuestion
,
queryQuestionPageList
,
deleteQuestion
,
queryQuestionDetails
,
editQuestion
,
batchImport
}
from
'@/data-source/questionBank/request-apis'
;
export
default
class
QuestionBankService
{
// 获取题目分类树
static
queryCategoryTree
(
params
:
any
)
{
...
...
@@ -33,11 +33,6 @@ export default class QuestionBankService {
return
editCategoryTree
(
params
);
}
// 查询分类树列表
static
queryQuestionCategoryTree
(
params
:
any
)
{
return
queryQuestionCategoryTree
(
params
);
}
// 查询题目列表
static
queryQuestionPageList
(
params
:
any
)
{
return
queryQuestionPageList
(
params
);
...
...
src/modules/teach-tool/components/CourseCategoryManage.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 14:25:47
* @LastEditTime: 2021-03-3
1 18:36:34
* @Description: 助学工具-课程分类
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -45,20 +45,22 @@ class CourseCategoryManage extends Component {
getWholeTree
=
()
=>
{
let
query
=
{
bizType
:
"QUESTION"
,
count
:
false
,
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
};
QuestionBankService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
result
}
=
res
;
this
.
setState
({
originTreeData
:
resul
t
},
()
=>
{
const
{
categoryList
=
[]
}
=
res
.
result
;
this
.
setState
({
originTreeData
:
categoryLis
t
},
()
=>
{
let
map
=
{};
let
topItem
=
[];
resul
t
.
forEach
((
item
)
=>
{
categoryLis
t
.
forEach
((
item
)
=>
{
topItem
.
push
(
item
);
});
this
.
setState
({
treeMap
:
Object
.
assign
(
this
.
getTreeMap
(
resul
t
,
map
),
{
treeMap
:
Object
.
assign
(
this
.
getTreeMap
(
categoryLis
t
,
map
),
{
0
:
{
sonCategoryList
:
topItem
,
},
...
...
@@ -73,19 +75,21 @@ class CourseCategoryManage extends Component {
this
.
getWholeTree
();
this
.
setState
({
categoryName
});
let
query
=
{
bizType
:
"QUESTION"
,
count
:
false
,
source
:
0
,
categoryName
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
};
QuestionBankService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
result
=
[]
}
=
res
;
const
{
categoryList
=
[]
}
=
res
.
result
;
let
str
=
"未分类"
;
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
});
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
resul
t
,
categoryName
),
treeData
:
this
.
renderTreeNodes
(
categoryLis
t
,
categoryName
),
});
let
nodeId
=
[];
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
...
...
@@ -100,9 +104,9 @@ class CourseCategoryManage extends Component {
parentId
:
"0"
,
categoryLevel
:
0
,
};
resul
t
.
unshift
(
defaultNode
);
categoryLis
t
.
unshift
(
defaultNode
);
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
resul
t
,
categoryName
),
treeData
:
this
.
renderTreeNodes
(
categoryLis
t
,
categoryName
),
});
let
nodeId
=
[];
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
...
...
@@ -121,8 +125,8 @@ class CourseCategoryManage extends Component {
parentId
:
"0"
,
categoryLevel
:
0
,
};
resul
t
.
unshift
(
defaultNode
);
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
resul
t
,
categoryName
)
});
categoryLis
t
.
unshift
(
defaultNode
);
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryLis
t
,
categoryName
)
});
if
(
operateType
===
"search"
)
{
this
.
setState
({
expandedKeys
:
[]
});
}
...
...
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 16:40:58
* @LastEditTime: 2021-03-3
1 19:23:40
* @Description: 助学工具-课程分类侧边栏
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -20,7 +20,7 @@ class CourseCategorySiderTree extends Component {
super
(
props
);
this
.
state
=
{
selectedKeys
:
props
.
fromModule
===
"
index
"
props
.
fromModule
===
"
QUESTION_INDEX
"
?
[
getParameterByName
(
"categoryId"
)
||
"null"
]
:
[
"null"
],
treeData
:
props
.
treeData
||
[],
...
...
@@ -31,7 +31,7 @@ class CourseCategorySiderTree extends Component {
componentDidMount
()
{
this
.
queryCategoryTree
(
"change"
);
this
.
props
.
getSelectedCategoryId
(
this
.
props
.
fromModule
===
"
index
"
this
.
props
.
fromModule
===
"
QUESTION_INDEX
"
?
[
getParameterByName
(
"categoryId"
)
||
"null"
]
:
[
"null"
]
);
...
...
@@ -40,7 +40,7 @@ class CourseCategorySiderTree extends Component {
shouldComponentUpdate
(
nextProps
,
nextState
)
{
const
{
currentTotal
,
updatedCategoryId
}
=
nextProps
;
if
(
this
.
props
.
fromModule
===
"
index
"
&&
this
.
props
.
fromModule
===
"
QUESTION_INDEX
"
&&
this
.
props
.
currentTotal
!==
currentTotal
&&
this
.
props
.
updatedCategoryId
===
updatedCategoryId
)
{
...
...
@@ -52,12 +52,14 @@ class CourseCategorySiderTree extends Component {
// 查询分类树
queryCategoryTree
=
(
type
,
categoryName
)
=>
{
let
query
=
{
source
:
0
,
bizType
:
[
"QUESTION_INDEX"
,
"QUESTION_MODAL"
].
includes
(
this
.
props
.
fromModule
)
?
"QUESTION"
:
"PAPER"
,
categoryName
,
count
:
true
,
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
};
QuestionBankService
.
query
Question
CategoryTree
(
query
).
then
((
res
)
=>
{
QuestionBankService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
let
str
=
"未分类"
;
if
(
categoryName
)
{
...
...
@@ -195,9 +197,10 @@ class CourseCategorySiderTree extends Component {
selectedKeys
,
autoExpandParent
,
}
=
this
.
state
;
return
(
<
div
className=
"category-tree-sider"
>
<
div
className=
"sider-title"
>
题目分类
</
div
>
{
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
this
.
props
.
fromModule
)
&&
<
div
className=
"sider-title"
>
{
this
.
props
.
fromModule
===
"QUESTION_INDEX"
?
"题目分类"
:
"试卷分类"
}
</
div
>
}
<
Search
className=
"sider-search"
placeholder=
"搜索名称分类"
...
...
@@ -206,7 +209,7 @@ class CourseCategorySiderTree extends Component {
}
}
enterButton=
{
<
span
className=
"icon iconfont"
>

</
span
>
}
/>
{
this
.
props
.
fromModule
===
"index"
&&
User
.
getUserRole
()
!==
"CloudLecturer"
&&
(
{
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
this
.
props
.
fromModule
)
&&
User
.
getUserRole
()
!==
"CloudLecturer"
&&
(
<
div
className=
"sider-btn"
>
<
Button
onClick=
{
()
=>
{
...
...
src/modules/teach-tool/examination-paper/ExaminationPaperIndex.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-27 14:55:14
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 16:08:38
* @LastEditTime: 2021-03-3
1 19:14:46
* @Description: 助学工具-试卷主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -37,7 +37,7 @@ class ExaminationPaperIndex extends Component {
>
<
div
className=
"sider"
>
<
CourseCategorySiderTree
fromModule=
"
index
"
fromModule=
"
PAPER_INDEX
"
getSelectedCategoryId=
{
this
.
getCategoryIdFromSider
.
bind
(
this
)
}
currentTotal=
{
this
.
state
.
currentTotal
}
updatedCategoryId=
{
this
.
state
.
updatedCategoryId
}
...
...
src/modules/teach-tool/examination-paper/NewExaminationPaper.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 19:38:00
* @LastEditTime: 2021-03-3
1 19:50:36
* @Description: 助学工具-新建试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -22,6 +22,7 @@ import ShowTips from "@/components/ShowTips";
import
Breadcrumbs
from
"@/components/Breadcrumbs"
;
import
"./NewExaminationPaper.less"
;
import
SelectQuestionModal
from
"./modal/SelectQuestionModal"
;
import
User
from
"@/common/js/user"
;
const
questionTypeEnum
=
{
SINGLE_CHOICE
:
"单选题"
,
...
...
@@ -35,28 +36,28 @@ class NewExaminationPaper extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
questionFormData
:
{
examinationPaperName
:
null
,
// 试卷名称
passScore
:
null
,
// 及格线
formData
:
{
categoryId
:
null
,
// 分类ID
singleChoiceCnt
:
0
,
// 单选题数量
multiChoiceCnt
:
0
,
// 多选题数量
judgeCnt
:
0
,
// 判断题数量
gapFillingCnt
:
0
,
// 填空题数量
indefiniteChoiceCnt
:
0
,
// 不定项选择题数量
paperName
:
null
,
// 试卷名称
passRate
:
60
,
// 及格线
passScore
:
0
,
// 及格分
questionCnt
:
0
,
// 题目数量
totalScore
:
0
,
// 总分
questionList
:
[],
// 题目列表
},
questionData
:
{
totalScore
:
0
,
totalCount
:
0
,
singleCount
:
0
,
singleScore
:
0
,
multiCount
:
0
,
multiScore
:
0
,
judgeCount
:
0
,
judgeScore
:
0
,
gapCount
:
0
,
gapScore
:
0
,
indefiniteCount
:
0
,
indefiniteScore
:
0
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
},
};
}
// 校验试卷名称是否重名
checkExistPaperName
=
(
paperName
)
=>
{};
// 自定义表格空状态
customizeRenderEmpty
=
()
=>
{
return
(
...
...
@@ -72,18 +73,17 @@ class NewExaminationPaper extends Component {
// 选择题目
chooseQuestion
=
()
=>
{
const
{
formData
}
=
this
.
state
;
const
m
=
(
<
SelectQuestionModal
setSelectedQuestion=
{
(
list
)
=>
{
this
.
setState
(
{
questionList
:
list
,
selectQuestionModal
:
null
,
this
.
setState
(
{
formData
:
{
...
formData
,
questionList
:
[...
formData
.
questionList
,
...
list
]
,
},
()
=>
{
console
.
log
(
this
.
state
.
questionList
);
}
);
selectQuestionModal
:
null
,
});
}
}
close=
{
()
=>
{
this
.
setState
({
...
...
@@ -95,21 +95,59 @@ class NewExaminationPaper extends Component {
this
.
setState
({
selectQuestionModal
:
m
});
};
// 保存题目
saveExaminationPaper
=
async
()
=>
{
try
{
await
this
.
formRef
.
current
.
validateFields
();
}
catch
(
e
)
{
console
.
log
(
e
);
}
// 移动已选题目
handleMoveItem
=
(
index
,
moveLength
)
=>
{
const
{
formData
}
=
this
.
state
;
const
questionList
=
[...
formData
.
questionList
];
const
item
=
questionList
.
splice
(
index
+
moveLength
,
1
);
questionList
.
splice
(
index
,
0
,
item
[
0
]);
this
.
setState
({
formData
:
{
...
formData
,
questionList
,
},
});
};
render
()
{
const
formItemLayout
=
{
labelCol
:
{
span
:
2
},
wrapperCol
:
{
span
:
10
},
};
// 移除已选题目
handleDelItem
=
(
delId
)
=>
{
const
{
formData
}
=
this
.
state
;
this
.
setState
({
formData
:
{
...
formData
,
questionList
:
[...
formData
.
questionList
].
filter
(
(
item
)
=>
item
.
id
!==
delId
),
},
});
};
// 保存题目
saveExaminationPaper
=
(
totalScore
)
=>
{
const
{
questionList
}
=
this
.
state
.
formData
;
let
_questionList
=
[];
questionList
.
forEach
((
item
,
index
)
=>
{
_questionList
.
push
({
categoryId
:
item
.
categoryId
,
portionScore
:
item
.
portionScore
||
0
,
questionId
:
item
.
id
,
questionType
:
item
.
questionType
,
score
:
item
.
score
||
2
,
sort
:
index
,
});
});
console
.
log
(
this
.
state
);
// try {
// await this.formRef.current.validateFields();
// } catch (e) {
// console.log(e);
// }
};
// 表头设置
parseColumns
=
()
=>
{
const
{
formData
}
=
this
.
state
;
const
columns
=
[
{
title
:
"序号"
,
...
...
@@ -121,7 +159,7 @@ class NewExaminationPaper extends Component {
},
{
title
:
"题型"
,
dataIndex
:
"questionType
Enum
"
,
dataIndex
:
"questionType"
,
width
:
"16%"
,
filters
:
[
{
...
...
@@ -146,8 +184,8 @@ class NewExaminationPaper extends Component {
},
],
filterMultiple
:
false
,
onFilter
:
(
value
,
record
)
=>
record
.
questionType
Enum
.
indexOf
(
value
)
===
0
,
render
:
(
val
)
=>
questionTypeEnum
[
val
]
onFilter
:
(
value
,
record
)
=>
record
.
questionType
.
indexOf
(
value
)
===
0
,
render
:
(
val
)
=>
questionTypeEnum
[
val
]
,
},
{
title
:
"题目"
,
...
...
@@ -175,54 +213,173 @@ class NewExaminationPaper extends Component {
},
},
{
title
:
"分值"
,
title
:
(
<
Tooltip
title=
"多选题和填空题的漏选/半对得分不能高于题目本身分值"
>
分值
</
Tooltip
>
),
dataIndex
:
"score"
,
width
:
"12%"
,
render
:
(
val
)
=>
{
return
<
InputNumber
min=
{
1
}
max=
{
100
}
defaultValue=
{
2
}
/>;
render
:
(
val
,
record
,
index
)
=>
{
return
(
<
InputNumber
min=
{
1
}
max=
{
100
}
value=
{
record
.
score
||
2
}
onChange=
{
(
value
)
=>
{
const
_questionList
=
[...
formData
.
questionList
];
this
.
setState
({
formData
:
{
...
formData
,
questionList
:
_questionList
.
map
((
item
)
=>
item
.
id
===
record
.
id
?
{
...
item
,
score
:
value
}
:
item
),
},
});
}
}
/>
);
},
},
{
dataIndex
:
"
extra
Score"
,
dataIndex
:
"
portion
Score"
,
width
:
"18%"
,
render
:
(
val
)
=>
{
render
:
(
val
,
record
,
index
)
=>
{
return
(
<
div
>
漏选得
<
InputNumber
defaultValue=
{
0
}
/>
</
div
>
[
"MULTI_CHOICE"
,
"GAP_FILLING"
,
"INDEFINITE_CHOICE"
].
includes
(
record
.
questionType
)
&&
(
<
div
>
{
record
.
questionType
===
"GAP_FILLING"
?
(
<
span
>
漏选得
</
span
>
)
:
(
<
span
>
半对得
</
span
>
)
}{
" "
}
<
InputNumber
min=
{
0
}
max=
{
record
.
score
}
value=
{
record
.
portionScore
||
0
}
onChange=
{
(
value
)
=>
{
const
_questionList
=
[...
formData
.
questionList
];
this
.
setState
({
formData
:
{
...
formData
,
questionList
:
_questionList
.
map
((
item
)
=>
item
.
id
===
record
.
id
?
{
...
item
,
portionScore
:
value
}
:
item
),
},
});
}
}
/>
</
div
>
)
);
},
},
{
title
:
"操作"
,
dataIndex
:
"operate"
,
width
:
"10%"
,
render
:
(
val
,
record
)
=>
<
span
>
移除
</
span
>,
width
:
"16%"
,
render
:
(
val
,
record
,
index
)
=>
{
return
(
<
div
className=
"record-operate"
>
<
div
className=
{
index
>
0
?
"record-operate__item"
:
"record-operate__ban"
}
onClick=
{
()
=>
{
this
.
handleMoveItem
(
index
,
-
1
);
}
}
>
上移
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
div
className=
{
index
<
formData
.
questionList
.
length
-
1
?
"record-operate__item"
:
"record-operate__ban"
}
onClick=
{
()
=>
{
this
.
handleMoveItem
(
index
,
1
);
}
}
>
下移
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
div
className=
"record-operate__item"
onClick=
{
()
=>
{
this
.
handleDelItem
(
record
.
id
);
}
}
>
移除
</
div
>
</
div
>
);
},
},
];
const
{
selectQuestionModal
,
questionData
,
examinationPaperName
,
passScore
=
60
,
questionList
=
[],
}
=
this
.
state
;
return
columns
;
};
render
()
{
const
formItemLayout
=
{
labelCol
:
{
span
:
2
},
wrapperCol
:
{
span
:
22
},
};
const
{
totalScore
=
0
,
totalCount
=
0
,
singleCount
=
0
,
singleScore
=
0
,
multiCount
=
0
,
multiScore
=
0
,
judgeCount
=
0
,
judgeScore
=
0
,
gapCount
=
0
,
gapScore
=
0
,
indefiniteCount
=
0
,
indefiniteScore
=
0
,
}
=
questionData
;
const
{
selectQuestionModal
,
formData
}
=
this
.
state
;
const
{
paperName
,
passRate
,
questionList
}
=
formData
;
const
singleQuestion
=
_
.
filter
(
questionList
,
(
item
)
=>
item
.
questionType
===
"SINGLE_CHOICE"
);
const
multiQuestion
=
_
.
filter
(
questionList
,
(
item
)
=>
item
.
questionType
===
"MULTI_CHOICE"
);
const
judgeQuestion
=
_
.
filter
(
questionList
,
(
item
)
=>
item
.
questionType
===
"JUDGE"
);
const
gapQuestion
=
_
.
filter
(
questionList
,
(
item
)
=>
item
.
questionType
===
"GAP_FILLING"
);
const
indefiniteQuestion
=
_
.
filter
(
questionList
,
(
item
)
=>
item
.
questionType
===
"INDEFINITE_CHOICE"
);
const
totalCount
=
questionList
.
length
;
const
singleCount
=
singleQuestion
.
length
;
const
multiCount
=
multiQuestion
.
length
;
const
judgeCount
=
judgeQuestion
.
length
;
const
gapCount
=
gapQuestion
.
length
;
const
indefiniteCount
=
indefiniteQuestion
.
length
;
const
totalScore
=
questionList
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
const
singleScore
=
singleQuestion
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
const
multiScore
=
multiQuestion
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
const
judgeScore
=
judgeQuestion
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
const
gapScore
=
gapQuestion
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
const
indefiniteScore
=
indefiniteQuestion
.
reduce
((
prev
,
cur
)
=>
{
return
prev
+
Number
(
cur
.
score
)
||
0
;
},
0
);
return
(
<
div
className=
"page new-examination-paper"
>
...
...
@@ -234,11 +391,10 @@ class NewExaminationPaper extends Component {
<
Form
ref=
{
this
.
formRef
}
{
...
formItemLayout
}
style=
{
{
width
:
1020
,
marginTop
:
32
}
}
style=
{
{
marginTop
:
32
}
}
>
<
h1
style=
{
{
fontSize
:
16
}
}
>
基本信息
</
h1
>
<
Form
.
Item
name=
"
examinationP
aperName"
name=
"
p
aperName"
label=
"试卷名称:"
required
rules=
{
[
...
...
@@ -246,39 +402,34 @@ class NewExaminationPaper extends Component {
required
:
true
,
message
:
"请输入试卷名称"
,
},
// (
{
getFieldValue
})
=>
({
// validator(_, value)
{
// if (_that.checkExistPaperName( value))
{
// return Promise.reject("该试卷名称已存在");
//
}
else
{
// return Promise.resolve();
//
}
//
},
//
}),
]
}
>
<
Input
value=
{
examinationP
aperName
}
value=
{
p
aperName
}
autoComplete=
"off"
maxLength=
{
40
}
placeholder=
"请输入试卷名称(40字以内)"
onChange=
{
(
e
)
=>
{
this
.
setState
({
paperName
:
e
.
target
.
value
.
trim
()
});
}
}
/>
</
Form
.
Item
>
<
div
style=
{
{
display
:
"flex"
,
justifyContent
:
"space-between"
,
marginTop
:
32
,
}
}
>
<
h1
style=
{
{
fontSize
:
16
}
}
>
题目管理
</
h1
>
<
Button
icon=
{
<
PlusOutlined
/>
}
onClick=
{
this
.
chooseQuestion
}
>
自选题目
</
Button
>
</
div
>
<
div
style=
{
{
margin
:
"10px 0 20px"
}
}
>
总计
{
totalScore
}
分,共
{
totalCount
}
题。 单选题
{
singleCount
}
题,共
{
singleScore
}
分;多选题
{
multiCount
}
题,共
{
multiScore
}
分;判断题
{
judgeCount
}
题,共
{
judgeScore
}
分,填空题
{
gapCount
}
题,共
{
gapScore
}
分,不定项选择题
{
indefiniteCount
}
题,共
{
indefiniteScore
}
分
</
div
>
<
Form
.
Item
label=
"及格线:"
required
>
<
div
>
<
Form
.
Item
noStyle
initialValue=
{
60
}
name=
"pass
Scor
e"
name=
"pass
Rat
e"
rules=
{
[
({
getFieldValue
})
=>
({
validator
(
_
,
value
)
{
...
...
@@ -294,23 +445,47 @@ class NewExaminationPaper extends Component {
<
InputNumber
min=
{
1
}
max=
{
100
}
value=
{
pass
Scor
e
}
on
Change=
{
(
valu
e
)
=>
{
value=
{
pass
Rat
e
}
on
Blur=
{
(
e
)
=>
{
this
.
setState
({
passScore
:
value
,
formData
:
{
...
formData
,
passRate
:
e
.
target
.
value
,
},
});
}
}
/>
</
Form
.
Item
>
{
" "
}
%
<
span
style=
{
{
marginLeft
:
20
}
}
>
总分(0)*及格线(
{
passScore
||
0
}
%)=及格分数(0)
总分(
{
totalScore
}
)*及格线(
{
passRate
||
0
}
%)=及格分数(
{
Math
.
round
(
totalScore
*
passRate
*
0.01
)
}
)
</
span
>
</
div
>
</
Form
.
Item
>
<
Button
icon=
{
<
PlusOutlined
/>
}
onClick=
{
this
.
chooseQuestion
}
>
自选题目
</
Button
>
<
div
style=
{
{
margin
:
"10px 0 20px"
}
}
>
总计
{
totalScore
}
分,共
{
totalCount
}
题。
{
" "
}
{
singleCount
>
0
&&
`单选题${singleCount}题,共
${singleScore}分;`
}
{
multiCount
>
0
&&
`多选题${multiCount}题,共${multiScore}分;`
}
{
judgeCount
>
0
&&
`判断题
${judgeCount}题,共${judgeScore}分,`
}
{
gapCount
>
0
&&
`填空题${gapCount}题,共${gapScore}
分,`
}
{
indefiniteCount
>
0
&&
`不定项选择题${indefiniteCount}题,共${indefiniteScore}分`
}
</
div
>
<
ConfigProvider
renderEmpty=
{
this
.
customizeRenderEmpty
}
>
<
Table
columns=
{
columns
}
columns=
{
this
.
parseColumns
()
}
dataSource=
{
questionList
}
pagination=
{
false
}
/>
...
...
@@ -320,7 +495,10 @@ class NewExaminationPaper extends Component {
<
div
className=
"footer"
>
<
Button
>
取消
</
Button
>
<
Button
>
预览
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
saveExaminationPaper
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
this
.
saveExaminationPaper
(
totalScore
)
}
>
保存
</
Button
>
</
div
>
...
...
src/modules/teach-tool/examination-paper/NewExaminationPaper.less
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 13:52:01
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 19:34:05
* @LastEditTime: 2021-03-3
1 16:06:32
* @Description: 助学工具-新建试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -13,6 +13,23 @@
.ant-tabs {
color: #666666;
}
.record-operate {
display: flex;
&__item {
color: #5289fa;
cursor: pointer;
&.split {
margin: 0 8px;
color: #bfbfbf;
}
}
&__ban {
color: gray;
pointer-events: none;
}
}
}
.footer {
...
...
src/modules/teach-tool/examination-paper/modal/SelectQuestionModal.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-29 10:52:26
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 19:17:30
* @LastEditTime: 2021-03-3
1 19:15:49
* @Description: 助学工具-新建试卷-选择题目弹窗
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -34,11 +34,22 @@ class SelectQuestionModal extends Component {
title=
"选择题目"
visible=
{
true
}
width=
{
1200
}
onOk=
{
()
=>
onOk=
{
()
=>
{
this
.
props
.
setSelectedQuestion
(
this
.
listRef
.
current
.
state
.
selectQuestionKeys
)
}
this
.
listRef
.
current
.
state
.
selectQuestionKeys
.
map
((
item
)
=>
{
item
.
questionType
=
item
.
questionTypeEnum
;
item
.
score
=
2
;
if
(
[
"MULTI_CHOICE"
,
"GAP_FILLING"
,
"INDEFINITE_CHOICE"
].
includes
(
item
.
questionTypeEnum
)
)
{
item
.
portionScore
=
0
;
}
return
item
;
})
);
}
}
onCancel=
{
this
.
props
.
close
}
className=
"select-question-modal"
>
...
...
@@ -48,14 +59,13 @@ class SelectQuestionModal extends Component {
>
<
div
className=
"sider"
>
<
CourseCategorySiderTree
fromModule=
"
modal
"
fromModule=
"
PAPER_MODAL
"
getSelectedCategoryId=
{
this
.
getCategoryIdFromSider
.
bind
(
this
)
}
/>
</
div
>
</
div
>
<
div
className=
"content"
>
<
SelectQuestionContent
fromModule=
"modal"
ref=
{
this
.
listRef
}
selectedCategoryId=
{
this
.
state
.
selectedCategoryId
}
/>
...
...
src/modules/teach-tool/modal/NewEditCourseCategoryModal.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-22 17:51:28
* @LastEditors: yuananting
* @LastEditTime: 2021-03-
29 19:37:0
3
* @LastEditTime: 2021-03-
31 18:33:2
3
* @Description: 助学工具-新建编辑课程分类模态框
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -28,6 +28,8 @@ class NewEditCourseCategoryModal extends Component {
// 查询分类树
queryCategoryTree
=
()
=>
{
let
query
=
{
bizType
:
"QUESTION"
,
count
:
false
,
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
...
...
src/modules/teach-tool/question-bank/QuestionBankIndex.jsx
View file @
4898b7f5
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-21 17:51:01
* @LastEditors: yuananting
* @LastEditTime: 2021-03-3
0 16:08:58
* @LastEditTime: 2021-03-3
1 19:15:27
* @Description: 助学工具-题库-题库主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -37,7 +37,7 @@ class QuestionBankIndex extends Component {
>
<
div
className=
"sider"
>
<
CourseCategorySiderTree
fromModule=
"
index
"
fromModule=
"
QUESTION_INDEX
"
getSelectedCategoryId=
{
this
.
getCategoryIdFromSider
.
bind
(
this
)
}
currentTotal=
{
this
.
state
.
currentTotal
}
updatedCategoryId=
{
this
.
state
.
updatedCategoryId
}
...
...
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