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
95bec18d
Commit
95bec18d
authored
Jul 29, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs:删除无用的注释
parent
c6b1c283
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
909 additions
and
909 deletions
+909
-909
src/modules/course-manage/video-course/AddVideoCourse.jsx
+909
-909
No files found.
src/modules/course-manage/video-course/AddVideoCourse.jsx
View file @
95bec18d
...
@@ -7,718 +7,718 @@
...
@@ -7,718 +7,718 @@
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
import
React
from
'react'
import
React
from
'react'
;
import
{
Button
,
Input
,
message
,
Modal
,
Tooltip
,
Form
,
Popconfirm
,
Menu
,
Dropdown
}
from
'antd'
import
{
Button
,
Input
,
message
,
Modal
,
Tooltip
,
Form
,
Popconfirm
,
Menu
,
Dropdown
}
from
'antd'
;
import
{
FileTypeIcon
}
from
'@/common/constants/academic/lessonEnum'
import
{
FileTypeIcon
}
from
'@/common/constants/academic/lessonEnum'
;
import
{
CourseCatalogSelect
}
from
'@/modules/common'
import
{
CourseCatalogSelect
}
from
'@/modules/common'
;
import
ShowTips
from
'@/components/ShowTips'
import
ShowTips
from
'@/components/ShowTips'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
moment
from
'moment'
import
moment
from
'moment'
;
import
AddVideoIntro
from
'./components/AddVideoIntro'
import
AddVideoIntro
from
'./components/AddVideoIntro'
;
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
PreviewCourseModal
from
'../modal/PreviewCourseModal'
import
PreviewCourseModal
from
'../modal/PreviewCourseModal'
;
import
CourseService
from
'@/domains/course-domain/CourseService'
import
CourseService
from
'@/domains/course-domain/CourseService'
;
import
Service
from
'@/common/js/service'
import
Service
from
'@/common/js/service'
;
import
User
from
'@/common/js/user'
import
User
from
'@/common/js/user'
;
import
_
from
'underscore'
import
_
from
'underscore'
;
import
Upload
from
'@/core/upload'
import
Upload
from
'@/core/upload'
;
import
{
randomString
}
from
'@/domains/basic-domain/utils'
import
{
randomString
}
from
'@/domains/basic-domain/utils'
;
import
ImgClipModal
from
'@/components/ImgClipModal'
import
ImgClipModal
from
'@/components/ImgClipModal'
;
import
$
from
'jquery'
import
$
from
'jquery'
;
import
'./AddVideoCourse.less'
import
'./AddVideoCourse.less'
;
import
Bus
from
'@/core/bus'
import
Bus
from
'@/core/bus'
;
const
{
TextArea
}
=
Input
const
{
TextArea
}
=
Input
;
const
EDIT_BOX_KEY
=
Math
.
random
()
const
EDIT_BOX_KEY
=
Math
.
random
()
;
//添加课程时课程默认的一些值
//添加课程时课程默认的一些值
const
defaultShelfState
=
'YES'
const
defaultShelfState
=
'YES'
;
const
defaultScheduleMedia
=
[
const
defaultScheduleMedia
=
[
{
{
contentType
:
'INTRO'
,
contentType
:
'INTRO'
,
mediaType
:
'TEXT'
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
mediaContent
:
''
,
key
:
EDIT_BOX_KEY
,
key
:
EDIT_BOX_KEY
,
},
},
]
]
;
const
whetherVisitorsJoin
=
'NO'
const
whetherVisitorsJoin
=
'NO'
;
let
cutFlag
=
false
let
cutFlag
=
false
;
const
SUPPORT_WORD_PDF
=
[
const
SUPPORT_WORD_PDF
=
[
'application/msword'
,
'application/msword'
,
'application/wps-writer'
,
'application/wps-writer'
,
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
,
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
,
'application/pdf'
,
'application/pdf'
,
'application/wps-office.pdf'
,
'application/wps-office.pdf'
,
]
]
;
class
AddVideoCourse
extends
React
.
Component
{
class
AddVideoCourse
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
);
const
id
=
getParameterByName
(
'id'
)
const
id
=
getParameterByName
(
'id'
);
const
pageType
=
getParameterByName
(
'type'
)
const
pageType
=
getParameterByName
(
'type'
);
this
.
state
=
{
this
.
state
=
{
id
,
// 线上课ID,编辑的时候从URL上带过来
id
,
// 线上课ID,编辑的时候从URL上带过来
pageType
,
// 页面类型: add->新建 edit->编辑
pageType
,
// 页面类型: add->新建 edit->编辑
imageFile
:
null
,
// 需要被截取的图片
imageFile
:
null
,
// 需要被截取的图片
courseName
:
null
,
// 线上课名称
courseName
:
null
,
// 线上课名称
coverId
:
null
,
// 视频封面的recourceId
coverId
:
null
,
// 视频封面的recourceId
coverUrl
:
null
,
// 线上课封面
coverUrl
:
null
,
// 线上课封面
studentList
:
[],
// 上课学员列表
studentList
:
[],
// 上课学员列表
shelfState
:
'YES'
,
//是否开启学院展示
shelfState
:
'YES'
,
//是否开启学院展示
scheduleMedia
:
[
scheduleMedia
:
[
{
{
// 线上课媒体资源
// 线上课媒体资源
contentType
:
'INTRO'
,
contentType
:
'INTRO'
,
mediaType
:
'TEXT'
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
mediaContent
:
''
,
key
:
EDIT_BOX_KEY
,
key
:
EDIT_BOX_KEY
,
},
},
],
],
diskList
:
[],
// 机构可见磁盘目录
diskList
:
[],
// 机构可见磁盘目录
selectedFileList
:
[],
// 已经从资料云盘中勾选的文件
selectedFileList
:
[],
// 已经从资料云盘中勾选的文件
showCutModal
:
false
,
// 是否显示截图弹窗
showCutModal
:
false
,
// 是否显示截图弹窗
showSelectFileModal
:
false
,
showSelectFileModal
:
false
,
studentModal
:
false
,
studentModal
:
false
,
categoryName
:
null
,
//分类名称
categoryName
:
null
,
//分类名称
categoryId
:
null
,
//分类的Id值
categoryId
:
null
,
//分类的Id值
whetherVisitorsJoin
:
'NO'
,
// 是否允许游客加入
whetherVisitorsJoin
:
'NO'
,
// 是否允许游客加入
showSelectCoverModal
:
false
,
showSelectCoverModal
:
false
,
cutImageBlob
:
null
,
cutImageBlob
:
null
,
introduce
:
''
,
introduce
:
''
,
courseChapterList
:
[],
// 课节列表
courseChapterList
:
[],
// 课节列表
// videoType: "MP4",
// videoType: "MP4",
mediaNameAlias
:
''
,
// 任一视频重命名的名称(气泡框)
mediaNameAlias
:
''
,
// 任一视频重命名的名称(气泡框)
selectTypeList
:
[
'MP4'
],
selectTypeList
:
[
'MP4'
],
accept
:
'video/mp4'
,
accept
:
'video/mp4'
,
}
};
}
}
componentWillMount
()
{
componentWillMount
()
{
const
{
id
,
pageType
}
=
this
.
state
const
{
id
,
pageType
}
=
this
.
state
;
if
(
pageType
===
'edit'
)
{
if
(
pageType
===
'edit'
)
{
this
.
handleFetchScheudleDetail
(
id
)
this
.
handleFetchScheudleDetail
(
id
);
}
}
Bus
.
bind
(
'editorLimit'
,
(
editorTextLength
)
=>
{
Bus
.
bind
(
'editorLimit'
,
(
editorTextLength
)
=>
{
this
.
setState
({
this
.
setState
({
editorTextLength
,
editorTextLength
,
})
});
})
});
}
}
handleChangeCatalogList
=
(
value
,
label
)
=>
{
handleChangeCatalogList
=
(
value
,
label
)
=>
{
this
.
setState
({
categoryId
:
value
,
categoryName
:
label
[
0
]
})
this
.
setState
({
categoryId
:
value
,
categoryName
:
label
[
0
]
});
}
};
// 获取线上课详情
// 获取线上课详情
handleFetchScheudleDetail
=
(
courseId
)
=>
{
handleFetchScheudleDetail
=
(
courseId
)
=>
{
CourseService
.
videoScheduleDetail
({
CourseService
.
videoScheduleDetail
({
courseId
,
courseId
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
||
{}
const
{
result
=
{}
}
=
res
||
{};
const
{
courseName
,
shelfState
,
whetherVisitorsJoin
,
courseMediaVOS
,
categoryId
,
courseChapterVOList
=
[]
}
=
result
const
{
courseName
,
shelfState
,
whetherVisitorsJoin
,
courseMediaVOS
,
categoryId
,
courseChapterVOList
=
[]
}
=
result
;
let
coverId
let
coverId
;
let
coverUrl
let
coverUrl
;
let
scheduleMedia
=
[]
let
scheduleMedia
=
[];
let
scheduleVideoUrl
let
scheduleVideoUrl
;
let
hasIntro
let
hasIntro
;
courseMediaVOS
.
map
((
item
)
=>
{
courseMediaVOS
.
map
((
item
)
=>
{
switch
(
item
.
contentType
)
{
switch
(
item
.
contentType
)
{
case
'COVER'
:
case
'COVER'
:
coverId
=
item
.
mediaContent
coverId
=
item
.
mediaContent
;
coverUrl
=
item
.
mediaUrl
coverUrl
=
item
.
mediaUrl
;
break
break
;
case
'INTRO'
:
case
'INTRO'
:
hasIntro
=
true
hasIntro
=
true
;
this
.
getTextDetail
(
'introduce'
,
item
.
mediaUrl
)
this
.
getTextDetail
(
'introduce'
,
item
.
mediaUrl
);
break
break
;
default
:
default
:
break
break
;
}
}
return
item
return
item
;
})
});
const
_courseChapterVOList
=
courseChapterVOList
.
map
((
item
)
=>
{
const
_courseChapterVOList
=
courseChapterVOList
.
map
((
item
)
=>
{
item
.
mediaName
=
item
.
name
item
.
mediaName
=
item
.
name
;
item
.
resourceId
=
item
.
id
item
.
resourceId
=
item
.
id
;
return
item
return
item
;
})
});
this
.
setState
({
this
.
setState
({
loadintroduce
:
!
hasIntro
,
loadintroduce
:
!
hasIntro
,
coverId
,
coverId
,
coverUrl
,
coverUrl
,
scheduleMedia
,
scheduleMedia
,
courseName
,
courseName
,
scheduleVideoUrl
,
scheduleVideoUrl
,
shelfState
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
categoryId
,
categoryId
,
courseChapterList
:
_courseChapterVOList
,
courseChapterList
:
_courseChapterVOList
,
})
});
})
});
}
};
getTextDetail
=
(
key
,
url
)
=>
{
getTextDetail
=
(
key
,
url
)
=>
{
$
.
ajax
({
$
.
ajax
({
data
:
{},
data
:
{},
type
:
'GET'
,
type
:
'GET'
,
url
,
url
,
contentType
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
contentType
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
this
.
setState
({
[
key
]:
res
,
[
`load
${
key
}
`
]:
true
})
this
.
setState
({
[
key
]:
res
,
[
`load
${
key
}
`
]:
true
});
},
},
})
});
}
};
handleGoBack
=
()
=>
{
handleGoBack
=
()
=>
{
const
{
coverId
,
courseName
,
scheduleMedia
,
courseChapterList
,
categoryId
,
shelfState
,
whetherVisitorsJoin
}
=
this
.
state
const
{
coverId
,
courseName
,
scheduleMedia
,
courseChapterList
,
categoryId
,
shelfState
,
whetherVisitorsJoin
}
=
this
.
state
;
if
(
if
(
!
courseChapterList
.
length
||
!
courseChapterList
.
length
||
!
_
.
isEqual
(
scheduleMedia
,
defaultScheduleMedia
)
||
!
_
.
isEqual
(
scheduleMedia
,
defaultScheduleMedia
)
||
categoryId
||
categoryId
||
courseName
||
courseName
||
coverId
||
coverId
||
shelfState
!==
defaultShelfState
||
shelfState
!==
defaultShelfState
||
whetherVisitorsJoin
!==
whetherVisitorsJoin
whetherVisitorsJoin
!==
whetherVisitorsJoin
)
{
)
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'确认要返回吗?'
,
title
:
'确认要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存。'
,
content
:
'返回后,本次编辑的内容将不被保存。'
,
okText
:
'确认返回'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
pathname
:
`/video-course`
,
})
});
},
},
})
});
}
else
{
}
else
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
pathname
:
`/video-course`
,
})
});
}
}
}
};
// 修改表单
// 修改表单
handleChangeForm
=
(
field
,
value
,
coverUrl
)
=>
{
handleChangeForm
=
(
field
,
value
,
coverUrl
)
=>
{
this
.
setState
({
this
.
setState
({
[
field
]:
value
,
[
field
]:
value
,
coverUrl
:
coverUrl
?
coverUrl
:
this
.
state
.
coverUrl
,
coverUrl
:
coverUrl
?
coverUrl
:
this
.
state
.
coverUrl
,
})
});
}
};
// 显示选择学员弹窗
// 显示选择学员弹窗
handleShowSelectStuModal
=
()
=>
{
handleShowSelectStuModal
=
()
=>
{
this
.
setState
({
studentModal
:
true
})
this
.
setState
({
studentModal
:
true
});
const
{
studentList
,
selectedStuList
}
=
this
.
state
const
{
studentList
,
selectedStuList
}
=
this
.
state
;
const
studentModal
=
(
const
studentModal
=
(
<
SelectStudent
<
SelectStudent
showTabs=
{
true
}
showTabs=
{
true
}
type=
'videoCourse'
type=
'videoCourse'
onSelect=
{
this
.
handleSelectStudent
}
onSelect=
{
this
.
handleSelectStudent
}
after=
{
true
}
//表明是不是上课后的状态
after=
{
true
}
//表明是不是上课后的状态
studentList=
{
studentList
}
studentList=
{
studentList
}
close=
{
()
=>
{
close=
{
()
=>
{
this
.
setState
({
this
.
setState
({
studentModal
:
null
,
studentModal
:
null
,
})
});
}
}
}
}
/>
/>
)
);
this
.
setState
({
studentModal
})
this
.
setState
({
studentModal
});
}
};
handleSelectStudent
=
(
studentIds
)
=>
{
handleSelectStudent
=
(
studentIds
)
=>
{
let
studentList
=
[]
let
studentList
=
[];
_
.
each
(
studentIds
,
(
item
)
=>
{
_
.
each
(
studentIds
,
(
item
)
=>
{
studentList
.
push
({
studentId
:
item
})
studentList
.
push
({
studentId
:
item
});
})
});
this
.
setState
({
studentList
})
this
.
setState
({
studentList
});
this
.
setState
({
studentModal
:
false
})
this
.
setState
({
studentModal
:
false
});
}
};
// 显示预览弹窗
// 显示预览弹窗
handleShowPreviewModal
=
()
=>
{
handleShowPreviewModal
=
()
=>
{
const
{
coverUrl
,
scheduleVideoUrl
,
courseName
,
scheduleMedia
,
introduce
,
courseChapterList
,
categoryName
}
=
this
.
state
const
{
coverUrl
,
scheduleVideoUrl
,
courseName
,
scheduleMedia
,
introduce
,
courseChapterList
,
categoryName
}
=
this
.
state
;
const
courseBasinInfo
=
{
const
courseBasinInfo
=
{
coverUrl
,
coverUrl
,
scheduleVideoUrl
,
scheduleVideoUrl
,
courseName
,
courseName
,
}
};
const
courseIntroInfo
=
{
const
courseIntroInfo
=
{
liveCourseMediaRequests
:
scheduleMedia
,
liveCourseMediaRequests
:
scheduleMedia
,
introduce
,
introduce
,
categoryName
,
categoryName
,
}
};
const
previewCourseModal
=
(
const
previewCourseModal
=
(
<
PreviewCourseModal
<
PreviewCourseModal
type=
'videoCourse'
type=
'videoCourse'
courseBasicInfo=
{
courseBasinInfo
}
courseBasicInfo=
{
courseBasinInfo
}
courseIntroInfo=
{
courseIntroInfo
}
courseIntroInfo=
{
courseIntroInfo
}
close=
{
()
=>
{
close=
{
()
=>
{
this
.
setState
({
this
.
setState
({
previewCourseModal
:
null
,
previewCourseModal
:
null
,
})
});
}
}
}
}
courseChapterList=
{
courseChapterList
}
courseChapterList=
{
courseChapterList
}
/>
/>
)
);
this
.
setState
({
previewCourseModal
})
this
.
setState
({
previewCourseModal
});
}
};
// 选择视频
// 选择视频
handleSelectVideo
=
(
addFolderIds
,
selectedFileList
)
=>
{
handleSelectVideo
=
(
addFolderIds
,
selectedFileList
)
=>
{
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
false
,
showSelectFileModal
:
false
,
})
});
let
{
courseChapterList
}
=
this
.
state
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
[...
courseChapterList
]
let
_courseChapterList
=
[...
courseChapterList
];
if
(
selectedFileList
.
length
+
courseChapterList
.
length
>
20
)
{
if
(
selectedFileList
.
length
+
courseChapterList
.
length
>
20
)
{
message
.
warning
(
`最多只能上传20个文件`
)
message
.
warning
(
`最多只能上传20个文件`
);
return
return
;
}
}
selectedFileList
.
map
((
file
,
index
)
=>
{
selectedFileList
.
map
((
file
,
index
)
=>
{
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
const
{
ossUrl
,
resourceId
,
folderName
,
folderFormat
,
folderSize
}
=
file
;
const
_mediaName
=
folderName
.
replace
(
`.
${
_
.
last
(
folderName
.
split
(
'.'
)).
toLowerCase
()}
`
,
''
)
const
_mediaName
=
folderName
.
replace
(
`.
${
_
.
last
(
folderName
.
split
(
'.'
)).
toLowerCase
()}
`
,
''
);
console
.
log
(
'folderFormat'
,
folderFormat
)
console
.
log
(
'folderFormat'
,
folderFormat
);
if
(
folderFormat
===
'MP4'
||
folderFormat
===
'video/mp4'
)
{
if
(
folderFormat
===
'MP4'
||
folderFormat
===
'video/mp4'
)
{
const
videoDom
=
document
.
createElement
(
'video'
)
const
videoDom
=
document
.
createElement
(
'video'
);
videoDom
.
src
=
ossUrl
videoDom
.
src
=
ossUrl
;
videoDom
.
onloadedmetadata
=
()
=>
{
videoDom
.
onloadedmetadata
=
()
=>
{
_courseChapterList
.
push
({
_courseChapterList
.
push
({
mediaContent
:
resourceId
,
mediaContent
:
resourceId
,
contentType
:
'SCHEDULE'
,
contentType
:
'SCHEDULE'
,
mediaType
:
'VIDEO'
,
mediaType
:
'VIDEO'
,
mediaName
:
_mediaName
,
mediaName
:
_mediaName
,
videoDuration
:
videoDom
.
duration
,
videoDuration
:
videoDom
.
duration
,
resourceId
,
resourceId
,
mediaUrl
:
ossUrl
,
mediaUrl
:
ossUrl
,
sort
:
_courseChapterList
.
length
,
sort
:
_courseChapterList
.
length
,
})
});
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
})
});
}
};
}
else
if
(
folderFormat
===
'WORD'
||
folderFormat
===
'PDF'
||
SUPPORT_WORD_PDF
.
indexOf
(
folderFormat
)
>
-
1
)
{
}
else
if
(
folderFormat
===
'WORD'
||
folderFormat
===
'PDF'
||
SUPPORT_WORD_PDF
.
indexOf
(
folderFormat
)
>
-
1
)
{
const
suffix
=
_
.
last
(
folderName
.
split
(
'.'
)).
toUpperCase
()
const
suffix
=
_
.
last
(
folderName
.
split
(
'.'
)).
toUpperCase
();
_courseChapterList
.
push
({
_courseChapterList
.
push
({
mediaContent
:
resourceId
,
mediaContent
:
resourceId
,
contentType
:
'SCHEDULE'
,
contentType
:
'SCHEDULE'
,
mediaType
:
suffix
,
mediaType
:
suffix
,
mediaName
:
_mediaName
,
mediaName
:
_mediaName
,
resourceId
,
resourceId
,
mediaUrl
:
ossUrl
,
mediaUrl
:
ossUrl
,
sort
:
_courseChapterList
.
length
,
sort
:
_courseChapterList
.
length
,
})
});
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
})
});
}
}
})
});
}
};
// 校验课节名称
// 校验课节名称
handleValidateChapterName
=
(
chapterName
)
=>
{
handleValidateChapterName
=
(
chapterName
)
=>
{
let
hasError
=
false
let
hasError
=
false
;
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
if
(
!
chapterName
)
{
if
(
!
chapterName
)
{
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
'error'
,
chapterNameValidateStatus
:
'error'
,
chapterNameHelpMsg
:
'请输入课节名称'
,
chapterNameHelpMsg
:
'请输入课节名称'
,
})
});
hasError
=
true
hasError
=
true
;
resolve
(
false
)
resolve
(
false
);
return
false
return
false
;
}
}
if
(
chapterName
.
length
>
40
)
{
if
(
chapterName
.
length
>
40
)
{
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
'error'
,
chapterNameValidateStatus
:
'error'
,
chapterNameHelpMsg
:
'不要超过40字'
,
chapterNameHelpMsg
:
'不要超过40字'
,
})
});
hasError
=
true
hasError
=
true
;
resolve
(
false
)
resolve
(
false
);
return
false
return
false
;
}
}
if
(
!
hasError
)
{
if
(
!
hasError
)
{
resolve
(
true
)
resolve
(
true
);
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
''
,
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
chapterNameHelpMsg
:
''
,
})
});
}
}
})
});
}
};
// 保存
// 保存
handleSubmit
=
()
=>
{
handleSubmit
=
()
=>
{
//过期判断
//过期判断
if
(
User
.
getExpirationTime
()
&&
moment
().
valueOf
()
>
Number
(
User
.
getExpirationTime
()))
{
if
(
User
.
getExpirationTime
()
&&
moment
().
valueOf
()
>
Number
(
User
.
getExpirationTime
()))
{
Modal
.
warning
({
Modal
.
warning
({
title
:
'服务已到期'
,
title
:
'服务已到期'
,
content
:
'当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买'
,
content
:
'当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买'
,
okText
:
'我知道了'
,
okText
:
'我知道了'
,
})
});
return
return
;
}
}
const
{
const
{
id
,
id
,
coverId
,
coverId
,
pageType
,
pageType
,
// videoName,
// videoName,
// videoDuration,
// videoDuration,
courseName
,
courseName
,
scheduleMedia
,
scheduleMedia
,
categoryId
,
categoryId
,
shelfState
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
introduce
,
introduce
,
courseChapterList
,
courseChapterList
,
editorTextLength
,
editorTextLength
,
}
=
this
.
state
}
=
this
.
state
;
const
commonParams
=
{
const
commonParams
=
{
// videoName,
// videoName,
videoDuration
:
0
,
//后端的必要参数,不能传空
videoDuration
:
0
,
//后端的必要参数,不能传空
scheduleMedia
:
scheduleMedia
.
filter
((
item
)
=>
!!
item
.
mediaContent
),
scheduleMedia
:
scheduleMedia
.
filter
((
item
)
=>
!!
item
.
mediaContent
),
categoryId
,
categoryId
,
courseName
,
courseName
,
coverId
,
coverId
,
operatorId
:
User
.
getStoreUserId
(),
operatorId
:
User
.
getStoreUserId
(),
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
shelfState
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
courseType
:
'VOICE'
,
courseType
:
'VOICE'
,
courseChapterList
,
courseChapterList
,
}
};
// 校验必填字段:课程名称, 课程视频
// 校验必填字段:课程名称, 课程视频
this
.
handleValidate
(
courseName
,
courseChapterList
,
categoryId
,
scheduleMedia
,
editorTextLength
).
then
((
res
)
=>
{
this
.
handleValidate
(
courseName
,
courseChapterList
,
categoryId
,
scheduleMedia
,
editorTextLength
).
then
((
res
)
=>
{
if
(
!
res
)
return
if
(
!
res
)
return
;
Upload
.
uploadTextToOSS
(
introduce
,
`
${
randomString
()}
.txt`
,
(
introduceId
)
=>
{
Upload
.
uploadTextToOSS
(
introduce
,
`
${
randomString
()}
.txt`
,
(
introduceId
)
=>
{
this
.
submitRemote
({
id
,
pageType
,
commonParams
:
{
...
commonParams
,
introduceId
}
})
this
.
submitRemote
({
id
,
pageType
,
commonParams
:
{
...
commonParams
,
introduceId
}
});
})
});
})
});
}
};
submitRemote
=
({
id
,
pageType
,
commonParams
})
=>
{
submitRemote
=
({
id
,
pageType
,
commonParams
})
=>
{
if
(
pageType
===
'add'
)
{
if
(
pageType
===
'add'
)
{
Service
.
Hades
(
'public/hades/createVideoSchedule'
,
commonParams
).
then
((
res
)
=>
{
Service
.
Hades
(
'public/hades/createVideoSchedule'
,
commonParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
if
(
!
res
)
return
;
message
.
success
(
'新建成功'
)
message
.
success
(
'新建成功'
);
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
pathname
:
`/video-course`
,
})
});
})
});
}
else
{
}
else
{
const
editParams
=
{
const
editParams
=
{
courseId
:
id
,
courseId
:
id
,
...
commonParams
,
...
commonParams
,
}
};
Service
.
Hades
(
'public/hades/editVideoSchedule'
,
editParams
).
then
((
res
)
=>
{
Service
.
Hades
(
'public/hades/editVideoSchedule'
,
editParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
if
(
!
res
)
return
;
message
.
success
(
'保存成功'
)
message
.
success
(
'保存成功'
);
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
pathname
:
`/video-course`
,
})
});
})
});
}
}
}
};
handleValidate
=
(
courseName
,
courseChapterList
,
categoryId
,
scheduleMedia
,
editorTextLength
)
=>
{
handleValidate
=
(
courseName
,
courseChapterList
,
categoryId
,
scheduleMedia
,
editorTextLength
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
if
(
!
courseName
)
{
if
(
!
courseName
)
{
message
.
warning
(
'请输入课程名称'
)
message
.
warning
(
'请输入课程名称'
);
resolve
(
false
)
resolve
(
false
);
return
false
return
false
;
}
}
if
(
!
courseChapterList
.
length
)
{
if
(
!
courseChapterList
.
length
)
{
message
.
warning
(
'请上传课节'
)
message
.
warning
(
'请上传课节'
);
resolve
(
false
)
resolve
(
false
);
return
false
return
false
;
}
}
if
(
!
categoryId
)
{
if
(
!
categoryId
)
{
message
.
warning
(
'请选择课程分类'
)
message
.
warning
(
'请选择课程分类'
);
resolve
(
false
)
resolve
(
false
);
return
false
return
false
;
}
}
if
(
editorTextLength
>
1000
)
{
if
(
editorTextLength
>
1000
)
{
message
.
warning
(
'课程简介超过字数限定'
)
message
.
warning
(
'课程简介超过字数限定'
);
resolve
(
false
)
resolve
(
false
);
return
return
;
}
}
resolve
(
true
)
resolve
(
true
);
})
});
}
};
handleSelectCover
=
(
file
)
=>
{
handleSelectCover
=
(
file
)
=>
{
if
(
!
file
)
{
if
(
!
file
)
{
message
.
info
(
'请选择文件!'
)
message
.
info
(
'请选择文件!'
);
return
return
;
}
}
this
.
setState
({
this
.
setState
({
visible
:
true
,
visible
:
true
,
imageFile
:
file
,
imageFile
:
file
,
})
});
}
};
//获取resourceId
//获取resourceId
getSignature
=
(
blob
,
fileName
)
=>
{
getSignature
=
(
blob
,
fileName
)
=>
{
Upload
.
uploadBlobToOSS
(
blob
,
'cover'
+
new
Date
().
valueOf
(),
null
,
'signInfo'
).
then
((
signInfo
)
=>
{
Upload
.
uploadBlobToOSS
(
blob
,
'cover'
+
new
Date
().
valueOf
(),
null
,
'signInfo'
).
then
((
signInfo
)
=>
{
this
.
setState
(
this
.
setState
(
{
{
coverClicpPath
:
signInfo
.
fileUrl
,
coverClicpPath
:
signInfo
.
fileUrl
,
coverId
:
signInfo
.
resourceId
,
coverId
:
signInfo
.
resourceId
,
visible
:
false
,
visible
:
false
,
},
},
()
=>
this
.
updateCover
()
()
=>
this
.
updateCover
()
)
);
})
});
}
};
updateCover
=
()
=>
{
updateCover
=
()
=>
{
const
{
coverClicpPath
,
coverId
}
=
this
.
state
const
{
coverClicpPath
,
coverId
}
=
this
.
state
;
this
.
setState
({
this
.
setState
({
showSelectCoverModal
:
false
,
showSelectCoverModal
:
false
,
coverUrl
:
coverClicpPath
,
coverUrl
:
coverClicpPath
,
coverId
:
coverId
,
coverId
:
coverId
,
})
});
}
};
handleRenameCourseChapter
=
(
chapterId
,
chapterIndex
)
=>
{
handleRenameCourseChapter
=
(
chapterId
,
chapterIndex
)
=>
{
const
{
mediaNameAlias
}
=
this
.
state
const
{
mediaNameAlias
}
=
this
.
state
;
this
.
handleValidateChapterName
(
mediaNameAlias
).
then
((
res
)
=>
{
this
.
handleValidateChapterName
(
mediaNameAlias
).
then
((
res
)
=>
{
// 校验不通过不能点确定保存修改课节名称
// 校验不通过不能点确定保存修改课节名称
if
(
!
res
)
{
if
(
!
res
)
{
return
message
.
warning
(
'重命名失败'
)
return
message
.
warning
(
'重命名失败'
);
}
}
let
{
courseChapterList
}
=
this
.
state
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
[]
let
_courseChapterList
=
[];
_courseChapterList
=
courseChapterList
.
map
((
item
,
index
)
=>
{
_courseChapterList
=
courseChapterList
.
map
((
item
,
index
)
=>
{
if
(
item
.
resourceId
===
chapterId
&&
chapterIndex
===
index
)
{
if
(
item
.
resourceId
===
chapterId
&&
chapterIndex
===
index
)
{
item
.
mediaName
=
mediaNameAlias
item
.
mediaName
=
mediaNameAlias
;
item
.
visible
=
false
item
.
visible
=
false
;
}
}
return
item
return
item
;
})
});
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
chapterNameValidateStatus
:
''
,
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
chapterNameHelpMsg
:
''
,
mediaNameAlias
:
''
,
mediaNameAlias
:
''
,
})
});
})
});
}
};
handleChangePopConfirmVisible
=
(
chapterId
,
chapterNameIndex
,
visible
)
=>
{
handleChangePopConfirmVisible
=
(
chapterId
,
chapterNameIndex
,
visible
)
=>
{
let
{
courseChapterList
}
=
this
.
state
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
[]
let
_courseChapterList
=
[];
_courseChapterList
=
courseChapterList
.
map
((
item
,
index
)
=>
{
_courseChapterList
=
courseChapterList
.
map
((
item
,
index
)
=>
{
if
(
item
.
resourceId
===
chapterId
&&
chapterNameIndex
===
index
)
{
if
(
item
.
resourceId
===
chapterId
&&
chapterNameIndex
===
index
)
{
item
.
visible
=
visible
item
.
visible
=
visible
;
}
else
{
}
else
{
item
.
visible
=
false
item
.
visible
=
false
;
}
}
return
item
return
item
;
})
});
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
})
});
}
};
handleDeleteCourseChapter
=
(
chapterId
,
chapterIndex
)
=>
{
handleDeleteCourseChapter
=
(
chapterId
,
chapterIndex
)
=>
{
console
.
log
(
'chapterId---'
,
chapterId
,
chapterIndex
)
console
.
log
(
'chapterId---'
,
chapterId
,
chapterIndex
);
let
{
courseChapterList
}
=
this
.
state
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
courseChapterList
.
filter
((
item
,
index
)
=>
{
let
_courseChapterList
=
courseChapterList
.
filter
((
item
,
index
)
=>
{
return
item
.
resourceId
!==
chapterId
||
(
item
.
resourceId
===
chapterId
&&
chapterIndex
!==
index
)
return
item
.
resourceId
!==
chapterId
||
(
item
.
resourceId
===
chapterId
&&
chapterIndex
!==
index
);
})
});
_courseChapterList
.
map
((
item
,
index
)
=>
{
_courseChapterList
.
map
((
item
,
index
)
=>
{
item
.
sort
=
index
item
.
sort
=
index
;
})
});
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
})
});
}
};
renderChapterTitle
=
(
item
)
=>
{
renderChapterTitle
=
(
item
)
=>
{
const
{
chapterNameValidateStatus
,
chapterNameHelpMsg
}
=
this
.
state
const
{
chapterNameValidateStatus
,
chapterNameHelpMsg
}
=
this
.
state
;
return
(
return
(
<
div
className=
'course-chapter-title-popover'
>
<
div
className=
'course-chapter-title-popover'
>
<
div
className=
'tag-title'
>
课节名称
</
div
>
<
div
className=
'tag-title'
>
课节名称
</
div
>
<
Form
>
<
Form
>
<
Form
.
Item
validateStatus=
{
chapterNameValidateStatus
}
help=
{
chapterNameHelpMsg
}
>
<
Form
.
Item
validateStatus=
{
chapterNameValidateStatus
}
help=
{
chapterNameHelpMsg
}
>
<
TextArea
<
TextArea
defaultValue=
{
item
.
mediaName
}
defaultValue=
{
item
.
mediaName
}
placeholder=
'请输入课节名称'
placeholder=
'请输入课节名称'
maxLength=
{
40
}
maxLength=
{
40
}
autoSize
autoSize
style=
{
{
width
:
'318px'
}
}
style=
{
{
width
:
'318px'
}
}
onChange=
{
(
e
)
=>
{
onChange=
{
(
e
)
=>
{
this
.
setState
(
this
.
setState
(
{
{
mediaNameAlias
:
e
.
target
.
value
.
trim
(),
mediaNameAlias
:
e
.
target
.
value
.
trim
(),
},
},
()
=>
{
()
=>
{
this
.
handleValidateChapterName
(
this
.
state
.
mediaNameAlias
)
this
.
handleValidateChapterName
(
this
.
state
.
mediaNameAlias
);
}
}
)
);
}
}
}
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
>
</
Form
>
</
div
>
</
div
>
)
);
}
};
// 上下移动
// 上下移动
handleChangeIndex
=
(
isUp
,
sortIndex
)
=>
{
handleChangeIndex
=
(
isUp
,
sortIndex
)
=>
{
const
{
courseChapterList
}
=
this
.
state
const
{
courseChapterList
}
=
this
.
state
;
// 第一个上移和最后一个下移不能使用
// 第一个上移和最后一个下移不能使用
if
((
isUp
&&
sortIndex
===
0
)
||
(
!
isUp
&&
sortIndex
===
courseChapterList
.
length
-
1
))
{
if
((
isUp
&&
sortIndex
===
0
)
||
(
!
isUp
&&
sortIndex
===
courseChapterList
.
length
-
1
))
{
return
return
;
}
}
let
_courseChapterList
=
[...
courseChapterList
]
let
_courseChapterList
=
[...
courseChapterList
];
const
temp
=
courseChapterList
[
sortIndex
]
const
temp
=
courseChapterList
[
sortIndex
];
// 若上移
// 若上移
if
(
isUp
)
{
if
(
isUp
)
{
_courseChapterList
[
sortIndex
-
1
]
=
temp
_courseChapterList
[
sortIndex
-
1
]
=
temp
;
_courseChapterList
[
sortIndex
-
1
].
sort
=
sortIndex
-
1
_courseChapterList
[
sortIndex
-
1
].
sort
=
sortIndex
-
1
;
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
-
1
]
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
-
1
];
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
;
}
else
{
}
else
{
// 若下移
// 若下移
_courseChapterList
[
sortIndex
+
1
]
=
temp
_courseChapterList
[
sortIndex
+
1
]
=
temp
;
_courseChapterList
[
sortIndex
+
1
].
sort
=
sortIndex
+
1
_courseChapterList
[
sortIndex
+
1
].
sort
=
sortIndex
+
1
;
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
+
1
]
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
+
1
];
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
;
}
}
this
.
setState
({
this
.
setState
({
courseChapterList
:
_courseChapterList
,
courseChapterList
:
_courseChapterList
,
})
});
}
};
renderTypemenu
=
()
=>
{
renderTypemenu
=
()
=>
{
return
(
return
(
<
Menu
>
<
Menu
>
<
Menu
.
Item
>
<
Menu
.
Item
>
<
span
<
span
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
selectFileType
(
'VIDEO'
)
this
.
selectFileType
(
'VIDEO'
);
}
}
>
}
}
>
视频文件
视频文件
</
span
>
</
span
>
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
>
<
Menu
.
Item
>
<
span
<
span
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
selectFileType
(
'WORD_PDF'
)
this
.
selectFileType
(
'WORD_PDF'
);
}
}
>
}
}
>
资料文件
资料文件
</
span
>
</
span
>
</
Menu
.
Item
>
</
Menu
.
Item
>
</
Menu
>
</
Menu
>
)
);
}
};
selectFileType
=
(
type
)
=>
{
selectFileType
=
(
type
)
=>
{
const
{
courseChapterList
}
=
this
.
state
const
{
courseChapterList
}
=
this
.
state
;
if
(
courseChapterList
.
length
>=
20
)
{
if
(
courseChapterList
.
length
>=
20
)
{
message
.
warning
(
`最多只能上传20个文件`
)
message
.
warning
(
`最多只能上传20个文件`
);
return
return
;
}
}
if
(
type
===
'VIDEO'
)
{
if
(
type
===
'VIDEO'
)
{
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
true
,
showSelectFileModal
:
true
,
selectTypeList
:
[
'MP4'
],
selectTypeList
:
[
'MP4'
],
accept
:
'video/mp4'
,
accept
:
'video/mp4'
,
})
});
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
showSelectFileModal
:
true
,
showSelectFileModal
:
true
,
selectTypeList
:
[
'DOC'
,
'DOCX'
,
'PDF'
],
selectTypeList
:
[
'DOC'
,
'DOCX'
,
'PDF'
],
accept
:
'.doc,.docx,.pdf'
,
accept
:
'.doc,.docx,.pdf'
,
})
});
}
}
}
};
renderToolTipTitle
=
()
=>
{
renderToolTipTitle
=
()
=>
{
return
(
return
(
<
div
>
<
div
>
<
p
>
视频支持mp4格式,大小不超过2G;
</
p
>
<
p
>
视频支持mp4格式,大小不超过2G;
</
p
>
<
p
>
文件支持PDF、docx、doc格式,大小不超过100M
</
p
>
<
p
>
文件支持PDF、docx、doc格式,大小不超过100M
</
p
>
</
div
>
</
div
>
)
);
}
};
render
()
{
render
()
{
const
{
const
{
pageType
,
pageType
,
courseName
,
courseName
,
coverUrl
,
coverUrl
,
scheduleMedia
,
scheduleMedia
,
showSelectFileModal
,
showSelectFileModal
,
diskList
,
diskList
,
// videoType,
// videoType,
shelfState
,
shelfState
,
categoryId
,
categoryId
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
visible
,
visible
,
showSelectCoverModal
,
showSelectCoverModal
,
introduce
,
introduce
,
loadintroduce
,
loadintroduce
,
id
,
id
,
courseChapterList
,
courseChapterList
,
imageFile
,
imageFile
,
selectTypeList
,
selectTypeList
,
accept
,
accept
,
}
=
this
.
state
}
=
this
.
state
;
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'
;
const
isDefaultCover
=
coverUrl
===
defaultCover
||
coverUrl
==
null
const
isDefaultCover
=
coverUrl
===
defaultCover
||
coverUrl
==
null
;
return
(
return
(
<
div
className=
'page add-video-course-page'
>
<
div
className=
'page add-video-course-page'
>
<
Breadcrumbs
navList=
{
pageType
===
'add'
?
'新建线上课'
:
'编辑线上课'
}
goBack=
{
this
.
handleGoBack
}
/>
<
Breadcrumbs
navList=
{
pageType
===
'add'
?
'新建线上课'
:
'编辑线上课'
}
goBack=
{
this
.
handleGoBack
}
/>
<
div
className=
'box'
>
<
div
className=
'box'
>
<
div
className=
'show-tips'
>
<
div
className=
'show-tips'
>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
</
div
>
</
div
>
<
div
className=
'form'
>
<
div
className=
'form'
>
<
div
className=
'course-name required'
>
<
div
className=
'course-name required'
>
<
span
className=
'label'
>
课程名称:
</
span
>
<
span
className=
'label'
>
课程名称:
</
span
>
<
Input
<
Input
value=
{
courseName
}
value=
{
courseName
}
placeholder=
'请输入线上课的名称(40字以内)'
placeholder=
'请输入线上课的名称(40字以内)'
maxLength=
{
40
}
maxLength=
{
40
}
style=
{
{
width
:
240
}
}
style=
{
{
width
:
240
}
}
onChange=
{
(
e
)
=>
{
onChange=
{
(
e
)
=>
{
this
.
handleChangeForm
(
'courseName'
,
e
.
target
.
value
)
this
.
handleChangeForm
(
'courseName'
,
e
.
target
.
value
);
}
}
}
}
/>
/>
</
div
>
</
div
>
<
div
className=
'upload-video mt16'
>
<
div
className=
'upload-video mt16'
>
<
div
className=
'content flex'
>
<
div
className=
'content flex'
>
<
span
className=
'label required upload-chapter'
>
上传课节:
</
span
>
<
span
className=
'label required upload-chapter'
>
上传课节:
</
span
>
</
div
>
</
div
>
<
div
className=
'sub-content'
>
<
div
className=
'sub-content'
>
<
div
className=
'btn-wrap'
>
<
div
className=
'btn-wrap'
>
{
/* <Button
{
/* <Button
onClick={() => {
onClick={() => {
if(courseChapterList.length >= 20) {
if(courseChapterList.length >= 20) {
message.warning(`最多只能上传20个文件`);
message.warning(`最多只能上传20个文件`);
...
@@ -728,207 +728,207 @@ class AddVideoCourse extends React.Component {
...
@@ -728,207 +728,207 @@ class AddVideoCourse extends React.Component {
showSelectFileModal: true
showSelectFileModal: true
})
})
}}>添加视频</Button> */
}
}}>添加视频</Button> */
}
<
div
className=
'select-file'
>
<
div
className=
'select-file'
>
<
Dropdown
overlay=
{
this
.
renderTypemenu
()
}
>
<
Dropdown
overlay=
{
this
.
renderTypemenu
()
}
>
<
Button
>
选择文件
</
Button
>
<
Button
>
选择文件
</
Button
>
</
Dropdown
>
</
Dropdown
>
</
div
>
</
div
>
<
div
className=
'course-ware--empty'
>
从素材库中选择视频
</
div
>
<
div
className=
'course-ware--empty'
>
从素材库中选择视频
</
div
>
</
div
>
</
div
>
<
div
className=
'tips'
>
<
div
className=
'tips'
>
课节数量限制20个,文件规格说明
课节数量限制20个,文件规格说明
<
Tooltip
title=
{
this
.
renderToolTipTitle
()
}
overlayClassName=
'my-chapter-tooltip'
>
<
Tooltip
title=
{
this
.
renderToolTipTitle
()
}
overlayClassName=
'my-chapter-tooltip'
>
<
i
className=
'icon iconfont'
style=
{
{
cursor
:
'pointer'
,
color
:
'#bfbfbf'
,
fontSize
:
'14px'
}
}
>
<
i
className=
'icon iconfont'
style=
{
{
cursor
:
'pointer'
,
color
:
'#bfbfbf'
,
fontSize
:
'14px'
}
}
>
{
' '
}
{
' '
}


</
i
>
</
i
>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
If
condition=
{
courseChapterList
.
length
>
0
}
>
<
If
condition=
{
courseChapterList
.
length
>
0
}
>
<
div
className=
'course-chapter-list-wrap'
>
<
div
className=
'course-chapter-list-wrap'
>
<
div
className=
'course-chapter-total'
>
{
`共${courseChapterList.length}个课节`
}
</
div
>
<
div
className=
'course-chapter-total'
>
{
`共${courseChapterList.length}个课节`
}
</
div
>
<
div
className=
'course-chapter-list'
id=
'course-chapter-list'
>
<
div
className=
'course-chapter-list'
id=
'course-chapter-list'
>
{
_
.
map
(
courseChapterList
,
(
item
,
index
)
=>
{
{
_
.
map
(
courseChapterList
,
(
item
,
index
)
=>
{
return
(
return
(
<
div
className=
'course-ware'
key=
{
index
}
>
<
div
className=
'course-ware'
key=
{
index
}
>
<
div
className=
'course-ware__index'
>
{
index
<
9
?
`0${index + 1} `
:
`${index + 1} `
}
</
div
>
<
div
className=
'course-ware__index'
>
{
index
<
9
?
`0${index + 1} `
:
`${index + 1} `
}
</
div
>
<
img
className=
'course-ware__img'
src=
{
FileTypeIcon
[
item
.
mediaType
]
}
alt=
''
/>
<
img
className=
'course-ware__img'
src=
{
FileTypeIcon
[
item
.
mediaType
]
}
alt=
''
/>
<
div
className=
'course-ware__name'
>
<
div
className=
'course-ware__name'
>
{
item
.
mediaName
&&
item
.
mediaName
.
length
>
24
?
<
Tooltip
title=
{
item
.
mediaName
}
>
{
item
.
mediaName
}
</
Tooltip
>
:
item
.
mediaName
}
{
item
.
mediaName
&&
item
.
mediaName
.
length
>
24
?
<
Tooltip
title=
{
item
.
mediaName
}
>
{
item
.
mediaName
}
</
Tooltip
>
:
item
.
mediaName
}
</
div
>
</
div
>
<
div
className=
'course-chapter__opt'
id=
{
item
.
resourceId
}
>
<
div
className=
'course-chapter__opt'
id=
{
item
.
resourceId
}
>
<
div
<
div
className=
{
`up ${Number(index) === 0 ? 'disabled' : ''}`
}
className=
{
`up ${Number(index) === 0 ? 'disabled' : ''}`
}
onClick=
{
()
=>
this
.
handleChangeIndex
(
true
,
item
.
sort
,
item
.
resourceId
)
}
>
onClick=
{
()
=>
this
.
handleChangeIndex
(
true
,
item
.
sort
,
item
.
resourceId
)
}
>
上移
上移
</
div
>
</
div
>
<
div
className=
'line'
>
|
</
div
>
<
div
className=
'line'
>
|
</
div
>
<
div
<
div
className=
{
`down ${Number(index) === courseChapterList.length - 1 ? 'disabled' : ''}`
}
className=
{
`down ${Number(index) === courseChapterList.length - 1 ? 'disabled' : ''}`
}
onClick=
{
()
=>
this
.
handleChangeIndex
(
false
,
item
.
sort
,
item
.
resourceId
)
}
>
onClick=
{
()
=>
this
.
handleChangeIndex
(
false
,
item
.
sort
,
item
.
resourceId
)
}
>
下移
下移
</
div
>
</
div
>
<
div
className=
'line'
>
|
</
div
>
<
div
className=
'line'
>
|
</
div
>
<
Popconfirm
<
Popconfirm
placement=
'topLeft'
placement=
'topLeft'
className=
'course-chapter-tooltip'
className=
'course-chapter-tooltip'
title=
{
this
.
renderChapterTitle
(
item
)
}
title=
{
this
.
renderChapterTitle
(
item
)
}
color=
'#fff'
color=
'#fff'
trigger=
'click'
trigger=
'click'
overlayClassName=
'chapter-popover'
overlayClassName=
'chapter-popover'
getPopupContainer=
{
()
=>
document
.
getElementById
(
'course-chapter-list'
)
}
getPopupContainer=
{
()
=>
document
.
getElementById
(
'course-chapter-list'
)
}
destroyTooltipOnHide=
{
true
}
destroyTooltipOnHide=
{
true
}
visible=
{
item
.
visible
}
visible=
{
item
.
visible
}
onConfirm=
{
()
=>
this
.
handleRenameCourseChapter
(
item
.
resourceId
,
index
)
}
onConfirm=
{
()
=>
this
.
handleRenameCourseChapter
(
item
.
resourceId
,
index
)
}
icon=
{
null
}
icon=
{
null
}
onVisibleChange=
{
(
visible
)
=>
{
onVisibleChange=
{
(
visible
)
=>
{
!
visible
&&
!
visible
&&
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
''
,
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
chapterNameHelpMsg
:
''
,
mediaNameAlias
:
''
,
mediaNameAlias
:
''
,
})
});
}
}
}
}
onCancel=
{
()
=>
this
.
handleChangePopConfirmVisible
(
item
.
resourceId
,
index
,
false
)
}
>
onCancel=
{
()
=>
this
.
handleChangePopConfirmVisible
(
item
.
resourceId
,
index
,
false
)
}
>
<
div
<
div
className=
'rename'
className=
'rename'
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
setState
({
mediaNameAlias
:
item
.
mediaName
},
()
=>
{
this
.
setState
({
mediaNameAlias
:
item
.
mediaName
},
()
=>
{
this
.
handleChangePopConfirmVisible
(
item
.
resourceId
,
index
,
true
)
this
.
handleChangePopConfirmVisible
(
item
.
resourceId
,
index
,
true
);
})
});
}
}
>
}
}
>
重命名
重命名
</
div
>
</
div
>
</
Popconfirm
>
</
Popconfirm
>
<
div
className=
'line'
>
|
</
div
>
<
div
className=
'line'
>
|
</
div
>
<
div
className=
'delete'
onClick=
{
()
=>
this
.
handleDeleteCourseChapter
(
item
.
resourceId
,
index
)
}
>
<
div
className=
'delete'
onClick=
{
()
=>
this
.
handleDeleteCourseChapter
(
item
.
resourceId
,
index
)
}
>
移除
移除
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
);
})
}
})
}
</
div
>
</
div
>
</
div
>
</
div
>
</
If
>
</
If
>
<
div
className=
'cover-url flex mt16'
>
<
div
className=
'cover-url flex mt16'
>
<
div
className=
'label cover'
>
封面图:
</
div
>
<
div
className=
'label cover'
>
封面图:
</
div
>
<
div
className=
'cover-url__wrap'
>
<
div
className=
'cover-url__wrap'
>
<
div
className=
'opt-btns'
>
<
div
className=
'opt-btns'
>
<
div
>
<
div
>
<
Button
<
Button
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
setState
({
showSelectCoverModal
:
true
})
this
.
setState
({
showSelectCoverModal
:
true
});
}
}
>
{
`${pageType === 'add' && !coverUrl ? '上传' : '修改'}封面`
}
</
Button
>
}
}
>
{
`${pageType === 'add' && !coverUrl ? '上传' : '修改'}封面`
}
</
Button
>
<
span
<
span
className=
{
`span ${coverUrl ? 'defalut-span' : ''}`
}
className=
{
`span ${coverUrl ? 'defalut-span' : ''}`
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
setState
({
this
.
setState
({
coverUrl
:
''
,
coverUrl
:
''
,
coverId
:
''
,
coverId
:
''
,
})
});
}
}
>
}
}
>
使用默认图
使用默认图
</
span
>
</
span
>
</
div
>
</
div
>
<
div
className=
'tips'
>
建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。
</
div
>
<
div
className=
'tips'
>
建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。
</
div
>
</
div
>
</
div
>
<
div
className=
'img-content'
>
<
div
className=
'img-content'
>
{
isDefaultCover
&&
<
span
className=
'tag'
>
默认图
</
span
>
}
{
isDefaultCover
&&
<
span
className=
'tag'
>
默认图
</
span
>
}
{
/* 如果视频和封面都没有上传的话, 那么就显示缺省, 如果上传了视频, 那么封面图就默认显示视频的第一帧, 如果上传了封面图, 那么就显示上传的封面图 */
}
{
/* 如果视频和封面都没有上传的话, 那么就显示缺省, 如果上传了视频, 那么封面图就默认显示视频的第一帧, 如果上传了封面图, 那么就显示上传的封面图 */
}
<
img
src=
{
coverUrl
||
`https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png`
}
alt=
''
/>
<
img
src=
{
coverUrl
||
`https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png`
}
alt=
''
/>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'course-catalog required'
>
<
div
className=
'course-catalog required'
>
<
span
className=
'label'
>
课程分类:
</
span
>
<
span
className=
'label'
>
课程分类:
</
span
>
<
CourseCatalogSelect
<
CourseCatalogSelect
value=
{
categoryId
}
value=
{
categoryId
}
onChange=
{
(
value
,
label
)
=>
{
onChange=
{
(
value
,
label
)
=>
{
this
.
handleChangeCatalogList
(
value
,
label
)
this
.
handleChangeCatalogList
(
value
,
label
);
}
}
}
}
/>
/>
</
div
>
</
div
>
<
div
className=
'intro-info mt16'
>
<
div
className=
'intro-info mt16'
>
<
AddVideoIntro
<
AddVideoIntro
data=
{
{
data=
{
{
id
,
id
,
liveCourseMediaRequests
:
scheduleMedia
,
liveCourseMediaRequests
:
scheduleMedia
,
shelfState
,
shelfState
,
whetherVisitorsJoin
,
whetherVisitorsJoin
,
introduce
,
introduce
,
loadintroduce
,
loadintroduce
,
}
}
}
}
onChange=
{
this
.
handleChangeForm
}
onChange=
{
this
.
handleChangeForm
}
/>
/>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'footer shrink-footer'
>
<
div
className=
'footer shrink-footer'
>
<
Button
onClick=
{
this
.
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
this
.
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
this
.
handleShowPreviewModal
}
>
预览
</
Button
>
<
Button
onClick=
{
this
.
handleShowPreviewModal
}
>
预览
</
Button
>
<
Button
type=
'primary'
onClick=
{
_
.
debounce
(()
=>
this
.
handleSubmit
(),
3000
,
true
)
}
>
<
Button
type=
'primary'
onClick=
{
_
.
debounce
(()
=>
this
.
handleSubmit
(),
3000
,
true
)
}
>
保存
保存
</
Button
>
</
Button
>
</
div
>
</
div
>
{
/* 选择备课文件弹窗 */
}
{
/* 选择备课文件弹窗 */
}
{
showSelectFileModal
&&
(
{
showSelectFileModal
&&
(
<
SelectPrepareFileModal
<
SelectPrepareFileModal
multiple=
{
true
}
multiple=
{
true
}
operateType=
'select'
operateType=
'select'
selectTypeList=
{
selectTypeList
}
selectTypeList=
{
selectTypeList
}
accept=
{
accept
}
accept=
{
accept
}
queryTypeEnum=
{
'ONLINE'
}
queryTypeEnum=
{
'ONLINE'
}
confirm=
{
{
confirm=
{
{
title
:
'文件过大,无法上传'
,
title
:
'文件过大,无法上传'
,
content
:
'上传的视频大小不能超过2G,文件大小不能超过100M'
,
content
:
'上传的视频大小不能超过2G,文件大小不能超过100M'
,
}
}
}
}
tooltip=
{
''
}
tooltip=
{
''
}
isOpen=
{
showSelectFileModal
}
isOpen=
{
showSelectFileModal
}
diskList=
{
diskList
}
diskList=
{
diskList
}
addVideo=
{
true
}
addVideo=
{
true
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
this
.
setState
({
showSelectFileModal
:
false
})
this
.
setState
({
showSelectFileModal
:
false
});
}
}
}
}
onSelect=
{
this
.
handleSelectVideo
}
onSelect=
{
this
.
handleSelectVideo
}
/>
/>
)
}
)
}
{
showSelectCoverModal
&&
(
{
showSelectCoverModal
&&
(
<
SelectPrepareFileModal
<
SelectPrepareFileModal
key=
'basic'
key=
'basic'
operateType=
'select'
operateType=
'select'
multiple=
{
false
}
multiple=
{
false
}
accept=
'image/jpeg,image/png,image/jpg'
accept=
'image/jpeg,image/png,image/jpg'
selectTypeList=
{
[
'JPG'
,
'JPEG'
,
'PNG'
]
}
selectTypeList=
{
[
'JPG'
,
'JPEG'
,
'PNG'
]
}
tooltip=
'支持文件类型:jpg、jpeg、png'
tooltip=
'支持文件类型:jpg、jpeg、png'
isOpen=
{
showSelectCoverModal
}
isOpen=
{
showSelectCoverModal
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
this
.
setState
({
showSelectCoverModal
:
false
})
this
.
setState
({
showSelectCoverModal
:
false
});
}
}
}
}
onSelect=
{
this
.
handleSelectCover
}
onSelect=
{
this
.
handleSelectCover
}
/>
/>
)
}
)
}
{
visible
&&
(
{
visible
&&
(
<
ImgClipModal
<
ImgClipModal
visible=
{
visible
}
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
})
this
.
setState
({
visible
:
false
});
}
}
}
}
/>
/>
)
}
)
}
{
this
.
state
.
previewCourseModal
}
{
this
.
state
.
previewCourseModal
}
</
div
>
</
div
>
)
);
}
}
}
}
export
default
AddVideoCourse
export
default
AddVideoCourse
;
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