Commit 5ca73a22 by wufan

feat:线上课列表默认图

parent 79ea4fff
...@@ -139,6 +139,7 @@ const FileTypeIcon = { ...@@ -139,6 +139,7 @@ const FileTypeIcon = {
PNG: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png", PNG: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png",
GIF: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png", GIF: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png",
BMP: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png", BMP: "https://image.xiaomaiketang.com/xm/XRkX8JBTPs.png",
VIDEO: "https://image.xiaomaiketang.com/xm/TKwbQGYDBR.png"
}; };
const UploadIcon = "https://image.xiaomaiketang.com/xm/4DXNrZWWsd.png"; const UploadIcon = "https://image.xiaomaiketang.com/xm/4DXNrZWWsd.png";
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2021-07-05 15:59:51 * @LastEditTime: 2021-07-06 13:45:55
* @Description: 线上课新增/编辑页 * @Description: 线上课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -56,7 +56,6 @@ class AddVideoCourse extends React.Component { ...@@ -56,7 +56,6 @@ class AddVideoCourse extends React.Component {
pageType, // 页面类型: add->新建 edit->编辑 pageType, // 页面类型: add->新建 edit->编辑
imageFile: null, // 需要被截取的图片 imageFile: null, // 需要被截取的图片
courseName: null, // 线上课名称 courseName: null, // 线上课名称
scheduleVideoIds: null, // 线上课链接
coverId: null, // 视频封面的recourceId coverId: null, // 视频封面的recourceId
coverUrl: null, // 线上课封面 coverUrl: null, // 线上课封面
studentList: [], // 上课学员列表 studentList: [], // 上课学员列表
...@@ -83,7 +82,8 @@ class AddVideoCourse extends React.Component { ...@@ -83,7 +82,8 @@ class AddVideoCourse extends React.Component {
cutImageBlob: null, cutImageBlob: null,
introduce: '', introduce: '',
courseChapterList:[ courseChapterList:[
] // 课节列表 ], // 课节列表
videoType: "MP4",
} }
} }
...@@ -124,14 +124,12 @@ class AddVideoCourse extends React.Component { ...@@ -124,14 +124,12 @@ class AddVideoCourse extends React.Component {
courseId courseId
}).then((res) => { }).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {}
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId, courseChapterList =[] } = result const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId, courseChapterVOList =[] } = result
let coverId let coverId
let coverUrl let coverUrl
let videoType
let videoDuration let videoDuration
let videoName let videoName
let scheduleMedia = [] let scheduleMedia = []
let scheduleVideoIds
let scheduleVideoUrl let scheduleVideoUrl
let hasIntro let hasIntro
...@@ -141,13 +139,6 @@ class AddVideoCourse extends React.Component { ...@@ -141,13 +139,6 @@ class AddVideoCourse extends React.Component {
coverId = item.mediaContent coverId = item.mediaContent
coverUrl = item.mediaUrl coverUrl = item.mediaUrl
break break
case 'SCHEDULE':
videoDuration = item.videoDuration
videoName = item.mediaName
scheduleVideoIds = item.mediaContent
scheduleVideoUrl = item.mediaUrl
videoType = item.mediaType
break
case 'INTRO': case 'INTRO':
hasIntro = true hasIntro = true
this.getTextDetail('introduce', item.mediaUrl) this.getTextDetail('introduce', item.mediaUrl)
...@@ -164,22 +155,27 @@ class AddVideoCourse extends React.Component { ...@@ -164,22 +155,27 @@ class AddVideoCourse extends React.Component {
} else { } else {
categoryName = `${categoryOneName}` categoryName = `${categoryOneName}`
} }
const _courseChapterVOList = courseChapterVOList.map(item => {
item.mediaName = item.name;
item.mediaNameAlias = item.name;
return item
})
this.setState({ this.setState({
loadintroduce: !hasIntro, loadintroduce: !hasIntro,
coverId, coverId,
coverUrl, coverUrl,
videoType,
videoName, videoName,
videoDuration, videoDuration,
scheduleMedia, scheduleMedia,
courseName, courseName,
scheduleVideoIds,
scheduleVideoUrl, scheduleVideoUrl,
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
categoryName, categoryName,
categoryId, categoryId,
courseChapterList courseChapterList: _courseChapterVOList
}) })
}) })
} }
...@@ -197,11 +193,11 @@ class AddVideoCourse extends React.Component { ...@@ -197,11 +193,11 @@ class AddVideoCourse extends React.Component {
} }
handleGoBack = () => { handleGoBack = () => {
const { coverId, videoName, videoDuration, courseName, scheduleMedia, scheduleVideoIds, categoryId, shelfState, whetherVisitorsJoin } = this.state const { coverId, videoName, videoDuration, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state
if ( if (
videoName || videoName ||
videoDuration || videoDuration ||
scheduleVideoIds || !courseChapterList.length ||
!_.isEqual(scheduleMedia, defaultScheduleMedia) || !_.isEqual(scheduleMedia, defaultScheduleMedia) ||
categoryId || categoryId ||
courseName || courseName ||
...@@ -334,8 +330,6 @@ class AddVideoCourse extends React.Component { ...@@ -334,8 +330,6 @@ class AddVideoCourse extends React.Component {
size: folderSize, size: folderSize,
videoName: folderName, videoName: folderName,
videoType: folderFormat, videoType: folderFormat,
scheduleVideoUrl: ossUrl,
scheduleVideoIds: resourceId,
courseChapterList: _courseChapterList courseChapterList: _courseChapterList
}) })
} }
...@@ -391,18 +385,12 @@ class AddVideoCourse extends React.Component { ...@@ -391,18 +385,12 @@ class AddVideoCourse extends React.Component {
const { const {
id, id,
size,
coverId, coverId,
coverUrl,
pageType, pageType,
joinType,
videoName, videoName,
videoDuration, videoDuration,
studentList,
courseName, courseName,
scheduleMedia, scheduleMedia,
scheduleVideoIds,
scheduleVideoUrl,
categoryId, categoryId,
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
...@@ -413,7 +401,6 @@ class AddVideoCourse extends React.Component { ...@@ -413,7 +401,6 @@ class AddVideoCourse extends React.Component {
const commonParams = { const commonParams = {
videoName, videoName,
videoDuration, videoDuration,
courseMediaId: scheduleVideoIds,
scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent), scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent),
categoryId, categoryId,
courseName, courseName,
...@@ -426,7 +413,7 @@ class AddVideoCourse extends React.Component { ...@@ -426,7 +413,7 @@ class AddVideoCourse extends React.Component {
courseChapterList courseChapterList
} }
// 校验必填字段:课程名称, 课程视频 // 校验必填字段:课程名称, 课程视频
this.handleValidate(courseName, scheduleVideoIds, categoryId, scheduleMedia).then((res) => { this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia).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 } })
...@@ -458,14 +445,14 @@ class AddVideoCourse extends React.Component { ...@@ -458,14 +445,14 @@ class AddVideoCourse extends React.Component {
} }
} }
handleValidate = (courseName, scheduleVideoIds, categoryId, scheduleMedia) => { handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia) => {
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 (!scheduleVideoIds) { if (!courseChapterList.length) {
message.warning('请上传视频') message.warning('请上传视频')
resolve(false) resolve(false)
return false return false
...@@ -690,18 +677,10 @@ class AddVideoCourse extends React.Component { ...@@ -690,18 +677,10 @@ class AddVideoCourse extends React.Component {
const { const {
pageType, pageType,
courseName, courseName,
scheduleVideoIds,
coverId,
coverUrl, coverUrl,
scheduleVideoUrl,
studentList,
scheduleMedia, scheduleMedia,
showCutModal,
showSelectFileModal, showSelectFileModal,
diskList, diskList,
imageFile,
joinType,
videoName,
videoType, videoType,
shelfState, shelfState,
categoryName, categoryName,
......
...@@ -63,17 +63,15 @@ class VideoCourseList extends React.Component { ...@@ -63,17 +63,15 @@ class VideoCourseList 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 <img
className='course-cover' className='course-cover'
src={ src={
coverUrl || coverUrl || 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png'
(type === 'internal' ? `${scheduleVideoUrl}?x-oss-process=video/snapshot,t_0,m_fast` : 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png')
} }
alt='' alt='封面图'
/> />
<Choose> <Choose>
<When condition={record.courseName.length > 25}> <When condition={record.courseName.length > 25}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment