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
c1bb4780
Commit
c1bb4780
authored
Apr 06, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:试卷接口联调完成
parent
6e01f9ee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
184 additions
and
110 deletions
+184
-110
src/data-source/aidTool/request-apis.ts
+6
-1
src/domains/aid-tool-domain/AidToolService.ts
+9
-2
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+79
-35
src/modules/teach-tool/paper-manage/components/PaperList.jsx
+88
-70
src/modules/teach-tool/question-manage/components/QuestionList.jsx
+2
-2
No files found.
src/data-source/aidTool/request-apis.ts
View file @
c1bb4780
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-03 15:13:12
* @LastEditors: yuananting
* @LastEditTime: 2021-04-0
2 14:12:49
* @LastEditTime: 2021-04-0
6 10:44:47
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -75,4 +75,8 @@ export function viewPaper(params: object) {
export
function
editPaper
(
params
:
object
)
{
return
Service
.
Hades
(
"public/hades/editPaper"
,
params
);
}
export
function
batchQueryQuestionDetails
(
params
:
object
)
{
return
Service
.
Hades
(
"public/hades/batchQueryQuestionDetails"
,
params
);
}
\ No newline at end of file
src/domains/aid-tool-domain/AidToolService.ts
View file @
c1bb4780
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-11 11:34:37
* @LastEditors: yuananting
* @LastEditTime: 2021-04-0
2 14:14:06
* @LastEditTime: 2021-04-0
6 10:44:18
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -23,7 +23,8 @@ import {
deletePaper
,
queryPaperDetail
,
viewPaper
,
editPaper
editPaper
,
batchQueryQuestionDetails
,
}
from
'@/data-source/aidTool/request-apis'
;
export
default
class
AidToolService
{
// 获取题目分类树
...
...
@@ -110,4 +111,9 @@ export default class AidToolService {
static
editPaper
(
params
:
any
)
{
return
editPaper
(
params
);
}
// 操作试卷-预览查询多题目信息
static
batchQueryQuestionDetails
(
params
:
any
)
{
return
batchQueryQuestionDetails
(
params
);
}
}
\ No newline at end of file
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
c1bb4780
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors: yuananting
* @LastEditTime: 2021-04-0
2 17:23:23
* @LastEditTime: 2021-04-0
6 14:03:49
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -78,36 +78,40 @@ class OperatePaper extends Component {
this
.
setState
({
currentOperate
:
"new"
,
currentNav
:
"新建试卷"
});
break
;
case
"edit"
:
this
.
setState
({
currentOperate
:
"edit"
,
currentNav
:
"编辑试卷"
},
()
=>
this
.
queryPaperDetail
());
this
.
setState
({
currentOperate
:
"edit"
,
currentNav
:
"编辑试卷"
},
()
=>
this
.
queryPaperDetail
()
);
break
;
case
"copy"
:
this
.
setState
({
currentOperate
:
"copy"
,
currentNav
:
"复制试卷"
},
()
=>
this
.
queryPaperDetail
());
this
.
setState
({
currentOperate
:
"copy"
,
currentNav
:
"复制试卷"
},
()
=>
this
.
queryPaperDetail
()
);
break
;
}
}
// 获取当前分类下的所有试卷
queryCurrentCategoryPapers
=
()
=>
{
const
categoryId
=
getParameterByName
(
"categoryId"
);
let
params
=
{
current
:
1
,
size
:
9999
,
categoryId
:
getParameterByName
(
"categoryId"
),
// 当前题库分类Id
categoryId
:
categoryId
===
"null"
?
null
:
categoryId
,
paperName
:
null
,
// 试卷名称
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
}
}
;
AidToolService
.
queryPaperPageList
(
params
).
then
((
res
)
=>
{
const
{
records
=
[]
}
=
res
.
result
;
this
.
setState
({
currentCategoryPapers
:
records
})
this
.
setState
({
currentCategoryPapers
:
records
})
;
});
};
// 编辑/复制试卷时获取相应试卷详情
queryPaperDetail
=
()
=>
{
const
{
currentOperate
,
formData
}
=
this
.
state
;
const
{
currentOperate
}
=
this
.
state
;
let
query
=
{
categoryId
:
getParameterByName
(
"categoryId"
),
paperId
:
getParameterByName
(
"paperId"
),
source
:
0
,
userId
:
User
.
getStoreUserId
(),
...
...
@@ -118,10 +122,14 @@ class OperatePaper extends Component {
const
{
paperName
,
passRate
}
=
result
;
this
.
setState
(
{
selectQuestionList
:
result
.
questionList
.
sort
((
a
,
b
)
=>
b
.
updateTime
-
a
.
updateTime
),
formData
:
{
selectQuestionList
:
result
.
questionList
.
sort
(
(
a
,
b
)
=>
b
.
updateTime
-
a
.
updateTime
),
formData
:
{
...
result
,
paperName
:
currentOperate
===
"copy"
?
paperName
+
"(复制)"
:
paperName
,
}
paperName
:
currentOperate
===
"copy"
?
paperName
+
"(复制)"
:
paperName
,
},
},
()
=>
{
this
.
formRef
.
current
.
setFieldsValue
({
...
...
@@ -270,13 +278,16 @@ class OperatePaper extends Component {
result
=
item
;
}
}
else
if
(
currentOperate
===
"edit"
)
{
if
(
item
.
paperName
===
paperName
&&
item
.
paperId
!==
getParameterByName
(
"paperId"
))
{
if
(
item
.
paperName
===
paperName
&&
item
.
paperId
!==
getParameterByName
(
"paperId"
)
)
{
result
=
item
;
}
}
});
return
result
;
}
}
;
// 保存试卷
savePaper
=
async
()
=>
{
...
...
@@ -305,9 +316,13 @@ class OperatePaper extends Component {
if
([
"new"
,
"copy"
].
includes
(
currentOperate
))
{
AidToolService
.
createPaper
(
this
.
state
.
formData
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
currentOperate
===
"new"
?
"新建成功"
:
"复制成功"
);
message
.
success
(
currentOperate
===
"new"
?
"新建成功"
:
"复制成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
});
}
});
...
...
@@ -319,7 +334,9 @@ class OperatePaper extends Component {
if
(
res
.
success
)
{
message
.
success
(
"编辑成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
});
}
});
...
...
@@ -334,23 +351,42 @@ class OperatePaper extends Component {
// 预览试卷
previewPaper
=
()
=>
{
const
{
selectQuestionList
,
formData
}
=
this
.
state
;
selectQuestionList
.
map
((
item
,
index
)
=>
{
item
.
sort
=
index
return
item
})
const
m
=
(
<
PaperPreviewModal
previewPage=
"paper-operate"
paperInfo=
{
{
...
formData
,
questionList
:
selectQuestionList
}
}
close=
{
()
=>
{
this
.
setState
({
paperPreviewModal
:
null
,
});
}
}
/>
);
this
.
setState
({
paperPreviewModal
:
m
});
}
const
questionIdList
=
selectQuestionList
.
map
((
item
)
=>
{
return
item
.
questionId
;
});
let
param
=
{
questionIdList
,
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
};
AidToolService
.
batchQueryQuestionDetails
(
param
).
then
((
res
)
=>
{
const
{
result
=
[]
}
=
res
;
result
.
map
((
item
)
=>
{
selectQuestionList
.
map
((
selectItem
)
=>
{
if
(
item
.
id
===
selectItem
.
questionId
)
{
item
.
questionId
=
item
.
id
;
item
.
questionType
=
item
.
questionTypeEnum
;
item
.
score
=
selectItem
.
score
||
2
;
item
.
portionScore
=
selectItem
.
portionScore
||
0
;
}
});
return
item
;
});
const
m
=
(
<
PaperPreviewModal
previewPage=
"paper-operate"
paperInfo=
{
{
...
formData
,
questionList
:
res
.
result
}
}
close=
{
()
=>
{
this
.
setState
({
paperPreviewModal
:
null
,
});
}
}
/>
);
this
.
setState
({
paperPreviewModal
:
m
});
});
};
// 取消/返回
handleGoBack
=
()
=>
{
...
...
@@ -364,7 +400,9 @@ class OperatePaper extends Component {
),
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
});
},
});
...
...
@@ -557,7 +595,13 @@ class OperatePaper extends Component {
labelCol
:
{
span
:
2
},
wrapperCol
:
{
span
:
22
},
};
const
{
selectQuestionModal
,
paperPreviewModal
,
selectQuestionList
,
currentNav
,
formData
}
=
this
.
state
;
const
{
selectQuestionModal
,
paperPreviewModal
,
selectQuestionList
,
currentNav
,
formData
,
}
=
this
.
state
;
const
{
singleChoiceCnt
,
multiChoiceCnt
,
...
...
src/modules/teach-tool/paper-manage/components/PaperList.jsx
View file @
c1bb4780
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-04-0
1 15:06:37
* @LastEditTime: 2021-04-0
6 14:36:06
* @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -99,47 +99,58 @@ class PaperList extends Component {
// 编辑试卷
editPaper
=
(
record
)
=>
{
const
{
categoryId
}
=
this
.
state
.
query
;
window
.
RCHistory
.
push
({
pathname
:
`/paper-operate-page/operate?type=edit&paperId=
${
record
.
paperId
}
&categoryId=
${
categoryId
}
`
,
});
if
(
record
.
relatedExam
===
0
)
{
const
{
categoryId
}
=
this
.
state
.
query
;
window
.
RCHistory
.
push
({
pathname
:
`/paper-operate-page/operate?type=edit&paperId=
${
record
.
paperId
}
&categoryId=
${
categoryId
}
`
,
});
}
else
{
return
Modal
.
info
({
title
:
"无法编辑"
,
icon
:
(
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
content
:
"该试卷已被考试采用,无法继续编辑。如需修改,请复制一份进行修改。"
,
okText
:
"我知道了"
,
});
}
};
// 删除试卷
deletePaper
(
record
)
{
return
Modal
.
confirm
({
title
:
"提示"
,
content
:
"确定要删除此试卷吗?"
,
icon
:
(
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
okText
:
"删除"
,
cancelText
:
"取消"
,
onOk
:
()
=>
{
let
params
=
{
categoryId
:
this
.
state
.
query
.
categoryId
,
paperId
:
record
.
paperId
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
};
AidToolService
.
deletePaper
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
"删除成功"
);
const
{
query
,
total
}
=
this
.
state
;
const
{
size
,
current
}
=
query
;
const
_query
=
query
;
if
(
total
/
size
<
current
)
{
if
(
total
%
size
===
1
)
{
_query
.
current
=
1
;
}
deletePaper
=
(
record
)
=>
{
if
(
record
.
relatedExam
===
0
)
{
let
params
=
{
paperId
:
record
.
paperId
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
};
AidToolService
.
deletePaper
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
"删除成功"
);
const
{
query
,
total
}
=
this
.
state
;
const
{
size
,
current
}
=
query
;
const
_query
=
query
;
if
(
total
/
size
<
current
)
{
if
(
total
%
size
===
1
)
{
_query
.
current
=
1
;
}
this
.
setState
({
query
:
_query
},
()
=>
this
.
queryPaperPageList
());
}
});
},
});
}
this
.
setState
({
query
:
_query
},
()
=>
this
.
queryPaperPageList
());
}
});
}
else
{
return
Modal
.
info
({
title
:
"删除试卷"
,
content
:
"该试卷已被考试采用,无法删除。"
,
icon
:
(
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
okText
:
"我知道了"
,
});
}
};
// 自定义表格空状态
customizeRenderEmpty
=
()
=>
{
...
...
@@ -200,17 +211,16 @@ class PaperList extends Component {
title
:
"题目数量"
,
key
:
"questionCnt"
,
dataIndex
:
"questionCnt"
,
},
{
title
:
"关联考试数"
,
key
:
"relatedExam"
,
dataIndex
:
"relatedExam"
,
},
];
if
((
this
.
props
.
type
!==
'modal-select'
))
{
if
(
this
.
props
.
type
!==
"modal-select"
)
{
const
isPermiss
=
[
"CloudManager"
,
"StoreManager"
].
includes
(
User
.
getUserRole
());
columns
.
push
({
title
:
"操作"
,
key
:
"operate"
,
...
...
@@ -225,21 +235,21 @@ class PaperList extends Component {
>
预览
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
div
{
isPermiss
&&
<
span
className=
"record-operate__item split"
>
|
</
span
>
}
{
isPermiss
&&
<
div
className=
"record-operate__item"
onClick=
{
()
=>
this
.
copyPaper
(
record
)
}
>
复制
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
Dropdown
overlay=
{
this
.
initDropMenu
(
record
)
}
>
</
div
>
}
{
isPermiss
&&
<
span
className=
"record-operate__item split"
>
|
</
span
>
}
{
isPermiss
&&
<
Dropdown
overlay=
{
this
.
initDropMenu
(
record
)
}
>
<
div
className=
"record-operate__item"
>
更多
</
div
>
</
Dropdown
>
</
Dropdown
>
}
</
div
>
);
},
})
})
;
}
return
columns
;
};
...
...
@@ -270,20 +280,26 @@ class PaperList extends Component {
onSelectChange
=
(
selectedRowKeys
,
selectedRows
)
=>
{
this
.
setState
({
selectedRowKeys
})
this
.
props
.
onSelect
(
selectedRows
[
0
]
||
{})
}
selectedRowKeys
,
})
;
this
.
props
.
onSelect
(
selectedRows
[
0
]
||
{})
;
}
;
render
()
{
const
{
dataSource
=
[],
total
,
query
,
paperPreviewModal
,
selectedRowKeys
}
=
this
.
state
;
const
{
dataSource
=
[],
total
,
query
,
paperPreviewModal
,
selectedRowKeys
,
}
=
this
.
state
;
const
{
current
,
size
,
categoryId
,
paperName
}
=
query
;
const
rowSelection
=
{
type
:
'radio'
,
type
:
"radio"
,
selectedRowKeys
,
onChange
:
this
.
onSelectChange
,
};
const
isPermiss
=
[
"CloudManager"
,
"StoreManager"
].
includes
(
User
.
getUserRole
())
return
(
<
div
className=
{
"paper-list "
+
this
.
props
.
type
}
>
...
...
@@ -314,8 +330,9 @@ class PaperList extends Component {
</
div
>
</
Row
>
</
div
>
{
(
this
.
props
.
type
!==
'modal-select'
)
&&
<
Button
{
this
.
props
.
type
!==
"modal-select"
&&
isPermiss
&&
categoryId
&&
(
<
Button
type=
"primary"
onClick=
{
()
=>
{
window
.
RCHistory
.
push
({
...
...
@@ -324,24 +341,26 @@ class PaperList extends Component {
}
}
>
新建试卷
</
Button
>
}
</
Button
>
)
}
<
div
className=
"paper-list-content"
>
<
ConfigProvider
renderEmpty=
{
this
.
customizeRenderEmpty
}
>
{
(
this
.
props
.
type
!==
'modal-select'
)
?
<
Table
rowKey=
{
(
record
)
=>
record
.
id
}
dataSource=
{
dataSource
}
columns=
{
this
.
parseColumns
()
}
pagination=
{
false
}
bordered
onChange=
{
this
.
handleChangeTable
}
/>
:
{
this
.
props
.
type
!==
"modal-select"
?
(
<
Table
rowKey=
{
(
record
)
=>
record
.
id
}
dataSource=
{
dataSource
}
columns=
{
this
.
parseColumns
()
}
pagination=
{
false
}
bordered
onChange=
{
this
.
handleChangeTable
}
/>
)
:
(
<
Table
rowKey=
{
(
record
)
=>
record
.
id
}
dataSource=
{
dataSource
}
rowKey=
{
(
item
)
=>
{
return
item
.
paperId
return
item
.
paperId
;
}
}
rowSelection=
{
rowSelection
}
columns=
{
this
.
parseColumns
()
}
...
...
@@ -349,7 +368,7 @@ class PaperList extends Component {
bordered
onChange=
{
this
.
handleChangeTable
}
/>
}
)
}
</
ConfigProvider
>
{
total
>
0
&&
(
...
...
@@ -376,4 +395,4 @@ class PaperList extends Component {
}
}
export
default
PaperList
;
\ No newline at end of file
export
default
PaperList
;
src/modules/teach-tool/question-manage/components/QuestionList.jsx
View file @
c1bb4780
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-04-0
1 13:47:54
* @LastEditTime: 2021-04-0
6 13:43:08
* @Description: 助学工具-题库-题目列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -117,7 +117,7 @@ class QuestionList extends Component {
const
_query
=
{
...
this
.
state
.
query
,
current
:
1
,
order
:
"
ACCURACY
_DESC"
,
// 排序规则
order
:
"
UPDATED
_DESC"
,
// 排序规则
questionName
:
null
,
// 题目名称
questionType
:
null
,
// 题目类型
};
...
...
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