Commit c6b1c283 by guomingpang

docs:删除无用的注释

parent a0a455ba
...@@ -8,30 +8,30 @@ ...@@ -8,30 +8,30 @@
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="" /> <link rel="icon" href="" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta
name="description" name="description"
content="小麦企学院,一站式企业培训数字化服务商,通过“工具+内容”,帮助企业快速从0到1搭建数字化培训体系,并让整个培训过程可视化,降低培训成本,提升培训效率。" content="小麦企学院,一站式企业培训数字化服务商,通过“工具+内容”,帮助企业快速从0到1搭建数字化培训体系,并让整个培训过程可视化,降低培训成本,提升培训效率。"
/> />
<meta <meta
name="keywords" name="keywords"
content="小麦企学院,企业培训,员工培训,企业大学,企业内训,企业外训,培训计划,培训素材,企培,企训,素材库,培训课程,培训任务,直播课,线上课,图文课,线下活动,知识库,作业,考试,排行榜,培训类别管理,定制培训计划,管理数据,学习数据,企学院,资料共享,培训数字化,数字化培训,培训工具,在线培训,线上培训,培训saas,培训管理,企业微信培训,对客培训,客户培训,直播培训,互联网培训,新员工培训,管理培训,管理者培训,工人培训,制造业培训,餐饮培训,服务业培训,零售培训,门店培训,工厂培训,车间培训,培训补贴,人事培训,财务培训,职场培训,企业学院平台,教育企业学院,教育企业平台,教育平台学院,企业学习,酷学院,小鹅通,企业学院,云学堂,时代光华,云课堂,魔学院,云大学,米知云,授课学堂" content="小麦企学院,企业培训,员工培训,企业大学,企业内训,企业外训,培训计划,培训素材,企培,企训,素材库,培训课程,培训任务,直播课,线上课,图文课,线下活动,知识库,作业,考试,排行榜,培训类别管理,定制培训计划,管理数据,学习数据,企学院,资料共享,培训数字化,数字化培训,培训工具,在线培训,线上培训,培训saas,培训管理,企业微信培训,对客培训,客户培训,直播培训,互联网培训,新员工培训,管理培训,管理者培训,工人培训,制造业培训,餐饮培训,服务业培训,零售培训,门店培训,工厂培训,车间培训,培训补贴,人事培训,财务培训,职场培训,企业学院平台,教育企业学院,教育企业平台,教育平台学院,企业学习,酷学院,小鹅通,企业学院,云学堂,时代光华,云课堂,魔学院,云大学,米知云,授课学堂"
/> />
<!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> --> <!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> -->
<link rel="shortcut icon" href="https://image.xiaomaiketang.com/xm/c4KiP2epBP.png" /> <link rel="shortcut icon" href="https://image.xiaomaiketang.com/xm/c4KiP2epBP.png" />
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="//at.alicdn.com/t/font_2223403_oe5p510553.css" /> <link rel="stylesheet" href="//at.alicdn.com/t/font_2223403_oe5p510553.css" />
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML. Only files inside the `public` folder can be referenced from the HTML.
...@@ -40,19 +40,19 @@ ...@@ -40,19 +40,19 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>小麦企学院</title> <title>小麦企学院</title>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/iscroll-zoom-min.js"></script> <script type="text/javascript" src="https://image.xiaomaiketang.com/xm/iscroll-zoom-min.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/hammer.min.js"></script> <script type="text/javascript" src="https://image.xiaomaiketang.com/xm/hammer.min.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/lrz.all.bundle.js"></script> <script type="text/javascript" src="https://image.xiaomaiketang.com/xm/lrz.all.bundle.js"></script>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script> <script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script>
<script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"></script> <script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"></script>
<script type="text/javascript" src="https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"></script> <script type="text/javascript" src="https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"></script>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!-- <!--
This HTML file is a template. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.
...@@ -62,5 +62,5 @@ ...@@ -62,5 +62,5 @@
To begin the development, run `npm start` or `yarn start`. To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`. To create a production bundle, use `npm run build` or `yarn build`.
--> -->
</body> </body>
</html> </html>
...@@ -21,492 +21,487 @@ import './GraphicsCourseList.less' ...@@ -21,492 +21,487 @@ import './GraphicsCourseList.less'
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png' const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png'
class GraphicsCourseList extends React.Component { class GraphicsCourseList extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
id: '', // 视频课ID id: '', // 视频课ID
studentIds: [], studentIds: [],
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
selectPlanList: {}, selectPlanList: {},
} }
} }
componentDidMount() { componentDidMount() {
const videoCourseItem = localStorage.getItem('videoCourseItem') const videoCourseItem = localStorage.getItem('videoCourseItem')
if (videoCourseItem) { if (videoCourseItem) {
const _videoCourseItem = JSON.parse(videoCourseItem) const _videoCourseItem = JSON.parse(videoCourseItem)
this.handleShowShareModal(_videoCourseItem, true) this.handleShowShareModal(_videoCourseItem, true)
} }
} }
// 观看数据弹窗 // 观看数据弹窗
handleShowWatchDataModal = (record) => { handleShowWatchDataModal = (record) => {
const watchDataModal = ( const watchDataModal = (
<WatchDataModal <WatchDataModal
type='videoCourseList' type='videoCourseList'
data={record} data={record}
close={() => { close={() => {
this.setState({ this.setState({
watchDataModal: null, watchDataModal: null,
}) })
}} }}
/> />
) )
this.setState({ watchDataModal }) this.setState({ watchDataModal })
} }
handlePlanName = (planArray) => { handlePlanName = (planArray) => {
let planStr = '' let planStr = ''
planArray.forEach((item, index) => { planArray.forEach((item, index) => {
if (index < planArray.length - 1) { if (index < planArray.length - 1) {
planStr = planStr + item.planName + '、' planStr = planStr + item.planName + '、'
} else { } else {
planStr = planStr + item.planName planStr = planStr + item.planName
} }
}) })
return planStr return planStr
} }
// 请求表头 // 请求表头
parseColumns = () => { parseColumns = () => {
const columns = [ const columns = [
{ {
title: '图文课', title: '图文课',
key: 'scheduleName', key: 'scheduleName',
dataIndex: 'scheduleName', dataIndex: 'scheduleName',
width: 321, width: 321,
fixed: 'left', fixed: 'left',
render: (val, record) => { render: (val, record) => {
const { coverUrl } = record const { coverUrl } = record
return ( return (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<img className='course-cover' src={coverUrl || defaultCoverUrl} alt='' /> <img className='course-cover' src={coverUrl || defaultCoverUrl} alt='' />
<Choose> <Choose>
<When condition={record.courseName.length > 25}> <When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}> <Tooltip title={record.courseName}>
<div className='course-name'>{record.courseName}</div> <div className='course-name'>{record.courseName}</div>
</Tooltip> </Tooltip>
</When> </When>
<Otherwise> <Otherwise>
<div className='course-name'>{record.courseName}</div> <div className='course-name'>{record.courseName}</div>
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) )
}, },
}, },
{ {
title: '课程分类', title: '课程分类',
key: 'categoryName', key: 'categoryName',
dataIndex: 'categoryName', dataIndex: 'categoryName',
width: 120, width: 120,
render: (val, record) => { render: (val, record) => {
return <div className='record__item'>{record.categorySonName}</div> return <div className='record__item'>{record.categorySonName}</div>
}, },
}, },
{ {
title: '创建人', title: '创建人',
key: 'createName', key: 'createName',
dataIndex: 'createName', dataIndex: 'createName',
width: 100, width: 100,
render: (val) => { render: (val) => {
return ( return (
<div> <div>
{val && ( {val && (
<Tooltip title={val}> <Tooltip title={val}>
<div>{val.length > 4 ? `${val.slice(0, 4)}...` : val}</div> <div>{val.length > 4 ? `${val.slice(0, 4)}...` : val}</div>
</Tooltip> </Tooltip>
)} )}
</div> </div>
) )
}, },
}, },
{ {
title: ( title: (
<span> <span>
<span>学院展示</span> <span>学院展示</span>
<Tooltip <Tooltip
title={ title={
<div> <div>
开启后,学员可在学院内查看到此课程。 开启后,学员可在学院内查看到此课程。
<br /> <br />
关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。 关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。
</div> </div>
}> }>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
width: 120, width: 120,
dataIndex: 'courseware', dataIndex: 'courseware',
render: (val, item, index) => { render: (val, item, index) => {
return ( return (
<Switch <Switch
size='small' size='small'
checked={item.shelfState === 'YES'} checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState === 'YES' ? true : false} defaultChecked={item.shelfState === 'YES' ? true : false}
onChange={(checked) => this.changeShelfState(index, item, checked)} onChange={(checked) => this.changeShelfState(index, item, checked)}
/> />
) )
}, },
}, },
{ {
title: '观看学员数', title: '观看学员数',
width: 110, width: 110,
key: 'watchUserCount', key: 'watchUserCount',
dataIndex: 'watchUserCount', dataIndex: 'watchUserCount',
render: (val, item) => { render: (val, item) => {
return <div className='watchUserCount'>{val}</div> return <div className='watchUserCount'>{val}</div>
}, },
}, },
{ {
title: '创建时间', title: '创建时间',
width: 181, width: 181,
key: 'created', key: 'created',
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val) return window.formatDate('YYYY-MM-DD H:i', val)
}, },
}, },
{ {
title: '最近修改时间', title: '最近修改时间',
width: 181, width: 181,
key: 'updated', key: 'updated',
dataIndex: 'updated', dataIndex: 'updated',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val) return window.formatDate('YYYY-MM-DD H:i', val)
}, },
}, },
{ {
title: '关联项', title: '关联项',
width: 200, width: 200,
key: 'planList', key: 'planList',
dataIndex: 'planList', dataIndex: 'planList',
render: (val, record) => { render: (val, record) => {
return ( return (
<div className='related-task'> <div className='related-task'>
<Choose> <Choose>
<When condition={record.relatedPlanList}> <When condition={record.relatedPlanList}>
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter> <Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => { {record.relatedPlanList.map((item, index) => {
return ( return (
<span key={item.planId}> <span key={item.planId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '} {item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span> </span>
) )
})} })}
</Tooltip> </Tooltip>
</When> </When>
<Otherwise> <Otherwise>
<span></span> <span></span>
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) )
}, },
}, },
{ {
title: '操作', title: '操作',
key: 'operate', key: 'operate',
dataIndex: 'operate', dataIndex: 'operate',
width: 210, width: 210,
fixed: 'right', fixed: 'right',
render: (val, record) => { render: (val, record) => {
return ( return (
<div className='operate'> <div className='operate'>
<div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}> <div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}>
观看数据 观看数据
</div> </div>
<span className='operate__item split'> | </span> <span className='operate__item split'> | </span>
<div className='operate__item' onClick={() => this.handleShowShareModal(record)}> <div className='operate__item' onClick={() => this.handleShowShareModal(record)}>
分享 分享
</div> </div>
<span className='operate__item split'> | </span> <span className='operate__item split'> | </span>
<Dropdown overlay={this.renderMoreOperate(record)}> <Dropdown overlay={this.renderMoreOperate(record)}>
<span className='more-operate'> <span className='more-operate'>
<span className='operate-text'>更多</span> <span className='operate-text'>更多</span>
<span className='iconfont icon' style={{ color: '#2966FF' }}> <span className='iconfont icon' style={{ color: '#2966FF' }}>
&#xe824; &#xe824;
</span> </span>
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
) )
}, },
}, },
] ]
return columns return columns
} }
handleRelatedModalShow = (item) => { handleRelatedModalShow = (item) => {
const selectPlanList = {} const selectPlanList = {}
if (item.relatedPlanList) { if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => { item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {} selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }] selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item return item
}) })
} }
this.setState({ this.setState({
RelatedPlanModalVisible: true, RelatedPlanModalVisible: true,
selectCourseId: item.id, selectCourseId: item.id,
selectPlanList: selectPlanList, selectPlanList: selectPlanList,
}) })
} }
closeRelatedPlanModalVisible = () => { closeRelatedPlanModalVisible = () => {
this.setState({ this.setState({
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
}) })
} }
onChangeSelectPlanList = (selectPlanList) => { onChangeSelectPlanList = (selectPlanList) => {
this.setState({ this.setState({
selectPlanList: selectPlanList, selectPlanList: selectPlanList,
}) })
} }
onConfirmSelectPlanList = () => { onConfirmSelectPlanList = () => {
this.setState( this.setState(
{ {
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
}, },
() => { () => {
this.props.onChange() this.props.onChange()
} }
) )
} }
renderMoreOperate = (item) => { renderMoreOperate = (item) => {
return ( return (
<div className='live-course-more-menu'> <div className='live-course-more-menu'>
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && ( {(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
<div <div
className='operate__item' className='operate__item'
key='plan' key='plan'
onClick={() => { onClick={() => {
this.handleRelatedModalShow(item) this.handleRelatedModalShow(item)
}}> }}>
关联培训计划 关联培训计划
</div> </div>
)} )}
<div <div
className='operate__item' className='operate__item'
key='edit' key='edit'
onClick={() => { onClick={() => {
window.RCHistory.push(`/create-graphics-course?type=edit&id=${item.id}`) window.RCHistory.push(`/create-graphics-course?type=edit&id=${item.id}`)
}}> }}>
编辑 编辑
</div> </div>
<div className='operate__item' key='delete' onClick={() => this.handleDeleteGraphicsCourse(item.id)}> <div className='operate__item' key='delete' onClick={() => this.handleDeleteGraphicsCourse(item.id)}>
删除 删除
</div> </div>
</div> </div>
) )
} }
//改变上架状态 //改变上架状态
changeShelfState = (index, item, checked) => { changeShelfState = (index, item, checked) => {
let _shelfState = checked ? 'YES' : 'NO' let _shelfState = checked ? 'YES' : 'NO'
// if(_shelfState==='NO'){ const params = {
// _shelfState = "YES"; courseId: item.id,
// }else{ shelfState: _shelfState,
// _shelfState = "NO" }
// } CourseService.changeVideoShelfState(params).then((res) => {
const params = { if (res.success) {
courseId: item.id, if (_shelfState === 'YES') {
shelfState: _shelfState, message.success('已开启展示')
} } else {
CourseService.changeVideoShelfState(params).then((res) => { message.success('已取消展示')
if (res.success) { }
if (_shelfState === 'YES') { this.props.changeShelfState(index, _shelfState)
message.success('已开启展示') }
} else { })
message.success('已取消展示') }
} // 删除视频课
this.props.changeShelfState(index, _shelfState) handleDeleteGraphicsCourse = (scheduleId) => {
} Modal.confirm({
}) title: '你确定要删除此线上课吗?',
} content: '删除后,学员将不能进行观看。',
// 删除视频课 icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>,
handleDeleteGraphicsCourse = (scheduleId) => { okText: '确定',
Modal.confirm({ okType: 'danger',
title: '你确定要删除此线上课吗?', cancelText: '取消',
content: '删除后,学员将不能进行观看。', onOk: () => {
icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>, const param = {
okText: '确定', courseId: scheduleId,
okType: 'danger', storeId: User.getStoreId(),
cancelText: '取消', }
onOk: () => { CourseService.delVideoSchedule(param).then(() => {
const param = { message.success('删除成功')
courseId: scheduleId, this.props.onChange()
storeId: User.getStoreId(), })
} },
CourseService.delVideoSchedule(param).then(() => { })
message.success('删除成功') }
this.props.onChange()
})
},
})
}
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (record, needStr = false) => { handleShowShareModal = (record, needStr = false) => {
const { id, scheduleVideoUrl } = record const { id, scheduleVideoUrl } = record
const htmlUrl = `${LIVE_SHARE}graphics_detail/${id}?id=${User.getStoreId()}` const htmlUrl = `${LIVE_SHARE}graphics_detail/${id}?id=${User.getStoreId()}`
const longUrl = htmlUrl const longUrl = htmlUrl
const { coverUrl, courseName } = record const { coverUrl, courseName } = record
const shareData = { const shareData = {
longUrl, longUrl,
coverUrl, coverUrl,
scheduleVideoUrl, scheduleVideoUrl,
courseName, courseName,
} }
const shareLiveModal = ( const shareLiveModal = (
<ShareLiveModal <ShareLiveModal
needStr={needStr} needStr={needStr}
data={shareData} data={shareData}
type='graphicsClass' type='graphicsClass'
title='图文课' title='图文课'
close={() => { close={() => {
this.setState({ this.setState({
shareLiveModal: null, shareLiveModal: null,
}) })
localStorage.setItem('videoCourseItem', '') localStorage.setItem('videoCourseItem', '')
}} }}
/> />
) )
this.setState({ shareLiveModal }) this.setState({ shareLiveModal })
} }
handleChangeTable = (pagination, filters, sorter) => { handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter const { columnKey, order } = sorter
const { query } = this.props const { query } = this.props
let { order: _order } = query let { order: _order } = query
// 按创建时间升序排序 // 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') { if (columnKey === 'created' && order === 'ascend') {
_order = 'CREATED_ASC' _order = 'CREATED_ASC'
} }
// 按创建时间降序排序 // 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') { if (columnKey === 'created' && order === 'descend') {
_order = 'CREATED_DESC' _order = 'CREATED_DESC'
} }
// 按更新时间升序排序 // 按更新时间升序排序
if (columnKey === 'updated' && order === 'ascend') { if (columnKey === 'updated' && order === 'ascend') {
_order = 'UPDATED_ASC' _order = 'UPDATED_ASC'
} }
// 按更新时间降序排序 // 按更新时间降序排序
if (columnKey === 'updated' && order === 'descend') { if (columnKey === 'updated' && order === 'descend') {
_order = 'UPDATED_DESC' _order = 'UPDATED_DESC'
} }
const _query = { const _query = {
...query, ...query,
orderEnum: _order, orderEnum: _order,
} }
this.props.onChange(_query) this.props.onChange(_query)
} }
handleRelatedModalShow = (item) => { handleRelatedModalShow = (item) => {
const selectPlanList = {} const selectPlanList = {}
if (item.relatedPlanList) { if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => { item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {} selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }] selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item return item
}) })
} }
this.setState({ this.setState({
RelatedPlanModalVisible: true, RelatedPlanModalVisible: true,
selectCourseId: item.id, selectCourseId: item.id,
selectPlanList: selectPlanList, selectPlanList: selectPlanList,
}) })
} }
closeRelatedPlanModalVisible = () => { closeRelatedPlanModalVisible = () => {
this.setState({ this.setState({
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
}) })
} }
onChangeSelectPlanList = (selectPlanList) => { onChangeSelectPlanList = (selectPlanList) => {
this.setState({ this.setState({
selectPlanList: selectPlanList, selectPlanList: selectPlanList,
}) })
} }
onConfirmSelectPlanList = () => { onConfirmSelectPlanList = () => {
this.setState( this.setState(
{ {
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
}, },
() => { () => {
this.props.onChange() this.props.onChange()
} }
) )
} }
render() { render() {
const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state
const { dataSource = [], totalCount, query } = this.props const { dataSource = [], totalCount, query } = this.props
const { current, size } = query const { current, size } = query
return ( return (
<div className='video-course-list'> <div className='video-course-list'>
<XMTable <XMTable
renderEmpty={{ renderEmpty={{
image: college, image: college,
description: '暂无数据', description: '暂无数据',
}} }}
rowKey={(record) => record.id} rowKey={(record) => record.id}
dataSource={dataSource} dataSource={dataSource}
columns={this.parseColumns()} columns={this.parseColumns()}
onChange={this.handleChangeTable} onChange={this.handleChangeTable}
pagination={false} pagination={false}
scroll={{ x: 1500 }} scroll={{ x: 1500 }}
bordered bordered
className='video-list-table' className='video-list-table'
/> />
<div className='box-footer'> <div className='box-footer'>
<PageControl <PageControl
current={current - 1} current={current - 1}
pageSize={size} pageSize={size}
total={totalCount} total={totalCount}
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 } const _query = { ...query, current: page + 1 }
this.props.onChange(_query) this.props.onChange(_query)
}} }}
/> />
</div> </div>
{RelatedPlanModalVisible && ( {RelatedPlanModalVisible && (
<RelatedPlanModal <RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible} onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible} visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId} selectCourseId={selectCourseId}
selectPlanList={selectPlanList} selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList} onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList} onConfirm={this.onConfirmSelectPlanList}
/> />
)} )}
{RelatedPlanModalVisible && ( {RelatedPlanModalVisible && (
<RelatedPlanModal <RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible} onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible} visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId} selectCourseId={selectCourseId}
selectPlanList={selectPlanList} selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList} onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList} onConfirm={this.onConfirmSelectPlanList}
/> />
)} )}
{this.state.shareLiveModal} {this.state.shareLiveModal}
{this.state.watchDataModal} {this.state.watchDataModal}
</div> </div>
) )
} }
} }
export default GraphicsCourseList export default GraphicsCourseList
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
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, FileVerifyMap } 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'
...@@ -18,7 +18,6 @@ import AddVideoIntro from './components/AddVideoIntro' ...@@ -18,7 +18,6 @@ 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 StoreService from '@/domains/store-domain/storeService'
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'
...@@ -32,717 +31,694 @@ import Bus from '@/core/bus' ...@@ -32,717 +31,694 @@ import Bus from '@/core/bus'
const { TextArea } = Input const { TextArea } = Input
const EDIT_BOX_KEY = Math.random() const EDIT_BOX_KEY = Math.random()
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }
//添加课程时课程默认的一些值 //添加课程时课程默认的一些值
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] })
} }
// catalogChange = (value, _categoryName) => { // 获取线上课详情
// const categoryName = _.pluck(_categoryName, 'categoryName').join('-') handleFetchScheudleDetail = (courseId) => {
// const changeValueLength = value.length CourseService.videoScheduleDetail({
// switch (changeValueLength) { courseId,
// case 1: }).then((res) => {
// this.setState({ categoryId: value[0], categoryName }) const { result = {} } = res || {}
// break const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId, courseChapterVOList = [] } = result
// case 2: let coverId
// this.setState({ categoryId: value[1], categoryName }) let coverUrl
// break let scheduleMedia = []
// default: let scheduleVideoUrl
// this.setState({ categoryId: null }) let hasIntro
// break
// } courseMediaVOS.map((item) => {
// } switch (item.contentType) {
// 获取线上课详情 case 'COVER':
handleFetchScheudleDetail = (courseId) => { coverId = item.mediaContent
CourseService.videoScheduleDetail({ coverUrl = item.mediaUrl
courseId, break
}).then((res) => { case 'INTRO':
const { result = {} } = res || {} hasIntro = true
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId, courseChapterVOList = [] } = result this.getTextDetail('introduce', item.mediaUrl)
let coverId break
let coverUrl default:
let scheduleMedia = [] break
let scheduleVideoUrl }
let hasIntro return item
})
courseMediaVOS.map((item) => {
switch (item.contentType) { const _courseChapterVOList = courseChapterVOList.map((item) => {
case 'COVER': item.mediaName = item.name
coverId = item.mediaContent item.resourceId = item.id
coverUrl = item.mediaUrl return item
break })
case 'INTRO':
hasIntro = true this.setState({
this.getTextDetail('introduce', item.mediaUrl) loadintroduce: !hasIntro,
break coverId,
default: coverUrl,
break scheduleMedia,
} courseName,
return item scheduleVideoUrl,
}) shelfState,
whetherVisitorsJoin,
// let categoryName categoryId,
// if (categoryTwoName) { courseChapterList: _courseChapterVOList,
// categoryName = `${categoryOneName}-${categoryTwoName}` })
// } else { })
// categoryName = `${categoryOneName}` }
// }
getTextDetail = (key, url) => {
const _courseChapterVOList = courseChapterVOList.map((item) => { $.ajax({
item.mediaName = item.name data: {},
item.resourceId = item.id type: 'GET',
return item url,
}) contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => {
this.setState({ this.setState({ [key]: res, [`load${key}`]: true })
loadintroduce: !hasIntro, },
coverId, })
coverUrl, }
scheduleMedia,
courseName, handleGoBack = () => {
scheduleVideoUrl, const { coverId, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state
shelfState, if (
whetherVisitorsJoin, !courseChapterList.length ||
categoryId, !_.isEqual(scheduleMedia, defaultScheduleMedia) ||
courseChapterList: _courseChapterVOList, categoryId ||
}) courseName ||
}) coverId ||
} shelfState !== defaultShelfState ||
whetherVisitorsJoin !== whetherVisitorsJoin
getTextDetail = (key, url) => { ) {
$.ajax({ Modal.confirm({
data: {}, title: '确认要返回吗?',
type: 'GET', content: '返回后,本次编辑的内容将不被保存。',
url, okText: '确认返回',
contentType: 'application/x-www-form-urlencoded; charset=UTF-8', cancelText: '留在本页',
success: (res) => { icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>,
this.setState({ [key]: res, [`load${key}`]: true }) onOk: () => {
}, window.RCHistory.push({
}) pathname: `/video-course`,
} })
},
handleGoBack = () => { })
const { coverId, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state } else {
if ( window.RCHistory.push({
!courseChapterList.length || pathname: `/video-course`,
!_.isEqual(scheduleMedia, defaultScheduleMedia) || })
categoryId || }
courseName || }
coverId ||
shelfState !== defaultShelfState || // 修改表单
whetherVisitorsJoin !== whetherVisitorsJoin handleChangeForm = (field, value, coverUrl) => {
) { this.setState({
Modal.confirm({ [field]: value,
title: '确认要返回吗?', coverUrl: coverUrl ? coverUrl : this.state.coverUrl,
content: '返回后,本次编辑的内容将不被保存。', })
okText: '确认返回', }
cancelText: '留在本页',
icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>, // 显示选择学员弹窗
onOk: () => { handleShowSelectStuModal = () => {
window.RCHistory.push({ this.setState({ studentModal: true })
pathname: `/video-course`,
}) const { studentList, selectedStuList } = this.state
}, const studentModal = (
}) <SelectStudent
} else { showTabs={true}
window.RCHistory.push({ type='videoCourse'
pathname: `/video-course`, onSelect={this.handleSelectStudent}
}) after={true} //表明是不是上课后的状态
} studentList={studentList}
} close={() => {
this.setState({
// 修改表单 studentModal: null,
handleChangeForm = (field, value, coverUrl) => { })
this.setState({ }}
[field]: value, />
coverUrl: coverUrl ? coverUrl : this.state.coverUrl, )
}) this.setState({ studentModal })
} }
// 显示选择学员弹窗 handleSelectStudent = (studentIds) => {
handleShowSelectStuModal = () => { let studentList = []
this.setState({ studentModal: true }) _.each(studentIds, (item) => {
studentList.push({ studentId: item })
const { studentList, selectedStuList } = this.state })
const studentModal = ( this.setState({ studentList })
<SelectStudent this.setState({ studentModal: false })
showTabs={true} }
type='videoCourse'
onSelect={this.handleSelectStudent} // 显示预览弹窗
after={true} //表明是不是上课后的状态 handleShowPreviewModal = () => {
studentList={studentList} const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, introduce, courseChapterList, categoryName } = this.state
close={() => { const courseBasinInfo = {
this.setState({ coverUrl,
studentModal: null, scheduleVideoUrl,
}) courseName,
}} }
/> const courseIntroInfo = {
) liveCourseMediaRequests: scheduleMedia,
this.setState({ studentModal }) introduce,
} categoryName,
}
handleSelectStudent = (studentIds) => {
let studentList = [] const previewCourseModal = (
_.each(studentIds, (item) => { <PreviewCourseModal
studentList.push({ studentId: item }) type='videoCourse'
}) courseBasicInfo={courseBasinInfo}
this.setState({ studentList }) courseIntroInfo={courseIntroInfo}
this.setState({ studentModal: false }) close={() => {
} this.setState({
previewCourseModal: null,
// 显示预览弹窗 })
handleShowPreviewModal = () => { }}
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, introduce, courseChapterList, categoryName } = this.state courseChapterList={courseChapterList}
const courseBasinInfo = { />
coverUrl, )
scheduleVideoUrl,
courseName, this.setState({ previewCourseModal })
} }
const courseIntroInfo = {
liveCourseMediaRequests: scheduleMedia, // 选择视频
introduce, handleSelectVideo = (addFolderIds, selectedFileList) => {
categoryName, this.setState({
} showSelectFileModal: false,
})
const previewCourseModal = (
<PreviewCourseModal let { courseChapterList } = this.state
type='videoCourse' let _courseChapterList = [...courseChapterList]
courseBasicInfo={courseBasinInfo}
courseIntroInfo={courseIntroInfo} if (selectedFileList.length + courseChapterList.length > 20) {
close={() => { message.warning(`最多只能上传20个文件`)
this.setState({ return
previewCourseModal: null, }
}) selectedFileList.map((file, index) => {
}} const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file
courseChapterList={courseChapterList} const _mediaName = folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`, '')
/> console.log('folderFormat', folderFormat)
) if (folderFormat === 'MP4' || folderFormat === 'video/mp4') {
const videoDom = document.createElement('video')
this.setState({ previewCourseModal }) videoDom.src = ossUrl
} videoDom.onloadedmetadata = () => {
_courseChapterList.push({
// 选择视频 mediaContent: resourceId,
handleSelectVideo = (addFolderIds, selectedFileList) => { contentType: 'SCHEDULE',
this.setState({ mediaType: 'VIDEO',
showSelectFileModal: false, mediaName: _mediaName,
}) videoDuration: videoDom.duration,
resourceId,
let { courseChapterList } = this.state mediaUrl: ossUrl,
let _courseChapterList = [...courseChapterList] sort: _courseChapterList.length,
})
if (selectedFileList.length + courseChapterList.length > 20) { this.setState({
message.warning(`最多只能上传20个文件`) courseChapterList: _courseChapterList,
return })
} }
selectedFileList.map((file, index) => { } else if (folderFormat === 'WORD' || folderFormat === 'PDF' || SUPPORT_WORD_PDF.indexOf(folderFormat) > -1) {
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file const suffix = _.last(folderName.split('.')).toUpperCase()
const _mediaName = folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`, '') _courseChapterList.push({
console.log('folderFormat', folderFormat) mediaContent: resourceId,
if (folderFormat === 'MP4' || folderFormat === 'video/mp4') { contentType: 'SCHEDULE',
const videoDom = document.createElement('video') mediaType: suffix,
videoDom.src = ossUrl mediaName: _mediaName,
videoDom.onloadedmetadata = () => { resourceId,
_courseChapterList.push({ mediaUrl: ossUrl,
mediaContent: resourceId, sort: _courseChapterList.length,
contentType: 'SCHEDULE', })
mediaType: 'VIDEO', this.setState({
mediaName: _mediaName, courseChapterList: _courseChapterList,
videoDuration: videoDom.duration, })
resourceId, }
mediaUrl: ossUrl, })
sort: _courseChapterList.length, }
})
this.setState({ // 校验课节名称
courseChapterList: _courseChapterList, handleValidateChapterName = (chapterName) => {
}) let hasError = false
} return new Promise((resolve) => {
} else if (folderFormat === 'WORD' || folderFormat === 'PDF' || SUPPORT_WORD_PDF.indexOf(folderFormat) > -1) { if (!chapterName) {
const suffix = _.last(folderName.split('.')).toUpperCase() this.setState({
_courseChapterList.push({ chapterNameValidateStatus: 'error',
mediaContent: resourceId, chapterNameHelpMsg: '请输入课节名称',
contentType: 'SCHEDULE', })
mediaType: suffix, hasError = true
mediaName: _mediaName, resolve(false)
resourceId, return false
mediaUrl: ossUrl, }
sort: _courseChapterList.length,
}) if (chapterName.length > 40) {
this.setState({ this.setState({
courseChapterList: _courseChapterList, chapterNameValidateStatus: 'error',
}) chapterNameHelpMsg: '不要超过40字',
} })
}) hasError = true
} resolve(false)
return false
// 校验课节名称 }
handleValidateChapterName = (chapterName) => {
let hasError = false if (!hasError) {
return new Promise((resolve) => { resolve(true)
if (!chapterName) { this.setState({
this.setState({ chapterNameValidateStatus: '',
chapterNameValidateStatus: 'error', chapterNameHelpMsg: '',
chapterNameHelpMsg: '请输入课节名称', })
}) }
hasError = true })
resolve(false) }
return false
} // 保存
handleSubmit = () => {
if (chapterName.length > 40) { //过期判断
this.setState({ if (User.getExpirationTime() && moment().valueOf() > Number(User.getExpirationTime())) {
chapterNameValidateStatus: 'error', Modal.warning({
chapterNameHelpMsg: '不要超过40字', title: '服务已到期',
}) content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买',
hasError = true okText: '我知道了',
resolve(false) })
return false return
} }
if (!hasError) { const {
resolve(true) id,
this.setState({ coverId,
chapterNameValidateStatus: '', pageType,
chapterNameHelpMsg: '', // videoName,
}) // videoDuration,
} courseName,
}) scheduleMedia,
} categoryId,
shelfState,
// 保存 whetherVisitorsJoin,
handleSubmit = () => { introduce,
//过期判断 courseChapterList,
if (User.getExpirationTime() && moment().valueOf() > Number(User.getExpirationTime())) { editorTextLength,
Modal.warning({ } = this.state
title: '服务已到期',
content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买', const commonParams = {
okText: '我知道了', // videoName,
}) videoDuration: 0, //后端的必要参数,不能传空
return scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent),
} categoryId,
courseName,
const { coverId,
id, operatorId: User.getStoreUserId(),
coverId, storeId: User.getStoreId(),
pageType, shelfState,
// videoName, whetherVisitorsJoin,
// videoDuration, courseType: 'VOICE',
courseName, courseChapterList,
scheduleMedia, }
categoryId, // 校验必填字段:课程名称, 课程视频
shelfState, this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength).then((res) => {
whetherVisitorsJoin, if (!res) return
introduce, Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
courseChapterList, this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } })
editorTextLength, })
} = this.state })
}
const commonParams = {
// videoName, submitRemote = ({ id, pageType, commonParams }) => {
videoDuration: 0, //后端的必要参数,不能传空 if (pageType === 'add') {
scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent), Service.Hades('public/hades/createVideoSchedule', commonParams).then((res) => {
categoryId, if (!res) return
courseName, message.success('新建成功')
coverId, window.RCHistory.push({
operatorId: User.getStoreUserId(), pathname: `/video-course`,
storeId: User.getStoreId(), })
shelfState, })
whetherVisitorsJoin, } else {
courseType: 'VOICE', const editParams = {
courseChapterList, courseId: id,
} ...commonParams,
// 校验必填字段:课程名称, 课程视频 }
this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength).then((res) => { Service.Hades('public/hades/editVideoSchedule', editParams).then((res) => {
if (!res) return if (!res) return
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => { message.success('保存成功')
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } }) window.RCHistory.push({
}) pathname: `/video-course`,
}) })
} })
}
submitRemote = ({ id, pageType, commonParams }) => { }
if (pageType === 'add') {
Service.Hades('public/hades/createVideoSchedule', commonParams).then((res) => { handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength) => {
if (!res) return return new Promise((resolve) => {
message.success('新建成功') if (!courseName) {
window.RCHistory.push({ message.warning('请输入课程名称')
pathname: `/video-course`, resolve(false)
}) return false
}) }
} else { if (!courseChapterList.length) {
const editParams = { message.warning('请上传课节')
courseId: id, resolve(false)
...commonParams, return false
} }
Service.Hades('public/hades/editVideoSchedule', editParams).then((res) => { if (!categoryId) {
if (!res) return message.warning('请选择课程分类')
message.success('保存成功') resolve(false)
window.RCHistory.push({ return false
pathname: `/video-course`, }
}) if (editorTextLength > 1000) {
}) message.warning('课程简介超过字数限定')
} resolve(false)
} return
}
handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength) => { resolve(true)
return new Promise((resolve) => { })
if (!courseName) { }
message.warning('请输入课程名称') handleSelectCover = (file) => {
resolve(false) if (!file) {
return false message.info('请选择文件!')
} return
if (!courseChapterList.length) { }
message.warning('请上传课节') this.setState({
resolve(false) visible: true,
return false imageFile: file,
} })
if (!categoryId) { }
message.warning('请选择课程分类') //获取resourceId
resolve(false) getSignature = (blob, fileName) => {
return false Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
} this.setState(
if (editorTextLength > 1000) { {
message.warning('课程简介超过字数限定') coverClicpPath: signInfo.fileUrl,
resolve(false) coverId: signInfo.resourceId,
return visible: false,
} },
resolve(true) () => this.updateCover()
}) )
} })
handleSelectCover = (file) => { }
if (!file) { updateCover = () => {
message.info('请选择文件!') const { coverClicpPath, coverId } = this.state
return this.setState({
} showSelectCoverModal: false,
this.setState({ coverUrl: coverClicpPath,
visible: true, coverId: coverId,
imageFile: file, })
}) }
}
//获取resourceId handleRenameCourseChapter = (chapterId, chapterIndex) => {
getSignature = (blob, fileName) => { const { mediaNameAlias } = this.state
Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
this.setState( this.handleValidateChapterName(mediaNameAlias).then((res) => {
{ // 校验不通过不能点确定保存修改课节名称
coverClicpPath: signInfo.fileUrl, if (!res) {
coverId: signInfo.resourceId, return message.warning('重命名失败')
visible: false, }
},
() => this.updateCover() let { courseChapterList } = this.state
) let _courseChapterList = []
}) _courseChapterList = courseChapterList.map((item, index) => {
} if (item.resourceId === chapterId && chapterIndex === index) {
updateCover = () => { item.mediaName = mediaNameAlias
const { coverClicpPath, coverId } = this.state item.visible = false
this.setState({ }
showSelectCoverModal: false, return item
coverUrl: coverClicpPath, })
coverId: coverId, this.setState({
}) courseChapterList: _courseChapterList,
} chapterNameValidateStatus: '',
chapterNameHelpMsg: '',
handleRenameCourseChapter = (chapterId, chapterIndex) => { mediaNameAlias: '',
const { mediaNameAlias } = this.state })
})
this.handleValidateChapterName(mediaNameAlias).then((res) => { }
// 校验不通过不能点确定保存修改课节名称
if (!res) { handleChangePopConfirmVisible = (chapterId, chapterNameIndex, visible) => {
return message.warning('重命名失败') let { courseChapterList } = this.state
} let _courseChapterList = []
_courseChapterList = courseChapterList.map((item, index) => {
let { courseChapterList } = this.state if (item.resourceId === chapterId && chapterNameIndex === index) {
let _courseChapterList = [] item.visible = visible
_courseChapterList = courseChapterList.map((item, index) => { } else {
if (item.resourceId === chapterId && chapterIndex === index) { item.visible = false
item.mediaName = mediaNameAlias }
item.visible = false return item
} })
return item this.setState({
}) courseChapterList: _courseChapterList,
this.setState({ })
courseChapterList: _courseChapterList, }
chapterNameValidateStatus: '',
chapterNameHelpMsg: '', handleDeleteCourseChapter = (chapterId, chapterIndex) => {
mediaNameAlias: '', console.log('chapterId---', chapterId, chapterIndex)
}) let { courseChapterList } = this.state
}) let _courseChapterList = courseChapterList.filter((item, index) => {
} return item.resourceId !== chapterId || (item.resourceId === chapterId && chapterIndex !== index)
})
handleChangePopConfirmVisible = (chapterId, chapterNameIndex, visible) => { _courseChapterList.map((item, index) => {
let { courseChapterList } = this.state item.sort = index
let _courseChapterList = [] })
_courseChapterList = courseChapterList.map((item, index) => { this.setState({
if (item.resourceId === chapterId && chapterNameIndex === index) { courseChapterList: _courseChapterList,
item.visible = visible })
} else { }
item.visible = false
} renderChapterTitle = (item) => {
return item const { chapterNameValidateStatus, chapterNameHelpMsg } = this.state
})
this.setState({ return (
courseChapterList: _courseChapterList, <div className='course-chapter-title-popover'>
}) <div className='tag-title'>课节名称</div>
} <Form>
<Form.Item validateStatus={chapterNameValidateStatus} help={chapterNameHelpMsg}>
handleDeleteCourseChapter = (chapterId, chapterIndex) => { <TextArea
console.log('chapterId---', chapterId, chapterIndex) defaultValue={item.mediaName}
let { courseChapterList } = this.state placeholder='请输入课节名称'
let _courseChapterList = courseChapterList.filter((item, index) => { maxLength={40}
return item.resourceId !== chapterId || (item.resourceId === chapterId && chapterIndex !== index) autoSize
}) style={{ width: '318px' }}
_courseChapterList.map((item, index) => { onChange={(e) => {
item.sort = index this.setState(
}) {
this.setState({ mediaNameAlias: e.target.value.trim(),
courseChapterList: _courseChapterList, },
}) () => {
} this.handleValidateChapterName(this.state.mediaNameAlias)
}
renderChapterTitle = (item) => { )
const { chapterNameValidateStatus, chapterNameHelpMsg } = this.state }}
/>
return ( </Form.Item>
<div className='course-chapter-title-popover'> </Form>
<div className='tag-title'>课节名称</div> </div>
<Form> )
<Form.Item validateStatus={chapterNameValidateStatus} help={chapterNameHelpMsg}> }
<TextArea
defaultValue={item.mediaName} // 上下移动
placeholder='请输入课节名称' handleChangeIndex = (isUp, sortIndex) => {
maxLength={40} const { courseChapterList } = this.state
autoSize
style={{ width: '318px' }} // 第一个上移和最后一个下移不能使用
onChange={(e) => { if ((isUp && sortIndex === 0) || (!isUp && sortIndex === courseChapterList.length - 1)) {
this.setState( return
{ }
mediaNameAlias: e.target.value.trim(),
}, let _courseChapterList = [...courseChapterList]
() => { const temp = courseChapterList[sortIndex]
this.handleValidateChapterName(this.state.mediaNameAlias)
} // 若上移
) if (isUp) {
}} _courseChapterList[sortIndex - 1] = temp
/> _courseChapterList[sortIndex - 1].sort = sortIndex - 1
</Form.Item> _courseChapterList[sortIndex] = courseChapterList[sortIndex - 1]
</Form> _courseChapterList[sortIndex].sort = sortIndex
</div> } else {
) // 若下移
} _courseChapterList[sortIndex + 1] = temp
_courseChapterList[sortIndex + 1].sort = sortIndex + 1
// 上下移动 _courseChapterList[sortIndex] = courseChapterList[sortIndex + 1]
handleChangeIndex = (isUp, sortIndex) => { _courseChapterList[sortIndex].sort = sortIndex
const { courseChapterList } = this.state }
// 第一个上移和最后一个下移不能使用 this.setState({
if ((isUp && sortIndex === 0) || (!isUp && sortIndex === courseChapterList.length - 1)) { courseChapterList: _courseChapterList,
return })
} }
renderTypemenu = () => {
let _courseChapterList = [...courseChapterList] return (
const temp = courseChapterList[sortIndex] <Menu>
<Menu.Item>
// 若上移 <span
if (isUp) { onClick={() => {
_courseChapterList[sortIndex - 1] = temp this.selectFileType('VIDEO')
_courseChapterList[sortIndex - 1].sort = sortIndex - 1 }}>
_courseChapterList[sortIndex] = courseChapterList[sortIndex - 1] 视频文件
_courseChapterList[sortIndex].sort = sortIndex </span>
} else { </Menu.Item>
// 若下移 <Menu.Item>
_courseChapterList[sortIndex + 1] = temp <span
_courseChapterList[sortIndex + 1].sort = sortIndex + 1 onClick={() => {
_courseChapterList[sortIndex] = courseChapterList[sortIndex + 1] this.selectFileType('WORD_PDF')
_courseChapterList[sortIndex].sort = sortIndex }}>
} 资料文件
</span>
this.setState({ </Menu.Item>
courseChapterList: _courseChapterList, </Menu>
}) )
} }
renderTypemenu = () => { selectFileType = (type) => {
return ( const { courseChapterList } = this.state
<Menu> if (courseChapterList.length >= 20) {
<Menu.Item> message.warning(`最多只能上传20个文件`)
<span return
onClick={() => { }
this.selectFileType('VIDEO') if (type === 'VIDEO') {
}}> this.setState({
视频文件 showSelectFileModal: true,
</span> selectTypeList: ['MP4'],
</Menu.Item> accept: 'video/mp4',
<Menu.Item> })
<span } else {
onClick={() => { this.setState({
this.selectFileType('WORD_PDF') showSelectFileModal: true,
}}> selectTypeList: ['DOC', 'DOCX', 'PDF'],
资料文件 accept: '.doc,.docx,.pdf',
</span> })
</Menu.Item> }
</Menu> }
)
} renderToolTipTitle = () => {
selectFileType = (type) => { return (
const { courseChapterList } = this.state <div>
if (courseChapterList.length >= 20) { <p>视频支持mp4格式,大小不超过2G;</p>
message.warning(`最多只能上传20个文件`) <p>文件支持PDF、docx、doc格式,大小不超过100M</p>
return </div>
} )
if (type === 'VIDEO') { }
this.setState({
showSelectFileModal: true, render() {
selectTypeList: ['MP4'], const {
accept: 'video/mp4', pageType,
}) courseName,
} else { coverUrl,
this.setState({ scheduleMedia,
showSelectFileModal: true, showSelectFileModal,
selectTypeList: ['DOC', 'DOCX', 'PDF'], diskList,
accept: '.doc,.docx,.pdf', // videoType,
}) shelfState,
} categoryId,
} whetherVisitorsJoin,
visible,
renderToolTipTitle = () => { showSelectCoverModal,
return (
<div> introduce,
<p>视频支持mp4格式,大小不超过2G;</p> loadintroduce,
<p>文件支持PDF、docx、doc格式,大小不超过100M</p> id,
</div> courseChapterList,
) imageFile,
} selectTypeList,
accept,
render() { } = this.state
const { const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'
pageType, const isDefaultCover = coverUrl === defaultCover || coverUrl == null
courseName,
coverUrl, return (
scheduleMedia, <div className='page add-video-course-page'>
showSelectFileModal, <Breadcrumbs navList={pageType === 'add' ? '新建线上课' : '编辑线上课'} goBack={this.handleGoBack} />
diskList,
// videoType, <div className='box'>
shelfState, <div className='show-tips'>
categoryId, <ShowTips message='请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利' />
whetherVisitorsJoin, </div>
visible,
showSelectCoverModal, <div className='form'>
<div className='course-name required'>
introduce, <span className='label'>课程名称:</span>
loadintroduce, <Input
id, value={courseName}
courseChapterList, placeholder='请输入线上课的名称(40字以内)'
imageFile, maxLength={40}
selectTypeList, style={{ width: 240 }}
accept, onChange={(e) => {
} = this.state this.handleChangeForm('courseName', e.target.value)
const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png' }}
const isDefaultCover = coverUrl === defaultCover || coverUrl == null />
</div>
return (
<div className='page add-video-course-page'> <div className='upload-video mt16'>
<Breadcrumbs navList={pageType === 'add' ? '新建线上课' : '编辑线上课'} goBack={this.handleGoBack} /> <div className='content flex'>
<span className='label required upload-chapter'>上传课节:</span>
<div className='box'> </div>
<div className='show-tips'> <div className='sub-content'>
<ShowTips message='请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利' /> <div className='btn-wrap'>
</div> {/* <Button
<div className='form'>
<div className='course-name required'>
<span className='label'>课程名称:</span>
<Input
value={courseName}
placeholder='请输入线上课的名称(40字以内)'
maxLength={40}
style={{ width: 240 }}
onChange={(e) => {
this.handleChangeForm('courseName', e.target.value)
}}
/>
</div>
<div className='upload-video mt16'>
<div className='content flex'>
<span className='label required upload-chapter'>上传课节:</span>
</div>
<div className='sub-content'>
<div className='btn-wrap'>
{/* <Button
onClick={() => { onClick={() => {
if(courseChapterList.length >= 20) { if(courseChapterList.length >= 20) {
message.warning(`最多只能上传20个文件`); message.warning(`最多只能上传20个文件`);
...@@ -752,207 +728,207 @@ class AddVideoCourse extends React.Component { ...@@ -752,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' }}>
{' '} {' '}
&#xe61d; &#xe61d;
</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
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