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
d9ac3788
Commit
d9ac3788
authored
Jul 13, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style:全局tablist 中的switch使用small尺寸
parent
2b36c514
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
917 additions
and
889 deletions
+917
-889
src/modules/course-manage/components/LiveCourseList.jsx
+2
-1
src/modules/course-manage/graphics-course/components/GraphicsCourseList.jsx
+47
-41
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
+26
-28
src/modules/course-manage/offline-course/components/AddGraphicsIntro.jsx
+92
-93
src/modules/course-manage/offline-course/components/OfflineCourseList.jsx
+8
-5
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
+112
-116
src/modules/course-manage/video-course/components/VideoCourseList.jsx
+1
-0
src/modules/plan-manage/components/BasicInfo.jsx
+14
-9
src/modules/plan-manage/components/PlanList.jsx
+1
-0
src/modules/teach-tool/examination-manager/AddExam.tsx
+550
-510
src/routes/index.tsx
+64
-86
No files found.
src/modules/course-manage/components/LiveCourseList.jsx
View file @
d9ac3788
...
@@ -125,7 +125,7 @@ class LiveCourseList extends React.Component {
...
@@ -125,7 +125,7 @@ class LiveCourseList extends React.Component {
columns
=
[
columns
=
[
{
{
title
:
'直播课'
,
title
:
'直播课'
,
width
:
'23%'
,
key
:
'course'
,
key
:
'course'
,
fixed
:
'left'
,
fixed
:
'left'
,
dataIndex
:
'courseName'
,
dataIndex
:
'courseName'
,
...
@@ -284,6 +284,7 @@ class LiveCourseList extends React.Component {
...
@@ -284,6 +284,7 @@ class LiveCourseList extends React.Component {
render
:
(
val
,
item
,
index
)
=>
{
render
:
(
val
,
item
,
index
)
=>
{
return
(
return
(
<
Switch
<
Switch
size=
'small'
checked=
{
item
.
shelfState
===
'YES'
}
checked=
{
item
.
shelfState
===
'YES'
}
defaultChecked=
{
item
.
shelfState
===
'YES'
?
true
:
false
}
defaultChecked=
{
item
.
shelfState
===
'YES'
?
true
:
false
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
...
...
src/modules/course-manage/graphics-course/components/GraphicsCourseList.jsx
View file @
d9ac3788
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
import
User
from
'@/common/js/user'
;
import
User
from
'@/common/js/user'
;
import
college
from
'@/common/lottie/college'
;
import
college
from
'@/common/lottie/college'
;
import
{
PageControl
,
XMTable
}
from
'@/components'
;
import
{
PageControl
,
XMTable
}
from
'@/components'
;
import
{
appId
,
LIVE_SHARE
}
from
'@/domains/course-domain/constants'
;
import
{
LIVE_SHARE
}
from
'@/domains/course-domain/constants'
;
import
CourseService
from
'@/domains/course-domain/CourseService'
;
import
CourseService
from
'@/domains/course-domain/CourseService'
;
import
ShareLiveModal
from
'@/modules/course-manage/modal/ShareLiveModal'
;
import
ShareLiveModal
from
'@/modules/course-manage/modal/ShareLiveModal'
;
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
...
@@ -57,7 +57,7 @@ class GraphicsCourseList extends React.Component {
...
@@ -57,7 +57,7 @@ class GraphicsCourseList extends React.Component {
handlePlanName
=
(
planArray
)
=>
{
handlePlanName
=
(
planArray
)
=>
{
let
planStr
=
''
;
let
planStr
=
''
;
planArray
.
map
((
item
,
index
)
=>
{
planArray
.
forEach
((
item
,
index
)
=>
{
if
(
index
<
planArray
.
length
-
1
)
{
if
(
index
<
planArray
.
length
-
1
)
{
planStr
=
planStr
+
item
.
planName
+
'、'
;
planStr
=
planStr
+
item
.
planName
+
'、'
;
}
else
{
}
else
{
...
@@ -76,18 +76,21 @@ class GraphicsCourseList extends React.Component {
...
@@ -76,18 +76,21 @@ class GraphicsCourseList extends React.Component {
width
:
321
,
width
:
321
,
fixed
:
'left'
,
fixed
:
'left'
,
render
:
(
val
,
record
)
=>
{
render
:
(
val
,
record
)
=>
{
const
{
coverUrl
,
scheduleVideoUrl
}
=
record
;
const
{
coverUrl
}
=
record
;
return
(
return
(
<
div
className=
'record__item'
>
<
div
className=
'record__item'
>
{
/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */
}
{
/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */
}
<
img
className=
'course-cover'
src=
{
coverUrl
||
defaultCoverUrl
}
/>
<
img
className=
'course-cover'
src=
{
coverUrl
||
defaultCoverUrl
}
alt=
''
/>
{
record
.
courseName
.
length
>
25
?
(
<
Choose
>
<
Tooltip
title=
{
record
.
courseName
}
>
<
When
condition=
{
record
.
courseName
.
length
>
25
}
>
<
Tooltip
title=
{
record
.
courseName
}
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
</
Tooltip
>
</
When
>
<
Otherwise
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
</
Tooltip
>
</
Otherwise
>
)
:
(
</
Choose
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
)
}
</
div
>
</
div
>
);
);
},
},
...
@@ -144,12 +147,14 @@ class GraphicsCourseList extends React.Component {
...
@@ -144,12 +147,14 @@ class GraphicsCourseList extends React.Component {
width
:
120
,
width
:
120
,
dataIndex
:
'courseware'
,
dataIndex
:
'courseware'
,
render
:
(
val
,
item
,
index
)
=>
{
render
:
(
val
,
item
,
index
)
=>
{
return
(
return
(
<
Switch
<
Switch
checked=
{
item
.
shelfState
===
"YES"
}
size=
'small'
defaultChecked=
{
item
.
shelfState
===
"YES"
?
true
:
false
}
checked=
{
item
.
shelfState
===
'YES'
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
/>
defaultChecked=
{
item
.
shelfState
===
'YES'
?
true
:
false
}
)
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
/>
);
},
},
},
},
{
{
...
@@ -168,7 +173,7 @@ class GraphicsCourseList extends React.Component {
...
@@ -168,7 +173,7 @@ class GraphicsCourseList extends React.Component {
dataIndex
:
'created'
,
dataIndex
:
'created'
,
sorter
:
true
,
sorter
:
true
,
render
:
(
val
)
=>
{
render
:
(
val
)
=>
{
return
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
return
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
},
},
},
},
{
{
...
@@ -178,7 +183,7 @@ class GraphicsCourseList extends React.Component {
...
@@ -178,7 +183,7 @@ class GraphicsCourseList extends React.Component {
dataIndex
:
'updated'
,
dataIndex
:
'updated'
,
sorter
:
true
,
sorter
:
true
,
render
:
(
val
)
=>
{
render
:
(
val
)
=>
{
return
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
return
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
},
},
},
},
{
{
...
@@ -189,19 +194,22 @@ class GraphicsCourseList extends React.Component {
...
@@ -189,19 +194,22 @@ class GraphicsCourseList extends React.Component {
render
:
(
val
,
record
)
=>
{
render
:
(
val
,
record
)
=>
{
return
(
return
(
<
div
className=
'related-task'
>
<
div
className=
'related-task'
>
{
record
.
relatedPlanList
?
(
<
Choose
>
<
Tooltip
title=
{
this
.
handlePlanName
(
record
.
relatedPlanList
)
}
placement=
'top'
arrowPointAtCenter
>
<
When
condition=
{
record
.
relatedPlanList
}
>
{
record
.
relatedPlanList
.
map
((
item
,
index
)
=>
{
<
Tooltip
title=
{
this
.
handlePlanName
(
record
.
relatedPlanList
)
}
placement=
'top'
arrowPointAtCenter
>
return
(
{
record
.
relatedPlanList
.
map
((
item
,
index
)
=>
{
<
span
>
return
(
{
item
.
planName
}
{
index
<
record
.
relatedPlanList
.
length
-
1
&&
<
span
>
、
</
span
>
}{
' '
}
<
span
>
</
span
>
{
item
.
planName
}
{
index
<
record
.
relatedPlanList
.
length
-
1
&&
<
span
>
、
</
span
>
}{
' '
}
);
</
span
>
})
}
);
</
Tooltip
>
})
}
)
:
(
</
Tooltip
>
<
span
></
span
>
</
When
>
)
}
<
Otherwise
>
<
span
></
span
>
</
Otherwise
>
</
Choose
>
</
div
>
</
div
>
);
);
},
},
...
@@ -297,7 +305,7 @@ class GraphicsCourseList extends React.Component {
...
@@ -297,7 +305,7 @@ class GraphicsCourseList extends React.Component {
className=
'operate__item'
className=
'operate__item'
key=
'edit'
key=
'edit'
onClick=
{
()
=>
{
onClick=
{
()
=>
{
RCHistory
.
push
(
`/create-graphics-course?type=edit&id=${item.id}`
);
window
.
RCHistory
.
push
(
`/create-graphics-course?type=edit&id=${item.id}`
);
}
}
>
}
}
>
编辑
编辑
</
div
>
</
div
>
...
@@ -305,17 +313,17 @@ class GraphicsCourseList extends React.Component {
...
@@ -305,17 +313,17 @@ class GraphicsCourseList extends React.Component {
删除
删除
</
div
>
</
div
>
</
div
>
</
div
>
)
)
;
}
}
;
//改变上架状态
//改变上架状态
changeShelfState
=
(
index
,
item
,
checked
)
=>
{
changeShelfState
=
(
index
,
item
,
checked
)
=>
{
let
_shelfState
=
checked
?
"YES"
:
"NO"
let
_shelfState
=
checked
?
'YES'
:
'NO'
;
// if(_shelfState==='NO'){
// if(_shelfState==='NO'){
// _shelfState = "YES";
// _shelfState = "YES";
// }else{
// }else{
// _shelfState = "NO"
// _shelfState = "NO"
// }
// }
const
params
=
{
const
params
=
{
courseId
:
item
.
id
,
courseId
:
item
.
id
,
shelfState
:
_shelfState
,
shelfState
:
_shelfState
,
};
};
...
@@ -326,7 +334,7 @@ class GraphicsCourseList extends React.Component {
...
@@ -326,7 +334,7 @@ class GraphicsCourseList extends React.Component {
}
else
{
}
else
{
message
.
success
(
'已取消展示'
);
message
.
success
(
'已取消展示'
);
}
}
this
.
props
.
changeShelfState
(
index
,
_shelfState
)
this
.
props
.
changeShelfState
(
index
,
_shelfState
);
}
}
});
});
};
};
...
@@ -355,8 +363,6 @@ class GraphicsCourseList extends React.Component {
...
@@ -355,8 +363,6 @@ class GraphicsCourseList extends React.Component {
// 显示分享弹窗
// 显示分享弹窗
handleShowShareModal
=
(
record
,
needStr
=
false
)
=>
{
handleShowShareModal
=
(
record
,
needStr
=
false
)
=>
{
const
{
id
,
scheduleVideoUrl
}
=
record
;
const
{
id
,
scheduleVideoUrl
}
=
record
;
const
_appId
=
appId
;
const
htmlUrl
=
`
${
LIVE_SHARE
}
graphics_detail/
${
id
}
?id=
${
User
.
getStoreId
()}
`
;
const
htmlUrl
=
`
${
LIVE_SHARE
}
graphics_detail/
${
id
}
?id=
${
User
.
getStoreId
()}
`
;
const
longUrl
=
htmlUrl
;
const
longUrl
=
htmlUrl
;
const
{
coverUrl
,
courseName
}
=
record
;
const
{
coverUrl
,
courseName
}
=
record
;
...
...
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
View file @
d9ac3788
...
@@ -10,11 +10,10 @@
...
@@ -10,11 +10,10 @@
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Button
,
Input
,
Radio
,
message
,
Modal
,
TreeSelect
,
Select
,
Switch
,
TimePicker
,
InputNumber
,
Tooltip
}
from
'antd'
;
import
{
Button
,
Input
,
Radio
,
message
,
Modal
,
TreeSelect
,
Select
,
Switch
,
TimePicker
,
InputNumber
,
Tooltip
}
from
'antd'
;
import
$
from
'jquery'
;
import
$
from
'jquery'
;
import
Bus
from
'@/core/bus'
;
import
RangePicker
from
'@/modules/common/DateRangePicker'
;
import
RangePicker
from
'@/modules/common/DateRangePicker'
;
import
ShowTips
from
'@/components/ShowTips'
;
import
ShowTips
from
'@/components/ShowTips'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
SelectStudent
from
'../modal/select-student'
;
import
SelectPrepareFileModal
from
'../../prepare-lesson/modal/SelectPrepareFileModal'
;
import
SelectPrepareFileModal
from
'../../prepare-lesson/modal/SelectPrepareFileModal'
;
import
PreviewOfflineModal
from
'./modal/PreviewOfflineModal'
;
import
PreviewOfflineModal
from
'./modal/PreviewOfflineModal'
;
import
StoreService
from
'@/domains/store-domain/storeService'
;
import
StoreService
from
'@/domains/store-domain/storeService'
;
...
@@ -26,13 +25,11 @@ import moment from 'moment';
...
@@ -26,13 +25,11 @@ import moment from 'moment';
import
Upload
from
'@/core/upload'
;
import
Upload
from
'@/core/upload'
;
import
GraphicsEditor
from
'../components/GraphicsEditor'
;
import
GraphicsEditor
from
'../components/GraphicsEditor'
;
import
MultipleDatePicker
from
'@/components/MultipleDatePicker'
;
import
MultipleDatePicker
from
'@/components/MultipleDatePicker'
;
import
ImgClipModal
from
'@/components/ImgClipModal'
import
ImgClipModal
from
'@/components/ImgClipModal'
;
import
'./AddOfflineCourse.less'
;
import
'./AddOfflineCourse.less'
;
import
Bus
from
'@/core/bus'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
defaultCoverUrl
=
'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
;
const
defaultCoverUrl
=
'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
;
let
cutFlag
=
false
;
const
unitList
=
[
const
unitList
=
[
{
key
:
'HOUR'
,
value
:
'小时'
},
{
key
:
'HOUR'
,
value
:
'小时'
},
{
key
:
'MINUTE'
,
value
:
'分钟'
},
{
key
:
'MINUTE'
,
value
:
'分钟'
},
...
@@ -42,8 +39,8 @@ class AddOfflineCourse extends React.Component {
...
@@ -42,8 +39,8 @@ class AddOfflineCourse extends React.Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
courseId
=
getParameterByName
(
'id'
);
const
courseId
=
window
.
getParameterByName
(
'id'
);
const
pageType
=
getParameterByName
(
'type'
);
const
pageType
=
window
.
getParameterByName
(
'type'
);
this
.
state
=
{
this
.
state
=
{
courseId
,
// 线下课ID,编辑的时候从URL上带过来
courseId
,
// 线下课ID,编辑的时候从URL上带过来
...
@@ -159,7 +156,6 @@ class AddOfflineCourse extends React.Component {
...
@@ -159,7 +156,6 @@ class AddOfflineCourse extends React.Component {
const
{
result
=
{}
}
=
res
||
{};
const
{
result
=
{}
}
=
res
||
{};
const
{
const
{
courseName
,
courseName
,
courseState
,
categoryId
,
categoryId
,
offlinePlace
,
offlinePlace
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
...
@@ -341,13 +337,12 @@ class AddOfflineCourse extends React.Component {
...
@@ -341,13 +337,12 @@ class AddOfflineCourse extends React.Component {
this
.
setState
({
previewOfflineModal
});
this
.
setState
({
previewOfflineModal
});
};
};
handleSelectCover
=
(
file
)
=>
{
handleSelectCover
=
(
file
)
=>
{
this
.
setState
({
this
.
setState
({
visible
:
true
,
visible
:
true
,
imageFile
:
file
imageFile
:
file
,
});
});
}
};
//获取resourceId
//获取resourceId
getSignature
=
(
blob
,
fileName
)
=>
{
getSignature
=
(
blob
,
fileName
)
=>
{
...
@@ -620,7 +615,7 @@ class AddOfflineCourse extends React.Component {
...
@@ -620,7 +615,7 @@ class AddOfflineCourse extends React.Component {
};
};
StoreService
.
getStoreUserBasicPage
(
_query
).
then
((
res
)
=>
{
StoreService
.
getStoreUserBasicPage
(
_query
).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
;
const
{
result
=
{}
}
=
res
;
const
{
records
=
[],
total
=
0
,
hasNext
}
=
result
;
const
{
records
=
[],
hasNext
}
=
result
;
const
list
=
current
>
1
?
teacherList
.
concat
(
records
)
:
records
;
const
list
=
current
>
1
?
teacherList
.
concat
(
records
)
:
records
;
this
.
setState
({
this
.
setState
({
hasNext
,
hasNext
,
...
@@ -677,14 +672,11 @@ class AddOfflineCourse extends React.Component {
...
@@ -677,14 +672,11 @@ class AddOfflineCourse extends React.Component {
coverUrl
,
coverUrl
,
introduce
,
introduce
,
categoryId
,
categoryId
,
categoryList
,
courseCatalogList
,
courseCatalogList
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
loadintroduce
,
loadintroduce
,
showSelectCoverModal
,
showSelectCoverModal
,
visible
,
visible
,
hasImgReady
,
cutImageBlob
,
teacherId
,
teacherId
,
teacherList
,
teacherList
,
calendarTime
,
calendarTime
,
...
@@ -846,7 +838,7 @@ class AddOfflineCourse extends React.Component {
...
@@ -846,7 +838,7 @@ class AddOfflineCourse extends React.Component {
);
);
}
}
}
}
getPopupContainer=
{
()
=>
document
.
getElementById
(
'teacher'
)
}
>
getPopupContainer=
{
()
=>
document
.
getElementById
(
'teacher'
)
}
>
{
_
.
map
(
teacherList
,
(
item
,
index
)
=>
{
{
_
.
map
(
teacherList
,
(
item
)
=>
{
return
(
return
(
<
Option
value=
{
item
.
id
}
key=
{
item
.
id
}
>
<
Option
value=
{
item
.
id
}
key=
{
item
.
id
}
>
{
item
.
nickName
}
{
item
.
nickName
}
...
@@ -894,7 +886,7 @@ class AddOfflineCourse extends React.Component {
...
@@ -894,7 +886,7 @@ class AddOfflineCourse extends React.Component {
</
span
>
</
span
>
<
div
>
<
div
>
<
div
className=
'select-day'
>
<
div
className=
'select-day'
>
已选
<
span
className=
'mark-day'
>
{
isLongArr
(
calendarTime
)
?
calendarTime
.
length
:
0
}
</
span
>
天
已选
<
span
className=
'mark-day'
>
{
window
.
isLongArr
(
calendarTime
)
?
calendarTime
.
length
:
0
}
</
span
>
天
</
div
>
</
div
>
<
MultipleDatePicker
disabled=
{
isEditDisablie
}
selectDateList=
{
calendarTime
}
onSelect=
{
this
.
selectMultiDate
}
canSelectTodayBefore=
{
false
}
/>
<
MultipleDatePicker
disabled=
{
isEditDisablie
}
selectDateList=
{
calendarTime
}
onSelect=
{
this
.
selectMultiDate
}
canSelectTodayBefore=
{
false
}
/>
</
div
>
</
div
>
...
@@ -982,8 +974,8 @@ class AddOfflineCourse extends React.Component {
...
@@ -982,8 +974,8 @@ class AddOfflineCourse extends React.Component {
onChange=
{
(
dates
)
=>
{
onChange=
{
(
dates
)
=>
{
this
.
handleChangeDates
(
dates
);
this
.
handleChangeDates
(
dates
);
}
}
}
}
renderExtraFooter=
{
()
=>
renderExtraFooter=
{
()
=>
(
calendarTime
[
0
]
?
(
<
If
condition=
{
calendarTime
[
0
]
}
>
<
div
style=
{
{
position
:
'absolute'
,
bottom
:
8
,
cursor
:
'pointer'
}
}
>
<
div
style=
{
{
position
:
'absolute'
,
bottom
:
8
,
cursor
:
'pointer'
}
}
>
<
span
<
span
onClick=
{
()
=>
onClick=
{
()
=>
...
@@ -1043,8 +1035,8 @@ class AddOfflineCourse extends React.Component {
...
@@ -1043,8 +1035,8 @@ class AddOfflineCourse extends React.Component {
上课前3天
上课前3天
</
span
>
</
span
>
</
div
>
</
div
>
)
:
null
</
If
>
}
)
}
/>
/>
</
div
>
</
div
>
)
}
)
}
...
@@ -1275,12 +1267,18 @@ class AddOfflineCourse extends React.Component {
...
@@ -1275,12 +1267,18 @@ class AddOfflineCourse extends React.Component {
}
}
}
}
onSelect=
{
this
.
handleSelectCover
}
onSelect=
{
this
.
handleSelectCover
}
/>
/>
)
)
}
}
{
visible
&&
(
{
visible
&&
<
ImgClipModal
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});}
}
/>
visible=
{
visible
}
}
imgUrl=
{
imageFile
.
ossUrl
}
{
this
.
state
.
previewOfflineModal
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});
}
}
/>
)
}
{
this
.
state
.
previewOfflineModal
}
</
div
>
</
div
>
);
);
}
}
...
...
src/modules/course-manage/offline-course/components/AddGraphicsIntro.jsx
View file @
d9ac3788
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-07-16 11:05:17
* @Date: 2020-07-16 11:05:17
* @Last Modified by: chenshu
* @Last Modified by: chenshu
* @Last Modified time: 2021-04-06 16:17:57
* @Last Modified time: 2021-04-06 16:17:57
* @Description: 添加直播-简介
* @Description: 添加直播-简介
*/
*/
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
{
Col
,
message
,
Row
,
Switch
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
GraphicsEditor
from
'../../components/GraphicsEditor'
;
import
GraphicsEditor
from
'../../components/GraphicsEditor'
;
import
User
from
'@/common/js/user'
;
import
UploadOss
from
'@/core/upload'
;
import
'./AddGraphicsIntro.less'
;
import
'./AddGraphicsIntro.less'
;
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
{
DISK_MAP
}
from
'@/common/constants/academic/lessonEnum'
;
import
{
ImgCutModalNew
}
from
'@/components'
;
const
{
TextArea
}
=
Input
;
class
AddGraphicsIntro
extends
React
.
Component
{
class
AddGraphicsIntro
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
showSelectFileModal
:
false
,
showSelectFileModal
:
false
,
diskList
:
[],
diskList
:
[],
selectType
:
null
,
selectType
:
null
,
}
}
;
}
}
// 上传封面图
// 上传封面图
handleShowImgCutModal
=
(
event
)
=>
{
handleShowImgCutModal
=
(
event
)
=>
{
const
imageFile
=
event
.
target
.
files
[
0
];
const
imageFile
=
event
.
target
.
files
[
0
];
if
(
!
imageFile
)
return
;
if
(
!
imageFile
)
return
;
this
.
setState
({
this
.
setState
({
imageFile
,
imageFile
,
showCutModal
:
true
,
showCutModal
:
true
,
});
});
}
}
;
// 选择暖场资源
// 选择暖场资源
handleSelectVideo
=
(
file
)
=>
{
handleSelectVideo
=
(
file
)
=>
{
const
{
selectType
}
=
this
.
state
;
const
{
selectType
}
=
this
.
state
;
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
false
showSelectFileModal
:
false
,
})
})
;
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
;
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
;
if
(
selectType
===
'WARMUP'
)
{
if
(
selectType
===
'WARMUP'
)
{
const
liveCourseWarmMedia
=
{
const
liveCourseWarmMedia
=
{
contentType
:
'WARMUP'
,
contentType
:
'WARMUP'
,
mediaType
:
folderFormat
===
'MP4'
?
'VIDEO'
:
'PICTURE'
,
mediaType
:
folderFormat
===
'MP4'
?
'VIDEO'
:
'PICTURE'
,
mediaContent
:
resourceId
,
mediaContent
:
resourceId
,
mediaUrl
:
ossUrl
,
mediaUrl
:
ossUrl
,
mediaName
:
folderName
,
mediaName
:
folderName
,
size
:
folderSize
size
:
folderSize
,
}
}
;
this
.
props
.
onChange
(
'liveCourseWarmMedia'
,
liveCourseWarmMedia
);
this
.
props
.
onChange
(
'liveCourseWarmMedia'
,
liveCourseWarmMedia
);
}
else
{
}
else
{
// 最多添加九图片
// 最多添加九图片
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
const
list
=
_
.
filter
(
liveCourseMediaRequests
,
(
item
)
=>
{
const
list
=
_
.
filter
(
liveCourseMediaRequests
,
(
item
)
=>
{
return
item
.
mediaType
==
"PICTURE"
;
return
item
.
mediaType
==
'PICTURE'
;
});
});
if
(
list
.
length
>
8
)
{
if
(
list
.
length
>
8
)
{
message
.
warning
(
"最多添加9张图片"
);
message
.
warning
(
'最多添加9张图片'
);
return
;
return
;
}
}
liveCourseMediaRequests
.
push
({
liveCourseMediaRequests
.
push
({
...
@@ -78,121 +70,128 @@ class AddGraphicsIntro extends React.Component {
...
@@ -78,121 +70,128 @@ class AddGraphicsIntro extends React.Component {
});
});
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
}
}
};
}
changeDetail
=
(
value
)
=>
{
changeDetail
=
(
value
)
=>
{
this
.
props
.
onChange
(
'courseMedia'
,
value
);
this
.
props
.
onChange
(
'courseMedia'
,
value
);
}
}
;
changeIntro
=
(
value
)
=>
{
changeIntro
=
(
value
)
=>
{
this
.
props
.
onChange
(
'introduce'
,
value
);
this
.
props
.
onChange
(
'introduce'
,
value
);
}
}
;
whetherVisitorsJoinChange
=
()
=>
{
whetherVisitorsJoinChange
=
()
=>
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
"NO"
)
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
'NO'
)
{
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
)
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
);
}
else
{
}
else
{
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'NO'
)
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'NO'
);
}
}
}
}
;
shelfStateChange
=
()
=>
{
shelfStateChange
=
()
=>
{
if
(
this
.
props
.
data
.
shelfState
===
"NO"
)
{
if
(
this
.
props
.
data
.
shelfState
===
'NO'
)
{
this
.
props
.
onChange
(
'shelfState'
,
'YES'
)
this
.
props
.
onChange
(
'shelfState'
,
'YES'
);
}
else
{
}
else
{
this
.
props
.
onChange
(
'shelfState'
,
'NO'
)
this
.
props
.
onChange
(
'shelfState'
,
'NO'
);
}
}
}
}
;
render
()
{
render
()
{
const
{
data
:
{
id
,
whetherVisitorsJoin
,
courseMedia
,
introduce
,
shelfState
,
loadcourseMedia
,
loadintroduce
}
}
=
this
.
props
;
const
{
data
:
{
id
,
whetherVisitorsJoin
,
courseMedia
,
introduce
,
shelfState
,
loadcourseMedia
,
loadintroduce
},
}
=
this
.
props
;
const
{
showSelectFileModal
,
selectType
}
=
this
.
state
;
const
{
showSelectFileModal
,
selectType
}
=
this
.
state
;
return
(
return
(
<
div
className=
"add-offline__intro-info"
>
<
div
className=
'add-video__intro-info'
>
<
div
className=
"allow-tourist-join"
>
<
div
className=
'allow-tourist-join'
>
<
span
className=
"label"
>
观看设置:
</
span
>
<
span
className=
'label'
>
观看设置:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
div
>
<
div
>
<
Switch
checked=
{
whetherVisitorsJoin
===
"YES"
?
true
:
false
}
onChange=
{
this
.
whetherVisitorsJoinChange
}
/>
<
Switch
checked=
{
whetherVisitorsJoin
===
'YES'
?
true
:
false
}
onChange=
{
this
.
whetherVisitorsJoinChange
}
/>
</
div
>
</
div
>
<
div
>
<
div
>
<
div
className=
"desc"
>
<
div
className=
'desc'
>
<
div
>
开启:允许未绑定手机号的学员观看
</
div
>
<
div
>
开启:允许未绑定手机号的学员观看
</
div
>
<
div
>
关闭:仅限绑定了手机号的学员可以进入观看图文课
</
div
>
<
div
>
关闭:仅限绑定了手机号的学员可以进入观看图文课
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"store-show"
>
<
div
className=
'store-show'
>
<
span
className=
"label"
>
学院展示:
</
span
>
<
span
className=
'label'
>
学院展示:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
Row
>
<
Row
>
<
Col
span=
{
3
}
>
<
Col
span=
{
3
}
>
<
Switch
checked=
{
shelfState
===
"YES"
?
true
:
false
}
onChange=
{
this
.
shelfStateChange
}
/>
<
Switch
checked=
{
shelfState
===
'YES'
?
true
:
false
}
onChange=
{
this
.
shelfStateChange
}
/>
</
Col
>
</
Col
>
<
Col
span=
{
21
}
>
<
Col
span=
{
21
}
>
<
div
className=
"desc"
>
<
div
className=
'desc'
>
<
div
>
开启:图文课将在学员学院图文课列表中展示
</
div
>
<
div
>
开启:图文课将在学员学院图文课列表中展示
</
div
>
<
div
>
关闭:图文课将在学员学院图文课列表中隐藏
</
div
>
<
div
>
关闭:图文课将在学员学院图文课列表中隐藏
</
div
>
</
div
>
</
div
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"introduce required"
>
<
div
className=
'introduce required'
>
<
span
className=
"label"
style=
{
{
marginTop
:
5
}
}
>
课程内容:
</
span
>
<
span
className=
'label'
style=
{
{
marginTop
:
5
}
}
>
<
div
className=
"content"
>
课程内容:
<
div
className=
"intro-list"
>
</
span
>
<
div
className=
"intro-list__item content-editor"
>
<
div
className=
'content'
>
{
(
!
id
||
loadcourseMedia
)
&&
<
div
className=
'intro-list'
>
<
div
className=
'intro-list__item content-editor'
>
{
(
!
id
||
loadcourseMedia
)
&&
(
<
GraphicsEditor
<
GraphicsEditor
id=
"content"
id=
'content'
detail=
{
{
detail=
{
{
content
:
courseMedia
content
:
courseMedia
,
}
}
onChange=
{
(
val
)
=>
{
this
.
changeDetail
(
val
);
}
}
}
}
onChange=
{
(
val
)
=>
{
this
.
changeDetail
(
val
)
}
}
/>
/>
}
)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"introduce"
>
<
div
className=
'introduce'
>
<
span
className=
"label"
>
课程简介:
</
span
>
<
span
className=
'label'
>
课程简介:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
div
className=
"intro-list"
>
<
div
className=
'intro-list'
>
<
div
className=
"intro-list__item introduce-editor"
>
<
div
className=
'intro-list__item introduce-editor'
>
{
(
!
id
||
loadintroduce
)
&&
{
(
!
id
||
loadintroduce
)
&&
(
<
GraphicsEditor
<
GraphicsEditor
id=
"intro"
id=
'intro'
isIntro=
{
true
}
isIntro=
{
true
}
detail=
{
{
detail=
{
{
content
:
introduce
content
:
introduce
,
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
);
}
}
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
)
}
}
/>
/>
}
)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
/* 选择暖场图文件弹窗 */
}
{
/* 选择暖场图文件弹窗 */
}
{
showSelectFileModal
&&
{
showSelectFileModal
&&
(
<
SelectPrepareFileModal
<
SelectPrepareFileModal
operateType=
"select"
operateType=
'select'
accept=
{
selectType
===
"INTRO"
?
"image/jpeg,image/png,image/jpg"
:
"video/mp4,image/jpeg,image/png,image/jpg"
}
accept=
{
selectType
===
'INTRO'
?
'image/jpeg,image/png,image/jpg'
:
'video/mp4,image/jpeg,image/png,image/jpg'
}
selectTypeList=
{
selectType
===
"INTRO"
?
[
'JPG'
,
'JPEG'
,
'PNG'
]:
[
'MP4'
,
'JPG'
,
'JPEG'
,
'PNG'
]
}
selectTypeList=
{
selectType
===
'INTRO'
?
[
'JPG'
,
'JPEG'
,
'PNG'
]
:
[
'MP4'
,
'JPG'
,
'JPEG'
,
'PNG'
]
}
tooltip=
{
selectType
===
"INTRO"
?
'支持文件类型:jpg、jpeg、png'
:
'支持文件类型:jpg、jpeg、png、mp4'
}
tooltip=
{
selectType
===
'INTRO'
?
'支持文件类型:jpg、jpeg、png'
:
'支持文件类型:jpg、jpeg、png、mp4'
}
isOpen=
{
showSelectFileModal
}
isOpen=
{
showSelectFileModal
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
this
.
setState
({
showSelectFileModal
:
false
})
this
.
setState
({
showSelectFileModal
:
false
})
;
}
}
}
}
onSelect=
{
this
.
handleSelectVideo
}
onSelect=
{
this
.
handleSelectVideo
}
/>
/>
}
)
}
</
div
>
</
div
>
)
)
;
}
}
}
}
...
...
src/modules/course-manage/offline-course/components/OfflineCourseList.jsx
View file @
d9ac3788
...
@@ -17,6 +17,7 @@ import OfflineCourseData from '@/modules/course-manage/offline-course/OfflineCou
...
@@ -17,6 +17,7 @@ import OfflineCourseData from '@/modules/course-manage/offline-course/OfflineCou
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
find
,
reduce
,
last
}
from
'underscore'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
ENUM
from
'../../../knowledge-base/ENUM.js'
;
import
ENUM
from
'../../../knowledge-base/ENUM.js'
;
import
PreviewOfflineModal
from
'../modal/PreviewOfflineModal'
;
import
PreviewOfflineModal
from
'../modal/PreviewOfflineModal'
;
...
@@ -44,7 +45,7 @@ class OfflineCourseList extends React.Component {
...
@@ -44,7 +45,7 @@ class OfflineCourseList extends React.Component {
handlePlanName
=
(
planArray
)
=>
{
handlePlanName
=
(
planArray
)
=>
{
let
planStr
=
''
;
let
planStr
=
''
;
planArray
.
map
((
item
,
index
)
=>
{
planArray
.
forEach
((
item
,
index
)
=>
{
if
(
index
<
planArray
.
length
-
1
)
{
if
(
index
<
planArray
.
length
-
1
)
{
planStr
=
planStr
+
item
.
planName
+
'、'
;
planStr
=
planStr
+
item
.
planName
+
'、'
;
}
else
{
}
else
{
...
@@ -64,13 +65,13 @@ class OfflineCourseList extends React.Component {
...
@@ -64,13 +65,13 @@ class OfflineCourseList extends React.Component {
fixed
:
'left'
,
fixed
:
'left'
,
render
:
(
val
,
record
)
=>
{
render
:
(
val
,
record
)
=>
{
const
{
courseMediaVOS
,
courseName
,
offlinePlace
,
calendarTime
,
startTime
,
endTime
}
=
record
;
const
{
courseMediaVOS
,
courseName
,
offlinePlace
,
calendarTime
,
startTime
,
endTime
}
=
record
;
const
coverUrl
=
(
_
.
find
(
courseMediaVOS
,
(
data
)
=>
data
.
contentType
===
'COVER'
)
||
{}).
mediaUrl
;
const
coverUrl
=
(
find
(
courseMediaVOS
,
(
data
)
=>
data
.
contentType
===
'COVER'
)
||
{}).
mediaUrl
;
let
isContinue
=
calendarTime
.
length
>
1
;
let
isContinue
=
calendarTime
.
length
>
1
;
_
.
reduce
(
calendarTime
,
(
a
,
b
)
=>
{
reduce
(
calendarTime
,
(
a
,
b
)
=>
{
isContinue
=
isContinue
&&
b
-
a
===
86400000
;
isContinue
=
isContinue
&&
b
-
a
===
86400000
;
return
b
;
return
b
;
});
});
const
lastTime
=
_
.
last
(
calendarTime
);
const
lastTime
=
last
(
calendarTime
);
const
time
=
`
${
const
time
=
`
${
!
isContinue
!
isContinue
?
calendarTime
.
map
((
item
)
=>
moment
(
item
).
format
(
'MM-DD'
)).
join
(
'、'
)
?
calendarTime
.
map
((
item
)
=>
moment
(
item
).
format
(
'MM-DD'
)).
join
(
'、'
)
...
@@ -138,7 +139,9 @@ class OfflineCourseList extends React.Component {
...
@@ -138,7 +139,9 @@ class OfflineCourseList extends React.Component {
width
:
120
,
width
:
120
,
dataIndex
:
'courseware'
,
dataIndex
:
'courseware'
,
render
:
(
val
,
item
,
index
)
=>
{
render
:
(
val
,
item
,
index
)
=>
{
return
<
Switch
disabled=
{
item
.
courseState
===
'EXPIRED'
}
checked=
{
item
.
shelfState
===
'YES'
}
onChange=
{
()
=>
this
.
changeShelfState
(
item
)
}
/>;
return
(
<
Switch
size=
'small'
disabled=
{
item
.
courseState
===
'EXPIRED'
}
checked=
{
item
.
shelfState
===
'YES'
}
onChange=
{
()
=>
this
.
changeShelfState
(
item
)
}
/>
);
},
},
},
},
{
{
...
...
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
View file @
d9ac3788
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-07-16 11:05:17
* @Date: 2020-07-16 11:05:17
* @Last Modified by: chenshu
* @Last Modified by: chenshu
* @Last Modified time: 2021-04-06 16:44:09
* @Last Modified time: 2021-04-06 16:44:09
* @Description: 添加直播-简介
* @Description: 添加直播-简介
*/
*/
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
{
Col
,
message
,
Row
,
Switch
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
GraphicsEditor
from
'../../components/GraphicsEditor'
;
import
GraphicsEditor
from
'../../components/GraphicsEditor'
;
import
User
from
'@/common/js/user'
;
import
{
filter
}
from
'underscore'
;
import
UploadOss
from
'@/core/upload'
;
import
'./AddVideoIntro.less'
;
import
'./AddVideoIntro.less'
;
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
{
DISK_MAP
}
from
'@/common/constants/academic/lessonEnum'
;
import
{
ImgCutModalNew
}
from
'@/components'
;
const
{
TextArea
}
=
Input
;
const
defaultCover
=
'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1599635741526.png'
;
const
defaultCover
=
'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1599635741526.png'
;
class
AddVideoIntro
extends
React
.
Component
{
class
AddVideoIntro
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
warmUrl
:
defaultCover
,
warmUrl
:
defaultCover
,
showSelectFileModal
:
false
,
showSelectFileModal
:
false
,
diskList
:
[],
diskList
:
[],
selectType
:
null
selectType
:
null
,
}
}
;
}
}
// 上传封面图
// 上传封面图
handleShowImgCutModal
=
(
event
)
=>
{
handleShowImgCutModal
=
(
event
)
=>
{
const
imageFile
=
event
.
target
.
files
[
0
];
const
imageFile
=
event
.
target
.
files
[
0
];
if
(
!
imageFile
)
return
;
if
(
!
imageFile
)
return
;
this
.
setState
({
this
.
setState
({
imageFile
,
imageFile
,
showCutModal
:
true
,
showCutModal
:
true
,
});
});
}
}
;
// 选择暖场资源
// 选择暖场资源
handleSelectVideo
=
(
file
)
=>
{
handleSelectVideo
=
(
file
)
=>
{
const
{
selectType
}
=
this
.
state
;
const
{
selectType
}
=
this
.
state
;
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
false
showSelectFileModal
:
false
,
})
})
;
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
;
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
;
if
(
selectType
===
'WARMUP'
)
{
if
(
selectType
===
'WARMUP'
)
{
const
liveCourseWarmMedia
=
{
const
liveCourseWarmMedia
=
{
contentType
:
'WARMUP'
,
contentType
:
'WARMUP'
,
mediaType
:
folderFormat
===
'MP4'
?
'VIDEO'
:
'PICTURE'
,
mediaType
:
folderFormat
===
'MP4'
?
'VIDEO'
:
'PICTURE'
,
mediaContent
:
resourceId
,
mediaContent
:
resourceId
,
mediaUrl
:
ossUrl
,
mediaUrl
:
ossUrl
,
mediaName
:
folderName
,
mediaName
:
folderName
,
size
:
folderSize
size
:
folderSize
,
}
}
;
this
.
props
.
onChange
(
'liveCourseWarmMedia'
,
liveCourseWarmMedia
);
this
.
props
.
onChange
(
'liveCourseWarmMedia'
,
liveCourseWarmMedia
);
}
else
{
}
else
{
// 最多添加九图片
// 最多添加九图片
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
const
list
=
_
.
filter
(
liveCourseMediaRequests
,
(
item
)
=>
{
const
list
=
filter
(
liveCourseMediaRequests
,
(
item
)
=>
{
return
item
.
mediaType
==
"PICTURE"
;
return
item
.
mediaType
===
'PICTURE'
;
});
});
if
(
list
.
length
>
8
)
{
if
(
list
.
length
>
8
)
{
message
.
warning
(
"最多添加9张图片"
);
message
.
warning
(
'最多添加9张图片'
);
return
;
return
;
}
}
liveCourseMediaRequests
.
push
({
liveCourseMediaRequests
.
push
({
contentType
:
'INTRO'
,
contentType
:
'INTRO'
,
size
:
folderSize
,
size
:
folderSize
,
mediaName
:
folderName
,
mediaName
:
folderName
,
mediaContent
:
resourceId
,
mediaContent
:
resourceId
,
mediaType
:
'PICTURE'
,
mediaType
:
'PICTURE'
,
mediaUrl
:
ossUrl
,
mediaUrl
:
ossUrl
,
});
});
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
}
}
};
}
changeIntro
=
(
value
)
=>
{
changeIntro
=
(
value
)
=>
{
this
.
props
.
onChange
(
'introduce'
,
value
);
this
.
props
.
onChange
(
'introduce'
,
value
);
}
}
;
handleUpload
=
(
Blob
)
=>
{
handleUpload
=
(
Blob
)
=>
{
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
true
,
showSelectFileModal
:
true
,
selectType
:
'INTRO'
selectType
:
'INTRO'
,
})
})
;
}
}
;
whetherVisitorsJoinChange
=
()
=>
{
whetherVisitorsJoinChange
=
()
=>
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
"NO"
)
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
'NO'
)
{
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
)
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
);
}
else
{
}
else
{
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'NO'
)
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'NO'
);
}
}
}
}
;
shelfStateChange
=
()
=>
{
shelfStateChange
=
()
=>
{
if
(
this
.
props
.
data
.
shelfState
===
"NO"
)
{
if
(
this
.
props
.
data
.
shelfState
===
'NO'
)
{
this
.
props
.
onChange
(
'shelfState'
,
'YES'
)
this
.
props
.
onChange
(
'shelfState'
,
'YES'
);
}
else
{
}
else
{
this
.
props
.
onChange
(
'shelfState'
,
'NO'
)
this
.
props
.
onChange
(
'shelfState'
,
'NO'
);
}
}
}
}
;
render
()
{
render
()
{
const
{
data
:
{
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[],
shelfState
,
id
,
introduce
,
loadintroduce
}
}
=
this
.
props
;
const
{
const
{
showSelectFileModal
,
selectType
}
=
this
.
state
data
:
{
whetherVisitorsJoin
,
shelfState
,
id
,
introduce
,
loadintroduce
},
}
=
this
.
props
;
const
{
showSelectFileModal
,
selectType
}
=
this
.
state
;
return
(
return
(
<
div
className=
"add-video__intro-info"
>
<
div
className=
'add-video__intro-info'
>
<
div
className=
"allow-tourist-join"
>
<
div
className=
'allow-tourist-join'
>
<
span
className=
"label"
>
观看设置:
</
span
>
<
span
className=
'label'
>
观看设置:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
div
>
<
div
>
<
Switch
checked=
{
whetherVisitorsJoin
===
"NO"
?
true
:
false
}
onChange=
{
this
.
whetherVisitorsJoinChange
}
/>
<
Switch
checked=
{
whetherVisitorsJoin
===
'NO'
?
true
:
false
}
onChange=
{
this
.
whetherVisitorsJoinChange
}
/>
</
div
>
</
div
>
<
div
>
<
div
>
<
div
className=
"desc"
>
<
div
className=
'desc'
>
<
Choose
>
<
Choose
>
<
When
condition=
{
whetherVisitorsJoin
===
"NO"
}
>
<
When
condition=
{
whetherVisitorsJoin
===
'NO'
}
>
<
div
>
已开启,学员需绑定手机号才可观看
</
div
>
<
div
>
已开启,学员需绑定手机号才可观看
</
div
>
</
When
>
</
When
>
<
Otherwise
>
<
Otherwise
>
<
div
>
已关闭,学员无需绑定手机号即可观看
</
div
>
<
div
>
已关闭,学员无需绑定手机号即可观看
</
div
>
</
Otherwise
>
</
Otherwise
>
</
Choose
>
</
Choose
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"store-show"
>
<
div
className=
'store-show'
>
<
span
className=
"label"
>
学院展示:
</
span
>
<
span
className=
'label'
>
学院展示:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
Row
>
<
Row
>
<
Col
span=
{
3
}
>
<
Col
span=
{
3
}
>
<
Switch
checked=
{
shelfState
===
"YES"
?
true
:
false
}
onChange=
{
this
.
shelfStateChange
}
/>
<
Switch
checked=
{
shelfState
===
'YES'
?
true
:
false
}
onChange=
{
this
.
shelfStateChange
}
/>
</
Col
>
</
Col
>
<
Col
span=
{
21
}
>
<
Col
span=
{
21
}
>
<
div
className=
"desc"
>
<
div
className=
'desc'
>
<
Choose
>
<
Choose
>
<
When
condition=
{
shelfState
===
"YES"
}
>
<
When
condition=
{
shelfState
===
'YES'
}
>
<
div
>
已开启,课程将在该学院的学员课程列表中显示
</
div
>
<
div
>
已开启,课程将在该学院的学员课程列表中显示
</
div
>
</
When
>
</
When
>
<
Otherwise
>
<
Otherwise
>
<
div
>
已关闭,课程将在该学院的学员课程列表中隐藏
</
div
>
<
div
>
已关闭,课程将在该学院的学员课程列表中隐藏
</
div
>
</
Otherwise
>
</
Otherwise
>
</
Choose
>
</
Choose
>
</
div
>
</
div
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"introduce"
>
<
div
className=
'introduce'
>
<
span
className=
"label"
>
课程简介:
</
span
>
<
span
className=
'label'
>
课程简介:
</
span
>
<
div
className=
"content"
>
<
div
className=
'content'
>
<
div
className=
"intro-list"
>
<
div
className=
'intro-list'
>
<
div
className=
"intro-list__item introduce-editor"
>
<
div
className=
'intro-list__item introduce-editor'
>
{
(
!
id
||
loadintroduce
)
&&
{
(
!
id
||
loadintroduce
)
&&
(
<
GraphicsEditor
<
GraphicsEditor
maxLimit=
{
1000
}
maxLimit=
{
1000
}
id=
"intro"
id=
'intro'
isIntro=
{
true
}
isIntro=
{
true
}
detail=
{
{
detail=
{
{
content
:
introduce
content
:
introduce
,
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
);
}
}
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
)
}
}
/>
/>
}
)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
/* 选择暖场图文件弹窗 */
}
{
/* 选择暖场图文件弹窗 */
}
{
showSelectFileModal
&&
{
showSelectFileModal
&&
(
<
SelectPrepareFileModal
<
SelectPrepareFileModal
operateType=
"select"
operateType=
'select'
accept=
{
selectType
===
"INTRO"
?
"image/jpeg,image/png,image/jpg"
:
"video/mp4,image/jpeg,image/png,image/jpg"
}
accept=
{
selectType
===
'INTRO'
?
'image/jpeg,image/png,image/jpg'
:
'video/mp4,image/jpeg,image/png,image/jpg'
}
selectTypeList=
{
selectType
===
"INTRO"
?
[
'JPG'
,
'JPEG'
,
'PNG'
]:
[
'MP4'
,
'JPG'
,
'JPEG'
,
'PNG'
]
}
selectTypeList=
{
selectType
===
'INTRO'
?
[
'JPG'
,
'JPEG'
,
'PNG'
]
:
[
'MP4'
,
'JPG'
,
'JPEG'
,
'PNG'
]
}
tooltip=
{
selectType
===
"INTRO"
?
'支持文件类型:jpg、jpeg、png'
:
'支持文件类型:jpg、jpeg、png、mp4'
}
tooltip=
{
selectType
===
'INTRO'
?
'支持文件类型:jpg、jpeg、png'
:
'支持文件类型:jpg、jpeg、png、mp4'
}
isOpen=
{
showSelectFileModal
}
isOpen=
{
showSelectFileModal
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
this
.
setState
({
showSelectFileModal
:
false
})
this
.
setState
({
showSelectFileModal
:
false
})
;
}
}
}
}
onSelect=
{
this
.
handleSelectVideo
}
onSelect=
{
this
.
handleSelectVideo
}
/>
/>
}
)
}
</
div
>
</
div
>
)
)
;
}
}
}
}
...
...
src/modules/course-manage/video-course/components/VideoCourseList.jsx
View file @
d9ac3788
...
@@ -153,6 +153,7 @@ class VideoCourseList extends React.Component {
...
@@ -153,6 +153,7 @@ class VideoCourseList extends React.Component {
render
:
(
val
,
item
,
index
)
=>
{
render
:
(
val
,
item
,
index
)
=>
{
return
(
return
(
<
Switch
<
Switch
size=
'small'
loading=
{
ShelfLoading
}
loading=
{
ShelfLoading
}
checked=
{
item
.
shelfState
===
'YES'
}
checked=
{
item
.
shelfState
===
'YES'
}
defaultChecked=
{
item
.
shelfState
}
defaultChecked=
{
item
.
shelfState
}
...
...
src/modules/plan-manage/components/BasicInfo.jsx
View file @
d9ac3788
...
@@ -16,18 +16,16 @@
...
@@ -16,18 +16,16 @@
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Button
,
Input
,
Switch
,
Radio
,
Row
,
Col
,
Modal
,
message
,
Tooltip
}
from
'antd'
;
import
{
Button
,
Input
,
Switch
,
Radio
,
Row
,
Col
,
message
,
Tooltip
}
from
'antd'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
SelectOperatorModal
from
'../modal/SelectOperatorModal'
;
import
SelectOperatorModal
from
'../modal/SelectOperatorModal'
;
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
Upload
from
'@/core/upload'
;
import
Upload
from
'@/core/upload'
;
import
GraphicsEditor
from
'@/modules/course-manage/components/GraphicsEditor'
;
import
GraphicsEditor
from
'@/modules/course-manage/components/GraphicsEditor'
;
import
ImgClipModal
from
'@/components/ImgClipModal'
import
ImgClipModal
from
'@/components/ImgClipModal'
;
import
'./BasicInfo.less'
;
import
'./BasicInfo.less'
;
const
{
TextArea
}
=
Input
;
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'
;
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'
;
let
cutFlag
=
false
;
class
BasicInfo
extends
React
.
Component
{
class
BasicInfo
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -84,7 +82,7 @@ class BasicInfo extends React.Component {
...
@@ -84,7 +82,7 @@ class BasicInfo extends React.Component {
handleSelectCover
=
(
file
)
=>
{
handleSelectCover
=
(
file
)
=>
{
this
.
setState
({
this
.
setState
({
visible
:
true
,
visible
:
true
,
imageFile
:
file
imageFile
:
file
,
});
});
};
};
//获取resourceId
//获取resourceId
...
@@ -139,7 +137,7 @@ class BasicInfo extends React.Component {
...
@@ -139,7 +137,7 @@ class BasicInfo extends React.Component {
};
};
render
()
{
render
()
{
const
{
operatorModalVisible
,
showSelectFileModal
,
visible
,
hasImgReady
,
cutImageBlob
,
imageFile
}
=
this
.
state
;
const
{
operatorModalVisible
,
showSelectFileModal
,
visible
,
imageFile
}
=
this
.
state
;
const
{
data
}
=
this
.
props
;
const
{
data
}
=
this
.
props
;
const
{
planName
,
coverUrl
,
introduce
,
enableState
,
operateType
,
selectOperatorList
,
percentCompleteLive
,
percentCompleteVideo
,
percentCompletePicture
}
=
const
{
planName
,
coverUrl
,
introduce
,
enableState
,
operateType
,
selectOperatorList
,
percentCompleteLive
,
percentCompleteVideo
,
percentCompletePicture
}
=
data
;
data
;
...
@@ -335,9 +333,16 @@ class BasicInfo extends React.Component {
...
@@ -335,9 +333,16 @@ class BasicInfo extends React.Component {
onSelect=
{
this
.
handleSelectCover
}
onSelect=
{
this
.
handleSelectCover
}
/>
/>
)
}
)
}
{
visible
&&
{
visible
&&
(
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});}
}
/>
<
ImgClipModal
}
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});
}
}
/>
)
}
</
div
>
</
div
>
);
);
}
}
...
...
src/modules/plan-manage/components/PlanList.jsx
View file @
d9ac3788
...
@@ -64,6 +64,7 @@ function PlanList(props) {
...
@@ -64,6 +64,7 @@ function PlanList(props) {
render
:
(
val
,
item
,
index
)
=>
{
render
:
(
val
,
item
,
index
)
=>
{
return
(
return
(
<
Switch
<
Switch
size=
'small'
checked=
{
item
.
enableState
===
'NO'
?
false
:
true
}
checked=
{
item
.
enableState
===
'NO'
?
false
:
true
}
onChange=
{
()
=>
changeEnableState
(
item
)
}
onChange=
{
()
=>
changeEnableState
(
item
)
}
disabled=
{
User
.
getUserRole
()
===
'CloudManager'
||
User
.
getUserRole
()
===
'StoreManager'
?
false
:
true
}
disabled=
{
User
.
getUserRole
()
===
'CloudManager'
||
User
.
getUserRole
()
===
'StoreManager'
?
false
:
true
}
...
...
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
d9ac3788
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
;
import
Breadcrumbs
from
"@/components/Breadcrumbs"
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
{
Form
,
Alert
,
Input
,
Button
,
InputNumber
,
DatePicker
,
Switch
,
Radio
,
message
,
Modal
,
Tooltip
}
from
'antd'
;
import
{
Form
,
Alert
,
Input
,
Button
,
InputNumber
,
DatePicker
,
Switch
,
Radio
,
message
,
Modal
,
Tooltip
}
from
'antd'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
User
from
"@/common/js/user"
;
import
User
from
'@/common/js/user'
;
import
moment
from
'moment'
import
moment
from
'moment'
;
import
Service
from
"@/common/js/service"
;
import
Service
from
'@/common/js/service'
;
import
_
from
'underscore'
import
_
from
'underscore'
;
import
GraphicsEditor
from
'../../course-manage/components/GraphicsEditor'
;
import
GraphicsEditor
from
'../../course-manage/components/GraphicsEditor'
;
import
SelectPaperModal
from
'./SelectPaperModal'
import
SelectPaperModal
from
'./SelectPaperModal'
;
import
PreviewModal
from
'./PreviewModal'
import
PreviewModal
from
'./PreviewModal'
;
import
ShowTips
from
"@/components/ShowTips"
;
import
ShowTips
from
'@/components/ShowTips'
;
import
'./AddExam.less'
;
import
'./AddExam.less'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
function
AddExam
(
props
:
any
)
{
function
AddExam
(
props
:
any
)
{
const
paperInfoInit
:
any
=
{
passScore
:
60
};
const
paperInfoInit
:
any
=
{
passScore
:
60
};
const
[
showModal
,
setShowModal
]
=
useState
(
false
);
const
[
showModal
,
setShowModal
]
=
useState
(
false
);
const
[
paperInfo
,
setPaperInfo
]
=
useState
(
paperInfoInit
);
const
[
paperInfo
,
setPaperInfo
]
=
useState
(
paperInfoInit
);
const
[
paperId
,
setPaperId
]
=
useState
(
''
);
const
[
paperId
,
setPaperId
]
=
useState
(
''
);
const
[
passRate
,
setPassRate
]
=
useState
(
60
);
//及格线
const
[
passRate
,
setPassRate
]
=
useState
(
60
);
//及格线
const
[
examStartTime
,
setStartTime
]
=
useState
(
''
);
const
[
examStartTime
,
setStartTime
]
=
useState
(
''
);
const
[
examEndTime
,
setExamEndTime
]
=
useState
(
''
);
const
[
examEndTime
,
setExamEndTime
]
=
useState
(
''
);
const
[
examName
,
setExamName
]
=
useState
(
''
);
const
[
examName
,
setExamName
]
=
useState
(
''
);
const
[
needPhone
,
setNeedPhone
]
=
useState
(
'DO_NOT_NEED_PHONE_VERIFY'
);
const
[
needPhone
,
setNeedPhone
]
=
useState
(
'DO_NOT_NEED_PHONE_VERIFY'
);
const
[
needOptionDisorder
,
setNeedOptionDisorder
]
=
useState
(
'OPTION_SORT'
);
const
[
needOptionDisorder
,
setNeedOptionDisorder
]
=
useState
(
'OPTION_SORT'
);
const
[
resultContent
,
setResultContent
]
=
useState
(
'PASS_AND_SCORE'
);
const
[
resultContent
,
setResultContent
]
=
useState
(
'PASS_AND_SCORE'
);
const
[
answerAnalysis
,
setAnswerAnalysis
]
=
useState
(
'RIGHT_OR_WRONG'
);
const
[
answerAnalysis
,
setAnswerAnalysis
]
=
useState
(
'RIGHT_OR_WRONG'
);
const
[
resultShow
,
setResultShow
]
=
useState
(
'IMMEDIATELY'
);
const
[
resultShow
,
setResultShow
]
=
useState
(
'IMMEDIATELY'
);
const
[
examDesc
,
setExamDesc
]
=
useState
(
''
);
const
[
examDesc
,
setExamDesc
]
=
useState
(
''
);
const
[
passScore
,
setPassScore
]
=
useState
(
100
);
const
[
passScore
,
setPassScore
]
=
useState
(
100
);
const
[
desclen
,
setDescLen
]
=
useState
(
0
);
const
[
desclen
,
setDescLen
]
=
useState
(
0
);
const
[
check
,
setCheck
]
=
useState
(
false
);
const
[
check
,
setCheck
]
=
useState
(
false
);
const
[
getData
,
setGetData
]
=
useState
(
false
);
const
[
getData
,
setGetData
]
=
useState
(
false
);
const
[
preview
,
setPreview
]
=
useState
(
false
);
const
[
preview
,
setPreview
]
=
useState
(
false
);
const
[
examTotal
,
setExamTotal
]
=
useState
(
0
);
const
[
examTotal
,
setExamTotal
]
=
useState
(
0
);
const
[
examList
,
setExamList
]
=
useState
([]);
const
[
examList
,
setExamList
]
=
useState
([]);
const
request
=
useRef
(
false
);
const
request
=
useRef
(
false
);
const
{
match
}
=
props
;
const
{
match
}
=
props
;
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
useEffect
(()
=>
{
useEffect
(()
=>
{
queryExamList
();
queryExamList
();
switch
(
props
.
type
)
{
switch
(
props
.
type
)
{
case
"copy"
:
// 考试列表-复制考试进入
case
'copy'
:
// 考试列表-复制考试进入
case
"edit"
:
// 考试列表-编辑考试进入
case
'edit'
:
// 考试列表-编辑考试进入
queryExamDetail
();
queryExamDetail
();
break
;
break
;
case
"organizeExam"
:
// 试卷列表-组织考试进入
case
'organizeExam'
:
// 试卷列表-组织考试进入
case
"newPaperToAddExam"
:
// 组卷页面-新建保存试卷并组织考试
case
'newPaperToAddExam'
:
// 组卷页面-新建保存试卷并组织考试
case
"editPaperToAddExam"
:
// 组卷页面-编辑保存试卷并组织考试
case
'editPaperToAddExam'
:
// 组卷页面-编辑保存试卷并组织考试
setGetData
(
true
);
setGetData
(
true
);
setPaperInfo
(
props
.
paperInfo
);
setPaperInfo
(
props
.
paperInfo
);
setExamName
(
props
.
paperInfo
?.
paperName
)
setExamName
(
props
.
paperInfo
?.
paperName
);
break
;
break
;
}
}
},
[])
},
[
props
.
paperInfo
,
props
.
type
,
queryExamDetail
]);
useEffect
(()
=>
{
setPaperId
(
paperInfo
.
paperId
);
setPassRate
(
paperInfo
.
passRate
);
},
[
paperInfo
.
paperId
,
paperInfo
.
passRate
]);
useEffect
(()
=>
{
setPassScore
(
Math
.
round
((((
paperInfo
.
totalScore
||
0
)
*
(
passRate
||
0
))
as
any
)
/
100
));
setExamTotal
(
paperInfo
.
singleChoiceCnt
+
paperInfo
.
multiChoiceCnt
+
paperInfo
.
judgeCnt
+
paperInfo
.
gapFillingCnt
+
paperInfo
.
indefiniteChoiceCnt
||
0
);
},
[
paperInfo
.
gapFillingCnt
,
paperInfo
.
indefiniteChoiceCnt
,
paperInfo
.
judgeCnt
,
paperInfo
.
multiChoiceCnt
,
paperInfo
.
paperId
,
paperInfo
.
singleChoiceCnt
,
paperInfo
.
totalScore
,
passRate
,
]);
function
disabledDate
(
current
:
any
)
{
// Can not select days before today and today
return
current
&&
current
<
moment
().
startOf
(
'day'
);
}
function
queryExamList
()
{
let
param
=
{
current
:
1
,
size
:
9999
,
order
:
'EXAM_START_TIME_DESC'
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
source
:
0
,
};
Service
.
Hades
(
'public/hades/queryExamPageList'
,
param
).
then
((
res
)
=>
{
console
.
log
(
res
);
const
{
result
=
{}
}
=
res
;
setExamList
(
result
.
records
);
});
}
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
(
props
.
type
===
'edit'
?
result
.
examStartTime
:
''
);
setExamEndTime
(
props
.
type
===
'edit'
?
result
.
examEndTime
:
''
);
setExamName
(
props
.
type
===
'edit'
?
result
.
examName
:
`
${
result
.
examName
}
(复制)`
);
setPassRate
(
result
.
passRate
*
100
);
setNeedPhone
(
result
.
needPhone
);
setExamDesc
(
result
.
examDesc
);
setExamDuration
((
result
.
examDuration
/
60
/
1000
)
as
any
);
setAnswerAnalysis
(
result
.
answerAnalysis
);
setNeedOptionDisorder
(
result
.
needOptionDisorder
);
setPassScore
(
result
.
passScore
);
setResultContent
(
result
.
resultContent
);
setResultShow
(
result
.
resultShow
);
setGetData
(
true
);
});
}
function
handleSave
()
{
if
(
request
.
current
)
{
return
;
}
setCheck
(
true
);
const
param
=
{
paperId
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
examName
,
passRate
:
passRate
/
100
,
examStartTime
,
examEndTime
,
examDesc
,
needPhone
,
needOptionDisorder
,
resultContent
,
answerAnalysis
,
resultShow
,
examDuration
:
(
examDuration
||
0
)
*
60
*
1000
,
passScore
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
,
examId
:
''
,
};
useEffect
(()
=>
{
if
(
!
param
.
examName
)
{
setPaperId
(
paperInfo
.
paperId
)
message
.
warning
(
'请输入考试名称'
);
setPassRate
(
paperInfo
.
passRate
)
return
;
}
},
[
paperInfo
.
paperId
])
if
(
param
.
examName
&&
param
.
examName
.
length
>
40
)
{
message
.
warning
(
'考试名称最多40字'
);
return
;
}
useEffect
(()
=>
{
if
(
checkExist
(
param
.
examName
))
{
setPassScore
(
Math
.
round
((
paperInfo
.
totalScore
||
0
)
*
(
passRate
||
0
)
as
any
/
100
))
message
.
warning
(
'此考试名称已存在'
);
setExamTotal
(
paperInfo
.
singleChoiceCnt
+
paperInfo
.
multiChoiceCnt
+
paperInfo
.
judgeCnt
+
paperInfo
.
gapFillingCnt
+
paperInfo
.
indefiniteChoiceCnt
||
0
)
return
;
}
,
[
paperInfo
.
paperId
,
passRate
])
}
function
disabledDate
(
current
:
any
)
{
if
(
!
paperId
)
{
// Can not select days before today and today
message
.
warning
(
'请选择试卷'
);
return
current
&&
current
<
moment
().
startOf
(
'day'
)
;
return
;
}
}
function
queryExamList
()
{
if
(
!
passRate
)
{
let
param
=
{
message
.
warning
(
'请输入及格线'
);
current
:
1
,
return
;
size
:
9999
,
order
:
'EXAM_START_TIME_DESC'
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
source
:
0
,
}
Service
.
Hades
(
'public/hades/queryExamPageList'
,
param
).
then
(
res
=>
{
console
.
log
(
res
)
const
{
result
=
{}
}
=
res
;
setExamList
(
result
.
records
)
})
}
}
function
queryExamDetail
()
{
if
(
!
examStartTime
||
!
examEndTime
)
{
Service
.
Hades
(
"public/hades/queryExamDetail"
,
{
message
.
warning
(
'请选择考试起止时间'
);
examId
:
match
.
params
.
id
,
return
;
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
}).
then
((
res
)
=>
{
const
{
result
}
=
res
setPaperInfo
(
result
.
examPaper
)
setPaperId
(
result
.
examPaper
.
paperId
)
setStartTime
(
props
.
type
===
'edit'
?
result
.
examStartTime
:
''
)
setExamEndTime
(
props
.
type
===
'edit'
?
result
.
examEndTime
:
''
)
setExamName
(
props
.
type
===
'edit'
?
result
.
examName
:
`
${
result
.
examName
}
(复制)`
)
setPassRate
(
result
.
passRate
*
100
)
setNeedPhone
(
result
.
needPhone
)
setExamDesc
(
result
.
examDesc
)
setExamDuration
(
result
.
examDuration
/
60
/
1000
as
any
)
setAnswerAnalysis
(
result
.
answerAnalysis
)
setNeedOptionDisorder
(
result
.
needOptionDisorder
)
setPassScore
(
result
.
passScore
)
setResultContent
(
result
.
resultContent
)
setResultShow
(
result
.
resultShow
)
setGetData
(
true
)
})
}
}
function
handleSave
()
{
if
(
Number
(
examStartTime
)
<
moment
().
valueOf
())
{
if
(
request
.
current
)
{
message
.
warning
(
'开始时间不能早于现在'
);
return
return
;
}
}
if
(
!
examDuration
)
{
message
.
warning
(
'请输入考试时长'
);
return
;
}
if
(
examStartTime
+
(
examDuration
as
any
)
*
60
*
1000
>
examEndTime
)
{
message
.
warning
(
'考试时长不得超过考试有效期时长'
);
return
;
}
if
(
desclen
>
1000
)
{
message
.
warning
(
'内容过长,不能超过1000字'
);
return
;
}
request
.
current
=
true
;
setTimeout
(()
=>
{
request
.
current
=
false
;
},
2000
);
if
(
props
.
type
===
'edit'
)
{
param
.
examId
=
match
.
params
.
id
;
}
setCheck
(
true
);
Service
.
Hades
(
props
.
type
===
'edit'
?
'public/hades/editExam'
:
'public/hades/createExam'
,
param
).
then
((
res
)
=>
{
const
param
=
{
message
.
success
(
props
.
type
===
'edit'
?
'编辑成功'
:
'创建成功'
);
switch
(
props
.
type
)
{
case
'organizeExam'
:
// 试卷列表-组织考试进入
case
'newPaperToAddExam'
:
// 组卷保存组织考试
case
'editPaperToAddExam'
:
window
.
RCHistory
.
push
(
'/examination-manage-index'
);
break
;
case
'add'
:
case
'edit'
:
// 考试列表-新建或编辑
case
'copy'
:
// 考试列表-新建或编辑
props
.
freshList
();
props
.
history
.
goBack
();
break
;
}
});
}
function
disabledRangeTime
(
date
:
any
,
type
:
any
)
{
if
(
moment
(
date
).
isSame
(
moment
(),
'day'
))
{
return
{
disabledHours
:
()
=>
{
const
hours
=
[];
for
(
let
i
=
0
;
i
<
moment
().
hour
();
i
++
)
{
hours
.
push
(
i
);
}
return
hours
;
},
disabledMinutes
:
()
=>
{
const
currentMinute
=
moment
().
minute
();
const
currentHour
=
moment
(
date
).
hour
();
const
minutes
=
[];
if
(
currentHour
===
moment
().
hour
())
{
for
(
let
i
=
0
;
i
<
currentMinute
;
i
++
)
{
minutes
.
push
(
i
);
}
}
return
minutes
;
},
};
}
return
{
disabledHours
:
()
=>
[],
disabledMinutes
:
()
=>
[],
disabledSeconds
:
()
=>
[],
};
}
function
handleGoBack
()
{
Modal
.
confirm
({
title
:
'确定要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
(
'/examination-manage-index'
);
},
});
}
// 校验考试名称是否存在
function
checkExist
(
examName
:
any
)
{
var
result
:
any
=
null
;
examList
.
forEach
((
item
:
any
)
=>
{
if
(
result
!=
null
)
{
return
result
;
}
if
(
props
.
type
===
'edit'
)
{
if
(
item
.
examName
===
examName
&&
item
.
examId
!==
match
.
params
.
id
)
{
result
=
item
;
}
}
else
{
if
(
item
.
examName
===
examName
)
{
result
=
item
;
}
}
});
return
result
;
}
let
title
=
''
;
switch
(
props
.
type
)
{
case
'add'
:
case
'organizeExam'
:
case
'newPaperToAddExam'
:
case
'editPaperToAddExam'
:
title
=
'新建考试'
;
break
;
case
'edit'
:
title
=
'编辑考试'
;
break
;
case
'copy'
:
title
=
'复制考试'
;
break
;
default
:
break
;
}
return
(
<
div
className=
'page examPage'
>
<
Breadcrumbs
navList=
{
title
}
goBack=
{
handleGoBack
}
/>
<
div
className=
'box'
>
<
div
className=
'show-tips'
>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
</
div
>
{
' '
}
<
div
className=
'form'
>
<
div
className=
'title'
>
基本信息
</
div
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
14
}
}
layout=
'horizontal'
>
<
Form
.
Item
label=
'考试名称'
validateStatus=
{
check
&&
(
!
examName
||
examName
.
length
>
40
||
checkExist
(
examName
))
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
examName
.
length
>
40
?
'考试名称最多40字'
:
checkExist
(
examName
)
&&
'此考试名称已存在'
)
}
required
>
<
Input
placeholder=
'请输入考试名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
setExamName
(
e
.
target
.
value
);
}
}
style=
{
{
width
:
320
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'选择试卷'
validateStatus=
{
check
&&
!
paperId
?
'error'
:
''
}
help=
{
check
&&
!
paperId
&&
'请选择试卷'
}
required
>
<
Button
onClick=
{
()
=>
{
setShowModal
(
true
);
}
}
>
{
paperInfo
.
paperId
?
'重新选择'
:
'选择试卷'
}
</
Button
>
{
paperInfo
.
paperId
&&
(
<
div
className=
'paperTitle'
>
<
img
src=
'https://image.xiaomaiketang.com/xm/pY5imEhjzw.png'
alt=
''
/>
{
paperInfo
.
paperName
}
</
div
>
)
}
{
paperInfo
.
paperId
&&
(
<
div
className=
'table'
>
<
div
className=
'header'
>
<
div
className=
'item'
>
单选题
</
div
>
<
div
className=
'item'
>
多选题
</
div
>
<
div
className=
'item'
>
判断题
</
div
>
<
div
className=
'item'
>
填空题
</
div
>
<
div
className=
'item long'
>
不定项选择题
</
div
>
<
div
className=
'item'
>
合计
</
div
>
</
div
>
<
div
className=
'body-list'
>
<
div
className=
'item'
>
{
paperInfo
.
singleChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
multiChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
judgeCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
gapFillingCnt
||
0
}
题
</
div
>
<
div
className=
'item long'
>
{
paperInfo
.
indefiniteChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
examTotal
}
题
</
div
>
</
div
>
<
div
className=
'body-list'
>
<
div
className=
'item'
>
{
paperInfo
.
singleChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
multiChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
judgeScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
gapFillingScore
||
0
}
分
</
div
>
<
div
className=
'item long'
>
{
paperInfo
.
indefiniteChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
totalScore
||
0
}
分
</
div
>
</
div
>
</
div
>
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
{
<
div
>
<
span
>
及格线
</
span
>
<
Tooltip
title=
'默认为选中试卷所设置的及格线,可修改'
>
<
span
className=
'icon iconfont'
style=
{
{
color
:
'#BFBFBF'
,
marginLeft
:
4
}
}
>

</
span
>
</
Tooltip
>
</
div
>
}
style=
{
{
marginTop
:
24
}
}
validateStatus=
{
check
&&
!
passRate
?
'error'
:
''
}
help=
{
check
&&
!
passRate
&&
'请输入及格线'
}
required
>
<
InputNumber
value=
{
passRate
}
min=
{
0
}
max=
{
100
}
onChange=
{
(
value
:
any
)
=>
{
setPassRate
(
parseInt
(
value
));
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
%
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
'#999'
}
}
>
{
` 总分(${paperInfo.totalScore || 0})*及格线(${passRate || 0}%)=及格分数(${passScore})`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试有效期'
validateStatus=
{
check
&&
!
examStartTime
?
'error'
:
''
}
help=
{
check
&&
!
examStartTime
&&
'请选择考试起止时间'
}
required
>
<
RangePicker
style=
{
{
width
:
320
}
}
showTime=
{
{
defaultValue
:
[
moment
().
add
(
5
,
'minutes'
),
moment
().
add
(
5
,
'minutes'
)]
}
}
ranges=
{
{
近七天
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
6
,
'day'
).
endOf
(
'day'
)],
近
1
个月
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
1
,
'month'
).
endOf
(
'day'
)],
近
3
个月
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
3
,
'month'
).
endOf
(
'day'
)],
}
}
disabledDate=
{
disabledDate
}
value=
{
[
examStartTime
?
moment
(
Number
(
examStartTime
))
:
null
,
examEndTime
?
moment
(
Number
(
examEndTime
))
:
null
]
}
disabledTime=
{
disabledRangeTime
}
format=
'YYYY/MM/DD HH:mm'
onChange=
{
(
date
:
any
)
=>
{
setStartTime
(
date
&&
date
[
0
]?.
valueOf
());
setExamEndTime
(
date
&&
date
[
1
]?.
valueOf
());
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试时长'
validateStatus=
{
check
&&
!
examDuration
?
'error'
:
''
}
help=
{
check
&&
!
examDuration
&&
'请输入考试时长'
}
required
>
<
InputNumber
value=
{
examDuration
}
max=
{
1440
}
min=
{
1
}
onChange=
{
(
value
:
any
)
=>
{
setExamDuration
(
parseInt
(
value
)
as
any
);
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
分钟
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
'#999'
}
}
>
{
` 时长不能超过1440分钟(24小时)`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试说明'
validateStatus=
{
check
&&
desclen
>
1000
?
'error'
:
''
}
help=
{
check
&&
desclen
>
1000
&&
'最多只能输入1000个字'
}
>
{
(
getData
||
props
.
type
===
'add'
)
&&
(
<
GraphicsEditor
maxLimit=
{
1000
}
isIntro=
{
true
}
detail=
{
{
content
:
examDesc
,
}
}
onChange=
{
(
val
:
any
,
len
:
any
)
=>
{
setExamDesc
(
val
);
setDescLen
(
len
);
}
}
/>
)
}
</
Form
.
Item
>
<
div
className=
'title'
style=
{
{
marginTop
:
40
}
}
>
考试设置
</
div
>
<
Form
.
Item
label=
'身份验证'
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needPhone
==
'NEED_PHONE_VERIFY'
}
onChange=
{
(
val
)
=>
{
setNeedPhone
(
val
?
'NEED_PHONE_VERIFY'
:
'DO_NOT_NEED_PHONE_VERIFY'
);
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
'#999'
}
}
>
<
p
>
开启:需要绑定手机号的学员才能参加考试
</
p
>
<
p
>
关闭:微信/企业微信登陆直接参加考试
</
p
>
</
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
'选项乱序'
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needOptionDisorder
==
'OPTION_RANDOM'
}
onChange=
{
(
val
)
=>
{
setNeedOptionDisorder
(
val
?
'OPTION_RANDOM'
:
'OPTION_SORT'
);
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
'#999'
}
}
>
<
p
>
开启:选择题的选项随机排序
</
p
>
<
p
>
关闭:选择题按题目原有顺序展示
</
p
>
</
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试结果查看'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultShow
(
e
.
target
.
value
);
}
}
value=
{
resultShow
}
>
<
Radio
value=
{
'IMMEDIATELY'
}
>
交卷后立即显示考试结果
</
Radio
>
<
Radio
value=
{
'AFTER_EXAM_END'
}
>
到达考试截止日期才显示结果
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
' 考试结果内容'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultContent
(
e
.
target
.
value
);
}
}
value=
{
resultContent
}
>
<
Radio
value=
{
'PASS_AND_SCORE'
}
>
显示考试分数和是否及格
</
Radio
>
<
Radio
value=
{
'ONLY_SCORE'
}
>
仅显示考试分数
</
Radio
>
<
Radio
value=
{
'ONLY_PASS'
}
>
仅显示是否及格
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
'答案与解析'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setAnswerAnalysis
(
e
.
target
.
value
);
}
}
value=
{
answerAnalysis
}
>
<
Radio
value=
{
'ANALYSE_AND_RIGHT_OR_WRONG'
}
>
显示对错与解析
</
Radio
>
<
Radio
value=
{
'RIGHT_OR_WRONG'
}
>
仅显示对错
</
Radio
>
<
Radio
value=
{
'CAN_NOT_CHECK'
}
>
都不显示
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
{
showModal
&&
(
<
SelectPaperModal
onSelect=
{
(
info
:
any
)
=>
{
setPaperInfo
(
info
);
}
}
paperInfo=
{
paperInfo
}
close=
{
()
=>
{
setShowModal
(
false
);
}
}
></
SelectPaperModal
>
)
}
<
div
className=
'footer shrink-footer'
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
{
setPreview
(
true
);
}
}
>
预览
</
Button
>
<
Button
type=
'primary'
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
{
preview
&&
(
<
PreviewModal
info=
{
{
paperId
,
paperId
,
startTime
:
examStartTime
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
endTime
:
examEndTime
,
...
@@ -138,409 +571,17 @@ function AddExam(props: any) {
...
@@ -138,409 +571,17 @@ function AddExam(props: any) {
resultContent
,
resultContent
,
answerAnalysis
,
answerAnalysis
,
resultShow
,
resultShow
,
examDuration
:
(
examDuration
||
0
)
*
60
*
1000
,
examDuration
,
passScore
,
passScore
,
tenantId
:
User
.
getStoreId
(),
examTotal
,
userId
:
User
.
getStoreUserId
(),
totalScore
:
paperInfo
.
totalScore
,
source
:
0
,
}
}
examId
:
''
onClose=
{
()
=>
{
}
setPreview
(
false
);
}
}
></
PreviewModal
>
if
(
!
param
.
examName
)
{
)
}
message
.
warning
(
'请输入考试名称'
);
return
}
if
(
param
.
examName
&&
param
.
examName
.
length
>
40
)
{
message
.
warning
(
'考试名称最多40字'
);
return
}
if
(
checkExist
(
param
.
examName
))
{
message
.
warning
(
'此考试名称已存在'
);
return
}
if
(
!
paperId
)
{
message
.
warning
(
'请选择试卷'
);
return
}
if
(
!
passRate
)
{
message
.
warning
(
'请输入及格线'
);
return
}
if
(
!
examStartTime
||
!
examEndTime
)
{
message
.
warning
(
'请选择考试起止时间'
);
return
}
if
(
Number
(
examStartTime
)
<
moment
().
valueOf
())
{
message
.
warning
(
'开始时间不能早于现在'
);
return
}
if
(
!
examDuration
)
{
message
.
warning
(
'请输入考试时长'
);
return
}
if
(
examStartTime
+
(
examDuration
as
any
)
*
60
*
1000
>
examEndTime
)
{
message
.
warning
(
'考试时长不得超过考试有效期时长'
);
return
}
if
(
desclen
>
1000
)
{
message
.
warning
(
'内容过长,不能超过1000字'
);
return
}
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'
?
'编辑成功'
:
'创建成功'
);
switch
(
props
.
type
)
{
case
"organizeExam"
:
// 试卷列表-组织考试进入
case
"newPaperToAddExam"
:
// 组卷保存组织考试
case
"editPaperToAddExam"
:
window
.
RCHistory
.
push
(
"/examination-manage-index"
)
break
;
case
"add"
:
case
"edit"
:
// 考试列表-新建或编辑
case
"copy"
:
// 考试列表-新建或编辑
props
.
freshList
()
props
.
history
.
goBack
();
break
;
}
})
}
function
disabledRangeTime
(
date
:
any
,
type
:
any
)
{
if
(
moment
(
date
).
isSame
(
moment
(),
'day'
))
{
return
{
disabledHours
:
()
=>
{
const
hours
=
[];
for
(
let
i
=
0
;
i
<
moment
().
hour
();
i
++
)
{
hours
.
push
(
i
);
}
return
hours
;
},
disabledMinutes
:
()
=>
{
const
currentMinute
=
moment
().
minute
();
const
currentHour
=
moment
(
date
).
hour
();
const
minutes
=
[];
if
(
currentHour
===
moment
().
hour
())
{
for
(
let
i
=
0
;
i
<
currentMinute
;
i
++
)
{
minutes
.
push
(
i
);
}
}
return
minutes
;
},
};
}
return
{
disabledHours
:
()
=>
[],
disabledMinutes
:
()
=>
[],
disabledSeconds
:
()
=>
[],
};
}
function
handleGoBack
()
{
Modal
.
confirm
({
title
:
'确定要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
(
"/examination-manage-index"
)
}
})
}
// 校验考试名称是否存在
function
checkExist
(
examName
:
any
)
{
var
result
:
any
=
null
;
examList
.
forEach
((
item
:
any
)
=>
{
if
(
result
!=
null
)
{
return
result
;
}
if
(
props
.
type
===
'edit'
)
{
if
(
item
.
examName
===
examName
&&
item
.
examId
!==
match
.
params
.
id
)
{
result
=
item
;
}
}
else
{
if
(
item
.
examName
===
examName
)
{
result
=
item
;
}
}
});
return
result
;
};
let
title
=
''
;
switch
(
props
.
type
)
{
case
'add'
:
case
"organizeExam"
:
case
"newPaperToAddExam"
:
case
"editPaperToAddExam"
:
title
=
'新建考试'
;
break
;
case
'edit'
:
title
=
'编辑考试'
;
break
;
case
'copy'
:
title
=
'复制考试'
;
break
;
default
:
break
;
}
return
<
div
className=
"page examPage"
>
<
Breadcrumbs
navList=
{
title
}
goBack=
{
handleGoBack
}
/>
<
div
className=
"box"
>
<
div
className=
"show-tips"
>
<
ShowTips
message=
"请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利"
/>
</
div
>
<
div
className=
"form"
>
<
div
className=
"title"
>
基本信息
</
div
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
14
}
}
layout=
"horizontal"
>
<
Form
.
Item
label=
"考试名称"
validateStatus=
{
(
check
&&
(
!
examName
||
(
examName
.
length
>
40
||
checkExist
(
examName
))
))
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
(
examName
.
length
>
40
?
'考试名称最多40字'
:
(
checkExist
(
examName
)
&&
'此考试名称已存在'
)))
}
required
>
<
Input
placeholder=
'请输入考试名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
setExamName
(
e
.
target
.
value
)
}
}
style=
{
{
width
:
320
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"选择试卷"
validateStatus=
{
(
check
&&
!
paperId
)
?
'error'
:
''
}
help=
{
check
&&
!
paperId
&&
'请选择试卷'
}
required
>
<
Button
onClick=
{
()
=>
{
setShowModal
(
true
)
}
}
>
{
paperInfo
.
paperId
?
'重新选择'
:
'选择试卷'
}
</
Button
>
{
paperInfo
.
paperId
&&
<
div
className=
"paperTitle"
><
img
src=
"https://image.xiaomaiketang.com/xm/pY5imEhjzw.png"
alt=
""
/>
{
paperInfo
.
paperName
}
</
div
>
}
{
paperInfo
.
paperId
&&
<
div
className=
"table"
>
<
div
className=
"header"
>
<
div
className=
"item"
>
单选题
</
div
>
<
div
className=
"item"
>
多选题
</
div
>
<
div
className=
"item"
>
判断题
</
div
>
<
div
className=
"item"
>
填空题
</
div
>
<
div
className=
"item long"
>
不定项选择题
</
div
>
<
div
className=
"item"
>
合计
</
div
>
</
div
>
<
div
className=
"body-list"
>
<
div
className=
"item"
>
{
paperInfo
.
singleChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
multiChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
judgeCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
gapFillingCnt
||
0
}
题
</
div
>
<
div
className=
"item long"
>
{
paperInfo
.
indefiniteChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
examTotal
}
题
</
div
>
</
div
>
<
div
className=
"body-list"
>
<
div
className=
"item"
>
{
paperInfo
.
singleChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
multiChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
judgeScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
gapFillingScore
||
0
}
分
</
div
>
<
div
className=
"item long"
>
{
paperInfo
.
indefiniteChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
totalScore
||
0
}
分
</
div
>
</
div
>
</
div
>
}
</
Form
.
Item
>
<
Form
.
Item
label=
{
<
div
>
<
span
>
及格线
</
span
>
<
Tooltip
title=
"默认为选中试卷所设置的及格线,可修改"
>
<
span
className=
"icon iconfont"
style=
{
{
color
:
'#BFBFBF'
,
marginLeft
:
4
}
}
>

</
span
>
</
Tooltip
>
</
div
>
}
style=
{
{
marginTop
:
24
}
}
validateStatus=
{
(
check
&&
!
passRate
)
?
'error'
:
''
}
help=
{
check
&&
!
passRate
&&
'请输入及格线'
}
required
>
<
InputNumber
value=
{
passRate
}
min=
{
0
}
max=
{
100
}
onChange=
{
(
value
:
any
)
=>
{
setPassRate
(
parseInt
(
value
))
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
%
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
"#999"
}
}
>
{
` 总分(${paperInfo.totalScore || 0})*及格线(${passRate || 0}%)=及格分数(${passScore})`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试有效期"
validateStatus=
{
(
check
&&
!
examStartTime
)
?
'error'
:
''
}
help=
{
check
&&
!
examStartTime
&&
'请选择考试起止时间'
}
required
>
<
RangePicker
style=
{
{
width
:
320
}
}
showTime=
{
{
defaultValue
:
[
moment
().
add
(
5
,
'minutes'
),
moment
().
add
(
5
,
'minutes'
)]
}
}
ranges=
{
{
'近七天'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
6
,
'day'
).
endOf
(
'day'
)],
'近1个月'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
1
,
'month'
).
endOf
(
'day'
)],
'近3个月'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
3
,
'month'
).
endOf
(
'day'
)],
}
}
disabledDate=
{
disabledDate
}
value=
{
[
examStartTime
?
moment
(
Number
(
examStartTime
))
:
null
,
examEndTime
?
moment
(
Number
(
examEndTime
))
:
null
]
}
disabledTime=
{
disabledRangeTime
}
format=
"YYYY/MM/DD HH:mm"
onChange=
{
(
date
:
any
)
=>
{
setStartTime
(
date
&&
date
[
0
]?.
valueOf
());
setExamEndTime
(
date
&&
date
[
1
]?.
valueOf
());
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试时长"
validateStatus=
{
(
check
&&
!
examDuration
)
?
'error'
:
''
}
help=
{
check
&&
!
examDuration
&&
'请输入考试时长'
}
required
>
<
InputNumber
value=
{
examDuration
}
max=
{
1440
}
min=
{
1
}
onChange=
{
(
value
:
any
)
=>
{
setExamDuration
(
parseInt
(
value
)
as
any
)
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
分钟
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
"#999"
}
}
>
{
` 时长不能超过1440分钟(24小时)`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试说明"
validateStatus=
{
(
check
&&
(
desclen
>
1000
))
?
'error'
:
''
}
help=
{
check
&&
(
desclen
>
1000
)
&&
'最多只能输入1000个字'
}
>
{
(
getData
||
(
props
.
type
===
'add'
))
&&
<
GraphicsEditor
maxLimit=
{
1000
}
isIntro=
{
true
}
detail=
{
{
content
:
examDesc
}
}
onChange=
{
(
val
:
any
,
len
:
any
)
=>
{
setExamDesc
(
val
);
setDescLen
(
len
)
}
}
/>
}
</
Form
.
Item
>
<
div
className=
"title"
style=
{
{
marginTop
:
40
}
}
>
考试设置
</
div
>
<
Form
.
Item
label=
"身份验证"
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
,
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needPhone
==
'NEED_PHONE_VERIFY'
}
onChange=
{
(
val
)
=>
{
setNeedPhone
(
val
?
'NEED_PHONE_VERIFY'
:
'DO_NOT_NEED_PHONE_VERIFY'
)
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
"#999"
}
}
><
p
>
开启:需要绑定手机号的学员才能参加考试
</
p
>
<
p
>
关闭:微信/企业微信登陆直接参加考试
</
p
></
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
"选项乱序"
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
,
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needOptionDisorder
==
'OPTION_RANDOM'
}
onChange=
{
(
val
)
=>
{
setNeedOptionDisorder
(
val
?
'OPTION_RANDOM'
:
'OPTION_SORT'
)
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
"#999"
}
}
><
p
>
开启:选择题的选项随机排序
</
p
>
<
p
>
关闭:选择题按题目原有顺序展示
</
p
></
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试结果查看"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultShow
(
e
.
target
.
value
)
}
}
value=
{
resultShow
}
>
<
Radio
value=
{
'IMMEDIATELY'
}
>
交卷后立即显示考试结果
</
Radio
>
<
Radio
value=
{
'AFTER_EXAM_END'
}
>
到达考试截止日期才显示结果
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
" 考试结果内容"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultContent
(
e
.
target
.
value
)
}
}
value=
{
resultContent
}
>
<
Radio
value=
{
'PASS_AND_SCORE'
}
>
显示考试分数和是否及格
</
Radio
>
<
Radio
value=
{
'ONLY_SCORE'
}
>
仅显示考试分数
</
Radio
>
<
Radio
value=
{
'ONLY_PASS'
}
>
仅显示是否及格
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"答案与解析"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setAnswerAnalysis
(
e
.
target
.
value
)
}
}
value=
{
answerAnalysis
}
>
<
Radio
value=
{
'ANALYSE_AND_RIGHT_OR_WRONG'
}
>
显示对错与解析
</
Radio
>
<
Radio
value=
{
'RIGHT_OR_WRONG'
}
>
仅显示对错
</
Radio
>
<
Radio
value=
{
'CAN_NOT_CHECK'
}
>
都不显示
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
{
showModal
&&
<
SelectPaperModal
onSelect=
{
(
info
:
any
)
=>
{
setPaperInfo
(
info
)
}
}
paperInfo=
{
paperInfo
}
close=
{
()
=>
{
setShowModal
(
false
)
}
}
></
SelectPaperModal
>
}
<
div
className=
"footer shrink-footer"
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
{
setPreview
(
true
)
}
}
>
预览
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
{
preview
&&
<
PreviewModal
info=
{
{
paperId
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
examName
,
passRate
:
passRate
/
100
,
examStartTime
,
examEndTime
,
examDesc
,
needPhone
,
needOptionDisorder
,
resultContent
,
answerAnalysis
,
resultShow
,
examDuration
,
passScore
,
examTotal
,
totalScore
:
paperInfo
.
totalScore
}
}
onClose=
{
()
=>
{
setPreview
(
false
)
}
}
></
PreviewModal
>
}
</
div
>
</
div
>
);
}
}
export
default
withRouter
(
AddExam
);
export
default
withRouter
(
AddExam
);
\ No newline at end of file
src/routes/index.tsx
View file @
d9ac3788
...
@@ -3,108 +3,86 @@
...
@@ -3,108 +3,86 @@
* @Date: 2020-04-28 18:05:30
* @Date: 2020-04-28 18:05:30
* @LastEditors: wufan
* @LastEditors: wufan
* @LastEditTime: 2020-12-26 14:37:23
* @LastEditTime: 2020-12-26 14:37:23
* @Description:
* @Description:
*/
*/
import
mainRoutes
from
'./config/mainRoutes'
;
import
mainRoutes
from
'./config/mainRoutes'
;
import
redirectRoutes
from
'./config/redirectRoutes'
;
import
redirectRoutes
from
'./config/redirectRoutes'
;
import
React
from
'react'
import
React
from
'react'
;
import
{
Redirect
,
HashRouter
as
Router
,
Route
,
Switch
}
from
'react-router-dom'
;
import
{
HashRouter
as
Router
,
Route
,
Switch
}
from
'react-router-dom'
;
import
{
createHashHistory
}
from
'history'
;
import
{
createHashHistory
}
from
'history'
;
import
App
from
'../modules/root/App'
;
import
AppContext
from
'@/modules/root/AppContent'
;
import
AppContext
from
'@/modules/root/AppContent'
;
import
Login
from
'../modules/root/Login'
;
import
Login
from
'../modules/root/Login'
;
import
CollegeManagePage
from
'../modules/root/CollegeManagePage'
;
import
CollegeManagePage
from
'../modules/root/CollegeManagePage'
;
import
CreateCollege
from
'../modules/root/CreateCollege'
;
import
CreateCollege
from
'../modules/root/CreateCollege'
;
import
_
from
'underscore'
;
import
_
from
'underscore'
;
import
{
asyncComponent
}
from
'react-async-component'
import
SwitchRoute
from
'@/modules/root/SwitchRoute'
;
import
SwitchRoute
from
'@/modules/root/SwitchRoute'
;
import
ErrorCollege
from
'@/modules/root/ErrorCollege'
;
import
ErrorCollege
from
'@/modules/root/ErrorCollege'
;
const
history
=
createHashHistory
();
const
history
=
createHashHistory
();
window
.
RCHistory
=
_
.
extend
({},
history
,
{
window
.
RCHistory
=
_
.
extend
({},
history
,
{
push
:
(
obj
:
any
)
=>
{
push
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
history
.
push
(
obj
);
},
},
pushState
:
(
obj
:
any
)
=>
{
pushState
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
history
.
push
(
obj
);
},
},
pushStateWithStatus
:
(
obj
:
any
)
=>
{
pushStateWithStatus
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
history
.
push
(
obj
);
},
},
goBack
:
history
.
goBack
,
goBack
:
history
.
goBack
,
location
:
history
.
location
,
location
:
history
.
location
,
replace
:
(
obj
:
any
)
=>
{
replace
:
(
obj
:
any
)
=>
{
history
.
replace
(
obj
)
history
.
replace
(
obj
);
}
},
});
});
const
cache
:
any
=
{
path
:
''
,
component
:
null
}
function
dynamic
(
component
:
any
)
{
const
resolveComponent
=
component
return
asyncComponent
({
resolve
:
()
=>
{
const
ts
=
resolveComponent
()
return
ts
},
})
}
export
const
RootRouter
=
()
=>
{
export
const
RootRouter
=
()
=>
{
return
(
return
(
<
Router
{
...
history
}
>
<
Router
{
...
history
}
>
<
Switch
>
<
Switch
>
<
Route
key=
"1"
exact
path=
"/login"
render=
{
()
=>
<
Login
/>
}
/>
<
Route
key=
'1'
exact
path=
'/login'
render=
{
()
=>
<
Login
/>
}
/>
<
Route
key=
"2"
exact
path=
"/switch-route"
render=
{
()
=>
<
SwitchRoute
/>
}
/>
<
Route
key=
'2'
exact
path=
'/switch-route'
render=
{
()
=>
<
SwitchRoute
/>
}
/>
<
Route
key=
"3"
exact
path=
"/college-manage"
render=
{
()
=>
<
CollegeManagePage
/>
}
/>
<
Route
key=
'3'
exact
path=
'/college-manage'
render=
{
()
=>
<
CollegeManagePage
/>
}
/>
<
Route
key=
"4"
exact
path=
"/college-manage/create"
render=
{
()
=>
<
CreateCollege
/>
}
/>
<
Route
key=
'4'
exact
path=
'/college-manage/create'
render=
{
()
=>
<
CreateCollege
/>
}
/>
<
Route
key=
"6"
exact
path=
"/error-college"
render=
{
()
=>
<
ErrorCollege
/>
}
/>
<
Route
key=
'6'
exact
path=
'/error-college'
render=
{
()
=>
<
ErrorCollege
/>
}
/>
<
Route
key=
"5"
path=
"/"
render=
{
()
=>
<
AppContext
/>
}
/>
<
Route
key=
'5'
path=
'/'
render=
{
()
=>
<
AppContext
/>
}
/>
</
Switch
>
</
Switch
>
</
Router
>
</
Router
>
)
);
}
}
;
export
const
MainRoutes
=
()
=>
{
export
const
MainRoutes
=
()
=>
{
return
(
return
(
<
Switch
>
<
Switch
>
{
{
_
.
map
(
mainRoutes
,
({
path
,
component
},
key
)
=>
{
_
.
map
(
mainRoutes
,
({
return
(
path
,
<
Route
component
,
key=
{
key
}
},
key
)
=>
{
path=
{
path
}
return
<
Route
render=
{
()
=>
{
key=
{
key
}
const
Component
=
component
;
path=
{
path
}
return
<
Component
/>;
render=
{
()
=>
{
}
}
const
Component
=
component
;
/>
return
<
Component
/>
);
}
}
})
}
/>
</
Switch
>
})
);
}
};
</
Switch
>
)
}
export
const
RedirectRoutes
=
()
=>
{
export
const
RedirectRoutes
=
()
=>
{
return
(
return
(
<
Switch
>
<
Switch
>
{
{
_
.
map
(
redirectRoutes
,
({
path
,
component
},
key
)
=>
{
_
.
map
(
redirectRoutes
,
({
return
(
path
,
<
Route
component
,
key=
{
key
}
},
key
)
=>
{
path=
{
path
}
return
<
Route
render=
{
()
=>
{
key=
{
key
}
const
Component
=
component
;
path=
{
path
}
return
<
Component
/>;
render=
{
()
=>
{
}
}
const
Component
=
component
;
/>
return
<
Component
/>
);
}
}
})
}
/>
</
Switch
>
})
);
}
};
</
Switch
>
)
}
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