Commit 202c0875 by yuananting

fix:线上课模块统一观看设置、编辑器保存,修复默认分享图破裂

parent 1e2f3e0e
......@@ -116,11 +116,7 @@ class ShareLiveModal extends React.Component {
}
break;
case 'videoClass': // 视频课
coverImgSrc =
coverUrl ||
(courseDivision === 'internal'
? `${scheduleVideoUrl}?x-oss-process=video/snapshot,t_0,m_fast&anystring=anystring`
: 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png');
coverImgSrc = coverUrl || 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png';
break;
case 'graphicsClass': // 图文课
coverImgSrc = coverUrl || 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png';
......
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:07:47
* @LastEditors: wufan
* @LastEditTime: 2021-07-06 13:45:55
* @LastEditors: yuananting
* @LastEditTime: 2021-07-07 12:05:07
* @Description: 线上课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -26,6 +26,7 @@ import Upload from '@/core/upload'
import { randomString } from '@/domains/basic-domain/utils'
import $ from 'jquery'
import './AddVideoCourse.less'
import Bus from '@/core/bus'
const { TextArea } = Input;
const EDIT_BOX_KEY = Math.random()
......@@ -93,6 +94,11 @@ class AddVideoCourse extends React.Component {
if (pageType === 'edit') {
this.handleFetchScheudleDetail(id)
}
Bus.bind('editorLimit', (textLength) => {
this.setState({
textLength,
});
});
}
//获取分类列表
......@@ -395,7 +401,8 @@ class AddVideoCourse extends React.Component {
shelfState,
whetherVisitorsJoin,
introduce,
courseChapterList
courseChapterList,
textLength,
} = this.state
const commonParams = {
......@@ -413,7 +420,7 @@ class AddVideoCourse extends React.Component {
courseChapterList
}
// 校验必填字段:课程名称, 课程视频
this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia).then((res) => {
this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, textLength).then((res) => {
if (!res) return
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } })
......@@ -445,7 +452,7 @@ class AddVideoCourse extends React.Component {
}
}
handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia) => {
handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia, textLength) => {
return new Promise((resolve) => {
if (!courseName) {
message.warning('请输入课程名称')
......@@ -462,14 +469,19 @@ class AddVideoCourse extends React.Component {
resolve(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
}
if (textLength > 1000) {
message.warning('课程简介超过字数限定');
resolve(false);
return;
}
// 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)
})
}
......
......@@ -117,12 +117,12 @@ class AddVideoIntro extends React.Component {
<span className="label">观看设置:</span>
<div className="content">
<div>
<Switch checked={whetherVisitorsJoin==="YES"? true:false} onChange={this.whetherVisitorsJoinChange}/>
<Switch checked={whetherVisitorsJoin==="NO"? true:false} onChange={this.whetherVisitorsJoinChange}/>
</div>
<div>
<div className="desc">
<Choose>
<When condition={whetherVisitorsJoin==="YES"}>
<When condition={whetherVisitorsJoin==="NO"}>
<div>已开启,学员需绑定手机号才可观看</div>
</When>
<Otherwise>
......
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