Commit 5ca73a22 by wufan

feat:线上课列表默认图

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