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
35133ea3
Commit
35133ea3
authored
May 08, 2021
by
chenshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:初始化
parent
711245c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
62 deletions
+51
-62
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
+51
-62
No files found.
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
View file @
35133ea3
...
@@ -22,12 +22,9 @@ import {
...
@@ -22,12 +22,9 @@ import {
}
from
'antd'
;
}
from
'antd'
;
import
$
from
'jquery'
;
import
$
from
'jquery'
;
import
{
DISK_MAP
,
FileTypeIcon
,
FileVerifyMap
}
from
'@/common/constants/academic/lessonEnum'
;
import
{
ImgCutModalNew
}
from
'@/components'
;
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
AddGraphicsIntro
from
'./components/AddGraphicsIntro'
;
import
SelectStudent
from
'../modal/select-student'
;
import
SelectStudent
from
'../modal/select-student'
;
import
SelectPrepareFileModal
from
'../../prepare-lesson/modal/SelectPrepareFileModal'
;
import
SelectPrepareFileModal
from
'../../prepare-lesson/modal/SelectPrepareFileModal'
;
import
PreviewGraphicsModal
from
'../modal/PreviewGraphicsModal'
;
import
PreviewGraphicsModal
from
'../modal/PreviewGraphicsModal'
;
...
@@ -36,6 +33,7 @@ import Service from '@/common/js/service';
...
@@ -36,6 +33,7 @@ import Service from '@/common/js/service';
import
{
randomString
}
from
'@/domains/basic-domain/utils'
;
import
{
randomString
}
from
'@/domains/basic-domain/utils'
;
import
User
from
'@/common/js/user'
;
import
User
from
'@/common/js/user'
;
import
_
from
"underscore"
;
import
_
from
"underscore"
;
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'
;
...
@@ -45,7 +43,6 @@ const EDIT_BOX_KEY = Math.random();
...
@@ -45,7 +43,6 @@ const EDIT_BOX_KEY = Math.random();
const
fieldNames
=
{
label
:
'categoryName'
,
value
:
'id'
,
children
:
'sonCategoryList'
};
const
fieldNames
=
{
label
:
'categoryName'
,
value
:
'id'
,
children
:
'sonCategoryList'
};
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
//添加课程时课程默认的一些值
//添加课程时课程默认的一些值
const
defaultShelfState
=
'YES'
;
const
whetherVisitorsJoin
=
'NO'
const
whetherVisitorsJoin
=
'NO'
const
defaultCoverUrl
=
'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'
;
const
defaultCoverUrl
=
'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'
;
let
cutFlag
=
false
;
let
cutFlag
=
false
;
...
@@ -70,11 +67,9 @@ class AddOfflineCourse extends React.Component {
...
@@ -70,11 +67,9 @@ class AddOfflineCourse extends React.Component {
courseName
:
null
,
// 线下课名称
courseName
:
null
,
// 线下课名称
courseMedia
:
''
,
courseMedia
:
''
,
introduce
:
''
,
introduce
:
''
,
courseMediaId
:
null
,
// 线下课链接
coverId
:
null
,
// 线下封面的recourceId
coverId
:
null
,
// 线下封面的recourceId
coverUrl
:
defaultCoverUrl
,
// 线下课封面
coverUrl
:
defaultCoverUrl
,
// 线下课封面
studentList
:
[],
// 上课学员列表
studentList
:
[],
// 上课学员列表
shelfState
:
'YES'
,
//是否开启学院展示
diskList
:
[],
// 机构可见磁盘目录
diskList
:
[],
// 机构可见磁盘目录
selectedFileList
:
[],
// 已经从资料云盘中勾选的文件
selectedFileList
:
[],
// 已经从资料云盘中勾选的文件
showCutModal
:
false
,
// 是否显示截图弹窗
showCutModal
:
false
,
// 是否显示截图弹窗
...
@@ -166,7 +161,6 @@ class AddOfflineCourse extends React.Component {
...
@@ -166,7 +161,6 @@ class AddOfflineCourse extends React.Component {
const
{
result
=
{}
}
=
res
||
{};
const
{
result
=
{}
}
=
res
||
{};
const
{
const
{
courseName
,
courseName
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
courseMediaVOS
,
courseMediaVOS
,
categoryOneName
,
categoryOneName
,
...
@@ -207,7 +201,6 @@ class AddOfflineCourse extends React.Component {
...
@@ -207,7 +201,6 @@ class AddOfflineCourse extends React.Component {
coverId
,
coverId
,
coverUrl
,
coverUrl
,
courseName
,
courseName
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
categoryName
,
categoryName
,
categoryId
categoryId
...
@@ -233,12 +226,10 @@ class AddOfflineCourse extends React.Component {
...
@@ -233,12 +226,10 @@ class AddOfflineCourse extends React.Component {
videoName
,
videoName
,
videoDuration
,
videoDuration
,
courseName
,
courseName
,
courseMediaId
,
categoryId
,
categoryId
,
shelfState
,
whetherVisitorsJoin
whetherVisitorsJoin
}
=
this
.
state
;
}
=
this
.
state
;
if
(
videoName
||
videoDuration
||
c
ourseMediaId
||
categoryId
||
courseName
||
coverId
||
shelfState
!==
defaultShelfState
||
whetherVisitorsJoin
!==
whetherVisitorsJoin
){
if
(
videoName
||
videoDuration
||
c
ategoryId
||
courseName
||
coverId
||
whetherVisitorsJoin
!==
whetherVisitorsJoin
){
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'确认要返回吗?'
,
title
:
'确认要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存。'
,
content
:
'返回后,本次编辑的内容将不被保存。'
,
...
@@ -456,43 +447,56 @@ class AddOfflineCourse extends React.Component {
...
@@ -456,43 +447,56 @@ class AddOfflineCourse extends React.Component {
courseMedia
,
courseMedia
,
introduce
,
introduce
,
categoryId
,
categoryId
,
shelfStat
e
,
offlinePlac
e
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
whetherSetApply
,
whetherSetSignIn
,
whetherSetSignOut
,
teacherId
,
coverUrl
,
}
=
this
.
state
;
}
=
this
.
state
;
let
coverObj
=
{
contentType
:
'COVER'
,
mediaContent
:
coverId
,
mediaType
:
'PICTURE'
,
mediaUrl
:
coverUrl
,
}
let
scheduleMediaRequests
=
[];
if
(
coverId
){
scheduleMediaRequests
=
[
coverObj
]
}
const
commonParams
=
{
const
commonParams
=
{
categoryId
,
categoryId
,
courseName
,
courseName
,
coverId
,
scheduleMediaRequests
,
operatorId
:
User
.
getStoreUserId
(),
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
offlinePlace
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
courseType
:
'PICTURE'
,
whetherSetApply
,
whetherSetSignIn
,
whetherSetSignOut
,
teacherId
,
};
};
// 校验必填字段:课程名称, 课程线下
// 校验必填字段:课程名称, 课程线下
this
.
handleValidate
(
courseName
,
courseMedia
,
categoryId
).
then
((
res
)
=>
{
this
.
handleValidate
(
courseName
,
courseMedia
,
categoryId
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
if
(
!
res
)
return
;
Upload
.
uploadTextToOSS
(
courseMedia
,
`
${
randomString
()}
.txt`
,
(
courseMediaId
)
=>
{
Upload
.
uploadTextToOSS
(
introduce
,
`
${
randomString
()}
.txt`
,
(
introduceId
)
=>
{
Upload
.
uploadTextToOSS
(
introduce
,
`
${
randomString
()}
.txt`
,
(
introduceId
)
=>
{
this
.
submitRemote
({
this
.
submitRemote
({
id
,
id
,
pageType
,
pageType
,
commonParams
,
commonParams
,
introduceId
,
courseMediaId
,
});
introduceId
,
},
()
=>
message
.
warning
(
'上传课程简介失败'
));
});
},
()
=>
message
.
warning
(
'上传课程简介失败'
));
},
()
=>
message
.
warning
(
'上传课程内容失败'
));
});
});
}
}
submitRemote
=
(
data
)
=>
{
submitRemote
=
(
data
)
=>
{
const
{
id
,
pageType
,
commonParams
,
courseMediaId
,
introduceId
}
=
data
;
const
{
id
,
pageType
,
commonParams
,
introduceId
}
=
data
;
commonParams
.
courseMediaId
=
courseMediaId
;
commonParams
.
introduceId
=
introduceId
;
commonParams
.
introduceId
=
introduceId
;
if
(
pageType
===
'add'
)
{
if
(
pageType
===
'add'
)
{
Service
.
Hades
(
'public/hades/create
Media
Course'
,
commonParams
).
then
((
res
)
=>
{
Service
.
Hades
(
'public/hades/create
Offline
Course'
,
commonParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
if
(
!
res
)
return
;
message
.
success
(
"新建成功"
);
message
.
success
(
"新建成功"
);
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
...
@@ -521,24 +525,11 @@ class AddOfflineCourse extends React.Component {
...
@@ -521,24 +525,11 @@ class AddOfflineCourse extends React.Component {
resolve
(
false
);
resolve
(
false
);
return
false
return
false
}
}
if
(
!
courseMedia
)
{
message
.
warning
(
'请输入课程内容'
);
resolve
(
false
);
return
false
}
if
(
!
categoryId
){
if
(
!
categoryId
){
message
.
warning
(
'请选择课程分类'
);
message
.
warning
(
'请选择课程分类'
);
resolve
(
false
);
resolve
(
false
);
return
false
return
false
}
}
// const textMedia = scheduleMedia.filter((item) => item.mediaType === 'TEXT');
// for (let i = 0, len = textMedia.length; i < len; i++) {
// if (textMedia[i].mediaContentLength && textMedia[i].mediaContentLength.length > 1000) {
// message.warning(`第${i+1}个文字简介的字数超过了1000个字`);
// resolve(false);
// return false
// }
// }
resolve
(
true
);
resolve
(
true
);
});
});
}
}
...
@@ -611,31 +602,30 @@ class AddOfflineCourse extends React.Component {
...
@@ -611,31 +602,30 @@ class AddOfflineCourse extends React.Component {
this
.
setState
(
data
);
this
.
setState
(
data
);
}
}
whetherVisitorsJoinChange
=
()
=>
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
"NO"
){
this
.
setState
({
whetherVisitorsJoin
:
'YES'
});
}
else
{
this
.
setState
({
whetherVisitorsJoin
:
'NO'
});
}
}
render
()
{
render
()
{
const
{
const
{
id
,
id
,
pageType
,
pageType
,
courseName
,
courseName
,
coverUrl
,
coverUrl
,
studentList
,
courseMedia
,
introduce
,
introduce
,
showCutModal
,
diskList
,
imageFile
,
videoType
,
shelfState
,
categoryName
,
categoryName
,
courseCatalogList
,
courseCatalogList
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
loadcourseMedia
,
loadintroduce
,
loadintroduce
,
showSelectCoverModal
,
showSelectCoverModal
,
visible
,
visible
,
hasImgReady
,
hasImgReady
,
cutImageBlob
,
cutImageBlob
,
teacherName
,
teacherName
,
teacherId
,
teacherList
,
teacherList
,
calendarTime
,
calendarTime
,
startTime
,
startTime
,
...
@@ -655,13 +645,9 @@ class AddOfflineCourse extends React.Component {
...
@@ -655,13 +645,9 @@ class AddOfflineCourse extends React.Component {
signInType
,
signInType
,
signOutType
,
signOutType
,
quota
,
quota
,
offlinePlace
,
}
=
this
.
state
;
}
=
this
.
state
;
// 已选择的上课学员数量
const
hasSelectedStu
=
studentList
.
length
;
const
courseWareIcon
=
FileVerifyMap
[
videoType
]
?
FileTypeIcon
[
FileVerifyMap
[
videoType
].
type
]
:
FileTypeIcon
[
videoType
];
const
isDefaultCover
=
coverUrl
===
defaultCoverUrl
;
const
isDefaultCover
=
coverUrl
===
defaultCoverUrl
;
return
(
return
(
<
div
className=
"page add-offline-course-page"
>
<
div
className=
"page add-offline-course-page"
>
<
Breadcrumbs
<
Breadcrumbs
...
@@ -723,12 +709,15 @@ class AddOfflineCourse extends React.Component {
...
@@ -723,12 +709,15 @@ class AddOfflineCourse extends React.Component {
</
div
>
</
div
>
<
div
className=
"course-catalog"
>
<
div
className=
"course-catalog"
>
<
span
className=
"label"
><
span
className=
"require"
>
*
</
span
>
上课地点:
</
span
>
<
span
className=
"label"
><
span
className=
"require"
>
*
</
span
>
上课地点:
</
span
>
<
Select
<
Input
value=
{
offlinePlace
}
maxLength=
{
40
}
style=
{
{
width
:
240
}
}
style=
{
{
width
:
240
}
}
placeholder=
"请输入上课地点(40字以内)"
placeholder=
"请输入上课地点(40字以内)"
>
onChange=
{
(
e
)
=>
{
this
.
setState
({
offlinePlace
:
e
.
target
.
value
})
</
Select
>
}
}
/>
</
div
>
</
div
>
<
div
className=
"course-catalog"
id=
"teacher"
>
<
div
className=
"course-catalog"
id=
"teacher"
>
<
span
className=
"label"
><
span
className=
"require"
>
*
</
span
>
讲师:
</
span
>
<
span
className=
"label"
><
span
className=
"require"
>
*
</
span
>
讲师:
</
span
>
...
...
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