Commit 2b2c07bf by zhangleyuan

Merge branch 'feature/zhangleyuan/20210802/video-show' into rc

parents d7ee39a1 ffb147bc
......@@ -8,30 +8,30 @@
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="小麦企学院,一站式企业培训数字化服务商,通过“工具+内容”,帮助企业快速从0到1搭建数字化培训体系,并让整个培训过程可视化,降低培训成本,提升培训效率。"
/>
<meta
name="keywords"
content="小麦企学院,企业培训,员工培训,企业大学,企业内训,企业外训,培训计划,培训素材,企培,企训,素材库,培训课程,培训任务,直播课,线上课,图文课,线下活动,知识库,作业,考试,排行榜,培训类别管理,定制培训计划,管理数据,学习数据,企学院,资料共享,培训数字化,数字化培训,培训工具,在线培训,线上培训,培训saas,培训管理,企业微信培训,对客培训,客户培训,直播培训,互联网培训,新员工培训,管理培训,管理者培训,工人培训,制造业培训,餐饮培训,服务业培训,零售培训,门店培训,工厂培训,车间培训,培训补贴,人事培训,财务培训,职场培训,企业学院平台,教育企业学院,教育企业平台,教育平台学院,企业学习,酷学院,小鹅通,企业学院,云学堂,时代光华,云课堂,魔学院,云大学,米知云,授课学堂"
/>
<!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> -->
<link rel="shortcut icon" href="https://image.xiaomaiketang.com/xm/c4KiP2epBP.png" />
<head>
<meta charset="utf-8" />
<link rel="icon" href="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="小麦企学院,一站式企业培训数字化服务商,通过“工具+内容”,帮助企业快速从0到1搭建数字化培训体系,并让整个培训过程可视化,降低培训成本,提升培训效率。"
/>
<meta
name="keywords"
content="小麦企学院,企业培训,员工培训,企业大学,企业内训,企业外训,培训计划,培训素材,企培,企训,素材库,培训课程,培训任务,直播课,线上课,图文课,线下活动,知识库,作业,考试,排行榜,培训类别管理,定制培训计划,管理数据,学习数据,企学院,资料共享,培训数字化,数字化培训,培训工具,在线培训,线上培训,培训saas,培训管理,企业微信培训,对客培训,客户培训,直播培训,互联网培训,新员工培训,管理培训,管理者培训,工人培训,制造业培训,餐饮培训,服务业培训,零售培训,门店培训,工厂培训,车间培训,培训补贴,人事培训,财务培训,职场培训,企业学院平台,教育企业学院,教育企业平台,教育平台学院,企业学习,酷学院,小鹅通,企业学院,云学堂,时代光华,云课堂,魔学院,云大学,米知云,授课学堂"
/>
<!-- <link rel="apple-touch-icon" href="../src/common/images/logo.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
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="stylesheet" href="//at.alicdn.com/t/font_2223403_oe5p510553.css" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="//at.alicdn.com/t/font_2223403_oe5p510553.css" />
<!--
<!--
Notice the use of %PUBLIC_URL% in the tags above.
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.
......@@ -40,19 +40,19 @@
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`.
-->
<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/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/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" src="https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<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/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/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" src="https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
......@@ -62,5 +62,5 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</body>
</html>
......@@ -21,492 +21,487 @@ import './GraphicsCourseList.less'
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png'
class GraphicsCourseList extends React.Component {
constructor(props) {
super(props)
this.state = {
id: '', // 视频课ID
studentIds: [],
RelatedPlanModalVisible: false,
selectPlanList: {},
}
}
constructor(props) {
super(props)
this.state = {
id: '', // 视频课ID
studentIds: [],
RelatedPlanModalVisible: false,
selectPlanList: {},
}
}
componentDidMount() {
const videoCourseItem = localStorage.getItem('videoCourseItem')
if (videoCourseItem) {
const _videoCourseItem = JSON.parse(videoCourseItem)
this.handleShowShareModal(_videoCourseItem, true)
}
}
componentDidMount() {
const videoCourseItem = localStorage.getItem('videoCourseItem')
if (videoCourseItem) {
const _videoCourseItem = JSON.parse(videoCourseItem)
this.handleShowShareModal(_videoCourseItem, true)
}
}
// 观看数据弹窗
handleShowWatchDataModal = (record) => {
const watchDataModal = (
<WatchDataModal
type='videoCourseList'
data={record}
close={() => {
this.setState({
watchDataModal: null,
})
}}
/>
)
this.setState({ watchDataModal })
}
// 观看数据弹窗
handleShowWatchDataModal = (record) => {
const watchDataModal = (
<WatchDataModal
type='videoCourseList'
data={record}
close={() => {
this.setState({
watchDataModal: null,
})
}}
/>
)
this.setState({ watchDataModal })
}
handlePlanName = (planArray) => {
let planStr = ''
planArray.forEach((item, index) => {
if (index < planArray.length - 1) {
planStr = planStr + item.planName + '、'
} else {
planStr = planStr + item.planName
}
})
return planStr
}
// 请求表头
parseColumns = () => {
const columns = [
{
title: '图文课',
key: 'scheduleName',
dataIndex: 'scheduleName',
width: 321,
fixed: 'left',
render: (val, record) => {
const { coverUrl } = record
return (
<div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<img className='course-cover' src={coverUrl || defaultCoverUrl} alt='' />
<Choose>
<When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}>
<div className='course-name'>{record.courseName}</div>
</Tooltip>
</When>
<Otherwise>
<div className='course-name'>{record.courseName}</div>
</Otherwise>
</Choose>
</div>
)
},
},
{
title: '课程分类',
key: 'categoryName',
dataIndex: 'categoryName',
width: 120,
render: (val, record) => {
return <div className='record__item'>{record.categorySonName}</div>
},
},
{
title: '创建人',
key: 'createName',
dataIndex: 'createName',
width: 100,
render: (val) => {
return (
<div>
{val && (
<Tooltip title={val}>
<div>{val.length > 4 ? `${val.slice(0, 4)}...` : val}</div>
</Tooltip>
)}
</div>
)
},
},
{
title: (
<span>
<span>学院展示</span>
<Tooltip
title={
<div>
开启后,学员可在学院内查看到此课程。
<br />
关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。
</div>
}>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d;
</i>
</Tooltip>
</span>
),
width: 120,
dataIndex: 'courseware',
render: (val, item, index) => {
return (
<Switch
size='small'
checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState === 'YES' ? true : false}
onChange={(checked) => this.changeShelfState(index, item, checked)}
/>
)
},
},
{
title: '观看学员数',
width: 110,
key: 'watchUserCount',
dataIndex: 'watchUserCount',
render: (val, item) => {
return <div className='watchUserCount'>{val}</div>
},
},
{
title: '创建时间',
width: 181,
key: 'created',
dataIndex: 'created',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
},
},
{
title: '最近修改时间',
width: 181,
key: 'updated',
dataIndex: 'updated',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
},
},
{
title: '关联项',
width: 200,
key: 'planList',
dataIndex: 'planList',
render: (val, record) => {
return (
<div className='related-task'>
<Choose>
<When condition={record.relatedPlanList}>
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => {
return (
<span key={item.planId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span>
)
})}
</Tooltip>
</When>
<Otherwise>
<span></span>
</Otherwise>
</Choose>
</div>
)
},
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
width: 210,
fixed: 'right',
render: (val, record) => {
return (
<div className='operate'>
<div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}>
观看数据
</div>
<span className='operate__item split'> | </span>
<div className='operate__item' onClick={() => this.handleShowShareModal(record)}>
分享
</div>
<span className='operate__item split'> | </span>
<Dropdown overlay={this.renderMoreOperate(record)}>
<span className='more-operate'>
<span className='operate-text'>更多</span>
<span className='iconfont icon' style={{ color: '#2966FF' }}>
&#xe824;
</span>
</span>
</Dropdown>
</div>
)
},
},
]
return columns
}
handlePlanName = (planArray) => {
let planStr = ''
planArray.forEach((item, index) => {
if (index < planArray.length - 1) {
planStr = planStr + item.planName + '、'
} else {
planStr = planStr + item.planName
}
})
return planStr
}
// 请求表头
parseColumns = () => {
const columns = [
{
title: '图文课',
key: 'scheduleName',
dataIndex: 'scheduleName',
width: 321,
fixed: 'left',
render: (val, record) => {
const { coverUrl } = record
return (
<div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<img className='course-cover' src={coverUrl || defaultCoverUrl} alt='' />
<Choose>
<When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}>
<div className='course-name'>{record.courseName}</div>
</Tooltip>
</When>
<Otherwise>
<div className='course-name'>{record.courseName}</div>
</Otherwise>
</Choose>
</div>
)
},
},
{
title: '课程分类',
key: 'categoryName',
dataIndex: 'categoryName',
width: 120,
render: (val, record) => {
return <div className='record__item'>{record.categorySonName}</div>
},
},
{
title: '创建人',
key: 'createName',
dataIndex: 'createName',
width: 100,
render: (val) => {
return (
<div>
{val && (
<Tooltip title={val}>
<div>{val.length > 4 ? `${val.slice(0, 4)}...` : val}</div>
</Tooltip>
)}
</div>
)
},
},
{
title: (
<span>
<span>学院展示</span>
<Tooltip
title={
<div>
开启后,学员可在学院内查看到此课程。
<br />
关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。
</div>
}>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d;
</i>
</Tooltip>
</span>
),
width: 120,
dataIndex: 'courseware',
render: (val, item, index) => {
return (
<Switch
size='small'
checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState === 'YES' ? true : false}
onChange={(checked) => this.changeShelfState(index, item, checked)}
/>
)
},
},
{
title: '观看学员数',
width: 110,
key: 'watchUserCount',
dataIndex: 'watchUserCount',
render: (val, item) => {
return <div className='watchUserCount'>{val}</div>
},
},
{
title: '创建时间',
width: 181,
key: 'created',
dataIndex: 'created',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
},
},
{
title: '最近修改时间',
width: 181,
key: 'updated',
dataIndex: 'updated',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
},
},
{
title: '关联项',
width: 200,
key: 'planList',
dataIndex: 'planList',
render: (val, record) => {
return (
<div className='related-task'>
<Choose>
<When condition={record.relatedPlanList}>
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => {
return (
<span key={item.planId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span>
)
})}
</Tooltip>
</When>
<Otherwise>
<span></span>
</Otherwise>
</Choose>
</div>
)
},
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
width: 210,
fixed: 'right',
render: (val, record) => {
return (
<div className='operate'>
<div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}>
观看数据
</div>
<span className='operate__item split'> | </span>
<div className='operate__item' onClick={() => this.handleShowShareModal(record)}>
分享
</div>
<span className='operate__item split'> | </span>
<Dropdown overlay={this.renderMoreOperate(record)}>
<span className='more-operate'>
<span className='operate-text'>更多</span>
<span className='iconfont icon' style={{ color: '#2966FF' }}>
&#xe824;
</span>
</span>
</Dropdown>
</div>
)
},
},
]
return columns
}
handleRelatedModalShow = (item) => {
const selectPlanList = {}
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item
})
}
handleRelatedModalShow = (item) => {
const selectPlanList = {}
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item
})
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
})
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
})
}
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
})
}
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
})
}
onChangeSelectPlanList = (selectPlanList) => {
this.setState({
selectPlanList: selectPlanList,
})
}
onChangeSelectPlanList = (selectPlanList) => {
this.setState({
selectPlanList: selectPlanList,
})
}
onConfirmSelectPlanList = () => {
this.setState(
{
RelatedPlanModalVisible: false,
},
() => {
this.props.onChange()
}
)
}
onConfirmSelectPlanList = () => {
this.setState(
{
RelatedPlanModalVisible: false,
},
() => {
this.props.onChange()
}
)
}
renderMoreOperate = (item) => {
return (
<div className='live-course-more-menu'>
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
<div
className='operate__item'
key='plan'
onClick={() => {
this.handleRelatedModalShow(item)
}}>
关联培训计划
</div>
)}
<div
className='operate__item'
key='edit'
onClick={() => {
window.RCHistory.push(`/create-graphics-course?type=edit&id=${item.id}`)
}}>
编辑
</div>
<div className='operate__item' key='delete' onClick={() => this.handleDeleteGraphicsCourse(item.id)}>
删除
</div>
</div>
)
}
//改变上架状态
changeShelfState = (index, item, checked) => {
let _shelfState = checked ? 'YES' : 'NO'
// if(_shelfState==='NO'){
// _shelfState = "YES";
// }else{
// _shelfState = "NO"
// }
const params = {
courseId: item.id,
shelfState: _shelfState,
}
CourseService.changeVideoShelfState(params).then((res) => {
if (res.success) {
if (_shelfState === 'YES') {
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>,
okText: '确定',
okType: 'danger',
cancelText: '取消',
onOk: () => {
const param = {
courseId: scheduleId,
storeId: User.getStoreId(),
}
CourseService.delVideoSchedule(param).then(() => {
message.success('删除成功')
this.props.onChange()
})
},
})
}
renderMoreOperate = (item) => {
return (
<div className='live-course-more-menu'>
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
<div
className='operate__item'
key='plan'
onClick={() => {
this.handleRelatedModalShow(item)
}}>
关联培训计划
</div>
)}
<div
className='operate__item'
key='edit'
onClick={() => {
window.RCHistory.push(`/create-graphics-course?type=edit&id=${item.id}`)
}}>
编辑
</div>
<div className='operate__item' key='delete' onClick={() => this.handleDeleteGraphicsCourse(item.id)}>
删除
</div>
</div>
)
}
//改变上架状态
changeShelfState = (index, item, checked) => {
let _shelfState = checked ? 'YES' : 'NO'
const params = {
courseId: item.id,
shelfState: _shelfState,
}
CourseService.changeVideoShelfState(params).then((res) => {
if (res.success) {
if (_shelfState === 'YES') {
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>,
okText: '确定',
okType: 'danger',
cancelText: '取消',
onOk: () => {
const param = {
courseId: scheduleId,
storeId: User.getStoreId(),
}
CourseService.delVideoSchedule(param).then(() => {
message.success('删除成功')
this.props.onChange()
})
},
})
}
// 显示分享弹窗
handleShowShareModal = (record, needStr = false) => {
const { id, scheduleVideoUrl } = record
const htmlUrl = `${LIVE_SHARE}graphics_detail/${id}?id=${User.getStoreId()}`
const longUrl = htmlUrl
const { coverUrl, courseName } = record
const shareData = {
longUrl,
coverUrl,
scheduleVideoUrl,
courseName,
}
// 显示分享弹窗
handleShowShareModal = (record, needStr = false) => {
const { id, scheduleVideoUrl } = record
const htmlUrl = `${LIVE_SHARE}graphics_detail/${id}?id=${User.getStoreId()}`
const longUrl = htmlUrl
const { coverUrl, courseName } = record
const shareData = {
longUrl,
coverUrl,
scheduleVideoUrl,
courseName,
}
const shareLiveModal = (
<ShareLiveModal
needStr={needStr}
data={shareData}
type='graphicsClass'
title='图文课'
close={() => {
this.setState({
shareLiveModal: null,
})
localStorage.setItem('videoCourseItem', '')
}}
/>
)
const shareLiveModal = (
<ShareLiveModal
needStr={needStr}
data={shareData}
type='graphicsClass'
title='图文课'
close={() => {
this.setState({
shareLiveModal: null,
})
localStorage.setItem('videoCourseItem', '')
}}
/>
)
this.setState({ shareLiveModal })
}
this.setState({ shareLiveModal })
}
handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter
const { query } = this.props
let { order: _order } = query
// 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') {
_order = 'CREATED_ASC'
}
// 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') {
_order = 'CREATED_DESC'
}
// 按更新时间升序排序
if (columnKey === 'updated' && order === 'ascend') {
_order = 'UPDATED_ASC'
}
// 按更新时间降序排序
if (columnKey === 'updated' && order === 'descend') {
_order = 'UPDATED_DESC'
}
handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter
const { query } = this.props
let { order: _order } = query
// 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') {
_order = 'CREATED_ASC'
}
// 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') {
_order = 'CREATED_DESC'
}
// 按更新时间升序排序
if (columnKey === 'updated' && order === 'ascend') {
_order = 'UPDATED_ASC'
}
// 按更新时间降序排序
if (columnKey === 'updated' && order === 'descend') {
_order = 'UPDATED_DESC'
}
const _query = {
...query,
orderEnum: _order,
}
this.props.onChange(_query)
}
handleRelatedModalShow = (item) => {
const selectPlanList = {}
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item
})
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
})
}
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
})
}
onChangeSelectPlanList = (selectPlanList) => {
this.setState({
selectPlanList: selectPlanList,
})
}
onConfirmSelectPlanList = () => {
this.setState(
{
RelatedPlanModalVisible: false,
},
() => {
this.props.onChange()
}
)
}
render() {
const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state
const { dataSource = [], totalCount, query } = this.props
const { current, size } = query
const _query = {
...query,
orderEnum: _order,
}
this.props.onChange(_query)
}
handleRelatedModalShow = (item) => {
const selectPlanList = {}
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item
})
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
})
}
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
})
}
onChangeSelectPlanList = (selectPlanList) => {
this.setState({
selectPlanList: selectPlanList,
})
}
onConfirmSelectPlanList = () => {
this.setState(
{
RelatedPlanModalVisible: false,
},
() => {
this.props.onChange()
}
)
}
render() {
const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state
const { dataSource = [], totalCount, query } = this.props
const { current, size } = query
return (
<div className='video-course-list'>
<XMTable
renderEmpty={{
image: college,
description: '暂无数据',
}}
rowKey={(record) => record.id}
dataSource={dataSource}
columns={this.parseColumns()}
onChange={this.handleChangeTable}
pagination={false}
scroll={{ x: 1500 }}
bordered
className='video-list-table'
/>
return (
<div className='video-course-list'>
<XMTable
renderEmpty={{
image: college,
description: '暂无数据',
}}
rowKey={(record) => record.id}
dataSource={dataSource}
columns={this.parseColumns()}
onChange={this.handleChangeTable}
pagination={false}
scroll={{ x: 1500 }}
bordered
className='video-list-table'
/>
<div className='box-footer'>
<PageControl
current={current - 1}
pageSize={size}
total={totalCount}
toPage={(page) => {
const _query = { ...query, current: page + 1 }
this.props.onChange(_query)
}}
/>
</div>
{RelatedPlanModalVisible && (
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{RelatedPlanModalVisible && (
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{this.state.shareLiveModal}
{this.state.watchDataModal}
</div>
)
}
<div className='box-footer'>
<PageControl
current={current - 1}
pageSize={size}
total={totalCount}
toPage={(page) => {
const _query = { ...query, current: page + 1 }
this.props.onChange(_query)
}}
/>
</div>
{RelatedPlanModalVisible && (
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{RelatedPlanModalVisible && (
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{this.state.shareLiveModal}
{this.state.watchDataModal}
</div>
)
}
}
export default GraphicsCourseList
......@@ -7,35 +7,33 @@
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import React from 'react'
import { Button, Input, message, Modal, Tooltip, Form, Popconfirm, Menu, Dropdown } from 'antd'
import { FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum'
import { CourseCatalogSelect } from '@/modules/common'
import ShowTips from '@/components/ShowTips'
import Breadcrumbs from '@/components/Breadcrumbs'
import moment from 'moment'
import AddVideoIntro from './components/AddVideoIntro'
import SelectStudent from '../modal/select-student'
import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal'
import PreviewCourseModal from '../modal/PreviewCourseModal'
import StoreService from '@/domains/store-domain/storeService'
import CourseService from '@/domains/course-domain/CourseService'
import Service from '@/common/js/service'
import User from '@/common/js/user'
import _ from 'underscore'
import Upload from '@/core/upload'
import { randomString } from '@/domains/basic-domain/utils'
import ImgClipModal from '@/components/ImgClipModal'
import $ from 'jquery'
import './AddVideoCourse.less'
import Bus from '@/core/bus'
const { TextArea } = Input
const EDIT_BOX_KEY = Math.random()
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }
import React from 'react';
import { Button, Input, message, Modal, Tooltip, Form, Popconfirm, Menu, Dropdown } from 'antd';
import { FileTypeIcon } from '@/common/constants/academic/lessonEnum';
import { CourseCatalogSelect } from '@/modules/common';
import ShowTips from '@/components/ShowTips';
import Breadcrumbs from '@/components/Breadcrumbs';
import moment from 'moment';
import AddVideoIntro from './components/AddVideoIntro';
import SelectStudent from '../modal/select-student';
import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal';
import PreviewCourseModal from '../modal/PreviewCourseModal';
import CourseService from '@/domains/course-domain/CourseService';
import Service from '@/common/js/service';
import User from '@/common/js/user';
import _ from 'underscore';
import Upload from '@/core/upload';
import { randomString } from '@/domains/basic-domain/utils';
import ImgClipModal from '@/components/ImgClipModal';
import $ from 'jquery';
import './AddVideoCourse.less';
import Bus from '@/core/bus';
const { TextArea } = Input;
const EDIT_BOX_KEY = Math.random();
//添加课程时课程默认的一些值
const defaultShelfState = 'YES'
const defaultShelfState = 'YES';
const defaultScheduleMedia = [
{
contentType: 'INTRO',
......@@ -43,23 +41,23 @@ const defaultScheduleMedia = [
mediaContent: '',
key: EDIT_BOX_KEY,
},
]
const whetherVisitorsJoin = 'NO'
];
const whetherVisitorsJoin = 'NO';
let cutFlag = false
let cutFlag = false;
const SUPPORT_WORD_PDF = [
'application/msword',
'application/wps-writer',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/pdf',
'application/wps-office.pdf',
]
];
class AddVideoCourse extends React.Component {
constructor(props) {
super(props)
super(props);
const id = getParameterByName('id')
const pageType = getParameterByName('type')
const id = getParameterByName('id');
const pageType = getParameterByName('type');
this.state = {
id, // 线上课ID,编辑的时候从URL上带过来
......@@ -95,81 +93,59 @@ class AddVideoCourse extends React.Component {
mediaNameAlias: '', // 任一视频重命名的名称(气泡框)
selectTypeList: ['MP4'],
accept: 'video/mp4',
}
};
}
componentWillMount() {
const { id, pageType } = this.state
const { id, pageType } = this.state;
if (pageType === 'edit') {
this.handleFetchScheudleDetail(id)
this.handleFetchScheudleDetail(id);
}
Bus.bind('editorLimit', (editorTextLength) => {
this.setState({
editorTextLength,
})
})
});
});
}
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('-')
// const changeValueLength = value.length
// switch (changeValueLength) {
// case 1:
// this.setState({ categoryId: value[0], categoryName })
// break
// case 2:
// this.setState({ categoryId: value[1], categoryName })
// break
// default:
// this.setState({ categoryId: null })
// break
// }
// }
// 获取线上课详情
handleFetchScheudleDetail = (courseId) => {
CourseService.videoScheduleDetail({
courseId,
}).then((res) => {
const { result = {} } = res || {}
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId, courseChapterVOList = [] } = result
let coverId
let coverUrl
let scheduleMedia = []
let scheduleVideoUrl
let hasIntro
const { result = {} } = res || {};
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId, courseChapterVOList = [] } = result;
let coverId;
let coverUrl;
let scheduleMedia = [];
let scheduleVideoUrl;
let hasIntro;
courseMediaVOS.map((item) => {
switch (item.contentType) {
case 'COVER':
coverId = item.mediaContent
coverUrl = item.mediaUrl
break
coverId = item.mediaContent;
coverUrl = item.mediaUrl;
break;
case 'INTRO':
hasIntro = true
this.getTextDetail('introduce', item.mediaUrl)
break
hasIntro = true;
this.getTextDetail('introduce', item.mediaUrl);
break;
default:
break
break;
}
return item
})
// let categoryName
// if (categoryTwoName) {
// categoryName = `${categoryOneName}-${categoryTwoName}`
// } else {
// categoryName = `${categoryOneName}`
// }
return item;
});
const _courseChapterVOList = courseChapterVOList.map((item) => {
item.mediaName = item.name
item.resourceId = item.id
return item
})
item.mediaName = item.name;
item.resourceId = item.id;
return item;
});
this.setState({
loadintroduce: !hasIntro,
......@@ -182,9 +158,9 @@ class AddVideoCourse extends React.Component {
whetherVisitorsJoin,
categoryId,
courseChapterList: _courseChapterVOList,
})
})
}
});
});
};
getTextDetail = (key, url) => {
$.ajax({
......@@ -193,13 +169,13 @@ class AddVideoCourse extends React.Component {
url,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => {
this.setState({ [key]: res, [`load${key}`]: true })
this.setState({ [key]: res, [`load${key}`]: true });
},
})
}
});
};
handleGoBack = () => {
const { coverId, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state
const { coverId, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state;
if (
!courseChapterList.length ||
!_.isEqual(scheduleMedia, defaultScheduleMedia) ||
......@@ -218,29 +194,29 @@ class AddVideoCourse extends React.Component {
onOk: () => {
window.RCHistory.push({
pathname: `/video-course`,
})
});
},
})
});
} else {
window.RCHistory.push({
pathname: `/video-course`,
})
});
}
}
};
// 修改表单
handleChangeForm = (field, value, coverUrl) => {
this.setState({
[field]: value,
coverUrl: coverUrl ? coverUrl : this.state.coverUrl,
})
}
});
};
// 显示选择学员弹窗
handleShowSelectStuModal = () => {
this.setState({ studentModal: true })
this.setState({ studentModal: true });
const { studentList, selectedStuList } = this.state
const { studentList, selectedStuList } = this.state;
const studentModal = (
<SelectStudent
showTabs={true}
......@@ -251,35 +227,35 @@ class AddVideoCourse extends React.Component {
close={() => {
this.setState({
studentModal: null,
})
});
}}
/>
)
this.setState({ studentModal })
}
);
this.setState({ studentModal });
};
handleSelectStudent = (studentIds) => {
let studentList = []
let studentList = [];
_.each(studentIds, (item) => {
studentList.push({ studentId: item })
})
this.setState({ studentList })
this.setState({ studentModal: false })
}
studentList.push({ studentId: item });
});
this.setState({ studentList });
this.setState({ studentModal: false });
};
// 显示预览弹窗
handleShowPreviewModal = () => {
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, introduce, courseChapterList, categoryName } = this.state
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, introduce, courseChapterList, categoryName } = this.state;
const courseBasinInfo = {
coverUrl,
scheduleVideoUrl,
courseName,
}
};
const courseIntroInfo = {
liveCourseMediaRequests: scheduleMedia,
introduce,
categoryName,
}
};
const previewCourseModal = (
<PreviewCourseModal
......@@ -289,35 +265,35 @@ class AddVideoCourse extends React.Component {
close={() => {
this.setState({
previewCourseModal: null,
})
});
}}
courseChapterList={courseChapterList}
/>
)
);
this.setState({ previewCourseModal })
}
this.setState({ previewCourseModal });
};
// 选择视频
handleSelectVideo = (addFolderIds, selectedFileList) => {
this.setState({
showSelectFileModal: false,
})
});
let { courseChapterList } = this.state
let _courseChapterList = [...courseChapterList]
let { courseChapterList } = this.state;
let _courseChapterList = [...courseChapterList];
if (selectedFileList.length + courseChapterList.length > 20) {
message.warning(`最多只能上传20个文件`)
return
message.warning(`最多只能上传20个文件`);
return;
}
selectedFileList.map((file, index) => {
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file
const _mediaName = folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`, '')
console.log('folderFormat', folderFormat)
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
const _mediaName = folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`, '');
console.log('folderFormat', folderFormat);
if (folderFormat === 'MP4' || folderFormat === 'video/mp4') {
const videoDom = document.createElement('video')
videoDom.src = ossUrl
const videoDom = document.createElement('video');
videoDom.src = ossUrl;
videoDom.onloadedmetadata = () => {
_courseChapterList.push({
mediaContent: resourceId,
......@@ -328,13 +304,13 @@ class AddVideoCourse extends React.Component {
resourceId,
mediaUrl: ossUrl,
sort: _courseChapterList.length,
})
});
this.setState({
courseChapterList: _courseChapterList,
})
}
});
};
} else if (folderFormat === 'WORD' || folderFormat === 'PDF' || SUPPORT_WORD_PDF.indexOf(folderFormat) > -1) {
const suffix = _.last(folderName.split('.')).toUpperCase()
const suffix = _.last(folderName.split('.')).toUpperCase();
_courseChapterList.push({
mediaContent: resourceId,
contentType: 'SCHEDULE',
......@@ -343,47 +319,47 @@ class AddVideoCourse extends React.Component {
resourceId,
mediaUrl: ossUrl,
sort: _courseChapterList.length,
})
});
this.setState({
courseChapterList: _courseChapterList,
})
});
}
})
}
});
};
// 校验课节名称
handleValidateChapterName = (chapterName) => {
let hasError = false
let hasError = false;
return new Promise((resolve) => {
if (!chapterName) {
this.setState({
chapterNameValidateStatus: 'error',
chapterNameHelpMsg: '请输入课节名称',
})
hasError = true
resolve(false)
return false
});
hasError = true;
resolve(false);
return false;
}
if (chapterName.length > 40) {
this.setState({
chapterNameValidateStatus: 'error',
chapterNameHelpMsg: '不要超过40字',
})
hasError = true
resolve(false)
return false
});
hasError = true;
resolve(false);
return false;
}
if (!hasError) {
resolve(true)
resolve(true);
this.setState({
chapterNameValidateStatus: '',
chapterNameHelpMsg: '',
})
});
}
})
}
});
};
// 保存
handleSubmit = () => {
......@@ -393,8 +369,8 @@ class AddVideoCourse extends React.Component {
title: '服务已到期',
content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买',
okText: '我知道了',
})
return
});
return;
}
const {
......@@ -411,7 +387,7 @@ class AddVideoCourse extends React.Component {
introduce,
courseChapterList,
editorTextLength,
} = this.state
} = this.state;
const commonParams = {
// videoName,
......@@ -426,75 +402,75 @@ class AddVideoCourse extends React.Component {
whetherVisitorsJoin,
courseType: 'VOICE',
courseChapterList,
}
};
// 校验必填字段:课程名称, 课程视频
this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength).then((res) => {
if (!res) return
if (!res) return;
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } })
})
})
}
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } });
});
});
};
submitRemote = ({ id, pageType, commonParams }) => {
if (pageType === 'add') {
Service.Hades('public/hades/createVideoSchedule', commonParams).then((res) => {
if (!res) return
message.success('新建成功')
if (!res) return;
message.success('新建成功');
window.RCHistory.push({
pathname: `/video-course`,
})
})
});
});
} else {
const editParams = {
courseId: id,
...commonParams,
}
};
Service.Hades('public/hades/editVideoSchedule', editParams).then((res) => {
if (!res) return
message.success('保存成功')
if (!res) return;
message.success('保存成功');
window.RCHistory.push({
pathname: `/video-course`,
})
})
});
});
}
}
};
handleValidate = (courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength) => {
return new Promise((resolve) => {
if (!courseName) {
message.warning('请输入课程名称')
resolve(false)
return false
message.warning('请输入课程名称');
resolve(false);
return false;
}
if (!courseChapterList.length) {
message.warning('请上传课节')
resolve(false)
return false
message.warning('请上传课节');
resolve(false);
return false;
}
if (!categoryId) {
message.warning('请选择课程分类')
resolve(false)
return false
message.warning('请选择课程分类');
resolve(false);
return false;
}
if (editorTextLength > 1000) {
message.warning('课程简介超过字数限定')
resolve(false)
return
message.warning('课程简介超过字数限定');
resolve(false);
return;
}
resolve(true)
})
}
resolve(true);
});
};
handleSelectCover = (file) => {
if (!file) {
message.info('请选择文件!')
return
message.info('请选择文件!');
return;
}
this.setState({
visible: true,
imageFile: file,
})
}
});
};
//获取resourceId
getSignature = (blob, fileName) => {
Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
......@@ -505,77 +481,77 @@ class AddVideoCourse extends React.Component {
visible: false,
},
() => this.updateCover()
)
})
}
);
});
};
updateCover = () => {
const { coverClicpPath, coverId } = this.state
const { coverClicpPath, coverId } = this.state;
this.setState({
showSelectCoverModal: false,
coverUrl: coverClicpPath,
coverId: coverId,
})
}
});
};
handleRenameCourseChapter = (chapterId, chapterIndex) => {
const { mediaNameAlias } = this.state
const { mediaNameAlias } = this.state;
this.handleValidateChapterName(mediaNameAlias).then((res) => {
// 校验不通过不能点确定保存修改课节名称
if (!res) {
return message.warning('重命名失败')
return message.warning('重命名失败');
}
let { courseChapterList } = this.state
let _courseChapterList = []
let { courseChapterList } = this.state;
let _courseChapterList = [];
_courseChapterList = courseChapterList.map((item, index) => {
if (item.resourceId === chapterId && chapterIndex === index) {
item.mediaName = mediaNameAlias
item.visible = false
item.mediaName = mediaNameAlias;
item.visible = false;
}
return item
})
return item;
});
this.setState({
courseChapterList: _courseChapterList,
chapterNameValidateStatus: '',
chapterNameHelpMsg: '',
mediaNameAlias: '',
})
})
}
});
});
};
handleChangePopConfirmVisible = (chapterId, chapterNameIndex, visible) => {
let { courseChapterList } = this.state
let _courseChapterList = []
let { courseChapterList } = this.state;
let _courseChapterList = [];
_courseChapterList = courseChapterList.map((item, index) => {
if (item.resourceId === chapterId && chapterNameIndex === index) {
item.visible = visible
item.visible = visible;
} else {
item.visible = false
item.visible = false;
}
return item
})
return item;
});
this.setState({
courseChapterList: _courseChapterList,
})
}
});
};
handleDeleteCourseChapter = (chapterId, chapterIndex) => {
console.log('chapterId---', chapterId, chapterIndex)
let { courseChapterList } = this.state
console.log('chapterId---', chapterId, chapterIndex);
let { courseChapterList } = this.state;
let _courseChapterList = courseChapterList.filter((item, index) => {
return item.resourceId !== chapterId || (item.resourceId === chapterId && chapterIndex !== index)
})
return item.resourceId !== chapterId || (item.resourceId === chapterId && chapterIndex !== index);
});
_courseChapterList.map((item, index) => {
item.sort = index
})
item.sort = index;
});
this.setState({
courseChapterList: _courseChapterList,
})
}
});
};
renderChapterTitle = (item) => {
const { chapterNameValidateStatus, chapterNameHelpMsg } = this.state
const { chapterNameValidateStatus, chapterNameHelpMsg } = this.state;
return (
<div className='course-chapter-title-popover'>
......@@ -594,54 +570,54 @@ class AddVideoCourse extends React.Component {
mediaNameAlias: e.target.value.trim(),
},
() => {
this.handleValidateChapterName(this.state.mediaNameAlias)
this.handleValidateChapterName(this.state.mediaNameAlias);
}
)
);
}}
/>
</Form.Item>
</Form>
</div>
)
}
);
};
// 上下移动
handleChangeIndex = (isUp, sortIndex) => {
const { courseChapterList } = this.state
const { courseChapterList } = this.state;
// 第一个上移和最后一个下移不能使用
if ((isUp && sortIndex === 0) || (!isUp && sortIndex === courseChapterList.length - 1)) {
return
return;
}
let _courseChapterList = [...courseChapterList]
const temp = courseChapterList[sortIndex]
let _courseChapterList = [...courseChapterList];
const temp = courseChapterList[sortIndex];
// 若上移
if (isUp) {
_courseChapterList[sortIndex - 1] = temp
_courseChapterList[sortIndex - 1].sort = sortIndex - 1
_courseChapterList[sortIndex] = courseChapterList[sortIndex - 1]
_courseChapterList[sortIndex].sort = sortIndex
_courseChapterList[sortIndex - 1] = temp;
_courseChapterList[sortIndex - 1].sort = sortIndex - 1;
_courseChapterList[sortIndex] = courseChapterList[sortIndex - 1];
_courseChapterList[sortIndex].sort = sortIndex;
} else {
// 若下移
_courseChapterList[sortIndex + 1] = temp
_courseChapterList[sortIndex + 1].sort = sortIndex + 1
_courseChapterList[sortIndex] = courseChapterList[sortIndex + 1]
_courseChapterList[sortIndex].sort = sortIndex
_courseChapterList[sortIndex + 1] = temp;
_courseChapterList[sortIndex + 1].sort = sortIndex + 1;
_courseChapterList[sortIndex] = courseChapterList[sortIndex + 1];
_courseChapterList[sortIndex].sort = sortIndex;
}
this.setState({
courseChapterList: _courseChapterList,
})
}
});
};
renderTypemenu = () => {
return (
<Menu>
<Menu.Item>
<span
onClick={() => {
this.selectFileType('VIDEO')
this.selectFileType('VIDEO');
}}>
视频文件
</span>
......@@ -649,34 +625,34 @@ class AddVideoCourse extends React.Component {
<Menu.Item>
<span
onClick={() => {
this.selectFileType('WORD_PDF')
this.selectFileType('WORD_PDF');
}}>
资料文件
</span>
</Menu.Item>
</Menu>
)
}
);
};
selectFileType = (type) => {
const { courseChapterList } = this.state
const { courseChapterList } = this.state;
if (courseChapterList.length >= 20) {
message.warning(`最多只能上传20个文件`)
return
message.warning(`最多只能上传20个文件`);
return;
}
if (type === 'VIDEO') {
this.setState({
showSelectFileModal: true,
selectTypeList: ['MP4'],
accept: 'video/mp4',
})
});
} else {
this.setState({
showSelectFileModal: true,
selectTypeList: ['DOC', 'DOCX', 'PDF'],
accept: '.doc,.docx,.pdf',
})
});
}
}
};
renderToolTipTitle = () => {
return (
......@@ -684,8 +660,8 @@ class AddVideoCourse extends React.Component {
<p>视频支持mp4格式,大小不超过2G;</p>
<p>文件支持PDF、docx、doc格式,大小不超过100M</p>
</div>
)
}
);
};
render() {
const {
......@@ -709,9 +685,9 @@ class AddVideoCourse extends React.Component {
imageFile,
selectTypeList,
accept,
} = this.state
const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'
const isDefaultCover = coverUrl === defaultCover || coverUrl == null
} = this.state;
const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png';
const isDefaultCover = coverUrl === defaultCover || coverUrl == null;
return (
<div className='page add-video-course-page'>
......@@ -731,7 +707,7 @@ class AddVideoCourse extends React.Component {
maxLength={40}
style={{ width: 240 }}
onChange={(e) => {
this.handleChangeForm('courseName', e.target.value)
this.handleChangeForm('courseName', e.target.value);
}}
/>
</div>
......@@ -814,15 +790,15 @@ class AddVideoCourse extends React.Component {
chapterNameValidateStatus: '',
chapterNameHelpMsg: '',
mediaNameAlias: '',
})
});
}}
onCancel={() => this.handleChangePopConfirmVisible(item.resourceId, index, false)}>
<div
className='rename'
onClick={() => {
this.setState({ mediaNameAlias: item.mediaName }, () => {
this.handleChangePopConfirmVisible(item.resourceId, index, true)
})
this.handleChangePopConfirmVisible(item.resourceId, index, true);
});
}}>
重命名
</div>
......@@ -833,7 +809,7 @@ class AddVideoCourse extends React.Component {
</div>
</div>
</div>
)
);
})}
</div>
</div>
......@@ -846,7 +822,7 @@ class AddVideoCourse extends React.Component {
<div>
<Button
onClick={() => {
this.setState({ showSelectCoverModal: true })
this.setState({ showSelectCoverModal: true });
}}>{`${pageType === 'add' && !coverUrl ? '上传' : '修改'}封面`}</Button>
<span
className={`span ${coverUrl ? 'defalut-span' : ''}`}
......@@ -854,7 +830,7 @@ class AddVideoCourse extends React.Component {
this.setState({
coverUrl: '',
coverId: '',
})
});
}}>
使用默认图
</span>
......@@ -874,7 +850,7 @@ class AddVideoCourse extends React.Component {
<CourseCatalogSelect
value={categoryId}
onChange={(value, label) => {
this.handleChangeCatalogList(value, label)
this.handleChangeCatalogList(value, label);
}}
/>
</div>
......@@ -919,7 +895,7 @@ class AddVideoCourse extends React.Component {
diskList={diskList}
addVideo={true}
onClose={() => {
this.setState({ showSelectFileModal: false })
this.setState({ showSelectFileModal: false });
}}
onSelect={this.handleSelectVideo}
/>
......@@ -934,7 +910,7 @@ class AddVideoCourse extends React.Component {
tooltip='支持文件类型:jpg、jpeg、png'
isOpen={showSelectCoverModal}
onClose={() => {
this.setState({ showSelectCoverModal: false })
this.setState({ showSelectCoverModal: false });
}}
onSelect={this.handleSelectCover}
/>
......@@ -945,14 +921,14 @@ class AddVideoCourse extends React.Component {
imgUrl={imageFile.ossUrl}
onConfirm={this.getSignature}
onClose={() => {
this.setState({ visible: false })
this.setState({ visible: false });
}}
/>
)}
{this.state.previewCourseModal}
</div>
)
);
}
}
export default AddVideoCourse
export default AddVideoCourse;
......@@ -34,7 +34,7 @@ class ScanFileModal extends React.Component {
style={{ width: 632, objectFit: "cover" }}
/>
)}
{fileType === "VIDEO" && (
{(fileType ==="VIDEO" || fileType === "MP4") && (
<div>
<Player
src={item.mediaUrl || item.ossAddress || item.ossUrl}
......
......@@ -30,7 +30,7 @@
text-align: center;
margin-top: 100%;
.empty-tree-btn {
color: #2966FF;
color: #2966ff;
cursor: pointer;
}
}
......@@ -39,8 +39,6 @@
font-weight: 400;
color: #666666;
width: 234px;
// overflow-x: scroll;
// overflow-y: hidden;
.anticon {
color: #999999;
}
......@@ -52,7 +50,7 @@
white-space: nowrap;
}
.ant-tree-node-content-wrapper.ant-tree-node-selected {
color: #2966FF;
color: #2966ff;
}
}
.ant-tree-treenode-selected:hover::before,
......
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