Commit a6ced707 by wufan

feat:添加sort字段

parent 3dc6f992
......@@ -13,8 +13,9 @@
}
.container {
overflow: scroll;
height: 100%;;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
.course-cover, .course-url {
width: 100%;
......
......@@ -108,7 +108,7 @@ class PreviewCourseModal extends React.Component {
timeHorizonEnd,
teacherName,
} = courseClassInfo;
const { introduce } = courseIntroInfo;
const { introduce, categoryName } = courseIntroInfo;
let { activeTab } = this.state;
let liveDateStr, startTimeStr, endTimeStr;
......@@ -163,54 +163,53 @@ class PreviewCourseModal extends React.Component {
>
<div className="container__wrap">
<div className="container">
<div className="container__header">
{type === "videoCourse" ? (
<video
controls
src={courseChapterList.length && courseChapterList[0].mediaUrl || scheduleVideoUrl }
poster={
coverUrl
? coverUrl
: "https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png"
}
className="course-url"
/>
) : (
<img src={coverUrl} className="course-cover" />
)}
<div className='container__header'>
<Choose>
<When condition={type === 'videoCourse'}>
<video
controls
src={courseChapterList.length && courseChapterList[0].mediaUrl || scheduleVideoUrl }
poster={coverUrl ? coverUrl : `https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png`}
className='course-url'
/>
</When>
<Otherwise>
<img src={coverUrl} className='course-cover' alt='' />
</Otherwise>
</Choose>
</div>
{type === "videoCourse" ? (
<div className="container__body">
<div className="title__name">{courseName}</div>
{videoDuration && (
<div>视频时长:{this.dealTimeDuration(videoDuration)}</div>
)}
</div>
) : (
<div className="container__body">
<div className="container__body__title">
<div className="title__name">{courseName}</div>
<div className="title__state">
{courseStateShow[courseState].title}
</div>
</div>
<div className="container__body__time">
<span className="time__label">上课时间:</span>
<span className="time__value">
{[
<span>{liveDateStr}&nbsp;</span>,
<span>
{startTimeStr}~{endTimeStr}
</span>,
]}
</span>
<Choose>
<When condition={type === 'videoCourse'}>
<div className='container__body'>
<div className='title__name'>{courseName}</div>
<div className='title__category'>{categoryName}</div>
<div className='title__chapter'>{courseChapterList.length}小节</div>
</div>
<div className="container__body__teacher">
<span className="teacher__label">上课老师:</span>
<span className="teacher__value">{teacherName}</span>
</When>
<Otherwise>
<div className='container__body'>
<div className='container__body__title'>
<div className='title__name'>{courseName}</div>
<div className='title__state'>{courseStateShow[courseState].title}</div>
</div>
<div className='container__body__time'>
<span className='time__label'>上课时间:</span>
<span className='time__value'>
{[
<span>{liveDateStr}&nbsp;</span>,
<span>
{startTimeStr}~{endTimeStr}
</span>
]}
</span>
</div>
<div className='container__body__teacher'>
<span className='teacher__label'>上课老师:</span>
<span className='teacher__value'>{teacherName}</span>
</div>
</div>
</div>
)}
</Otherwise>
</Choose>
<div className="container__introduction">
<Choose>
......
......@@ -13,7 +13,8 @@
}
.container {
overflow: scroll;
overflow-y: auto;
overflow-x: hidden;
height: 100%;;
.course-cover, .course-url {
......@@ -30,6 +31,16 @@
color: #000;
}
.title__category {
color: #999999;
margin-top: 4px;
margin-bottom: 4px;
}
.title__chapter {
color: #999999;
margin-bottom: 4px;
}
.title__inst-name {
color: #666;
font-size: 12px;
......
......@@ -103,14 +103,14 @@ class AddVideoCourse extends React.Component {
})
}
catalogChange = (value) => {
catalogChange = (value, categoryName) => {
const changeValueLength = value.length
switch (changeValueLength) {
case 1:
this.setState({ categoryId: value[0] })
this.setState({ categoryId: value[0], categoryName })
break
case 2:
this.setState({ categoryId: value[1] })
this.setState({ categoryId: value[1], categoryName })
break
default:
this.setState({ categoryId: null })
......@@ -269,7 +269,7 @@ class AddVideoCourse extends React.Component {
// 显示预览弹窗
handleShowPreviewModal = () => {
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, videoDuration, introduce, courseChapterList } = this.state
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, videoDuration, introduce, courseChapterList, categoryName } = this.state
const courseBasinInfo = {
coverUrl,
......@@ -279,7 +279,8 @@ class AddVideoCourse extends React.Component {
}
const courseIntroInfo = {
liveCourseMediaRequests: scheduleMedia,
introduce
introduce,
categoryName
}
const previewCourseModal = (
......@@ -324,7 +325,8 @@ class AddVideoCourse extends React.Component {
mediaNameAlias: folderName.replace('.mp4',''),
videoDuration: videoDom.duration,
id: resourceId,
mediaUrl: ossUrl
mediaUrl: ossUrl,
sort: courseChapterList.length
})
this.setState({
......@@ -337,10 +339,42 @@ class AddVideoCourse extends React.Component {
})
}
})
}
// 校验课节名称
handleValidateChapterName = (chapterName)=> {
let hasError = false;
return new Promise((resolve) => {
if(!chapterName) {
this.setState({
chapterNameValidateStatus: "error",
chapterNameHelpMsg: '请输入课节名称'
})
hasError = true;
resolve(false)
return false
}
if(chapterName.length > 40) {
this.setState({
chapterNameValidateStatus: "error",
chapterNameHelpMsg: '不要超过40字'
})
hasError = true;
resolve(false)
return false
}
if(!hasError){
resolve(true)
this.setState({
chapterNameValidateStatus: "",
chapterNameHelpMsg: ""
})
}
})
}
// 保存
handleSubmit = () => {
const { instId, adminId } = window.currentUserInstInfo
......@@ -799,7 +833,7 @@ class AddVideoCourse extends React.Component {
<span className='label'>课程分类:</span>
{pageType === 'add' && (
<Cascader
defaultValue={[categoryName]}
defaultValue={[]}
options={courseCatalogList}
displayRender={(label) => label.join('-')}
fieldNames={fieldNames}
......
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