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
51719bb9
Commit
51719bb9
authored
Apr 07, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'fix;
parent
6a156684
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
168 additions
and
31 deletions
+168
-31
package-lock.json
+0
-0
src/modules/teach-tool/examination-manager/AddExam.tsx
+65
-11
src/modules/teach-tool/examination-manager/DataAnalysic.tsx
+15
-0
src/modules/teach-tool/examination-manager/Index.tsx
+84
-20
src/modules/teach-tool/examination-manager/dataAnalysic.less
+4
-0
No files found.
package-lock.json
deleted
100644 → 0
View file @
6a156684
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
51719bb9
...
...
@@ -32,11 +32,19 @@ function AddExam(props: any) {
const
[
passScore
,
setPassScore
]
=
useState
(
100
);
const
[
desclen
,
setDescLen
]
=
useState
(
0
);
const
[
check
,
setCheck
]
=
useState
(
false
);
const
timer
=
useRef
({});
const
request
=
useRef
(
false
);
const
{
match
}
=
props
;
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
useEffect
(()
=>
{
if
(
props
.
type
===
'edit'
)
{
queryExamDetail
()
}
},
[])
const
[
examDuration
,
setExamDuration
]
=
useState
(
0
);
useEffect
(()
=>
{
console
.
log
(
paperInfo
)
setPaperId
(
paperInfo
.
paperId
)
setPassRate
(
paperInfo
.
passScore
)
...
...
@@ -52,15 +60,44 @@ function AddExam(props: any) {
return
current
&&
current
<
moment
().
startOf
(
'day'
);
}
function
queryExamDetail
()
{
Service
.
Hades
(
"public/hades/queryExamDetail"
,
{
examId
:
match
.
params
.
id
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
}).
then
((
res
)
=>
{
const
{
result
}
=
res
setPaperInfo
(
result
.
examPaper
)
setPaperId
(
result
.
examPaper
.
paperId
)
setStartTime
(
result
.
examStartTime
)
setExamEndTime
(
result
.
examEndTime
)
setExamName
(
result
.
examName
)
setPassRate
(
result
.
passRate
*
100
)
setNeedPhone
(
result
.
needPhone
)
setExamDesc
(
result
.
examDesc
)
setExamDuration
(
result
.
examDuration
)
setAnswerAnalysis
(
result
.
answerAnalysis
)
setNeedOptionDisorder
(
result
.
needOptionDisorder
)
setPassScore
(
result
.
passScore
)
setResultContent
(
result
.
resultContent
)
setResultShow
(
result
.
resultShow
)
})
}
function
handleSave
()
{
if
(
request
.
current
)
{
return
}
setCheck
(
true
);
const
param
=
{
paperId
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
examName
,
passRate
,
passRate
:
passRate
/
100
,
examStartTime
,
examEndTime
,
examDesc
,
...
...
@@ -72,7 +109,9 @@ function AddExam(props: any) {
examDuration
,
passScore
,
tenantId
:
User
.
getStoreId
(),
source
:
0
userId
:
User
.
getStoreUserId
(),
source
:
0
,
examId
:
''
}
if
(
!
param
.
examName
)
{
...
...
@@ -106,13 +145,30 @@ function AddExam(props: any) {
}
if
(
examStartTime
+
(
examDuration
as
any
)
*
60
*
1000
>
examEndTime
)
{
message
.
warning
(
'考试时长不得超过考试有效期时长'
);
return
}
if
(
desclen
>
1000
)
{
message
.
warning
(
'内容过长,不能超过1000字'
);
return
}
Service
.
Hades
(
"public/hades/createExam"
,
param
).
then
((
res
)
=>
{
message
.
success
(
'创建成功'
);
request
.
current
=
true
;
setTimeout
(()
=>
{
request
.
current
=
false
},
2000
)
if
(
props
.
type
===
'edit'
)
{
param
.
examId
=
match
.
params
.
id
;
}
Service
.
Hades
(
props
.
type
===
'edit'
?
'public/hades/editExam'
:
"public/hades/createExam"
,
param
).
then
((
res
)
=>
{
message
.
success
(
props
.
type
===
'edit'
?
'编辑成功'
:
'创建成功'
);
props
.
freshList
()
props
.
history
.
goBack
();
})
}
...
...
@@ -181,7 +237,6 @@ function AddExam(props: any) {
required
>
<
Input
placeholder=
'请输入试卷名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
console
.
log
(
e
.
target
.
value
)
setExamName
(
e
.
target
.
value
)
}
}
style=
{
{
width
:
300
}
}
/>
</
Form
.
Item
>
...
...
@@ -273,9 +328,9 @@ function AddExam(props: any) {
{
` 时长不能超过1440分钟(24小时)`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试说明"
required
>
<
Form
.
Item
label=
"考试说明"
>
<
GraphicsEditor
maxLimit=
{
1000
}
isIntro=
{
true
}
detail=
{
{
content
:
examDesc
...
...
@@ -340,14 +395,13 @@ function AddExam(props: any) {
</
div
>
{
showModal
&&
<
SelectPaperModal
onSelect=
{
(
info
:
any
)
=>
{
console
.
log
(
info
,
'jkhjkhjk'
)
setPaperInfo
(
info
)
}
}
paperInfo=
{
paperInfo
}
close=
{
()
=>
{
setShowModal
(
false
)
}
}
></
SelectPaperModal
>
}
<
div
className=
"footer"
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
{
}
}
>
预览
</
Button
>
<
Button
type=
"primary"
onClick=
{
_
.
debounce
(()
=>
{
handleSave
()
},
3000
,
true
)
}
>
保存
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
...
...
src/modules/teach-tool/examination-manager/DataAnalysic.tsx
0 → 100644
View file @
51719bb9
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
'./dataAnalysic.less'
function
DataAnalysic
()
{
return
<
div
className=
"page dataAnalysic"
>
</
div
>
}
export
default
withRouter
(
DataAnalysic
);
\ No newline at end of file
src/modules/teach-tool/examination-manager/Index.tsx
View file @
51719bb9
...
...
@@ -14,26 +14,52 @@ const { RangePicker } = DatePicker;
const
{
Search
}
=
Input
;
const
{
Option
}
=
Select
;
interface
sortType
{
type
:
"ascend"
|
"descend"
|
null
|
undefined
}
function
ExaminationManager
(
props
:
any
)
{
const
queryInit
:
any
=
{
examName
:
''
,
current
:
1
,
size
:
10
,
order
:
'PASS_CNT_DESC'
current
:
1
,
size
:
10
,
order
:
'EXAM_START_TIME_DESC'
}
const
sortStatus
:
sortType
=
{
type
:
undefined
}
const
examStatus
=
{
EXAM_INIT
:
'未开始'
,
EXAM_STARTED
:
'进行中'
,
EXAM_FINISHED
:
'已结束'
const
sortEnum
=
{
}
const
{
match
}
=
props
;
const
sortState
:
any
=
false
;
const
ctx
:
any
=
useContext
(
XMContext
);
console
.
log
(
ctx
)
const
[
query
,
setQuery
]
=
useState
(
queryInit
);
const
[
expandFilter
,
setExpandFilter
]
=
useState
(
false
);
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
list
,
setList
]
=
useState
([]);
const
[
field
,
setfield
]
=
useState
(
''
);
const
[
order
,
setOrder
]
=
useState
(
sortStatus
.
type
);
const
[
questionCntSort
,
setQuestionCntSort
]
=
useState
(
sortState
)
const
queryRef
=
useRef
({});
const
orderEnum
=
{
userCnt
:
{
ascend
:
'USER_CNT_ASC'
,
descend
:
'USER_CNT_DESC'
},
passCnt
:
{
ascend
:
'PASS_CNT_ASC'
,
descend
:
'PASS_CNT_DESC'
},
examCreateTime
:
{
ascend
:
'EXAM_START_TIME_ASC'
,
descend
:
'EXAM_START_TIME_DESC'
}
}
const
columns
=
[
{
...
...
@@ -41,11 +67,22 @@ function ExaminationManager(props: any) {
// fixed:'left',
// width:350,
dataIndex
:
"examName"
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
div
style=
{
{
width
:
330
}
}
>
<
div
className=
'oneLineText'
style=
{
{
width
:
330
}
}
>
{
text
}
</
div
>
<
div
>
{
moment
(
record
.
examStartTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
~
{
moment
(
record
.
examEndTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
<
div
className=
"status"
>
{
(
examStatus
as
any
)[
record
.
examState
]
}
</
div
></
div
>
<
div
>
创建人:
{
record
.
examCreator
}
</
div
>
</
div
>,
render
:
(
text
:
any
,
record
:
any
)
=>
{
var
_text
=
'未开始'
,
_color
=
'rgba(255, 183, 20, 1)'
;
if
(
moment
().
valueOf
()
>
record
.
examEndTime
)
{
_text
=
'已结束'
;
_color
=
'rgba(153, 153, 153, 1)'
;
}
else
if
(
moment
().
valueOf
()
>
record
.
examStartTime
)
{
_text
=
'进行中'
;
_color
=
'rgba(59, 189, 170, 1)'
;
}
return
<
div
style=
{
{
width
:
330
}
}
>
<
div
className=
'oneLineText'
style=
{
{
width
:
330
}
}
>
{
text
}
</
div
>
<
div
>
{
moment
(
record
.
examStartTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
~
{
moment
(
record
.
examEndTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
<
div
className=
"status"
style=
{
{
border
:
`1px solid ${_color}`
,
color
:
_color
}
}
>
{
_text
}
</
div
></
div
>
<
div
>
创建人:
{
record
.
examCreator
}
</
div
>
</
div
>
},
},
{
title
:
"考试时长"
,
...
...
@@ -66,19 +103,23 @@ function ExaminationManager(props: any) {
title
:
"参与人数"
,
dataIndex
:
"userCnt"
,
sorter
:
true
,
// sortDirections: ['USER_CNT_DESC', 'USER_CNT_ASC'],
sortOrder
:
null
,
sortOrder
:
field
===
"userCnt"
?
order
:
sortStatus
.
type
,
},
{
title
:
"及格数"
,
dataIndex
:
"userCnt"
,
dataIndex
:
"passCnt"
,
sorter
:
true
,
sortOrder
:
field
===
"passCnt"
?
order
:
sortStatus
.
type
,
},
{
title
:
"创建时间"
,
dataIndex
:
"examCreateTime"
,
sorter
:
true
,
sortOrder
:
field
===
"examCreateTime"
?
order
:
sortStatus
.
type
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
span
>
{
moment
(
text
).
format
(
"YYYY-MM-DD HH:mm"
)
}
</
span
>,
},
{
title
:
"操作"
,
...
...
@@ -124,14 +165,17 @@ function ExaminationManager(props: any) {
ctx
.
xmState
?.
userPermission
?.
AddExam
()
&&
(
moment
().
valueOf
()
<
item
.
examStartTime
)
&&
<
Menu
.
Item
key=
"0"
>
<
span
onClick=
{
()
=>
{
if
(
moment
().
valueOf
()
+
5
*
60
*
1000
<
item
.
examStartTime
)
{
if
(
moment
().
valueOf
()
+
5
*
60
*
1000
>
item
.
examStartTime
)
{
Modal
.
info
({
title
:
'无法编辑'
,
content
:
'离考试开始时间小于5分钟,为保证答题数据的准确性,不能再进行编辑了'
,
})
}
else
{
props
.
history
.
push
({
pathname
:
`${match.url}/edit/${item.examId}`
})
}
}
}
>
...
...
@@ -167,7 +211,7 @@ function ExaminationManager(props: any) {
icon
:
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>,
onOk
:
()
=>
{
Service
.
Hades
(
"public/hades/deleteExam"
,
{
"examId"
:
item
.
paper
Id
,
"examId"
:
item
.
exam
Id
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
source
:
0
...
...
@@ -196,7 +240,17 @@ function ExaminationManager(props: any) {
},
[
query
])
function
onShowSizeChange
(
current
:
any
,
size
:
any
)
{
setQuery
({
current
:
1
,
size
,
order
:
'PASS_CNT_DESC'
})
setQuery
({
current
:
1
,
size
})
}
function
onChange
(
pagination
:
any
,
filters
:
any
,
sorter
:
any
,
extra
:
any
)
{
setfield
(
sorter
.
field
);
setOrder
(
sorter
.
order
)
console
.
log
(
sorter
.
field
,
sorter
.
order
,
(
orderEnum
as
any
)[
sorter
.
field
])
let
_query
:
any
=
{
...
queryRef
.
current
};
_query
.
order
=
(
orderEnum
as
any
)[
sorter
.
field
][
sorter
.
order
]
||
'EXAM_START_TIME_DESC'
setQuery
(
_query
)
}
return
<
div
className=
"page examination-manager"
>
...
...
@@ -266,7 +320,7 @@ function ExaminationManager(props: any) {
</
div
>
<
div
className=
"reset-fold-area"
>
<
Tooltip
title=
"清空筛选"
><
span
className=
"resetBtn iconfont icon"
onClick=
{
()
=>
{
setQuery
({
current
:
1
,
size
:
10
,
order
:
'
PASS_CNT
_DESC'
});
setQuery
({
current
:
1
,
size
:
10
,
order
:
'
EXAM_START_TIME
_DESC'
});
}
}
>

</
span
></
Tooltip
>
<
span
style=
{
{
cursor
:
'pointer'
}
}
className=
"fold-btn"
onClick=
{
()
=>
{
setExpandFilter
(
!
expandFilter
)
...
...
@@ -290,10 +344,11 @@ function ExaminationManager(props: any) {
size=
"small"
columns=
{
columns
}
dataSource=
{
list
}
onChange=
{
()
=>
{
}
}
scroll=
{
{
x
:
1100
}
}
onChange=
{
onChange
}
pagination=
{
false
}
style=
{
{
margin
:
'16px 0'
}
}
>
style=
{
{
margin
:
'0px 0 16px'
}
}
>
</
Table
>
{
total
>
0
&&
<
PageControl
...
...
@@ -312,7 +367,16 @@ function ExaminationManager(props: any) {
}
</
div
>
</
div
>
<
Route
path=
{
`${match.url}/add`
}
component=
{
AddExam
}
/>
<
Route
path=
{
`${match.url}/add`
}
render=
{
()
=>
{
return
<
AddExam
freshList=
{
()
=>
{
getList
()
}
}
/>;
}
}
/>
<
Route
path=
{
`${match.url}/edit/:id`
}
render=
{
()
=>
{
return
<
AddExam
type=
'edit'
freshList=
{
()
=>
{
getList
()
}
}
/>;
}
}
/>
</
div
>
}
...
...
src/modules/teach-tool/examination-manager/dataAnalysic.less
0 → 100644
View file @
51719bb9
.dataAnalysic{
}
\ No newline at end of file
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