Commit 39be164c by guomingpang

feat:课程管理5级分类,学院装修banner尺寸修改

parents 5d6962e4 95bec18d
...@@ -13,14 +13,13 @@ ...@@ -13,14 +13,13 @@
<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" />
<title>小麦企学院_搭建数字化企业大学</title>
<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" />
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
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>
<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>
......
import React, { useEffect, useState } from 'react'
import { TreeSelect } from 'antd'
import User from '@/common/js/user'
import Service from '@/common/js/service'
function CourseCatalogSelect(props) {
let {
showSearch = true,
value = '',
treeNodeFilterProp = 'title',
style = { width: 240 },
dropdownStyle = { maxHeight: 300, overflow: 'auto' },
placeholder = '请选择课程类型',
allowClear = true,
onChange = () => {},
} = props
let [courseCatalogList, setCourseCatalogList] = useState([])
useEffect(() => {
//获取分类列表
function getCourseCatalogList() {
Service.Hades('public/hades/queryCategoryTree', { source: 0, tenantId: User.getStoreId(), count: false, userId: User.getUserId() }).then((res) => {
const { categoryList = [] } = res.result
let list = renderTreeNodes(categoryList)
setCourseCatalogList(list)
})
}
function renderTreeNodes(list) {
let newTreeData = list.map((item) => {
item.title = item.categoryName
item.value = item.id
item.key = item.id
console.log(value, item.value, value === item.value, 'item.categoryName')
if (item.sonCategoryList) {
item.children = renderTreeNodes(item.sonCategoryList)
}
return item
})
return newTreeData
}
getCourseCatalogList()
}, [])
return (
<TreeSelect
treeNodeLabelProp='categoryName'
showSearch={showSearch}
treeNodeFilterProp={treeNodeFilterProp}
style={style}
value={value}
dropdownStyle={dropdownStyle}
treeData={courseCatalogList}
placeholder={placeholder}
allowClear={allowClear}
treeDefaultExpandAll
onChange={(value, label) => {
onChange(value, label)
}}
/>
)
}
export default CourseCatalogSelect
export { default as RangePicker } from './DateRangePicker'
export { default as CourseCatalogSelect } from './CourseCatalogSelect'
...@@ -6,25 +6,21 @@ ...@@ -6,25 +6,21 @@
* @Description: 新建/编辑直播课-基本信息 * @Description: 新建/编辑直播课-基本信息
*/ */
import React from 'react'; import React from 'react'
import { Input, Button, message, Cascader, Modal } from 'antd'; import { Input, Button, message, Cascader } from 'antd'
import UploadOss from '@/core/upload'; import { CourseCatalogSelect } from '@/modules/common'
import { ImgCutModalNew } from '@/components'; import StoreService from '@/domains/store-domain/storeService'
import StoreService from '@/domains/store-domain/storeService'; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'
import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'; import Upload from '@/core/upload'
import Upload from '@/core/upload';
import Cropper from 'react-cropper';
import ImgClipModal from '@/components/ImgClipModal' import ImgClipModal from '@/components/ImgClipModal'
import 'cropperjs/dist/cropper.css'; import 'cropperjs/dist/cropper.css'
import './AddLiveBasic.less'; import './AddLiveBasic.less'
const defaultCover = 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'; const defaultCover = 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }; const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }
let cutFlag = false;
let timer = null;
class AddLiveBasic extends React.Component { class AddLiveBasic extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
imageFile: null, imageFile: null,
showCutModal: false, showCutModal: false,
...@@ -32,63 +28,50 @@ class AddLiveBasic extends React.Component { ...@@ -32,63 +28,50 @@ class AddLiveBasic extends React.Component {
showSelectFileModal: false, showSelectFileModal: false,
cutImageBlob: null, cutImageBlob: null,
hasImgReady: false, // 图片是否上传成功 hasImgReady: false, // 图片是否上传成功
cropperInstace:null cropperInstace: null,
} }
} }
componentWillUnmount() {} componentWillUnmount() {}
componentDidMount() { componentDidMount() {
this.getCourseCatalogList(); this.getCourseCatalogList()
} }
getCourseCatalogList = () => { getCourseCatalogList = () => {
StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => { StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => {
this.setState({ this.setState({
courseCatalogList: res.result.records, courseCatalogList: res.result.records,
}); })
}); })
} }
// 使用默认封面图 // 使用默认封面图
handleResetCoverUrl = () => { handleResetCoverUrl = () => {
const { const {
data: { coverUrl }, data: { coverUrl },
} = this.props; } = this.props
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover
// 如果已经是默认图的话,不做任何任何处理 // 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return; if (isDefaultCover) return
message.success('已替换为默认图'); message.success('已替换为默认图')
this.props.onChange('coverUrl', defaultCover); this.props.onChange('coverUrl', defaultCover)
setTimeout(() => { setTimeout(() => {
this.props.onChange('coverId', null); this.props.onChange('coverId', null)
}, 1000); }, 1000)
}; }
catalogChange = (value) => { handleChangeCatalogList = (value) => {
const changeValueLength = value.length; this.props.onChange('categoryId', value)
switch (changeValueLength) {
case 1:
this.props.onChange('categoryId', value[0]);
break;
case 2:
this.props.onChange('categoryId', value[1]);
break;
default:
this.props.onChange('categoryId', null);
break;
} }
};
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.setState({ this.setState({
visible: true, visible: true,
imageFile:file imageFile: file,
}); })
} }
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob) => {
const { choosedBannerId } = this.state;
Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => { Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
this.setState( this.setState(
{ {
...@@ -97,26 +80,25 @@ class AddLiveBasic extends React.Component { ...@@ -97,26 +80,25 @@ class AddLiveBasic extends React.Component {
visible: false, visible: false,
}, },
() => this.updateCover() () => this.updateCover()
); )
}); })
}; }
updateCover = () =>{ updateCover = () => {
const {coverClicpPath,coverId} = this.state const { coverClicpPath, coverId } = this.state
this.setState({ this.setState({
showSelectFileModal: false, showSelectFileModal: false,
}); })
this.props.onChange('coverUrl', coverClicpPath); this.props.onChange('coverUrl', coverClicpPath)
setTimeout(() => { setTimeout(() => {
this.props.onChange('coverId', coverId); this.props.onChange('coverId', coverId)
}, 1000); }, 1000)
}; }
render() { render() {
const { showCutModal, imageFile, courseCatalogList, showSelectFileModal, visible, cutImageBlob, hasImgReady } = this.state; const { imageFile, showSelectFileModal, visible } = this.state
const { data, pageType, isEdit } = this.props; const { data } = this.props
const { courseName, categoryName, coverUrl } = data; const { courseName, coverUrl, categoryId } = data
const fileName = '';
// 当前是否使用的是默认图片 // 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover
return ( return (
<div className='add-live__basic-info'> <div className='add-live__basic-info'>
<div className='course-name'> <div className='course-name'>
...@@ -129,7 +111,7 @@ class AddLiveBasic extends React.Component { ...@@ -129,7 +111,7 @@ class AddLiveBasic extends React.Component {
maxLength={40} maxLength={40}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e) => { onChange={(e) => {
this.props.onChange('courseName', e.target.value); this.props.onChange('courseName', e.target.value)
}} }}
/> />
</div> </div>
...@@ -142,7 +124,7 @@ class AddLiveBasic extends React.Component { ...@@ -142,7 +124,7 @@ class AddLiveBasic extends React.Component {
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
}); })
}}> }}>
上传图片 上传图片
</Button> </Button>
...@@ -161,40 +143,14 @@ class AddLiveBasic extends React.Component { ...@@ -161,40 +143,14 @@ class AddLiveBasic extends React.Component {
<span className='label'> <span className='label'>
<span className='require'>*</span>课程分类: <span className='require'>*</span>课程分类:
</span> </span>
{pageType === 'add' && ( <CourseCatalogSelect
<Cascader value={categoryId}
options={courseCatalogList} onChange={(value, label) => {
displayRender={(label) => label.join('-')} this.handleChangeCatalogList(value, label)
fieldNames={fieldNames} }}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder='请选择课程分类'
suffixIcon={
<span className='icon iconfont' style={{ fontSize: '12px', color: '#BFBFBF' }}>
&#xe835;
</span>
}
/>
)}
{pageType === 'edit' && categoryName && (
<Cascader
disabled={!isEdit ? true : false}
defaultValue={[categoryName]}
options={courseCatalogList}
displayRender={(label) => label.join('-')}
fieldNames={fieldNames}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder='请选择课程分类'
suffixIcon={
<span className='icon iconfont' style={{ fontSize: '12px', color: '#BFBFBF' }}>
&#xe835;
</span>
}
/> />
)}
</div> </div>
{showSelectFileModal && {showSelectFileModal && (
<SelectPrepareFileModal <SelectPrepareFileModal
key='basic' key='basic'
operateType='select' operateType='select'
...@@ -204,17 +160,24 @@ class AddLiveBasic extends React.Component { ...@@ -204,17 +160,24 @@ class AddLiveBasic extends React.Component {
tooltip='支持文件类型:jpg、jpeg、png' tooltip='支持文件类型:jpg、jpeg、png'
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }); this.setState({ showSelectFileModal: false })
}} }}
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
} )}
{ visible && {visible && (
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/> <ImgClipModal
} visible={visible}
imgUrl={imageFile.ossUrl}
onConfirm={this.getSignature}
onClose={() => {
this.setState({ visible: false })
}}
/>
)}
</div> </div>
); )
} }
} }
export default AddLiveBasic; export default AddLiveBasic
...@@ -6,25 +6,25 @@ ...@@ -6,25 +6,25 @@
* @Description: 大班直播、互动班课的直播课列表 * @Description: 大班直播、互动班课的直播课列表
*/ */
import User from '@/common/js/user'; import User from '@/common/js/user'
import college from '@/common/lottie/college'; import college from '@/common/lottie/college'
import { PageControl, XMTable } from '@/components'; import { PageControl, XMTable } from '@/components'
import DownloadLiveModal from '@/components/DownloadLiveModal'; import DownloadLiveModal from '@/components/DownloadLiveModal'
import BaseService from '@/domains/basic-domain/baseService'; import BaseService from '@/domains/basic-domain/baseService'
import { LIVE_SHARE } from '@/domains/course-domain/constants'; import { LIVE_SHARE } from '@/domains/course-domain/constants'
import CourseService from '@/domains/course-domain/CourseService'; import CourseService from '@/domains/course-domain/CourseService'
import { QuestionCircleOutlined } from '@ant-design/icons'; import { QuestionCircleOutlined } from '@ant-design/icons'
import { Dropdown, message, Modal, Switch, Tooltip } from 'antd'; import { Dropdown, message, Modal, Switch, Tooltip } from 'antd'
import React from 'react'; import React from 'react'
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom'
import _ from 'underscore'; import _ from 'underscore'
import DataList from '../DataList/DataList'; import DataList from '../DataList/DataList'
import ManageCoursewareModal from '../modal/ManageCoursewareModal'; import ManageCoursewareModal from '../modal/ManageCoursewareModal'
import RelatedPlanModal from '../modal/RelatedPlanModal'; import RelatedPlanModal from '../modal/RelatedPlanModal'
import ShareLiveModal from '../modal/ShareLiveModal'; import ShareLiveModal from '../modal/ShareLiveModal'
import './LiveCourseList.less'; import './LiveCourseList.less'
const { confirm } = Modal; const { confirm } = Modal
const courseStateShow = { const courseStateShow = {
UN_START: { UN_START: {
code: 1, code: 1,
...@@ -46,33 +46,33 @@ const courseStateShow = { ...@@ -46,33 +46,33 @@ const courseStateShow = {
title: '未成功开课', title: '未成功开课',
color: '#999', color: '#999',
}, },
}; }
class LiveCourseList extends React.Component { class LiveCourseList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
columns: [], columns: [],
openDownloadModal: false, openDownloadModal: false,
url: '', url: '',
RelatedPlanModalVisible: false, RelatedPlanModalVisible: false,
selectPlanList: {}, selectPlanList: {},
}; }
} }
componentWillMount() { componentWillMount() {
this.parseColumns(); this.parseColumns()
} }
componentDidMount() { componentDidMount() {
this.getDownloadVersion(); this.getDownloadVersion()
} }
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (item, needStr = false) => { handleShowShareModal = (item, needStr = false) => {
const { liveCourseId } = item; const { liveCourseId } = item
const htmlUrl = `${LIVE_SHARE}live_detail/${liveCourseId}?id=${User.getStoreId()}`; const htmlUrl = `${LIVE_SHARE}live_detail/${liveCourseId}?id=${User.getStoreId()}`
const longUrl = htmlUrl; const longUrl = htmlUrl
console.log('htmlUrl', htmlUrl, longUrl); console.log('htmlUrl', htmlUrl, longUrl)
const shareData = { ...item, longUrl }; const shareData = { ...item, longUrl }
const shareLiveModal = ( const shareLiveModal = (
<ShareLiveModal <ShareLiveModal
needStr={needStr} needStr={needStr}
...@@ -82,45 +82,45 @@ class LiveCourseList extends React.Component { ...@@ -82,45 +82,45 @@ class LiveCourseList extends React.Component {
close={() => { close={() => {
this.setState({ this.setState({
shareLiveModal: null, shareLiveModal: null,
}); })
localStorage.setItem('largeLiveCourseItem', ''); localStorage.setItem('largeLiveCourseItem', '')
}} }}
/> />
); )
this.setState({ shareLiveModal }); this.setState({ shareLiveModal })
}; }
//改变上架状态 //改变上架状态
changeShelfState = (index, item, checked) => { changeShelfState = (index, item, checked) => {
let _shelfState = checked ? 'YES' : 'NO'; let _shelfState = checked ? 'YES' : 'NO'
const params = { const params = {
liveCourseId: item.liveCourseId, liveCourseId: item.liveCourseId,
shelfState: _shelfState, shelfState: _shelfState,
}; }
CourseService.turnOnOrOffLiveCloudCourse(params).then((res) => { CourseService.turnOnOrOffLiveCloudCourse(params).then((res) => {
if (res.success) { if (res.success) {
if (_shelfState === 'YES') { if (_shelfState === 'YES') {
message.success('已开启展示'); message.success('已开启展示')
} else { } else {
message.success('已取消展示'); message.success('已取消展示')
}
this.props.changeShelfState(index, _shelfState)
} }
this.props.changeShelfState(index, _shelfState); })
} }
});
};
// 前往上课数据页面 // 前往上课数据页面
handleLinkToClassData = (item) => { handleLinkToClassData = (item) => {
const { match } = this.props; const { match } = this.props
window.RCHistory.push({ window.RCHistory.push({
pathname: `${match.url}/live-course-data?type=large&id=${item.liveCourseId}`, pathname: `${match.url}/live-course-data?type=large&id=${item.liveCourseId}`,
}); })
}; }
parseColumns = () => { parseColumns = () => {
let columns; let columns
const userRole = User.getUserRole(); const userRole = User.getUserRole()
if (userRole !== 'CloudLecturer') { if (userRole !== 'CloudLecturer') {
columns = [ columns = [
{ {
...@@ -130,15 +130,15 @@ class LiveCourseList extends React.Component { ...@@ -130,15 +130,15 @@ class LiveCourseList extends React.Component {
fixed: 'left', fixed: 'left',
dataIndex: 'courseName', dataIndex: 'courseName',
render: (val, record) => { render: (val, record) => {
let hasCover = false; let hasCover = false
return ( return (
<div className='record__item'> <div className='record__item'>
{record.courseMediaVOS.map((item, index) => { {record.courseMediaVOS.map((item, index) => {
if (item.contentType === 'COVER') { if (item.contentType === 'COVER') {
hasCover = true; hasCover = true
return <img key={item.mediaContent + index} className='course-cover' src={item.mediaUrl} alt='' />; return <img key={item.mediaContent + index} className='course-cover' src={item.mediaUrl} alt='' />
} else { } else {
return null; return null
} }
})} })}
{!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'} alt='' />} {!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'} alt='' />}
...@@ -189,7 +189,7 @@ class LiveCourseList extends React.Component { ...@@ -189,7 +189,7 @@ class LiveCourseList extends React.Component {
<span key={item.adminId + index}> <span key={item.adminId + index}>
{item.adminName} {index < record.admins.length - 1 && <span></span>}{' '} {item.adminName} {index < record.admins.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</span> </span>
</Tooltip> </Tooltip>
...@@ -202,7 +202,7 @@ class LiveCourseList extends React.Component { ...@@ -202,7 +202,7 @@ class LiveCourseList extends React.Component {
<span> <span>
{item.adminName} {index < record.admins.length - 1 && <span></span>}{' '} {item.adminName} {index < record.admins.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</span> </span>
</Otherwise> </Otherwise>
...@@ -211,7 +211,7 @@ class LiveCourseList extends React.Component { ...@@ -211,7 +211,7 @@ class LiveCourseList extends React.Component {
</div> </div>
</div> </div>
</div> </div>
); )
}, },
}, },
{ {
...@@ -220,7 +220,7 @@ class LiveCourseList extends React.Component { ...@@ -220,7 +220,7 @@ class LiveCourseList extends React.Component {
key: 'couseCatalog', key: 'couseCatalog',
dataIndex: 'couseCatalog', dataIndex: 'couseCatalog',
render: (val, item) => { render: (val, item) => {
return <div className='categoryName'>{item.categoryName}</div>; return <div className='categoryName'>{item.categorySonName}</div>
}, },
}, },
{ {
...@@ -236,11 +236,11 @@ class LiveCourseList extends React.Component { ...@@ -236,11 +236,11 @@ class LiveCourseList extends React.Component {
this.setState({ this.setState({
editData: item, editData: item,
openCoursewareModal: true, openCoursewareModal: true,
}); })
}}> }}>
{item.courseDocumentCount} {item.courseDocumentCount}
</span> </span>
); )
}, },
}, },
{ {
...@@ -253,11 +253,11 @@ class LiveCourseList extends React.Component { ...@@ -253,11 +253,11 @@ class LiveCourseList extends React.Component {
<span <span
className='iconfont icon quota-icon' className='iconfont icon quota-icon'
onClick={() => { onClick={() => {
this.handleLinkToClassData(item); this.handleLinkToClassData(item)
}}> }}>
&#xe7d6; &#xe7d6;
</span> </span>
); )
}, },
}, },
{ {
...@@ -289,7 +289,7 @@ class LiveCourseList extends React.Component { ...@@ -289,7 +289,7 @@ class LiveCourseList extends React.Component {
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)}
/> />
); )
}, },
}, },
{ {
...@@ -300,7 +300,7 @@ class LiveCourseList extends React.Component { ...@@ -300,7 +300,7 @@ class LiveCourseList extends React.Component {
sorter: true, sorter: true,
render: (val, item) => { render: (val, item) => {
// -29000:与后端约定 在初始化学院时,创建时间(标志位-29000)默认展示为'-' // -29000:与后端约定 在初始化学院时,创建时间(标志位-29000)默认展示为'-'
return <span style={{ whiteSpace: 'nowrap' }}>{val === -29000 ? '-' : window.formatDate('YYYY-MM-DD H:i', val)}</span>; return <span style={{ whiteSpace: 'nowrap' }}>{val === -29000 ? '-' : window.formatDate('YYYY-MM-DD H:i', val)}</span>
}, },
}, },
{ {
...@@ -319,7 +319,7 @@ class LiveCourseList extends React.Component { ...@@ -319,7 +319,7 @@ class LiveCourseList extends React.Component {
<span> <span>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '} {item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</Tooltip> </Tooltip>
</When> </When>
...@@ -328,7 +328,7 @@ class LiveCourseList extends React.Component { ...@@ -328,7 +328,7 @@ class LiveCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
); )
}, },
}, },
{ {
...@@ -347,7 +347,7 @@ class LiveCourseList extends React.Component { ...@@ -347,7 +347,7 @@ class LiveCourseList extends React.Component {
key='enter_live_room1' key='enter_live_room1'
className='operate__item' className='operate__item'
onClick={() => { onClick={() => {
this.handleEnterLiveRoom(item); this.handleEnterLiveRoom(item)
}}> }}>
进入直播间 进入直播间
</div> </div>
...@@ -363,7 +363,7 @@ class LiveCourseList extends React.Component { ...@@ -363,7 +363,7 @@ class LiveCourseList extends React.Component {
key='view_play_back' key='view_play_back'
className='operate__item' className='operate__item'
onClick={() => { onClick={() => {
this.handleViewPlayBack(item); this.handleViewPlayBack(item)
}}> }}>
查看回放 查看回放
</div> </div>
...@@ -379,7 +379,7 @@ class LiveCourseList extends React.Component { ...@@ -379,7 +379,7 @@ class LiveCourseList extends React.Component {
key='share' key='share'
className='operate__item' className='operate__item'
onClick={() => { onClick={() => {
this.handleShowShareModal(item); this.handleShowShareModal(item)
}}> }}>
分享 分享
</div> </div>
...@@ -409,10 +409,10 @@ class LiveCourseList extends React.Component { ...@@ -409,10 +409,10 @@ class LiveCourseList extends React.Component {
</div> </div>
)} )}
</div> </div>
); )
}, },
}, },
]; ]
} else { } else {
columns = [ columns = [
{ {
...@@ -421,13 +421,13 @@ class LiveCourseList extends React.Component { ...@@ -421,13 +421,13 @@ class LiveCourseList extends React.Component {
key: 'course', key: 'course',
dataIndex: 'courseName', dataIndex: 'courseName',
render: (val, record) => { render: (val, record) => {
let hasCover = false; let hasCover = false
return ( return (
<div className='record__item'> <div className='record__item'>
{record.courseMediaVOS.map((item, index) => { {record.courseMediaVOS.map((item, index) => {
if (item.contentType === 'COVER') { if (item.contentType === 'COVER') {
hasCover = true; hasCover = true
return <img className='course-cover' src={item.mediaUrl} alt='' />; return <img className='course-cover' src={item.mediaUrl} alt='' />
} }
})} })}
{!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'} alt='' />} {!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'} alt='' />}
...@@ -477,7 +477,7 @@ class LiveCourseList extends React.Component { ...@@ -477,7 +477,7 @@ class LiveCourseList extends React.Component {
<span> <span>
{item.adminName} {index < record.admins.length - 1 && <span></span>}{' '} {item.adminName} {index < record.admins.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</span> </span>
</Tooltip> </Tooltip>
...@@ -490,7 +490,7 @@ class LiveCourseList extends React.Component { ...@@ -490,7 +490,7 @@ class LiveCourseList extends React.Component {
<span> <span>
{item.adminName} {index < record.admins.length - 1 && <span></span>}{' '} {item.adminName} {index < record.admins.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</span> </span>
</Otherwise> </Otherwise>
...@@ -499,7 +499,7 @@ class LiveCourseList extends React.Component { ...@@ -499,7 +499,7 @@ class LiveCourseList extends React.Component {
</div> </div>
</div> </div>
</div> </div>
); )
}, },
}, },
{ {
...@@ -508,7 +508,7 @@ class LiveCourseList extends React.Component { ...@@ -508,7 +508,7 @@ class LiveCourseList extends React.Component {
key: 'couseCatalog', key: 'couseCatalog',
dataIndex: 'couseCatalog', dataIndex: 'couseCatalog',
render: (val, item) => { render: (val, item) => {
return <div className='categoryName'>{item.categoryName}</div>; return <div className='categoryName'>{item.categorySonName}</div>
}, },
}, },
{ {
...@@ -524,11 +524,11 @@ class LiveCourseList extends React.Component { ...@@ -524,11 +524,11 @@ class LiveCourseList extends React.Component {
this.setState({ this.setState({
editData: item, editData: item,
openCoursewareModal: true, openCoursewareModal: true,
}); })
}}> }}>
{item.courseDocumentCount} {item.courseDocumentCount}
</span> </span>
); )
}, },
}, },
{ {
...@@ -541,11 +541,11 @@ class LiveCourseList extends React.Component { ...@@ -541,11 +541,11 @@ class LiveCourseList extends React.Component {
<span <span
className='iconfont icon quota-icon' className='iconfont icon quota-icon'
onClick={() => { onClick={() => {
this.handleLinkToClassData(item); this.handleLinkToClassData(item)
}}> }}>
&#xe7d6; &#xe7d6;
</span> </span>
); )
}, },
}, },
{ {
...@@ -555,7 +555,7 @@ class LiveCourseList extends React.Component { ...@@ -555,7 +555,7 @@ class LiveCourseList extends React.Component {
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val, item) => { render: (val, item) => {
return <span>{window.formatDate('YYYY-MM-DD H:i', val)}</span>; return <span>{window.formatDate('YYYY-MM-DD H:i', val)}</span>
}, },
}, },
{ {
...@@ -574,7 +574,7 @@ class LiveCourseList extends React.Component { ...@@ -574,7 +574,7 @@ class LiveCourseList extends React.Component {
<span> <span>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '} {item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span> </span>
); )
})} })}
</Tooltip> </Tooltip>
</When> </When>
...@@ -583,36 +583,36 @@ class LiveCourseList extends React.Component { ...@@ -583,36 +583,36 @@ class LiveCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
); )
}, },
}, },
]; ]
}
this.setState({ columns })
} }
this.setState({ columns });
};
handleAdminName = (adminArray) => { handleAdminName = (adminArray) => {
let adminStr = ''; let adminStr = ''
adminArray.forEach((item, index) => { adminArray.forEach((item, index) => {
if (index < adminArray.length - 1) { if (index < adminArray.length - 1) {
adminStr = adminStr + item.adminName + '、'; adminStr = adminStr + item.adminName + '、'
} else { } else {
adminStr = adminStr + item.adminName; adminStr = adminStr + item.adminName
}
})
return adminStr
} }
});
return adminStr;
};
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;
};
renderMoreOperate = (item) => { renderMoreOperate = (item) => {
return ( return (
...@@ -631,8 +631,8 @@ class LiveCourseList extends React.Component { ...@@ -631,8 +631,8 @@ class LiveCourseList extends React.Component {
</div> </div>
)} )}
</div> </div>
); )
}; }
handleDelete = (record) => { handleDelete = (record) => {
return confirm({ return confirm({
title: '你确定要删除直播课?', title: '你确定要删除直播课?',
...@@ -644,29 +644,29 @@ class LiveCourseList extends React.Component { ...@@ -644,29 +644,29 @@ class LiveCourseList extends React.Component {
width: 440, width: 440,
height: 188, height: 188,
onOk: () => { onOk: () => {
this.deleteConfirm(record); this.deleteConfirm(record)
}, },
}); })
}; }
deleteConfirm = (item) => { deleteConfirm = (item) => {
const params = { const params = {
liveCourseId: item.liveCourseId, liveCourseId: item.liveCourseId,
}; }
CourseService.delLiveCloudCourse(params).then((res) => { CourseService.delLiveCloudCourse(params).then((res) => {
if (res.success) { if (res.success) {
message.success('已删除'); message.success('已删除')
this.props.onChange(); this.props.onChange()
}
})
} }
});
};
toEditCoursePage = (item) => { toEditCoursePage = (item) => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/create-live-course?type=edit&id=${item.liveCourseId}`, pathname: `/create-live-course?type=edit&id=${item.liveCourseId}`,
}); })
}; }
refreshCourseList = () => { refreshCourseList = () => {
this.props.onChange(this.props.query); this.props.onChange(this.props.query)
}; }
//进入直播间 //进入直播间
handleEnterLiveRoom = (item) => { handleEnterLiveRoom = (item) => {
if (item.startTime - Date.now() > 1800000) { if (item.startTime - Date.now() > 1800000) {
...@@ -679,124 +679,124 @@ class LiveCourseList extends React.Component { ...@@ -679,124 +679,124 @@ class LiveCourseList extends React.Component {
&#xe834; &#xe834;
</span> </span>
), ),
}); })
} else { } else {
CourseService.getLiveCloudCourseDetail({ CourseService.getLiveCloudCourseDetail({
liveCourseId: item.liveCourseId, liveCourseId: item.liveCourseId,
}).then((res) => { }).then((res) => {
const url = `xmqx://liveCourseId=${item.liveCourseId}`; const url = `xmqx://liveCourseId=${item.liveCourseId}`
if (res.result.courseState === 'FINISH') { if (res.result.courseState === 'FINISH') {
Modal.warning({ Modal.warning({
title: '刷新页面', title: '刷新页面',
icon: <QuestionCircleOutlined />, icon: <QuestionCircleOutlined />,
content: '课次已结束,请刷新一下', content: '课次已结束,请刷新一下',
onOk: () => { onOk: () => {
this.refreshCourseList(); this.refreshCourseList()
}, },
}); })
} else { } else {
this.setState({ url, openDownloadModal: true }); this.setState({ url, openDownloadModal: true })
}
})
} }
});
} }
};
onShowSizeChange = (current, size) => { onShowSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return; return
}
let _query = this.props.query
_query.size = size
this.props.onChange(_query)
} }
let _query = this.props.query;
_query.size = size;
this.props.onChange(_query);
};
getDownloadVersion() { getDownloadVersion() {
const isMac = /macintosh|mac os x/i.test(navigator.userAgent); const isMac = /macintosh|mac os x/i.test(navigator.userAgent)
// 判断学员系统 // 判断学员系统
let platform; let platform
if (!isMac) { if (!isMac) {
platform = 1; platform = 1
} else { } else {
platform = 4; platform = 4
} }
BaseService.getLastedVersion({ model: 5, platform }).then((res) => { BaseService.getLastedVersion({ model: 5, platform }).then((res) => {
const { result = {} } = res; const { result = {} } = res
this.setState({ downloadUrl: result.releaseUrl }); this.setState({ downloadUrl: result.releaseUrl })
}); })
} }
handleViewPlayBack = (item) => { handleViewPlayBack = (item) => {
let htmlUrl; let htmlUrl
if (item.teacherId === User.getUserId()) { if (item.teacherId === User.getUserId()) {
htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?teacherId=${User.getUserId()}&id=${User.getStoreId()}`; htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?teacherId=${User.getUserId()}&id=${User.getStoreId()}`
} else if (_.pluck(item.admins, 'adminId').includes(User.getUserId())) { } else if (_.pluck(item.admins, 'adminId').includes(User.getUserId())) {
htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?userId=${User.getUserId()}&id=${User.getStoreId()}`; htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?userId=${User.getUserId()}&id=${User.getStoreId()}`
} else { } else {
htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?id=${User.getStoreId()}`; htmlUrl = `${LIVE_SHARE}replay/${item.liveCourseId}?id=${User.getStoreId()}`
}
window.open(htmlUrl)
} }
window.open(htmlUrl);
};
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.liveCourseId, selectCourseId: item.liveCourseId,
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()
}
)
} }
);
};
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 _columnKey; let _columnKey
let _order; let _order
// 按创建时间升序排序 // 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') { if (columnKey === 'created' && order === 'ascend') {
_columnKey = 'CREATED'; _columnKey = 'CREATED'
_order = 'SORT_ASC'; _order = 'SORT_ASC'
} }
// 按创建时间降序排序 // 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') { if (columnKey === 'created' && order === 'descend') {
_columnKey = 'CREATED'; _columnKey = 'CREATED'
_order = 'SORT_DESC'; _order = 'SORT_DESC'
} }
const _query = { const _query = {
...query, ...query,
sortMap: {}, sortMap: {},
}; }
_query.sortMap[_columnKey] = _order; _query.sortMap[_columnKey] = _order
this.props.onChange(_query); this.props.onChange(_query)
}; }
render() { render() {
const { total, query, courseList, loading } = this.props; const { total, query, courseList, loading } = this.props
const { current, size } = query; const { current, size } = query
const { openDownloadModal, downloadUrl, url, columns, openCoursewareModal, editData, RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state; const { openDownloadModal, downloadUrl, url, columns, openCoursewareModal, editData, RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state
const { match } = this.props; const { match } = this.props
return ( return (
<div className='live-course-list'> <div className='live-course-list'>
...@@ -822,8 +822,8 @@ class LiveCourseList extends React.Component { ...@@ -822,8 +822,8 @@ class LiveCourseList extends React.Component {
pageSize={size} pageSize={size}
total={parseInt(total)} total={parseInt(total)}
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 }; const _query = { ...query, current: page + 1 }
this.props.onChange(_query); this.props.onChange(_query)
}} }}
onShowSizeChange={this.onShowSizeChange} onShowSizeChange={this.onShowSizeChange}
/> />
...@@ -834,8 +834,8 @@ class LiveCourseList extends React.Component { ...@@ -834,8 +834,8 @@ class LiveCourseList extends React.Component {
<ManageCoursewareModal <ManageCoursewareModal
data={editData} data={editData}
onCancel={() => { onCancel={() => {
this.props.onChange(); this.props.onChange()
this.setState({ openCoursewareModal: false }); this.setState({ openCoursewareModal: false })
}} }}
/> />
)} )}
...@@ -846,7 +846,7 @@ class LiveCourseList extends React.Component { ...@@ -846,7 +846,7 @@ class LiveCourseList extends React.Component {
this.setState({ this.setState({
url: '', url: '',
openDownloadModal: false, openDownloadModal: false,
}); })
}} }}
/> />
)} )}
...@@ -863,8 +863,8 @@ class LiveCourseList extends React.Component { ...@@ -863,8 +863,8 @@ class LiveCourseList extends React.Component {
<iframe src={url} style={{ display: 'none' }} title='navigation' /> <iframe src={url} style={{ display: 'none' }} title='navigation' />
<Route path={`${match.url}/live-course-data`} component={DataList} /> <Route path={`${match.url}/live-course-data`} component={DataList} />
</div> </div>
); )
} }
} }
export default withRouter(LiveCourseList); export default withRouter(LiveCourseList)
...@@ -7,44 +7,35 @@ ...@@ -7,44 +7,35 @@
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react'; import React from 'react'
import { Button, Input, Radio, message, Modal, Cascader } from 'antd'; import { Button, Input, message, Modal } from 'antd'
import $ from 'jquery'; import $ from 'jquery'
import moment from 'moment'; import moment from 'moment'
import { DISK_MAP, FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum'; import { CourseCatalogSelect } from '@/modules/common'
import { ImgCutModalNew } from '@/components'; import ShowTips from '@/components/ShowTips'
import ShowTips from '@/components/ShowTips'; import Breadcrumbs from '@/components/Breadcrumbs'
import Breadcrumbs from '@/components/Breadcrumbs'; import AddGraphicsIntro from './components/AddGraphicsIntro'
import AddGraphicsIntro from './components/AddGraphicsIntro'; 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 PreviewGraphicsModal from '../modal/PreviewGraphicsModal'
import PreviewGraphicsModal from '../modal/PreviewGraphicsModal'; import Service from '@/common/js/service'
import StoreService from '@/domains/store-domain/storeService'; import { randomString } from '@/domains/basic-domain/utils'
import Service from '@/common/js/service'; import User from '@/common/js/user'
import { randomString } from '@/domains/basic-domain/utils'; import _ from 'underscore'
import User from '@/common/js/user'; import Upload from '@/core/upload'
import _ from 'underscore';
import Upload from '@/core/upload';
import ImgClipModal from '@/components/ImgClipModal' import ImgClipModal from '@/components/ImgClipModal'
import './AddGraphicsCourse.less'; import './AddGraphicsCourse.less'
import Bus from '@/core/bus'; import Bus from '@/core/bus'
const EDIT_BOX_KEY = Math.random();
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' };
//添加课程时课程默认的一些值 //添加课程时课程默认的一些值
const defaultShelfState = 'YES'; const defaultShelfState = 'YES'
const whetherVisitorsJoin = 'NO'; const defaultCover = 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png'
const defaultCover = 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png';
let cutFlag = false;
class AddGraphicsCourse extends React.Component { class AddGraphicsCourse 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->编辑
...@@ -61,103 +52,72 @@ class AddGraphicsCourse extends React.Component { ...@@ -61,103 +52,72 @@ class AddGraphicsCourse extends React.Component {
showCutModal: false, // 是否显示截图弹窗 showCutModal: false, // 是否显示截图弹窗
showSelectVideoModal: false, showSelectVideoModal: false,
studentModal: false, studentModal: false,
categoryName: null, //分类名称 categoryName: '',
courseCatalogList: [], //分类列表
categoryId: null, //分类的Id值 categoryId: null, //分类的Id值
whetherVisitorsJoin: 'NO', // 是否允许游客加入 whetherVisitorsJoin: 'NO', // 是否允许游客加入
}; }
} }
componentWillMount() { componentWillMount() {
const { id, pageType } = this.state; const { id, pageType } = this.state
this.getCourseCatalogList();
if (pageType === 'edit') { if (pageType === 'edit') {
this.handleFetchScheudleDetail(id); this.handleFetchScheudleDetail(id)
} }
Bus.bind('editorLimit', (editorTextLength, editorType) => { Bus.bind('editorLimit', (editorTextLength, editorType) => {
this.setState({ this.setState({
[editorType]: editorTextLength, [editorType]: editorTextLength,
}); })
}); })
} }
initBus = () => { initBus = () => {
Bus.bind('graphicsEditorImage', this.uploadImage); Bus.bind('graphicsEditorImage', this.uploadImage)
Bus.bind('graphicsEditorVideo', this.uploadVideo); Bus.bind('graphicsEditorVideo', this.uploadVideo)
}; }
removeBus = () => { removeBus = () => {
Bus.unbind('graphicsEditorImage', this.uploadImage); Bus.unbind('graphicsEditorImage', this.uploadImage)
Bus.unbind('graphicsEditorVideo', this.uploadVideo); Bus.unbind('graphicsEditorVideo', this.uploadVideo)
}; }
uploadImage = () => { uploadImage = () => {
this.setState({ showSelectImageModal: true }); this.setState({ showSelectImageModal: true })
}; }
uploadVideo = () => { uploadVideo = () => {
this.setState({ showSelectVideoModal: true }); this.setState({ showSelectVideoModal: true })
};
//获取分类列表
getCourseCatalogList = () => {
StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => {
this.setState({
courseCatalogList: res.result.records,
});
});
};
catalogChange = (value, options) => {
const changeValueLength = value.length;
switch (changeValueLength) {
case 1:
this.setState({ categoryId: value[0], categoryName: options[0].categoryName });
break;
case 2:
this.setState({ categoryId: value[1], categoryName: `${options[0].categoryName}-${options[1].categoryName}` });
break;
default:
this.setState({ categoryId: null, categoryName: '' });
break;
} }
};
// 获取图文课详情 // 获取图文课详情
handleFetchScheudleDetail = (courseId) => { handleFetchScheudleDetail = (courseId) => {
Service.Hades('public/hades/mediaCourseDetail', { Service.Hades('public/hades/mediaCourseDetail', {
courseId, courseId,
}).then((res) => { }).then((res) => {
const { result = {} } = res || {}; const { result = {} } = res || {}
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId } = result; const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId } = result
let coverId; let coverId
let coverUrl = this.state.coverUrl; let coverUrl = this.state.coverUrl
let hasIntro = false; let hasIntro = false
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
switch (item.contentType) { switch (item.contentType) {
case 'COVER': case 'COVER':
coverId = item.mediaContent; coverId = item.mediaContent
coverUrl = item.mediaUrl; coverUrl = item.mediaUrl
break; break
case 'SCHEDULE': case 'SCHEDULE':
this.getTextDetail('courseMedia', item.mediaUrl); this.getTextDetail('courseMedia', item.mediaUrl)
break; break
case 'INTRO': case 'INTRO':
hasIntro = true; hasIntro = true
this.getTextDetail('introduce', item.mediaUrl); this.getTextDetail('introduce', item.mediaUrl)
break; break
default: default:
break; break
} }
return item; return item
}); })
let categoryName;
if (categoryTwoName) {
categoryName = `${categoryOneName}-${categoryTwoName}`;
} else {
categoryName = `${categoryOneName}`;
}
this.setState({ this.setState({
loadintroduce: !hasIntro, loadintroduce: !hasIntro,
coverId, coverId,
...@@ -165,11 +125,10 @@ class AddGraphicsCourse extends React.Component { ...@@ -165,11 +125,10 @@ class AddGraphicsCourse extends React.Component {
courseName, courseName,
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
categoryName,
categoryId, categoryId,
}); })
}); })
}; }
getTextDetail = (key, url) => { getTextDetail = (key, url) => {
$.ajax({ $.ajax({
...@@ -178,13 +137,13 @@ class AddGraphicsCourse extends React.Component { ...@@ -178,13 +137,13 @@ class AddGraphicsCourse extends React.Component {
url, url,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8', contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => { success: (res) => {
this.setState({ [key]: res, [`load${key}`]: true }); this.setState({ [key]: res, [`load${key}`]: true })
}, },
}); })
}; }
handleGoBack = () => { handleGoBack = () => {
const { coverId, videoName, videoDuration, courseName, courseMediaId, categoryId, shelfState, whetherVisitorsJoin } = this.state; const { coverId, videoName, videoDuration, courseName, courseMediaId, categoryId, shelfState, whetherVisitorsJoin } = this.state
if ( if (
videoName || videoName ||
videoDuration || videoDuration ||
...@@ -204,32 +163,28 @@ class AddGraphicsCourse extends React.Component { ...@@ -204,32 +163,28 @@ class AddGraphicsCourse extends React.Component {
onOk: () => { onOk: () => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/graphics-course`,
}); })
}, },
}); })
} else { } else {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/graphics-course`,
}); })
}
} }
};
// 修改表单 // 修改表单
handleChangeForm = (field, value, coverUrl) => { handleChangeForm = (field, value, coverUrl) => {
this.setState({ this.setState({
[field]: value, [field]: value,
coverUrl: coverUrl ? coverUrl : this.state.coverUrl, coverUrl: coverUrl ? coverUrl : this.state.coverUrl,
}); })
}; }
// 显示选择学员弹窗 // 显示选择学员弹窗
handleShowSelectStuModal = () => { handleShowSelectStuModal = () => {
this.setState({ studentModal: true }); this.setState({ studentModal: true })
const { studentList, selectedStuList } = this.state
const { studentList, selectedStuList } = this.state;
// const _studentList = _.map(studentList, (item) => {
// return item.studentId
// })
const studentModal = ( const studentModal = (
<SelectStudent <SelectStudent
showTabs={true} showTabs={true}
...@@ -240,36 +195,40 @@ class AddGraphicsCourse extends React.Component { ...@@ -240,36 +195,40 @@ class AddGraphicsCourse extends React.Component {
close={() => { close={() => {
this.setState({ this.setState({
studentModal: null, studentModal: null,
}); })
}} }}
/> />
); )
this.setState({ studentModal }); this.setState({ studentModal })
}; }
handleChangeCatalogList = (value, label) => {
this.setState({ categoryId: value, categoryName: label[0] })
}
handleSelectStudent = (studentIds) => { handleSelectStudent = (studentIds) => {
let studentList = []; let studentList = []
_.each(studentIds, (item) => { _.each(studentIds, (item) => {
studentList.push({ studentId: item }); studentList.push({ studentId: item })
}); })
// this.setState({ studentModal: null }); // this.setState({ studentModal: null });
this.setState({ studentList }); this.setState({ studentList })
this.setState({ studentModal: false }); this.setState({ studentModal: false })
}; }
// 显示预览弹窗 // 显示预览弹窗
handleShowPreviewModal = () => { handleShowPreviewModal = () => {
const { coverUrl, courseName, courseMedia, introduce, categoryName } = this.state; const { coverUrl, courseName, courseMedia, introduce, categoryName } = this.state
const courseBasinInfo = { const courseBasinInfo = {
coverUrl, coverUrl,
courseName, courseName,
categoryName, categoryName,
}; }
const courseIntroInfo = { const courseIntroInfo = {
courseMedia, courseMedia,
introduce, introduce,
}; }
const previewGraphicsModal = ( const previewGraphicsModal = (
<PreviewGraphicsModal <PreviewGraphicsModal
courseBasicInfo={courseBasinInfo} courseBasicInfo={courseBasinInfo}
...@@ -277,23 +236,23 @@ class AddGraphicsCourse extends React.Component { ...@@ -277,23 +236,23 @@ class AddGraphicsCourse extends React.Component {
close={() => { close={() => {
this.setState({ this.setState({
previewGraphicsModal: null, previewGraphicsModal: null,
}); })
}} }}
/> />
); )
this.setState({ previewGraphicsModal }); this.setState({ previewGraphicsModal })
}; }
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.setState({ this.setState({
visible: true, visible: true,
imageFile:file imageFile: file,
}); })
}; }
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob) => {
Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => { Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
this.setState( this.setState(
{ {
...@@ -302,18 +261,18 @@ class AddGraphicsCourse extends React.Component { ...@@ -302,18 +261,18 @@ class AddGraphicsCourse extends React.Component {
visible: false, visible: false,
}, },
() => this.updateCover() () => this.updateCover()
); )
}); })
}; }
updateCover = () => { updateCover = () => {
const { coverClicpPath, coverId } = this.state; const { coverClicpPath, coverId } = this.state
this.setState({ this.setState({
showSelectCoverModal: false, showSelectCoverModal: false,
coverUrl: coverClicpPath, coverUrl: coverClicpPath,
coverId: coverId, coverId: coverId,
}); })
}; }
// 保存 // 保存
handleSubmit = () => { handleSubmit = () => {
...@@ -323,10 +282,10 @@ class AddGraphicsCourse extends React.Component { ...@@ -323,10 +282,10 @@ class AddGraphicsCourse extends React.Component {
title: '服务已到期', title: '服务已到期',
content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买', content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买',
okText: '我知道了', okText: '我知道了',
}); })
return; return
} }
const { id, coverId, pageType, courseName, courseMedia, introduce, categoryId, shelfState, whetherVisitorsJoin } = this.state; const { id, coverId, pageType, courseName, courseMedia, introduce, categoryId, shelfState, whetherVisitorsJoin } = this.state
const commonParams = { const commonParams = {
categoryId, categoryId,
...@@ -337,10 +296,10 @@ class AddGraphicsCourse extends React.Component { ...@@ -337,10 +296,10 @@ class AddGraphicsCourse extends React.Component {
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
courseType: 'PICTURE', courseType: 'PICTURE',
}; }
// 校验必填字段:课程名称, 课程图文 // 校验必填字段:课程名称, 课程图文
this.handleValidate(courseName, courseMedia, categoryId).then((res) => { this.handleValidate(courseName, courseMedia, categoryId).then((res) => {
if (!res) return; if (!res) return
Upload.uploadTextToOSS( Upload.uploadTextToOSS(
courseMedia, courseMedia,
`${randomString()}.txt`, `${randomString()}.txt`,
...@@ -355,95 +314,87 @@ class AddGraphicsCourse extends React.Component { ...@@ -355,95 +314,87 @@ class AddGraphicsCourse extends React.Component {
commonParams, commonParams,
courseMediaId, courseMediaId,
introduceId, introduceId,
}); })
}, },
() => message.warning('上传课程简介失败') () => message.warning('上传课程简介失败')
); )
}, },
() => message.warning('上传课程内容失败') () => message.warning('上传课程内容失败')
); )
}); })
}; }
submitRemote = (data) => { submitRemote = (data) => {
const { id, pageType, commonParams, courseMediaId, introduceId } = data; const { id, pageType, commonParams, courseMediaId, introduceId } = data
commonParams.courseMediaId = courseMediaId; commonParams.courseMediaId = courseMediaId
commonParams.introduceId = introduceId; commonParams.introduceId = introduceId
if (pageType === 'add') { if (pageType === 'add') {
Service.Hades('public/hades/createMediaCourse', commonParams).then((res) => { Service.Hades('public/hades/createMediaCourse', commonParams).then((res) => {
if (!res) return; if (!res) return
message.success('新建成功'); message.success('新建成功')
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/graphics-course`,
}); })
}); })
} else { } else {
const editParams = { const editParams = {
courseId: id, courseId: id,
...commonParams, ...commonParams,
}; }
Service.Hades('public/hades/editMediaCourse', editParams).then((res) => { Service.Hades('public/hades/editMediaCourse', editParams).then((res) => {
if (!res) return; if (!res) return
message.success('保存成功'); message.success('保存成功')
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/graphics-course`,
}); })
}); })
}
} }
};
handleValidate = (courseName, courseMedia, categoryId) => { handleValidate = (courseName, courseMedia, categoryId) => {
const { graphicsCourseIntor, graphicsCourseContent } = this.state; const { graphicsCourseIntor, graphicsCourseContent } = this.state
return new Promise((resolve) => { return new Promise((resolve) => {
if (!courseName) { if (!courseName) {
message.warning('请输入课程名称'); message.warning('请输入课程名称')
resolve(false); resolve(false)
return false; return false
} }
if (!courseMedia) { if (!courseMedia) {
message.warning('请输入课程内容'); message.warning('请输入课程内容')
resolve(false); resolve(false)
return false; return false
} }
if (!categoryId) { if (!categoryId) {
message.warning('请选择课程分类'); message.warning('请选择课程分类')
resolve(false); resolve(false)
return false; return false
} }
if (graphicsCourseContent > 1000) { if (graphicsCourseContent > 1000) {
message.warning('课程内容超过字数限定'); message.warning('课程内容超过字数限定')
resolve(false); resolve(false)
return; return
} }
if (graphicsCourseIntor > 1000) { if (graphicsCourseIntor > 1000) {
message.warning('课程简介超过字数限定'); message.warning('课程简介超过字数限定')
resolve(false); resolve(false)
return; return
} }
// const textMedia = scheduleMedia.filter((item) => item.mediaType === 'TEXT'); resolve(true)
// for (let i = 0, len = textMedia.length; i < len; i++) { })
// if (textMedia[i].mediaContentLength && textMedia[i].mediaContentLength.length > 1000) { }
// message.warning(`第${i+1}个文字简介的字数超过了1000个字`);
// resolve(false);
// return false
// }
// }
resolve(true);
});
};
// 使用默认封面图 // 使用默认封面图
handleResetCoverUrl = () => { handleResetCoverUrl = () => {
const { coverUrl } = this.state; const { coverUrl } = this.state
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover
// 如果已经是默认图的话,不做任何任何处理 // 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return; if (isDefaultCover) return
this.setState({ coverUrl: defaultCover, coverId: null }, () => { this.setState({ coverUrl: defaultCover, coverId: null }, () => {
message.success('已替换为默认图'); message.success('已替换为默认图')
}); })
}; }
render() { render() {
const { const {
...@@ -451,29 +402,20 @@ class AddGraphicsCourse extends React.Component { ...@@ -451,29 +402,20 @@ class AddGraphicsCourse extends React.Component {
pageType, pageType,
courseName, courseName,
coverUrl, coverUrl,
studentList,
courseMedia, courseMedia,
introduce, introduce,
showCutModal,
imageFile, imageFile,
videoType,
shelfState, shelfState,
categoryName,
courseCatalogList,
whetherVisitorsJoin, whetherVisitorsJoin,
loadcourseMedia, loadcourseMedia,
loadintroduce, loadintroduce,
showSelectCoverModal, showSelectCoverModal,
visible, visible,
hasImgReady, categoryId,
cutImageBlob, } = this.state
} = this.state;
// 已选择的上课学员数量 // 已选择的上课学员数量
const hasSelectedStu = studentList.length;
const courseWareIcon = FileVerifyMap[videoType] ? FileTypeIcon[FileVerifyMap[videoType].type] : FileTypeIcon[videoType];
// 当前是否使用的是默认图片 // 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover
return ( return (
<div className='page add-graphics-course-page'> <div className='page add-graphics-course-page'>
...@@ -493,34 +435,20 @@ class AddGraphicsCourse extends React.Component { ...@@ -493,34 +435,20 @@ class AddGraphicsCourse extends React.Component {
maxLength={40} maxLength={40}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e) => { onChange={(e) => {
this.handleChangeForm('courseName', e.target.value); this.handleChangeForm('courseName', e.target.value)
}} }}
/> />
</div> </div>
<div className='cover-url flex mt16'> <div className='cover-url flex mt16'>
<div className='label'>封面图:</div> <div className='label'>封面图:</div>
{/* <div className='cover-url__wrap'>
<div className='opt-btns'>
<Button
onClick={() => {
this.setState({
showSelectCoverModal: true,
});
}}>{`${pageType === 'add' && !coverUrl ? '上传' : '修改'}封面`}</Button>
<div className='tips'></div>
</div>
<div className='img-content'>
<img src={coverUrl} />
</div>
</div> */}
<div className='course-cover__wrap'> <div className='course-cover__wrap'>
<div className='opt-btns'> <div className='opt-btns'>
<Button <Button
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectCoverModal: true, showSelectCoverModal: true,
}); })
}}> }}>
上传图片 上传图片
</Button> </Button>
...@@ -537,19 +465,11 @@ class AddGraphicsCourse extends React.Component { ...@@ -537,19 +465,11 @@ class AddGraphicsCourse extends React.Component {
</div> </div>
<div className='course-catalog required'> <div className='course-catalog required'>
<span className='label'>课程分类:</span> <span className='label'>课程分类:</span>
<Cascader <CourseCatalogSelect
value={categoryName ? [categoryName] : undefined} value={categoryId}
options={courseCatalogList} onChange={(value, label) => {
displayRender={(label) => label.join('-')} this.handleChangeCatalogList(value, label)
fieldNames={fieldNames} }}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder='请选择课程分类'
suffixIcon={
<span className='icon iconfont' style={{ fontSize: '12px', color: '#BFBFBF' }}>
&#xe835;
</span>
}
/> />
</div> </div>
<div className='intro-info mt16'> <div className='intro-info mt16'>
...@@ -587,18 +507,25 @@ class AddGraphicsCourse extends React.Component { ...@@ -587,18 +507,25 @@ class AddGraphicsCourse extends React.Component {
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 visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/> <ImgClipModal
} visible={visible}
imgUrl={imageFile.ossUrl}
onConfirm={this.getSignature}
onClose={() => {
this.setState({ visible: false })
}}
/>
)}
{this.state.previewGraphicsModal} {this.state.previewGraphicsModal}
</div> </div>
); )
} }
} }
export default AddGraphicsCourse; export default AddGraphicsCourse
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:12:45
* @LastEditors: wufan
* @LastEditTime: 2021-07-05 10:23:10
* @Description: 线上课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import User from '@/common/js/user'; import User from '@/common/js/user';
import college from '@/common/lottie/college'; import college from '@/common/lottie/college';
import { PageControl, XMTable } from '@/components'; import { PageControl, XMTable } from '@/components';
...@@ -94,12 +101,7 @@ class GraphicsCourseList extends React.Component { ...@@ -94,12 +101,7 @@ class GraphicsCourseList extends React.Component {
dataIndex: 'categoryName', dataIndex: 'categoryName',
width: 120, width: 120,
render: (val, record) => { render: (val, record) => {
return ( return <div className='record__item'>{record.categorySonName}</div>;
<div className='record__item'>
{record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div>
);
}, },
}, },
{ {
...@@ -192,7 +194,7 @@ class GraphicsCourseList extends React.Component { ...@@ -192,7 +194,7 @@ class GraphicsCourseList extends React.Component {
<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> <span key={item.planId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '} {item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span> </span>
); );
...@@ -311,11 +313,6 @@ class GraphicsCourseList extends React.Component { ...@@ -311,11 +313,6 @@ class GraphicsCourseList extends React.Component {
//改变上架状态 //改变上架状态
changeShelfState = (index, item, checked) => { changeShelfState = (index, item, checked) => {
let _shelfState = checked ? 'YES' : 'NO'; let _shelfState = checked ? 'YES' : 'NO';
// if(_shelfState==='NO'){
// _shelfState = "YES";
// }else{
// _shelfState = "NO"
// }
const params = { const params = {
courseId: item.id, courseId: item.id,
shelfState: _shelfState, shelfState: _shelfState,
......
...@@ -6,66 +6,54 @@ ...@@ -6,66 +6,54 @@
* @LastEditTime: 2020-12-22 20:30:54 * @LastEditTime: 2020-12-22 20:30:54
*/ */
import React from 'react' import React from 'react'
import { Modal, Button, Table } from "antd"; import { Modal, Button, Table } from 'antd'
import "./AccountChargeModal"; import './AccountChargeModal'
const data = [ const data = [
{ person: "上台人数1v1", price: "3元/人/小时" }, { person: '上台人数1v1', price: '3元/人/小时' },
{ person: "上台人数1v2", price: "3元/人/小时" }, { person: '上台人数1v2', price: '3元/人/小时' },
{ person: "上台人数1v3", price: "3元/人/小时" }, { person: '上台人数1v3', price: '3元/人/小时' },
{ person: "上台人数1v4", price: "3元/人/小时" }, { person: '上台人数1v4', price: '3元/人/小时' },
{ person: "上台人数1v5", price: "3元/人/小时" }, { person: '上台人数1v5', price: '3元/人/小时' },
{ person: "上台人数1v6", price: "3元/人/小时" }, { person: '上台人数1v6', price: '3元/人/小时' },
{ person: "上台人数1v7", price: "4元/人/小时" }, { person: '上台人数1v7', price: '4元/人/小时' },
{ person: "上台人数1v8", price: "4元/人/小时" }, { person: '上台人数1v8', price: '4元/人/小时' },
{ person: "上台人数1v9", price: "8元/人/小时" }, { person: '上台人数1v9', price: '8元/人/小时' },
{ person: "上台人数1v10", price: "8元/人/小时" }, { person: '上台人数1v10', price: '8元/人/小时' },
{ person: "上台人数1v11", price: "8元/人/小时" }, { person: '上台人数1v11', price: '8元/人/小时' },
{ person: "上台人数1v12", price: "8元/人/小时" }, { person: '上台人数1v12', price: '8元/人/小时' },
]; ]
function ChargeExplainModal(props) { function ChargeExplainModal(props) {
return ( return (
<Modal <Modal
title="计费说明" title='计费说明'
visible={true} visible={true}
className="charge-explain-modal" className='charge-explain-modal'
width={880} width={880}
maskClosable={false} maskClosable={false}
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>} closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>}
onCancel={() => { onCancel={() => {
props.close(); props.close()
}} }}
footer={[ footer={[
<Button <Button
type="primary" type='primary'
onClick={() => { onClick={() => {
props.close(); props.close()
}} }}>
>
关闭 关闭
</Button>, </Button>,
]} ]}>
>
<div> <div>
<div className="explain-title">1)直播课时费</div> <div className='explain-title'>1)直播课时费</div>
<p className="main-explain-block"> <p className='main-explain-block'>每节课上课费用 = 上台人数单价 × 有效出勤学生和老师人数 × 排课时长</p>
每节课上课费用 = 上台人数单价 × 有效出勤学生和老师人数 × 排课时长
</p>
<ul> <ul>
<li> <li>1. 上课老师、学生和助教在教室中的累计时长满10分钟即为有效出勤;</li>
1. 上课老师、学生和助教在教室中的累计时长满10分钟即为有效出勤; <li>2. 排课时长指创建课节设置的课节时长,最小计费单位为0.5小时,不足0.5小时按0.5小时计算;</li>
</li> <li>3. 上台人数单价:以排课时设定的上台人数上限为准,不同直播教室类型的课时单价不同。</li>
<li>
2.
排课时长指创建课节设置的课节时长,最小计费单位为0.5小时,不足0.5小时按0.5小时计算;
</li>
<li>
3.
上台人数单价:以排课时设定的上台人数上限为准,不同直播教室类型的课时单价不同。
</li>
</ul> </ul>
<p className="main-explain-text" style={{marginTop: 16,marginBottom: 8}}> <p className='main-explain-text' style={{ marginTop: 16, marginBottom: 8 }}>
温馨提醒:上台人数1vN,1为授课老师,N为同时与老师视频互动学生数;直播课时费将在老师下课后立即结算。 温馨提醒:上台人数1vN,1为授课老师,N为同时与老师视频互动学生数;直播课时费将在老师下课后立即结算。
</p> </p>
<table style={{ width: 333 }}> <table style={{ width: 333 }}>
...@@ -82,47 +70,43 @@ function ChargeExplainModal(props) { ...@@ -82,47 +70,43 @@ function ChargeExplainModal(props) {
<td>{item.person}</td> <td>{item.person}</td>
<td>{item.price}</td> <td>{item.price}</td>
</tr> </tr>
); )
})} })}
</tbody> </tbody>
</table> </table>
<p className="main-explain-text"> <p className='main-explain-text'>
示例:王老师排了一节45分钟的课程,选择的直播教室类型为5人上台,安排了1位助教、12位学生。那么,排课时长45分钟记为1小时;全员累计在线时长≥10min,老师+助教+学生共计1+1+12=14人;课时单价3元/人/小时。所以,此节课的直播课时费=1x14x3=42元 示例:王老师排了一节45分钟的课程,选择的直播教室类型为5人上台,安排了1位助教、12位学生。那么,排课时长45分钟记为1小时;全员累计在线时长≥10min,老师+助教+学生共计1+1+12=14人;课时单价3元/人/小时。所以,此节课的直播课时费=1x14x3=42元
</p> </p>
<div className="explain-title mt16">2)录制费</div> <div className='explain-title mt16'>2)录制费</div>
<p className="main-explain-block">录制费 = 录课单价 × 回放视频时长</p> <p className='main-explain-block'>录制费 = 录课单价 × 回放视频时长</p>
<ul> <ul>
<li>1. 结算时间:从回放视频生成后立即结算</li> <li>1. 结算时间:从回放视频生成后立即结算</li>
<li> 2. 回放视频时长:0.5h起收,不足0.5h的按0.5h结算</li> <li> 2. 回放视频时长:0.5h起收,不足0.5h的按0.5h结算</li>
<li> 3. 单价:2元/小时</li> <li> 3. 单价:2元/小时</li>
</ul> </ul>
<p className="main-explain-text"> <p className='main-explain-text'>示例:生成了49分26秒的回放视频,不足1h按1h计算,总费用=1(h)*2元/h=2元</p>
示例:生成了49分26秒的回放视频,不足1h按1h计算,总费用=1(h)*2元/h=2元 <div className='explain-title mt16'>3)流量费</div>
</p> <p className='main-explain-block'>观看回放视频流量费 = 流量单价 × 回放流量</p>
<div className="explain-title mt16">3)流量费</div> <p className='main-explain-text'>
<p className="main-explain-block">
观看回放视频流量费 = 流量单价 × 回放流量
</p>
<p className="main-explain-text">
目前收费报价:0元(限时免费) 目前收费报价:0元(限时免费)
<br /> 若后续变更收费,将提前30日通告收费方式及价格标准 <br /> 若后续变更收费,将提前30日通告收费方式及价格标准
</p> </p>
<div className="explain-title mt16">4)存储费</div> <div className='explain-title mt16'>4)存储费</div>
<p className="main-explain-block">存储实际扣费 = 存储单价 × 存储文件大小</p> <p className='main-explain-block'>存储实际扣费 = 存储单价 × 存储文件大小</p>
<p className="main-explain-text"> <p className='main-explain-text'>
目前收费报价:0元(限时免费) 目前收费报价:0元(限时免费)
<br /> <br />
若后续变更收费,将提前30日通告收费方式及价格标准 若后续变更收费,将提前30日通告收费方式及价格标准
</p> </p>
<div className="explain-title mt16">5)其他说明</div> <div className='explain-title mt16'>5)其他说明</div>
<div className="main-explain-text"> <div className='main-explain-text'>
余额不足时将限制使用创建直播课、老师和学生进入直播间、老师和学生观看回放视频、在资料云盘或直播间上传文件等功能,请注意及时充值。(余额<300元时将发送短信提醒,请注意查看。) 余额不足时将限制使用创建直播课、老师和学生进入直播间、老师和学生观看回放视频、在素材库或直播间上传文件等功能,请注意及时充值。(余额<300元时将发送短信提醒,请注意查看。)
</div> </div>
</div> </div>
</Modal> </Modal>
); )
} }
export default ChargeExplainModal; export default ChargeExplainModal
...@@ -3,55 +3,55 @@ ...@@ -3,55 +3,55 @@
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-07-22 18:29:55 * @LastEditTime: 2021-07-22 18:29:55
* @Description: 线下新增/编辑页 * @Description: 线下活动新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react'; import React from 'react'
import { Button, Input, Radio, message, Modal, TreeSelect, Select, Switch, TimePicker, InputNumber, Tooltip } from 'antd'; import { Button, Input, Radio, message, Modal, Select, Switch, TimePicker, InputNumber, Tooltip } from 'antd'
import $ from 'jquery'; import $ from 'jquery'
import RangePicker from '@/modules/common/DateRangePicker'; import { RangePicker, CourseCatalogSelect } from '@/modules/common'
import ShowTips from '@/components/ShowTips'; import ShowTips from '@/components/ShowTips'
import Breadcrumbs from '@/components/Breadcrumbs'; import Breadcrumbs from '@/components/Breadcrumbs'
import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal'; import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal'
import PreviewOfflineModal from './modal/PreviewOfflineModal'; import PreviewOfflineModal from './modal/PreviewOfflineModal'
import StoreService from '@/domains/store-domain/storeService'; import StoreService from '@/domains/store-domain/storeService'
import Service from '@/common/js/service'; import Service from '@/common/js/service'
import { randomString } from '@/domains/basic-domain/utils'; import { randomString } from '@/domains/basic-domain/utils'
import User from '@/common/js/user'; import User from '@/common/js/user'
import _ from 'underscore'; import _ from 'underscore'
import moment from 'moment'; import moment from 'moment'
import Upload from '@/core/upload'; import Upload from '@/core/upload'
import GraphicsEditor from '../components/GraphicsEditor'; import GraphicsEditor from '../components/GraphicsEditor'
import MultipleDatePicker from '@/components/MultipleDatePicker'; import MultipleDatePicker from '@/components/MultipleDatePicker'
import ImgClipModal from '@/components/ImgClipModal'; import ImgClipModal from '@/components/ImgClipModal'
import './AddOfflineCourse.less'; import './AddOfflineCourse.less'
import Bus from '@/core/bus'; import Bus from '@/core/bus'
const { Option } = Select; const { Option } = Select
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'; const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
const unitList = [ const unitList = [
{ key: 'HOUR', value: '小时' }, { key: 'HOUR', value: '小时' },
{ key: 'MINUTE', value: '分钟' }, { key: 'MINUTE', value: '分钟' },
]; ]
class AddOfflineCourse extends React.Component { class AddOfflineCourse extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
const courseId = window.getParameterByName('id'); const courseId = window.getParameterByName('id')
const pageType = window.getParameterByName('type'); const pageType = window.getParameterByName('type')
this.state = { this.state = {
courseId, // 线下ID,编辑的时候从URL上带过来 courseId, // 线下活动ID,编辑的时候从URL上带过来
pageType, // 页面类型: add->新建 edit->编辑 pageType, // 页面类型: add->新建 edit->编辑
imageFile: null, // 需要被截取的图片 imageFile: null, // 需要被截取的图片
courseName: null, // 线下名称 courseName: null, // 线下活动名称
courseMedia: '', courseMedia: '',
introduce: '', introduce: '',
coverId: null, // 线下封面的recourceId coverId: null, // 线下封面的recourceId
coverUrl: defaultCoverUrl, // 线下封面 coverUrl: defaultCoverUrl, // 线下活动封面
studentList: [], // 上课学员列表 studentList: [], // 上课学员列表
diskList: [], // 机构可见磁盘目录 diskList: [], // 机构可见磁盘目录
selectedFileList: [], // 已经从资料云盘中勾选的文件 selectedFileList: [], // 已经从资料云盘中勾选的文件
...@@ -87,74 +87,74 @@ class AddOfflineCourse extends React.Component { ...@@ -87,74 +87,74 @@ class AddOfflineCourse extends React.Component {
isEditDisablie: false, isEditDisablie: false,
startTime: new Date().getTime() + 300000, // 批量开始时分 startTime: new Date().getTime() + 300000, // 批量开始时分
endTime: new Date().getTime() + 300000, // 批量结束时分 endTime: new Date().getTime() + 300000, // 批量结束时分
}; }
} }
componentWillMount() { componentWillMount() {
const { courseId, pageType } = this.state; const { courseId, pageType } = this.state
this.getCourseCatalogList(); this.getCourseCatalogList()
this.getTeacherList(); this.getTeacherList()
if (pageType === 'edit') { if (pageType === 'edit') {
this.handleFetchScheudleDetail(courseId); this.handleFetchScheudleDetail(courseId)
} }
Bus.bind('editorLimit', (editorTextLength) => { Bus.bind('editorLimit', (editorTextLength) => {
this.setState({ this.setState({
editorTextLength, editorTextLength,
}); })
}); })
} }
initBus = () => { initBus = () => {
Bus.bind('offlineEditorImage', this.uploadImage); Bus.bind('offlineEditorImage', this.uploadImage)
}; }
removeBus = () => { removeBus = () => {
Bus.unbind('offlineEditorImage', this.uploadImage); Bus.unbind('offlineEditorImage', this.uploadImage)
}; }
uploadImage = () => { uploadImage = () => {
this.setState({ showSelectImageModal: true }); this.setState({ showSelectImageModal: true })
}; }
//获取分类列表 //获取分类列表
getCourseCatalogList = () => { getCourseCatalogList = () => {
Service.Hades('public/hades/queryCategoryTree', { source: 0, tenantId: User.getStoreId(), count: false, userId: User.getUserId() }).then((res) => { Service.Hades('public/hades/queryCategoryTree', { source: 0, tenantId: User.getStoreId(), count: false, userId: User.getUserId() }).then((res) => {
const { categoryList = [] } = res.result; const { categoryList = [] } = res.result
this.setState({ this.setState({
categoryList, categoryList,
courseCatalogList: this.renderTreeNodes(categoryList), courseCatalogList: this.renderTreeNodes(categoryList),
}); })
}); })
}; }
renderTreeNodes = (data) => { renderTreeNodes = (data) => {
let newTreeData = data.map((item) => { let newTreeData = data.map((item) => {
item.title = item.categoryName; item.title = item.categoryName
item.value = item.id; item.value = item.id
item.key = item.id; item.key = item.id
if (item.sonCategoryList) { if (item.sonCategoryList) {
item.children = this.renderTreeNodes(item.sonCategoryList); item.children = this.renderTreeNodes(item.sonCategoryList)
}
return item
})
return newTreeData
} }
return item;
});
return newTreeData;
};
checkDetail = (courseId) => { checkDetail = (courseId) => {
return Service.Hades('public/hades/getOfflineCourseDetail', { return Service.Hades('public/hades/getOfflineCourseDetail', {
courseId, courseId,
}).then((res) => { }).then((res) => {
const { courseState } = res.result; const { courseState } = res.result
return courseState === 'UN_START'; return courseState === 'UN_START'
}); })
}; }
// 获取线下详情 // 获取线下活动详情
handleFetchScheudleDetail = (courseId) => { handleFetchScheudleDetail = (courseId) => {
return Service.Hades('public/hades/getOfflineCourseDetail', { return Service.Hades('public/hades/getOfflineCourseDetail', {
courseId, courseId,
}).then((res) => { }).then((res) => {
const { result = {} } = res || {}; const { result = {} } = res || {}
const { const {
courseName, courseName,
categoryId, categoryId,
...@@ -183,29 +183,29 @@ class AddOfflineCourse extends React.Component { ...@@ -183,29 +183,29 @@ class AddOfflineCourse extends React.Component {
signInType, signInType,
signOutType, signOutType,
whetherHaveApply, whetherHaveApply,
} = result; } = result
let coverId; let coverId
let coverUrl = this.state.coverUrl; let coverUrl = this.state.coverUrl
let hasIntro = false; let hasIntro = false
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
switch (item.contentType) { switch (item.contentType) {
case 'COVER': case 'COVER':
coverId = item.mediaContent; coverId = item.mediaContent
coverUrl = item.mediaUrl; coverUrl = item.mediaUrl
break; break
case 'SCHEDULE': case 'SCHEDULE':
this.getTextDetail('courseMedia', item.mediaUrl); this.getTextDetail('courseMedia', item.mediaUrl)
break; break
case 'INTRO': case 'INTRO':
hasIntro = true; hasIntro = true
this.getTextDetail('introduce', item.mediaUrl); this.getTextDetail('introduce', item.mediaUrl)
break; break
default: default:
break; break
} }
return item; return item
}); })
this.setState({ this.setState({
loadintroduce: !hasIntro, loadintroduce: !hasIntro,
coverId, coverId,
...@@ -237,9 +237,9 @@ class AddOfflineCourse extends React.Component { ...@@ -237,9 +237,9 @@ class AddOfflineCourse extends React.Component {
signInType, signInType,
signOutType, signOutType,
isEditDisablie: whetherHaveApply === 'YES', isEditDisablie: whetherHaveApply === 'YES',
}); })
}); })
}; }
getTextDetail = (key, url) => { getTextDetail = (key, url) => {
$.ajax({ $.ajax({
...@@ -248,13 +248,13 @@ class AddOfflineCourse extends React.Component { ...@@ -248,13 +248,13 @@ class AddOfflineCourse extends React.Component {
url, url,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8', contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => { success: (res) => {
this.setState({ [key]: res, [`load${key}`]: true }); this.setState({ [key]: res, [`load${key}`]: true })
}, },
}); })
}; }
handleGoBack = () => { handleGoBack = () => {
const { coverId, videoName, videoDuration, courseName, categoryId, whetherVisitorsJoin } = this.state; const { coverId, videoName, videoDuration, courseName, categoryId, whetherVisitorsJoin } = this.state
if (videoName || videoDuration || categoryId || courseName || coverId || whetherVisitorsJoin !== whetherVisitorsJoin) { if (videoName || videoDuration || categoryId || courseName || coverId || whetherVisitorsJoin !== whetherVisitorsJoin) {
Modal.confirm({ Modal.confirm({
title: '确认要返回吗?', title: '确认要返回吗?',
...@@ -265,15 +265,15 @@ class AddOfflineCourse extends React.Component { ...@@ -265,15 +265,15 @@ class AddOfflineCourse extends React.Component {
onOk: () => { onOk: () => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/offline-course`, pathname: `/offline-course`,
}); })
}, },
}); })
} else { } else {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/offline-course`, pathname: `/offline-course`,
}); })
}
} }
};
// 显示预览弹窗 // 显示预览弹窗
handleShowPreviewModal = () => { handleShowPreviewModal = () => {
...@@ -299,7 +299,7 @@ class AddOfflineCourse extends React.Component { ...@@ -299,7 +299,7 @@ class AddOfflineCourse extends React.Component {
signOutStartTimeUnit, signOutStartTimeUnit,
signOutEndTimeNum, signOutEndTimeNum,
signOutEndTimeUnit, signOutEndTimeUnit,
} = this.state; } = this.state
const data = { const data = {
coverUrl, coverUrl,
...@@ -323,27 +323,27 @@ class AddOfflineCourse extends React.Component { ...@@ -323,27 +323,27 @@ class AddOfflineCourse extends React.Component {
signOutStartTimeUnit, signOutStartTimeUnit,
signOutEndTimeNum, signOutEndTimeNum,
signOutEndTimeUnit, signOutEndTimeUnit,
}; }
const previewOfflineModal = ( const previewOfflineModal = (
<PreviewOfflineModal <PreviewOfflineModal
data={data} data={data}
close={() => { close={() => {
this.setState({ this.setState({
previewOfflineModal: null, previewOfflineModal: null,
}); })
}} }}
/> />
); )
this.setState({ previewOfflineModal }); this.setState({ previewOfflineModal })
}; }
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.setState({ this.setState({
visible: true, visible: true,
imageFile: file imageFile: file,
}); })
}; }
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -355,18 +355,18 @@ class AddOfflineCourse extends React.Component { ...@@ -355,18 +355,18 @@ class AddOfflineCourse extends React.Component {
visible: false, visible: false,
}, },
() => this.updateCover() () => this.updateCover()
); )
}); })
}; }
updateCover = () => { updateCover = () => {
const { coverClicpPath, coverId } = this.state; const { coverClicpPath, coverId } = this.state
this.setState({ this.setState({
showSelectCoverModal: false, showSelectCoverModal: false,
coverUrl: coverClicpPath, coverUrl: coverClicpPath,
coverId: coverId, coverId: coverId,
}); })
}; }
preSubmit = () => { preSubmit = () => {
//过期判断 //过期判断
...@@ -375,16 +375,16 @@ class AddOfflineCourse extends React.Component { ...@@ -375,16 +375,16 @@ class AddOfflineCourse extends React.Component {
title: '服务已到期', title: '服务已到期',
content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买', content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买',
okText: '我知道了', okText: '我知道了',
}); })
return; return
} }
const { courseId } = this.state; const { courseId } = this.state
if (courseId) { if (courseId) {
this.checkDetail(courseId).then((bool) => (bool ? this.handleSubmit() : message.warning('课程已开始,无法继续编辑'))); this.checkDetail(courseId).then((bool) => (bool ? this.handleSubmit() : message.warning('课程已开始,无法继续编辑')))
} else { } else {
this.handleSubmit(); this.handleSubmit()
}
} }
};
// 保存 // 保存
handleSubmit = () => { handleSubmit = () => {
...@@ -419,22 +419,22 @@ class AddOfflineCourse extends React.Component { ...@@ -419,22 +419,22 @@ class AddOfflineCourse extends React.Component {
signOutEndTimeUnit, signOutEndTimeUnit,
// isMore, // isMore,
editorTextLength, editorTextLength,
} = this.state; } = this.state
let coverObj = { let coverObj = {
contentType: 'COVER', contentType: 'COVER',
mediaContent: coverId, mediaContent: coverId,
mediaType: 'PICTURE', mediaType: 'PICTURE',
mediaUrl: coverUrl, mediaUrl: coverUrl,
}; }
let scheduleMediaRequests = []; let scheduleMediaRequests = []
if (coverId) { if (coverId) {
scheduleMediaRequests = [coverObj]; scheduleMediaRequests = [coverObj]
} }
// 编辑且使用默认图时不传 // 编辑且使用默认图时不传
if (pageType === 'edit' && coverUrl === defaultCoverUrl) { if (pageType === 'edit' && coverUrl === defaultCoverUrl) {
scheduleMediaRequests = []; scheduleMediaRequests = []
} }
const commonParams = { const commonParams = {
categoryId, categoryId,
...@@ -453,33 +453,33 @@ class AddOfflineCourse extends React.Component { ...@@ -453,33 +453,33 @@ class AddOfflineCourse extends React.Component {
calendarTime, calendarTime,
editorTextLength, editorTextLength,
// isMore, // isMore,
}; }
if (whetherSetApply === 'YES') { if (whetherSetApply === 'YES') {
commonParams.startTimeApply = startTimeApply; commonParams.startTimeApply = startTimeApply
commonParams.endTimeApply = endTimeApply; commonParams.endTimeApply = endTimeApply
commonParams.quota = quota; commonParams.quota = quota
} }
if (whetherSetSignIn === 'YES') { if (whetherSetSignIn === 'YES') {
commonParams.signInType = signInType; commonParams.signInType = signInType
commonParams.signInTimeNum = signInTimeNum; commonParams.signInTimeNum = signInTimeNum
commonParams.signInTimeUnit = signInTimeUnit; commonParams.signInTimeUnit = signInTimeUnit
} }
if (whetherSetSignOut === 'YES') { if (whetherSetSignOut === 'YES') {
commonParams.signOutType = signOutType; commonParams.signOutType = signOutType
if (commonParams.signOutType === 'START_LATER') { if (commonParams.signOutType === 'START_LATER') {
commonParams.signOutStartTimeNum = signOutStartTimeNum; commonParams.signOutStartTimeNum = signOutStartTimeNum
commonParams.signOutStartTimeUnit = signOutStartTimeUnit; commonParams.signOutStartTimeUnit = signOutStartTimeUnit
} }
commonParams.signOutEndTimeNum = signOutEndTimeNum; commonParams.signOutEndTimeNum = signOutEndTimeNum
commonParams.signOutEndTimeUnit = signOutEndTimeUnit; commonParams.signOutEndTimeUnit = signOutEndTimeUnit
} }
// 校验必填字段:课程名称, 课程线下 // 校验必填字段:课程名称, 课程线下
this.handleValidate(commonParams).then((res) => { this.handleValidate(commonParams).then((res) => {
if (!res) return; if (!res) return
Upload.uploadTextToOSS( Upload.uploadTextToOSS(
introduce, introduce,
`${randomString()}.txt`, `${randomString()}.txt`,
...@@ -489,182 +489,182 @@ class AddOfflineCourse extends React.Component { ...@@ -489,182 +489,182 @@ class AddOfflineCourse extends React.Component {
pageType, pageType,
commonParams, commonParams,
introduceId, introduceId,
}); })
}, },
() => message.warning('上传课程简介失败') () => message.warning('上传课程简介失败')
); )
}); })
}; }
submitRemote = (data) => { submitRemote = (data) => {
const { courseId, pageType, commonParams, introduceId } = data; const { courseId, pageType, commonParams, introduceId } = data
commonParams.introduceId = introduceId; commonParams.introduceId = introduceId
if (pageType === 'add') { if (pageType === 'add') {
Service.Hades('public/hades/createOfflineCourse', commonParams).then((res) => { Service.Hades('public/hades/createOfflineCourse', commonParams).then((res) => {
if (!res) return; if (!res) return
message.success('新建成功'); message.success('新建成功')
window.RCHistory.push({ window.RCHistory.push({
pathname: `/offline-course`, pathname: `/offline-course`,
}); })
}); })
} else { } else {
const editParams = { const editParams = {
courseId: courseId, courseId: courseId,
...commonParams, ...commonParams,
}; }
Service.Hades('public/hades/updateOfflineCourse', editParams).then((res) => { Service.Hades('public/hades/updateOfflineCourse', editParams).then((res) => {
if (!res) return; if (!res) return
message.success('保存成功'); message.success('保存成功')
window.RCHistory.push({ window.RCHistory.push({
pathname: `/offline-course`, pathname: `/offline-course`,
}); })
}); })
}
} }
};
handleValidate = (data) => { handleValidate = (data) => {
return new Promise((resolve) => { return new Promise((resolve) => {
if (!data.courseName) { if (!data.courseName) {
message.warning('请输入课程名称'); message.warning('请输入课程名称')
resolve(false); resolve(false)
} else if (!data.categoryId) { } else if (!data.categoryId) {
message.warning('请选择课程分类'); message.warning('请选择课程分类')
resolve(false); resolve(false)
} else if (!data.offlinePlace) { } else if (!data.offlinePlace) {
message.warning('请输入上课地点'); message.warning('请输入上课地点')
resolve(false); resolve(false)
} else if (!data.teacherId) { } else if (!data.teacherId) {
message.warning('请选择讲师'); message.warning('请选择讲师')
resolve(false); resolve(false)
} else if (_.isEmpty(data.calendarTime)) { } else if (_.isEmpty(data.calendarTime)) {
message.warning('请选择上课日期'); message.warning('请选择上课日期')
resolve(false); resolve(false)
} else if (!data.startTime || !data.endTime) { } else if (!data.startTime || !data.endTime) {
message.warning('请选择上课时间'); message.warning('请选择上课时间')
resolve(false); resolve(false)
} else if (moment(moment(data.calendarTime[0]).format('YYYY-MM-DD') + moment(data.startTime).format(' HH:mm')).valueOf() < Date.now()) { } else if (moment(moment(data.calendarTime[0]).format('YYYY-MM-DD') + moment(data.startTime).format(' HH:mm')).valueOf() < Date.now()) {
message.warning('上课时间不能早于现在'); message.warning('上课时间不能早于现在')
resolve(false); resolve(false)
} else if (data.startTime >= data.endTime) { } else if (data.startTime >= data.endTime) {
message.warning('上课结束时间不能早于上课开始时间'); message.warning('上课结束时间不能早于上课开始时间')
resolve(false); resolve(false)
} else if (data.whetherSetApply === 'YES' && !data.startTimeApply) { } else if (data.whetherSetApply === 'YES' && !data.startTimeApply) {
message.warning('请选择报名时间'); message.warning('请选择报名时间')
resolve(false); resolve(false)
} else if (data.whetherSetApply === 'YES' && data.startTimeApply >= data.endTimeApply) { } else if (data.whetherSetApply === 'YES' && data.startTimeApply >= data.endTimeApply) {
message.warning('报名结束时间需大于报名开始时间'); message.warning('报名结束时间需大于报名开始时间')
resolve(false); resolve(false)
} else if ( } else if (
data.whetherSetApply === 'YES' && data.whetherSetApply === 'YES' &&
data.endTimeApply > moment(moment(data.calendarTime[0]).format('YYYY-MM-DD') + moment(data.endTime).format(' HH:mm:ss')).valueOf() data.endTimeApply > moment(moment(data.calendarTime[0]).format('YYYY-MM-DD') + moment(data.endTime).format(' HH:mm:ss')).valueOf()
) { ) {
message.warning('报名结束时间需小于上课开始时间'); message.warning('报名结束时间需小于上课开始时间')
resolve(false); resolve(false)
} else if (data.whetherSetSignIn === 'YES' && !data.signInTimeNum) { } else if (data.whetherSetSignIn === 'YES' && !data.signInTimeNum) {
message.warning('请输入签到时间'); message.warning('请输入签到时间')
resolve(false); resolve(false)
} else if (data.whetherSetSignOut === 'YES' && ((data.signOutType === 'START_LATER' && !data.signOutStartTimeNum) || !data.signOutEndTimeNum)) { } else if (data.whetherSetSignOut === 'YES' && ((data.signOutType === 'START_LATER' && !data.signOutStartTimeNum) || !data.signOutEndTimeNum)) {
message.warning('请输入签退时间'); message.warning('请输入签退时间')
resolve(false); resolve(false)
} else if (data.editorTextLength > 1000) { } else if (data.editorTextLength > 1000) {
message.warning('课程简介超过字数限定'); message.warning('课程简介超过字数限定')
resolve(false); resolve(false)
} else { } else {
resolve(true); resolve(true)
}
})
} }
});
};
// 使用默认封面图 // 使用默认封面图
handleResetCoverUrl = () => { handleResetCoverUrl = () => {
const { coverUrl } = this.state; const { coverUrl } = this.state
const isDefaultCover = coverUrl === defaultCoverUrl; const isDefaultCover = coverUrl === defaultCoverUrl
// 如果已经是默认图的话,不做任何任何处理 // 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return; if (isDefaultCover) return
message.success('已替换为默认图'); message.success('已替换为默认图')
this.setState({ coverUrl: defaultCoverUrl }); this.setState({ coverUrl: defaultCoverUrl })
}; }
// 滑动加载更多讲师列表 // 滑动加载更多讲师列表
handleScrollTeacherList = (e) => { handleScrollTeacherList = (e) => {
const { hasNext } = this.state; const { hasNext } = this.state
const container = e.target; const container = e.target
//判定元素是否滚动到底部 //判定元素是否滚动到底部
const scrollToBottom = container && container.scrollHeight <= container.clientHeight + container.scrollTop; const scrollToBottom = container && container.scrollHeight <= container.clientHeight + container.scrollTop
if (scrollToBottom && hasNext) { if (scrollToBottom && hasNext) {
const { teacherQuery } = this.state; const { teacherQuery } = this.state
let _teacherQuery = teacherQuery; let _teacherQuery = teacherQuery
_teacherQuery.current = _teacherQuery.current + 1; _teacherQuery.current = _teacherQuery.current + 1
this.setState( this.setState(
{ {
teacherQuery: { ..._teacherQuery }, teacherQuery: { ..._teacherQuery },
}, },
() => { () => {
this.getTeacherList(_teacherQuery.current); this.getTeacherList(_teacherQuery.current)
}
)
} }
);
} }
};
getTeacherList(current = 1, selectList) { getTeacherList(current = 1, selectList) {
const { teacherQuery, teacherList } = this.state; const { teacherQuery, teacherList } = this.state
const _query = { const _query = {
...teacherQuery, ...teacherQuery,
current, current,
size: 15, size: 15,
}; }
StoreService.getStoreUserBasicPage(_query).then((res) => { StoreService.getStoreUserBasicPage(_query).then((res) => {
const { result = {} } = res; const { result = {} } = res
const { records = [], hasNext } = result; const { records = [], hasNext } = result
const list = current > 1 ? teacherList.concat(records) : records; const list = current > 1 ? teacherList.concat(records) : records
this.setState({ this.setState({
hasNext, hasNext,
teacherList: list, teacherList: list,
teacherQuery: { ..._query }, teacherQuery: { ..._query },
}); })
}); })
} }
changeIntro = (value) => { changeIntro = (value) => {
this.setState({ introduce: value }); this.setState({ introduce: value })
}; }
selectMultiDate = (calendarTime) => { selectMultiDate = (calendarTime) => {
const dateList = _.sortBy(calendarTime); const dateList = _.sortBy(calendarTime)
this.setState({ this.setState({
calendarTime: dateList, calendarTime: dateList,
}); })
}; }
handleChangeDates = (dates) => { handleChangeDates = (dates) => {
const data = {}; const data = {}
if (_.isEmpty(dates)) { if (_.isEmpty(dates)) {
data.startTimeApply = undefined; data.startTimeApply = undefined
data.endTimeApply = undefined; data.endTimeApply = undefined
} else { } else {
data.startTimeApply = dates[0].valueOf(); data.startTimeApply = dates[0].valueOf()
data.endTimeApply = dates[1].startOf('minute').valueOf() + 59000; data.endTimeApply = dates[1].startOf('minute').valueOf() + 59000
}
this.setState(data)
} }
this.setState(data);
};
whetherVisitorsJoinChange = () => { whetherVisitorsJoinChange = () => {
const {whetherSetApply,whetherVisitorsJoin} =this.state; const { whetherSetApply, whetherVisitorsJoin } = this.state
if(whetherSetApply =='NO'){ if (whetherSetApply == 'NO') {
message.warning('关闭报名无法获取手机号!') message.warning('关闭报名无法获取手机号!')
return return
} }
if (this.state.whetherVisitorsJoin === 'NO') { if (this.state.whetherVisitorsJoin === 'NO') {
this.setState({ whetherVisitorsJoin: 'YES' }); this.setState({ whetherVisitorsJoin: 'YES' })
} else { } else {
this.setState({ whetherVisitorsJoin: 'NO' }); this.setState({ whetherVisitorsJoin: 'NO' })
}
} }
};
handleChangeCatalogList = (value, label) => { handleChangeCatalogList = (value, label) => {
this.setState({ categoryId: value, categoryName: label[0] }); this.setState({ categoryId: value, categoryName: label[0] })
}; }
render() { render() {
const { const {
...@@ -703,11 +703,11 @@ class AddOfflineCourse extends React.Component { ...@@ -703,11 +703,11 @@ class AddOfflineCourse extends React.Component {
offlinePlace, offlinePlace,
isEditDisablie, isEditDisablie,
imageFile, imageFile,
} = this.state; } = this.state
const isDefaultCover = coverUrl === defaultCoverUrl; const isDefaultCover = coverUrl === defaultCoverUrl
return ( return (
<div className='page add-offline-course-page'> <div className='page add-offline-course-page'>
<Breadcrumbs navList={pageType === 'add' ? '新建线下课' : '编辑线下课'} goBack={this.handleGoBack} /> <Breadcrumbs navList={pageType === 'add' ? '新建线下活动' : '编辑线下活动'} goBack={this.handleGoBack} />
<div className='box'> <div className='box'>
<div className='show-tips'> <div className='show-tips'>
...@@ -723,11 +723,11 @@ class AddOfflineCourse extends React.Component { ...@@ -723,11 +723,11 @@ class AddOfflineCourse extends React.Component {
</span> </span>
<Input <Input
value={courseName} value={courseName}
placeholder='请输入线下的名称(40字以内)' placeholder='请输入线下活动的名称(40字以内)'
maxLength={40} maxLength={40}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e) => { onChange={(e) => {
this.setState({ courseName: e.target.value }); this.setState({ courseName: e.target.value })
}} }}
/> />
</div> </div>
...@@ -740,7 +740,7 @@ class AddOfflineCourse extends React.Component { ...@@ -740,7 +740,7 @@ class AddOfflineCourse extends React.Component {
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectCoverModal: true, showSelectCoverModal: true,
}); })
}}> }}>
上传图片 上传图片
</Button> </Button>
...@@ -759,7 +759,13 @@ class AddOfflineCourse extends React.Component { ...@@ -759,7 +759,13 @@ class AddOfflineCourse extends React.Component {
<span className='label special'> <span className='label special'>
<span className='require'>*</span>课程分类: <span className='require'>*</span>课程分类:
</span> </span>
<TreeSelect <CourseCatalogSelect
value={categoryId}
onChange={(value, label) => {
this.handleChangeCatalogList(value, label)
}}
/>
{/* <TreeSelect
showSearch showSearch
treeNodeFilterProp='title' treeNodeFilterProp='title'
style={{ width: 240 }} style={{ width: 240 }}
...@@ -770,9 +776,9 @@ class AddOfflineCourse extends React.Component { ...@@ -770,9 +776,9 @@ class AddOfflineCourse extends React.Component {
value={categoryId} value={categoryId}
treeDefaultExpandAll treeDefaultExpandAll
onChange={(value, label) => { onChange={(value, label) => {
this.handleChangeCatalogList(value, label); this.handleChangeCatalogList(value, label)
}} }}
/> /> */}
</div> </div>
<div className='course-catalog'> <div className='course-catalog'>
<span className='label special'> <span className='label special'>
...@@ -784,7 +790,7 @@ class AddOfflineCourse extends React.Component { ...@@ -784,7 +790,7 @@ class AddOfflineCourse extends React.Component {
style={{ width: 240 }} style={{ width: 240 }}
placeholder='请输入上课地点(40字以内)' placeholder='请输入上课地点(40字以内)'
onChange={(e) => { onChange={(e) => {
this.setState({ offlinePlace: e.target.value }); this.setState({ offlinePlace: e.target.value })
}} }}
/> />
</div> </div>
...@@ -808,22 +814,22 @@ class AddOfflineCourse extends React.Component { ...@@ -808,22 +814,22 @@ class AddOfflineCourse extends React.Component {
} }
onChange={(value, option) => { onChange={(value, option) => {
if (option) { if (option) {
this.setState({ teacherId: value, teacherName: option.children }); this.setState({ teacherId: value, teacherName: option.children })
} else { } else {
this.setState({ teacherId: value, teacherName: '' }); this.setState({ teacherId: value, teacherName: '' })
} }
}} }}
onSearch={(value) => { onSearch={(value) => {
let _teacherQuery = { ...this.state.teacherQuery }; let _teacherQuery = { ...this.state.teacherQuery }
_teacherQuery.nickName = value; _teacherQuery.nickName = value
this.setState( this.setState(
{ {
teacherQuery: _teacherQuery, teacherQuery: _teacherQuery,
}, },
() => { () => {
this.getTeacherList(); this.getTeacherList()
} }
); )
}} }}
onClear={(value) => { onClear={(value) => {
this.setState( this.setState(
...@@ -835,9 +841,9 @@ class AddOfflineCourse extends React.Component { ...@@ -835,9 +841,9 @@ class AddOfflineCourse extends React.Component {
}, },
}, },
() => { () => {
this.getTeacherList(); this.getTeacherList()
} }
); )
}} }}
getPopupContainer={() => document.getElementById('teacher')}> getPopupContainer={() => document.getElementById('teacher')}>
{_.map(teacherList, (item) => { {_.map(teacherList, (item) => {
...@@ -845,7 +851,7 @@ class AddOfflineCourse extends React.Component { ...@@ -845,7 +851,7 @@ class AddOfflineCourse extends React.Component {
<Option value={item.id} key={item.id}> <Option value={item.id} key={item.id}>
{item.nickName} {item.nickName}
</Option> </Option>
); )
})} })}
</Select> </Select>
</div> </div>
...@@ -863,7 +869,7 @@ class AddOfflineCourse extends React.Component { ...@@ -863,7 +869,7 @@ class AddOfflineCourse extends React.Component {
content: introduce, content: introduce,
}} }}
onChange={(val) => { onChange={(val) => {
this.changeIntro(val); this.changeIntro(val)
}} }}
/> />
)} )}
...@@ -900,7 +906,7 @@ class AddOfflineCourse extends React.Component { ...@@ -900,7 +906,7 @@ class AddOfflineCourse extends React.Component {
showNow={false} showNow={false}
style={{ width: 100, minWidth: 100 }} style={{ width: 100, minWidth: 100 }}
onSelect={(time) => { onSelect={(time) => {
this.setState({ startTime: time }); this.setState({ startTime: time })
}} }}
getPopupContainer={() => document.getElementById('hour')} getPopupContainer={() => document.getElementById('hour')}
/> />
...@@ -914,7 +920,7 @@ class AddOfflineCourse extends React.Component { ...@@ -914,7 +920,7 @@ class AddOfflineCourse extends React.Component {
showNow={false} showNow={false}
style={{ width: 100, minWidth: 100 }} style={{ width: 100, minWidth: 100 }}
onSelect={(time) => { onSelect={(time) => {
this.setState({ endTime: time }); this.setState({ endTime: time })
}} }}
getPopupContainer={() => document.getElementById('hour')} getPopupContainer={() => document.getElementById('hour')}
/> />
...@@ -927,7 +933,7 @@ class AddOfflineCourse extends React.Component { ...@@ -927,7 +933,7 @@ class AddOfflineCourse extends React.Component {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
value={offlineCourseType} value={offlineCourseType}
onChange={(e) => { onChange={(e) => {
this.setState({ offlineCourseType: e.target.value }); this.setState({ offlineCourseType: e.target.value })
}} }}
className='mt5' className='mt5'
disabled={isEditDisablie}> disabled={isEditDisablie}>
...@@ -952,8 +958,8 @@ class AddOfflineCourse extends React.Component { ...@@ -952,8 +958,8 @@ class AddOfflineCourse extends React.Component {
startTimeApply: undefined, startTimeApply: undefined,
endTimeApply: undefined, endTimeApply: undefined,
quota: null, quota: null,
whetherVisitorsJoin: value ? whetherVisitorsJoin : 'YES' whetherVisitorsJoin: value ? whetherVisitorsJoin : 'YES',
}); })
}} }}
/> />
<span className='switch-tip'>开启后可设置课程报名时间,获取报名数据</span> <span className='switch-tip'>开启后可设置课程报名时间,获取报名数据</span>
...@@ -968,7 +974,7 @@ class AddOfflineCourse extends React.Component { ...@@ -968,7 +974,7 @@ class AddOfflineCourse extends React.Component {
value={startTimeApply ? [moment(startTimeApply), moment(endTimeApply)] : null} value={startTimeApply ? [moment(startTimeApply), moment(endTimeApply)] : null}
format={'YYYY-MM-DD HH:mm'} format={'YYYY-MM-DD HH:mm'}
onChange={(dates) => { onChange={(dates) => {
this.handleChangeDates(dates); this.handleChangeDates(dates)
}} }}
renderExtraFooter={() => ( renderExtraFooter={() => (
<If condition={calendarTime[0]}> <If condition={calendarTime[0]}>
...@@ -1055,7 +1061,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1055,7 +1061,7 @@ class AddOfflineCourse extends React.Component {
style={{ margin: '0 4px', width: 90 }} style={{ margin: '0 4px', width: 90 }}
disabled={oldQuta < 0} disabled={oldQuta < 0}
onChange={(value) => { onChange={(value) => {
this.setState({ quota: value }); this.setState({ quota: value })
}} }}
/> />
<span className='switch-label'></span> <span className='switch-label'></span>
...@@ -1068,7 +1074,9 @@ class AddOfflineCourse extends React.Component { ...@@ -1068,7 +1074,9 @@ class AddOfflineCourse extends React.Component {
<span className='label'>观看设置:</span> <span className='label'>观看设置:</span>
<div className='content'> <div className='content'>
<Switch checked={whetherVisitorsJoin === 'NO' ? true : false} onChange={this.whetherVisitorsJoinChange} /> <Switch checked={whetherVisitorsJoin === 'NO' ? true : false} onChange={this.whetherVisitorsJoinChange} />
<div className='desc'>{whetherVisitorsJoin === 'NO' ? '已开启,仅限绑定了手机号的学员报名线下课' : '已关闭,允许未绑定手机号的学员报名线下课'}</div> <div className='desc'>
{whetherVisitorsJoin === 'NO' ? '已开启,仅限绑定了手机号的学员报名线下活动' : '已关闭,允许未绑定手机号的学员报名线下活动'}
</div>
</div> </div>
</div> </div>
<div className='course-catalog'> <div className='course-catalog'>
...@@ -1083,7 +1091,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1083,7 +1091,7 @@ class AddOfflineCourse extends React.Component {
signInType: 'START_AGO', signInType: 'START_AGO',
signInTimeNum: null, signInTimeNum: null,
signInTimeUnit: 'MINUTE', signInTimeUnit: 'MINUTE',
}); })
}} }}
/> />
<span className='switch-tip'>开启后可设置获取签到考勤数据</span> <span className='switch-tip'>开启后可设置获取签到考勤数据</span>
...@@ -1095,7 +1103,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1095,7 +1103,7 @@ class AddOfflineCourse extends React.Component {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
value={signInType} value={signInType}
onChange={(e) => { onChange={(e) => {
this.setState({ signInType: e.target.value }); this.setState({ signInType: e.target.value })
}} }}
className='mt5'> className='mt5'>
<Radio value='START_AGO' className='mr-16'> <Radio value='START_AGO' className='mr-16'>
...@@ -1117,18 +1125,18 @@ class AddOfflineCourse extends React.Component { ...@@ -1117,18 +1125,18 @@ class AddOfflineCourse extends React.Component {
precision={0} precision={0}
style={{ margin: '0 4px', width: 90 }} style={{ margin: '0 4px', width: 90 }}
onChange={(value) => { onChange={(value) => {
this.setState({ signInTimeNum: value }); this.setState({ signInTimeNum: value })
}} }}
/> />
<Select <Select
style={{ width: 72, marginRight: 4 }} style={{ width: 72, marginRight: 4 }}
value={signInTimeUnit} value={signInTimeUnit}
onChange={(value) => { onChange={(value) => {
const data = { signInTimeUnit: value }; const data = { signInTimeUnit: value }
if (value === 'HOUR' && signInTimeNum > 24) { if (value === 'HOUR' && signInTimeNum > 24) {
data.signInTimeNum = 24; data.signInTimeNum = 24
} }
this.setState(data); this.setState(data)
}}> }}>
{unitList.map((item) => ( {unitList.map((item) => (
<Option value={item.key} key={item.key}> <Option value={item.key} key={item.key}>
...@@ -1155,7 +1163,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1155,7 +1163,7 @@ class AddOfflineCourse extends React.Component {
signOutStartTimeUnit: 'MINUTE', signOutStartTimeUnit: 'MINUTE',
signOutEndTimeNum: null, signOutEndTimeNum: null,
signOutEndTimeUnit: 'MINUTE', signOutEndTimeUnit: 'MINUTE',
}); })
}} }}
/> />
<span className='switch-tip'>开启后可设置获取签退考勤数据</span> <span className='switch-tip'>开启后可设置获取签退考勤数据</span>
...@@ -1167,7 +1175,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1167,7 +1175,7 @@ class AddOfflineCourse extends React.Component {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
value={signOutType} value={signOutType}
onChange={(e) => { onChange={(e) => {
this.setState({ signOutType: e.target.value }); this.setState({ signOutType: e.target.value })
}} }}
className='mt5'> className='mt5'>
<Radio value='START_LATER' className='mr-16'> <Radio value='START_LATER' className='mr-16'>
...@@ -1190,7 +1198,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1190,7 +1198,7 @@ class AddOfflineCourse extends React.Component {
precision={0} precision={0}
style={{ margin: '0 4px', width: 90 }} style={{ margin: '0 4px', width: 90 }}
onChange={(value) => { onChange={(value) => {
this.setState({ signOutStartTimeNum: value }); this.setState({ signOutStartTimeNum: value })
}} }}
/> />
)} )}
...@@ -1199,11 +1207,11 @@ class AddOfflineCourse extends React.Component { ...@@ -1199,11 +1207,11 @@ class AddOfflineCourse extends React.Component {
style={{ width: 72, marginRight: 4 }} style={{ width: 72, marginRight: 4 }}
value={signOutStartTimeUnit} value={signOutStartTimeUnit}
onChange={(value) => { onChange={(value) => {
const data = { signOutStartTimeUnit: value }; const data = { signOutStartTimeUnit: value }
if (value === 'HOUR' && signOutStartTimeNum > 24) { if (value === 'HOUR' && signOutStartTimeNum > 24) {
data.signOutStartTimeNum = 24; data.signOutStartTimeNum = 24
} }
this.setState(data); this.setState(data)
}}> }}>
{unitList.map((item) => ( {unitList.map((item) => (
<Option value={item.key} key={item.key}> <Option value={item.key} key={item.key}>
...@@ -1220,18 +1228,18 @@ class AddOfflineCourse extends React.Component { ...@@ -1220,18 +1228,18 @@ class AddOfflineCourse extends React.Component {
precision={0} precision={0}
style={{ margin: '0 4px', width: 90 }} style={{ margin: '0 4px', width: 90 }}
onChange={(value) => { onChange={(value) => {
this.setState({ signOutEndTimeNum: value }); this.setState({ signOutEndTimeNum: value })
}} }}
/> />
<Select <Select
style={{ width: 72, marginRight: 4 }} style={{ width: 72, marginRight: 4 }}
value={signOutEndTimeUnit} value={signOutEndTimeUnit}
onChange={(value) => { onChange={(value) => {
const data = { signOutEndTimeUnit: value }; const data = { signOutEndTimeUnit: value }
if (value === 'HOUR' && signOutEndTimeNum > 24) { if (value === 'HOUR' && signOutEndTimeNum > 24) {
data.signOutEndTimeNum = 24; data.signOutEndTimeNum = 24
} }
this.setState(data); this.setState(data)
}}> }}>
{unitList.map((item) => ( {unitList.map((item) => (
<Option value={item.key} key={item.key}> <Option value={item.key} key={item.key}>
...@@ -1266,7 +1274,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1266,7 +1274,7 @@ class AddOfflineCourse extends React.Component {
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}
/> />
...@@ -1277,14 +1285,14 @@ class AddOfflineCourse extends React.Component { ...@@ -1277,14 +1285,14 @@ class AddOfflineCourse extends React.Component {
imgUrl={imageFile.ossUrl} imgUrl={imageFile.ossUrl}
onConfirm={this.getSignature} onConfirm={this.getSignature}
onClose={() => { onClose={() => {
this.setState({ visible: false }); this.setState({ visible: false })
}} }}
/> />
)} )}
{this.state.previewOfflineModal} {this.state.previewOfflineModal}
</div> </div>
); )
} }
} }
export default AddOfflineCourse; export default AddOfflineCourse
...@@ -136,10 +136,10 @@ class OfflineCourseFilter extends React.Component { ...@@ -136,10 +136,10 @@ class OfflineCourseFilter extends React.Component {
<Row type='flex' justify='space-between' align='top'> <Row type='flex' justify='space-between' align='top'>
<div className='search-condition'> <div className='search-condition'>
<div className='search-condition__item'> <div className='search-condition__item'>
<span className='search-name'>线下名称:</span> <span className='search-name'>线下活动名称:</span>
<Search <Search
value={courseName} value={courseName}
placeholder='搜索线下名称' placeholder='搜索线下活动名称'
onChange={(e) => { onChange={(e) => {
this.handleChangeQuery('courseName', e.target.value) this.handleChangeQuery('courseName', e.target.value)
}} }}
......
.video-course-filter { .video-course-filter {
position: relative; position: relative;
.video-list-table{ .video-list-table {
// tr:nth-child(even){ // tr:nth-child(even){
// background: transparent !important; // background: transparent !important;
...@@ -24,13 +23,14 @@ ...@@ -24,13 +23,14 @@
margin-bottom: 12px; margin-bottom: 12px;
align-items: center; align-items: center;
display: flex; display: flex;
.search-name{ .search-name {
width: 114px;
vertical-align: middle; vertical-align: middle;
} }
.shelf-status{ .shelf-status {
width:84px; width: 84px;
display:inline-block; display: inline-block;
text-align:right; text-align: right;
} }
} }
} }
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
line-height: 20px; line-height: 20px;
.fold-icon { .fold-icon {
font-size: 12px; font-size: 12px;
margin-left:4px; margin-left: 4px;
} }
} }
} }
......
...@@ -6,77 +6,77 @@ ...@@ -6,77 +6,77 @@
* @Description: 线上课-列表模块 * @Description: 线上课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import Service from '@/common/js/service'; import Service from '@/common/js/service'
import User from '@/common/js/user'; import User from '@/common/js/user'
import college from '@/common/lottie/college'; import college from '@/common/lottie/college'
import { PageControl, XMTable } from '@/components'; import { PageControl, XMTable } from '@/components'
import { LIVE_SHARE } from '@/domains/course-domain/constants'; import { LIVE_SHARE } from '@/domains/course-domain/constants'
import CourseService from '@/domains/course-domain/CourseService'; import CourseService from '@/domains/course-domain/CourseService'
import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal'; import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal'
import OfflineCourseData from '@/modules/course-manage/offline-course/OfflineCourseData'; import OfflineCourseData from '@/modules/course-manage/offline-course/OfflineCourseData'
import { Dropdown, message, Modal, Switch, Tooltip } from 'antd'; import { Dropdown, message, Modal, Switch, Tooltip } from 'antd'
import moment from 'moment'; import moment from 'moment'
import React from 'react'; import React from 'react'
import { find, reduce, last } from 'underscore'; import { find, reduce, last } from 'underscore'
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom'
import ENUM from '../../../knowledge-base/ENUM.js'; import ENUM from '../../../knowledge-base/ENUM.js'
import PreviewOfflineModal from '../modal/PreviewOfflineModal'; import PreviewOfflineModal from '../modal/PreviewOfflineModal'
import QRCodeModal from '../modal/QRCodeModal'; import QRCodeModal from '../modal/QRCodeModal'
import './OfflineCourseList.less'; import './OfflineCourseList.less'
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'; const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
class OfflineCourseList extends React.Component { class OfflineCourseList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
id: '', // 线上课ID id: '', // 线上课ID
studentIds: [], studentIds: [],
}; }
} }
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)
} }
} }
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 { courseMediaVOS, courseName, offlinePlace, calendarTime, startTime, endTime } = record; const { courseMediaVOS, courseName, offlinePlace, calendarTime, startTime, endTime } = record
const coverUrl = (find(courseMediaVOS, (data) => data.contentType === 'COVER') || {}).mediaUrl; const coverUrl = (find(courseMediaVOS, (data) => data.contentType === 'COVER') || {}).mediaUrl
let isContinue = calendarTime.length > 1; let isContinue = calendarTime.length > 1
reduce(calendarTime, (a, b) => { reduce(calendarTime, (a, b) => {
isContinue = isContinue && b - a === 86400000; isContinue = isContinue && b - a === 86400000
return b; return b
}); })
const lastTime = last(calendarTime); const lastTime = last(calendarTime)
const time = `${ const time = `${
!isContinue !isContinue
? calendarTime.map((item) => moment(item).format('MM-DD')).join('、') ? calendarTime.map((item) => moment(item).format('MM-DD')).join('、')
: `${moment(calendarTime[0]).format('MM-DD')}~${moment(lastTime).format('MM-DD')}` : `${moment(calendarTime[0]).format('MM-DD')}~${moment(lastTime).format('MM-DD')}`
} ${moment(startTime).format('HH:mm')} ~ ${moment(endTime).format('HH:mm')}`; } ${moment(startTime).format('HH:mm')} ~ ${moment(endTime).format('HH:mm')}`
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='' />
...@@ -92,7 +92,7 @@ class OfflineCourseList extends React.Component { ...@@ -92,7 +92,7 @@ class OfflineCourseList extends React.Component {
</Tooltip> </Tooltip>
</div> </div>
</div> </div>
); )
}, },
}, },
{ {
...@@ -106,7 +106,7 @@ class OfflineCourseList extends React.Component { ...@@ -106,7 +106,7 @@ class OfflineCourseList extends React.Component {
<div style={{ width: 6, height: 6, borderRadius: '50%', background: ENUM.offlineStateShow[val].color, marginRight: 8 }}></div> <div style={{ width: 6, height: 6, borderRadius: '50%', background: ENUM.offlineStateShow[val].color, marginRight: 8 }}></div>
{ENUM.offlineStateShow[val].title} {ENUM.offlineStateShow[val].title}
</div> </div>
); )
}, },
}, },
{ {
...@@ -115,7 +115,7 @@ class OfflineCourseList extends React.Component { ...@@ -115,7 +115,7 @@ class OfflineCourseList extends React.Component {
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>
}, },
}, },
{ {
...@@ -141,7 +141,7 @@ class OfflineCourseList extends React.Component { ...@@ -141,7 +141,7 @@ class OfflineCourseList extends React.Component {
render: (val, item, index) => { render: (val, item, index) => {
return ( return (
<Switch size='small' disabled={item.courseState === 'EXPIRED'} checked={item.shelfState === 'YES'} onChange={() => this.changeShelfState(item)} /> <Switch size='small' disabled={item.courseState === 'EXPIRED'} checked={item.shelfState === 'YES'} onChange={() => this.changeShelfState(item)} />
); )
}, },
}, },
{ {
...@@ -150,7 +150,7 @@ class OfflineCourseList extends React.Component { ...@@ -150,7 +150,7 @@ class OfflineCourseList extends React.Component {
key: 'teacher', key: 'teacher',
dataIndex: 'teacher', dataIndex: 'teacher',
render: (val, item) => { render: (val, item) => {
return <div>{item.teacherName}</div>; return <div>{item.teacherName}</div>
}, },
}, },
{ {
...@@ -178,7 +178,7 @@ class OfflineCourseList extends React.Component { ...@@ -178,7 +178,7 @@ class OfflineCourseList extends React.Component {
</span> </span>
)} )}
</div> </div>
); )
}, },
}, },
{ {
...@@ -188,7 +188,7 @@ class OfflineCourseList extends React.Component { ...@@ -188,7 +188,7 @@ class OfflineCourseList extends React.Component {
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return <span style={{ whiteSpace: 'nowrap' }}>{window.formatDate('YYYY-MM-DD H:i', val)}</span>; return <span style={{ whiteSpace: 'nowrap' }}>{window.formatDate('YYYY-MM-DD H:i', val)}</span>
}, },
}, },
{ {
...@@ -219,12 +219,12 @@ class OfflineCourseList extends React.Component { ...@@ -219,12 +219,12 @@ class OfflineCourseList extends React.Component {
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
); )
}, },
}, },
]; ]
return columns; return columns
}; }
// 显示预览弹窗 // 显示预览弹窗
handleShowPreviewModal = (courseId) => { handleShowPreviewModal = (courseId) => {
...@@ -234,12 +234,12 @@ class OfflineCourseList extends React.Component { ...@@ -234,12 +234,12 @@ class OfflineCourseList extends React.Component {
close={() => { close={() => {
this.setState({ this.setState({
previewOfflineModal: null, previewOfflineModal: null,
}); })
}} }}
/> />
); )
this.setState({ previewOfflineModal }); this.setState({ previewOfflineModal })
}; }
renderMoreOperate = (item) => { renderMoreOperate = (item) => {
return ( return (
...@@ -249,7 +249,7 @@ class OfflineCourseList extends React.Component { ...@@ -249,7 +249,7 @@ class OfflineCourseList extends React.Component {
className='operate__item' className='operate__item'
key='qrcode' key='qrcode'
onClick={() => { onClick={() => {
this.setState({ openQRCodeModal: true, qrcodeData: item }); this.setState({ openQRCodeModal: true, qrcodeData: item })
}}> }}>
考勤二维码 考勤二维码
</div> </div>
...@@ -258,7 +258,7 @@ class OfflineCourseList extends React.Component { ...@@ -258,7 +258,7 @@ class OfflineCourseList extends React.Component {
className='operate__item' className='operate__item'
key='preview' key='preview'
onClick={() => { onClick={() => {
this.handleShowPreviewModal(item.courseId); this.handleShowPreviewModal(item.courseId)
}}> }}>
预览 预览
</div> </div>
...@@ -268,7 +268,7 @@ class OfflineCourseList extends React.Component { ...@@ -268,7 +268,7 @@ class OfflineCourseList extends React.Component {
className='operate__item' className='operate__item'
key='cancel' key='cancel'
onClick={() => { onClick={() => {
this.handleDeleteOfflineCourse(item.courseId); this.handleDeleteOfflineCourse(item.courseId)
}}> }}>
取消课程 取消课程
</div> </div>
...@@ -278,7 +278,7 @@ class OfflineCourseList extends React.Component { ...@@ -278,7 +278,7 @@ class OfflineCourseList extends React.Component {
className='operate__item' className='operate__item'
key='edit' key='edit'
onClick={() => { onClick={() => {
RCHistory.push(`/create-offline-course?type=edit&id=${item.courseId}`); RCHistory.push(`/create-offline-course?type=edit&id=${item.courseId}`)
}}> }}>
编辑 编辑
</div> </div>
...@@ -289,37 +289,37 @@ class OfflineCourseList extends React.Component { ...@@ -289,37 +289,37 @@ class OfflineCourseList extends React.Component {
</div> </div>
)} )}
</div> </div>
); )
}; }
//改变上架状态 //改变上架状态
changeShelfState = (item) => { changeShelfState = (item) => {
if (!window.ctx.xmState.storeUserPermissionList.includes('EditOfflineClass')) { if (!window.ctx.xmState.storeUserPermissionList.includes('EditOfflineClass')) {
message.warning('无【编辑线下课】权限,请联系管理员'); message.warning('无【编辑线下活动】权限,请联系管理员')
return; return
} }
let _shelfState = item.shelfState; let _shelfState = item.shelfState
if (_shelfState === 'NO') { if (_shelfState === 'NO') {
_shelfState = 'YES'; _shelfState = 'YES'
item.shelfState = 'YES'; item.shelfState = 'YES'
} else { } else {
_shelfState = 'NO'; _shelfState = 'NO'
item.shelfState = 'NO'; item.shelfState = 'NO'
} }
const params = { const params = {
courseId: item.courseId, courseId: item.courseId,
shelfState: _shelfState, shelfState: _shelfState,
}; }
CourseService.changeVideoShelfState(params).then((res) => { CourseService.changeVideoShelfState(params).then((res) => {
if (res.success) { if (res.success) {
if (_shelfState === 'YES') { if (_shelfState === 'YES') {
message.success('已开启展示'); message.success('已开启展示')
} else { } else {
message.success('已取消展示'); message.success('已取消展示')
}
this.props.onChange()
} }
this.props.onChange(); })
} }
});
};
// 删除视频课 // 删除视频课
handleDeleteOfflineCourse = (courseId, isDelete) => { handleDeleteOfflineCourse = (courseId, isDelete) => {
if (isDelete) { if (isDelete) {
...@@ -333,13 +333,13 @@ class OfflineCourseList extends React.Component { ...@@ -333,13 +333,13 @@ class OfflineCourseList extends React.Component {
onOk: () => { onOk: () => {
const param = { const param = {
courseId: courseId, courseId: courseId,
}; }
Service.Hades('public/hades/delOfflineCourse', param).then(() => { Service.Hades('public/hades/delOfflineCourse', param).then(() => {
message.success('删除成功'); message.success('删除成功')
this.props.onChange(); this.props.onChange()
}); })
}, },
}); })
} else { } else {
Modal.confirm({ Modal.confirm({
title: '取消课程', title: '取消课程',
...@@ -350,82 +350,82 @@ class OfflineCourseList extends React.Component { ...@@ -350,82 +350,82 @@ class OfflineCourseList extends React.Component {
onOk: () => { onOk: () => {
const param = { const param = {
courseId: courseId, courseId: courseId,
}; }
Service.Hades('public/hades/cancelOfflineCourse', param).then(() => { Service.Hades('public/hades/cancelOfflineCourse', param).then(() => {
message.success('取消成功'); message.success('取消成功')
this.props.onChange(); this.props.onChange()
}); })
}, },
}); })
}
} }
};
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (record, needStr = false) => { handleShowShareModal = (record, needStr = false) => {
const { courseId } = record; const { courseId } = record
const htmlUrl = `${LIVE_SHARE}offline_detail/${courseId}?id=${User.getStoreId()}`; const htmlUrl = `${LIVE_SHARE}offline_detail/${courseId}?id=${User.getStoreId()}`
const longUrl = htmlUrl; const longUrl = htmlUrl
const { courseName, courseMediaVOS } = record; const { courseName, courseMediaVOS } = record
const coverUrl = (_.find(courseMediaVOS, (data) => data.contentType === 'COVER') || {}).mediaUrl; const coverUrl = (_.find(courseMediaVOS, (data) => data.contentType === 'COVER') || {}).mediaUrl
const shareData = { const shareData = {
longUrl, longUrl,
coverUrl, coverUrl,
courseName, courseName,
}; }
const shareLiveModal = ( const shareLiveModal = (
<ShareLiveModal <ShareLiveModal
needStr={needStr} needStr={needStr}
data={shareData} data={shareData}
type='offlineClass' type='offlineClass'
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 _columnKey; let _columnKey
let _order; let _order
// 按创建时间升序排序 // 按创建时间升序排序
if (columnKey === 'apply' && order === 'ascend') { if (columnKey === 'apply' && order === 'ascend') {
_columnKey = 'START_APPLY_DESC'; _columnKey = 'START_APPLY_DESC'
_order = 'SORT_ASC'; _order = 'SORT_ASC'
} }
if (columnKey === 'created' && order === 'ascend') { if (columnKey === 'created' && order === 'ascend') {
_columnKey = 'CREATED'; _columnKey = 'CREATED'
_order = 'SORT_ASC'; _order = 'SORT_ASC'
} }
// 按创建时间降序排序 // 按创建时间降序排序
if (columnKey === 'apply' && order === 'descend') { if (columnKey === 'apply' && order === 'descend') {
_columnKey = 'START_APPLY_DESC'; _columnKey = 'START_APPLY_DESC'
_order = 'SORT_DESC'; _order = 'SORT_DESC'
} }
if (columnKey === 'created' && order === 'descend') { if (columnKey === 'created' && order === 'descend') {
_columnKey = 'CREATED'; _columnKey = 'CREATED'
_order = 'SORT_DESC'; _order = 'SORT_DESC'
} }
const _query = { const _query = {
...query, ...query,
sortMap: {}, sortMap: {},
}; }
_query.sortMap[_columnKey] = _order; _query.sortMap[_columnKey] = _order
this.props.onChange(_query); this.props.onChange(_query)
}; }
render() { render() {
const { openQRCodeModal, qrcodeData } = this.state; const { openQRCodeModal, qrcodeData } = this.state
const { dataSource = [], totalCount, query, match } = this.props; const { dataSource = [], totalCount, query, match } = this.props
const { current, size } = query; const { current, size } = query
return ( return (
<div className='offline-course-list'> <div className='offline-course-list'>
<XMTable <XMTable
...@@ -449,8 +449,8 @@ class OfflineCourseList extends React.Component { ...@@ -449,8 +449,8 @@ class OfflineCourseList extends React.Component {
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>
...@@ -460,13 +460,13 @@ class OfflineCourseList extends React.Component { ...@@ -460,13 +460,13 @@ class OfflineCourseList extends React.Component {
visible={openQRCodeModal} visible={openQRCodeModal}
data={qrcodeData} data={qrcodeData}
onCancel={() => { onCancel={() => {
this.setState({ openQRCodeModal: false }); this.setState({ openQRCodeModal: false })
}} }}
/> />
<Route path={`${match.url}/data`} component={OfflineCourseData} /> <Route path={`${match.url}/data`} component={OfflineCourseData} />
</div> </div>
); )
} }
} }
export default withRouter(OfflineCourseList); export default withRouter(OfflineCourseList)
...@@ -7,22 +7,22 @@ ...@@ -7,22 +7,22 @@
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react'; import React from 'react'
import { Button } from 'antd'; import { Button } from 'antd'
import './OfflineCourseOpt.less'; import './OfflineCourseOpt.less'
export default function OfflineCourseOpt() { export default function OfflineCourseOpt() {
return ( return (
<div className="video-course-opt"> <div className='video-course-opt'>
<Button <Button
type="primary" type='primary'
onClick={() => { onClick={() => {
RCHistory.push('/create-offline-course?type=add'); RCHistory.push('/create-offline-course?type=add')
}} }}
className="mr12" className='mr12'>
>新建线下课</Button> 新建线下活动
</Button>
</div> </div>
); )
} }
import React from 'react'; import React from 'react'
import OfflineCourseFilter from './components/OfflineCourseFilter'; import OfflineCourseFilter from './components/OfflineCourseFilter'
import OfflineCourseOpt from './components/OfflineCourseOpt'; import OfflineCourseOpt from './components/OfflineCourseOpt'
import OfflineCourseList from './components/OfflineCourseList'; import OfflineCourseList from './components/OfflineCourseList'
import Service from '@/common/js/service'; import Service from '@/common/js/service'
import User from '@/common/js/user' import User from '@/common/js/user'
class OfflineCoursePage extends React.Component { class OfflineCoursePage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
query: { query: {
size: 10, size: 10,
current: 1, current: 1,
storeId:User.getStoreId() storeId: User.getStoreId(),
}, },
dataSource: [], // 线下课列表 dataSource: [], // 线下课列表
totalCount: 0, // 线下课数据总条数 totalCount: 0, // 线下课数据总条数
...@@ -23,54 +22,47 @@ class OfflineCoursePage extends React.Component { ...@@ -23,54 +22,47 @@ class OfflineCoursePage extends React.Component {
componentWillMount() { componentWillMount() {
// 获取线下课列表 // 获取线下课列表
this.handleFetchScheduleList(); this.handleFetchScheduleList()
} }
// 获取线下课列表 // 获取线下课列表
handleFetchScheduleList = (_query = {}) => { handleFetchScheduleList = (_query = {}) => {
const query = { const query = {
...this.state.query, ...this.state.query,
..._query ..._query,
}; }
// 更新请求参数 // 更新请求参数
this.setState({ query }); this.setState({ query })
Service.Hades('public/hades/getOfflineCoursePage', query).then((res) => { Service.Hades('public/hades/getOfflineCoursePage', query).then((res) => {
const { result = {} } = res || {}; const { result = {} } = res || {}
const { records = [], total = 0 } = result; const { records = [], total = 0 } = result
this.setState({ this.setState({
dataSource: records, dataSource: records,
totalCount: Number(total) totalCount: Number(total),
}); })
}) })
} }
render() { render() {
const { dataSource, totalCount, query } = this.state; const { dataSource, totalCount, query } = this.state
return ( return (
<div className="page video-course-page"> <div className='page video-course-page'>
<div className="content-header">线下课</div> <div className='content-header'>线下活动</div>
<div className="box"> <div className='box'>
{/* 搜索模块 */} {/* 搜索模块 */}
<OfflineCourseFilter <OfflineCourseFilter onChange={this.handleFetchScheduleList} />
onChange={this.handleFetchScheduleList}
/>
{/* 操作模块 */} {/* 操作模块 */}
{window.ctx.xmState.storeUserPermissionList.includes('AddOfflineClass') && <OfflineCourseOpt />} {window.ctx.xmState.storeUserPermissionList.includes('AddOfflineClass') && <OfflineCourseOpt />}
{/* 线下课列表模块 */} {/* 线下课列表模块 */}
<OfflineCourseList <OfflineCourseList query={query} dataSource={dataSource} totalCount={totalCount} onChange={this.handleFetchScheduleList} />
query={query}
dataSource={dataSource}
totalCount={totalCount}
onChange={this.handleFetchScheduleList}
/>
</div> </div>
</div> </div>
) )
} }
} }
export default OfflineCoursePage; export default OfflineCoursePage
import React from 'react'; import React from 'react'
import { Modal } from 'antd'; import { Modal } from 'antd'
import moment from 'moment'; import moment from 'moment'
import $ from 'jquery'; import $ from 'jquery'
import Service from "@/common/js/service"; import Service from '@/common/js/service'
import './PreviewOfflineModal.less'; import './PreviewOfflineModal.less'
import ENUM from '@/modules/knowledge-base/ENUM'; import ENUM from '@/modules/knowledge-base/ENUM'
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'; const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
class PreviewOfflineModal extends React.Component { class PreviewOfflineModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {}
}
} }
componentDidMount() { componentDidMount() {
const { data } = this.props; const { data } = this.props
_.isEmpty(data) ? this.getCourseDetail() : this.setState({ ...data }); _.isEmpty(data) ? this.getCourseDetail() : this.setState({ ...data })
} }
getCourseDetail = () => { getCourseDetail = () => {
...@@ -26,20 +24,20 @@ class PreviewOfflineModal extends React.Component { ...@@ -26,20 +24,20 @@ class PreviewOfflineModal extends React.Component {
courseId: this.props.courseId, courseId: this.props.courseId,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
const { result } = res; const { result } = res
let coverUrl = ''; let coverUrl = ''
result.courseMediaVOS.map((item) => { result.courseMediaVOS.map((item) => {
switch (item.contentType){ switch (item.contentType) {
case "COVER": case 'COVER':
coverUrl = item.mediaUrl; coverUrl = item.mediaUrl
break; break
case "INTRO": case 'INTRO':
this.getTextDetail('introduce', item.mediaUrl); this.getTextDetail('introduce', item.mediaUrl)
break; break
default: default:
break; break
} }
return item; return item
}) })
this.setState({ this.setState({
...result, ...result,
...@@ -54,10 +52,10 @@ class PreviewOfflineModal extends React.Component { ...@@ -54,10 +52,10 @@ class PreviewOfflineModal extends React.Component {
data: {}, data: {},
type: 'GET', type: 'GET',
url, url,
contentType:'application/x-www-form-urlencoded; charset=UTF-8', contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => { success: (res) => {
this.setState({ [key]: res, [`load${key}`]: true }); this.setState({ [key]: res, [`load${key}`]: true })
} },
}) })
} }
...@@ -85,79 +83,82 @@ class PreviewOfflineModal extends React.Component { ...@@ -85,79 +83,82 @@ class PreviewOfflineModal extends React.Component {
signOutStartTimeUnit, signOutStartTimeUnit,
signOutEndTimeNum, signOutEndTimeNum,
signOutEndTimeUnit, signOutEndTimeUnit,
} = this.state; } = this.state
const unit = (signInTimeUnit || '').toLocaleLowerCase() + 's'; const unit = (signInTimeUnit || '').toLocaleLowerCase() + 's'
const time = (signInType === 'START_AGO' ? startTime : endTime) && moment(signInType === 'START_AGO' ? startTime : endTime).subtract(signInTimeNum, unit); const time = (signInType === 'START_AGO' ? startTime : endTime) && moment(signInType === 'START_AGO' ? startTime : endTime).subtract(signInTimeNum, unit)
const signInTime = (time && signInTimeNum) && `${moment(time).format('HH:mm')} ~ ${moment(signInType === 'START_AGO' ? startTime : endTime).format('HH:mm')}`; const signInTime = time && signInTimeNum && `${moment(time).format('HH:mm')} ~ ${moment(signInType === 'START_AGO' ? startTime : endTime).format('HH:mm')}`
const endUnit = (signOutEndTimeUnit || '').toLocaleLowerCase() + 's'; const endUnit = (signOutEndTimeUnit || '').toLocaleLowerCase() + 's'
const end = (endTime && signOutEndTimeNum) && moment(endTime).add(signOutEndTimeNum, endUnit); const end = endTime && signOutEndTimeNum && moment(endTime).add(signOutEndTimeNum, endUnit)
let startUnit = ''; let startUnit = ''
let start = ''; let start = ''
if (signOutType === 'START_LATER') { if (signOutType === 'START_LATER') {
startUnit = (signOutStartTimeUnit || '').toLocaleLowerCase() + 's'; startUnit = (signOutStartTimeUnit || '').toLocaleLowerCase() + 's'
start = (startTime && signOutStartTimeNum) && moment(startTime).add(signOutStartTimeNum, startUnit); start = startTime && signOutStartTimeNum && moment(startTime).add(signOutStartTimeNum, startUnit)
} }
console.log(start, end, startTime, endTime, 666666) console.log(start, end, startTime, endTime, 666666)
const signOutTime = (start || end) && (signOutType === 'START_LATER' ? `${moment(start).format('HH:mm')} ~ ${moment(end).format('HH:mm')}` : `${moment(endTime).format('HH:mm')} ~ ${moment(end).format('HH:mm')}`); const signOutTime =
(start || end) &&
(signOutType === 'START_LATER'
? `${moment(start).format('HH:mm')} ~ ${moment(end).format('HH:mm')}`
: `${moment(endTime).format('HH:mm')} ~ ${moment(end).format('HH:mm')}`)
return ( return (
<Modal <Modal
title="预览" title='预览'
visible={true} visible={true}
width={680} width={680}
onCancel={this.props.close} onCancel={this.props.close}
footer={null} footer={null}
maskClosable={false} maskClosable={false}
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>} closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>}
className="preview-offline-modal" className='preview-offline-modal'>
> <div className='container__wrap'>
<div className="container__wrap"> <div className='container'>
<div className="container"> <div className='container__header'>
<div className="container__header"> <div className='cover'></div>
<div className="cover"></div> <img src={coverUrl || defaultCoverUrl} className='course-cover' />
<img src={coverUrl || defaultCoverUrl} className="course-cover" /> <span className='cover-teacher'>主讲人:{teacherName}</span>
<span className="cover-teacher">主讲人:{teacherName}</span> <span className='cover-state' style={{ background: (ENUM.offlineStateShow[courseState] || {}).color }}>
<span className="cover-state" style={{ background: (ENUM.offlineStateShow[courseState] || {}).color }}>{(ENUM.offlineStateShow[courseState] || {}).title}</span> {(ENUM.offlineStateShow[courseState] || {}).title}
</span>
</div> </div>
<div className="container__body"> <div className='container__body'>
<div className="title__name">{courseName}</div> <div className='title__name'>{courseName}</div>
<div className="title__categery"> <div className='title__categery'>
<img className="item-icon" src="https://image.xiaomaiketang.com/xm/cDMwz3jzaX.png" /> <img className='item-icon' src='https://image.xiaomaiketang.com/xm/cDMwz3jzaX.png' />
课程分类:{categoryName} 课程分类:{categoryName}
</div> </div>
<div className="title__categery"> <div className='title__categery'>
<img className="item-icon" src="https://image.xiaomaiketang.com/xm/BfTBK3dGda.png" /> <img className='item-icon' src='https://image.xiaomaiketang.com/xm/BfTBK3dGda.png' />
上课时间:{startTime ? moment(startTime).format('HH:mm') : ''}~{endTime ? moment(endTime).format('HH:mm') : ''} 上课时间:{startTime ? moment(startTime).format('HH:mm') : ''}~{endTime ? moment(endTime).format('HH:mm') : ''}
</div> </div>
<div className="title__categery"> <div className='title__categery'>
<img className="item-icon" src="https://image.xiaomaiketang.com/xm/KhFNBTtAKR.png" /> <img className='item-icon' src='https://image.xiaomaiketang.com/xm/KhFNBTtAKR.png' />
上课地点:{offlinePlace} 上课地点:{offlinePlace}
</div> </div>
</div> </div>
<div className="container__introduction"> <div className='container__introduction'>
<div className="title">线下课简介</div> <div className='title'>线下活动简介</div>
<div className="container__introduction__list editor-box"> <div className='container__introduction__list editor-box'>
{whetherSetApply === 'YES' && <div className="course-time"> {whetherSetApply === 'YES' && (
<div className="time-title">报名时间</div> <div className='course-time'>
<div className="time-text">{startTimeApply && moment(startTimeApply).format('MM-DD HH:mm')} ~ {endTimeApply && moment(endTimeApply).format('MM-DD HH:mm')}</div> <div className='time-title'>报名时间</div>
</div>} <div className='time-text'>
{(whetherSetSignIn === 'YES' || whetherSetSignOut === 'YES') && <div className="course-time"> {startTimeApply && moment(startTimeApply).format('MM-DD HH:mm')} ~ {endTimeApply && moment(endTimeApply).format('MM-DD HH:mm')}
<div className="time-title">考勤时间</div>
{whetherSetSignIn === 'YES' &&
<div className="time-text">
签到:{signInTime}
</div> </div>
}
{whetherSetSignOut === 'YES' &&
<div className="time-text">
签退:{signOutTime}
</div> </div>
} )}
</div>} {(whetherSetSignIn === 'YES' || whetherSetSignOut === 'YES') && (
<div className='course-time'>
<div className='time-title'>考勤时间</div>
{whetherSetSignIn === 'YES' && <div className='time-text'>签到:{signInTime}</div>}
{whetherSetSignOut === 'YES' && <div className='time-text'>签退:{signOutTime}</div>}
</div>
)}
<div <div
className="intro-item text" className='intro-item text'
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: introduce __html: introduce,
}} }}
/> />
</div> </div>
...@@ -169,4 +170,4 @@ class PreviewOfflineModal extends React.Component { ...@@ -169,4 +170,4 @@ class PreviewOfflineModal extends React.Component {
} }
} }
export default PreviewOfflineModal; export default PreviewOfflineModal
...@@ -7,31 +7,30 @@ ...@@ -7,31 +7,30 @@
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react' import React from 'react';
import { Button, Input, message, Modal, Cascader, 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 ShowTips from '@/components/ShowTips' import { CourseCatalogSelect } from '@/modules/common';
import Breadcrumbs from '@/components/Breadcrumbs' import ShowTips from '@/components/ShowTips';
import moment from 'moment' import Breadcrumbs from '@/components/Breadcrumbs';
import AddVideoIntro from './components/AddVideoIntro' import moment from 'moment';
import SelectStudent from '../modal/select-student' import AddVideoIntro from './components/AddVideoIntro';
import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal' import SelectStudent from '../modal/select-student';
import PreviewCourseModal from '../modal/PreviewCourseModal' import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal';
import StoreService from '@/domains/store-domain/storeService' import PreviewCourseModal from '../modal/PreviewCourseModal';
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';
import _ from 'underscore' import _ from 'underscore';
import Upload from '@/core/upload' import Upload from '@/core/upload';
import { randomString } from '@/domains/basic-domain/utils' import { randomString } from '@/domains/basic-domain/utils';
import ImgClipModal from '@/components/ImgClipModal' import ImgClipModal from '@/components/ImgClipModal';
import $ from 'jquery' import $ from 'jquery';
import './AddVideoCourse.less' import './AddVideoCourse.less';
import Bus from '@/core/bus' 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';
...@@ -47,11 +46,11 @@ const whetherVisitorsJoin = 'NO'; ...@@ -47,11 +46,11 @@ 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) {
...@@ -84,24 +83,21 @@ class AddVideoCourse extends React.Component { ...@@ -84,24 +83,21 @@ class AddVideoCourse extends React.Component {
showSelectFileModal: false, showSelectFileModal: false,
studentModal: false, studentModal: false,
categoryName: null, //分类名称 categoryName: null, //分类名称
courseCatalogList: [], //分类列表
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;
this.getCourseCatalogList();
if (pageType === 'edit') { if (pageType === 'edit') {
this.handleFetchScheudleDetail(id); this.handleFetchScheudleDetail(id);
} }
...@@ -112,51 +108,29 @@ class AddVideoCourse extends React.Component { ...@@ -112,51 +108,29 @@ class AddVideoCourse extends React.Component {
}); });
} }
//获取分类列表 handleChangeCatalogList = (value, label) => {
getCourseCatalogList = () => { this.setState({ categoryId: value, categoryName: label[0] });
StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => {
this.setState({
courseCatalogList: res.result.records,
});
});
}; };
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) => { handleFetchScheudleDetail = (courseId) => {
CourseService.videoScheduleDetail({ CourseService.videoScheduleDetail({
courseId, courseId,
}).then((res) => { }).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {};
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId, courseChapterVOList =[] } = result const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryId, courseChapterVOList = [] } = result;
let coverId let coverId;
let coverUrl let coverUrl;
// let videoDuration let scheduleMedia = [];
// let videoName let scheduleVideoUrl;
let scheduleMedia = [] let hasIntro;
let scheduleVideoUrl
let hasIntro
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
switch (item.contentType) { switch (item.contentType) {
case 'COVER': case 'COVER':
coverId = item.mediaContent coverId = item.mediaContent;
coverUrl = item.mediaUrl coverUrl = item.mediaUrl;
break break;
case 'INTRO': case 'INTRO':
hasIntro = true; hasIntro = true;
this.getTextDetail('introduce', item.mediaUrl); this.getTextDetail('introduce', item.mediaUrl);
...@@ -167,36 +141,26 @@ class AddVideoCourse extends React.Component { ...@@ -167,36 +141,26 @@ class AddVideoCourse extends React.Component {
return item; return item;
}); });
let categoryName; const _courseChapterVOList = courseChapterVOList.map((item) => {
if (categoryTwoName) {
categoryName = `${categoryOneName}-${categoryTwoName}`;
} else {
categoryName = `${categoryOneName}`;
}
const _courseChapterVOList = courseChapterVOList.map(item => {
item.mediaName = item.name; item.mediaName = item.name;
item.resourceId = item.id; item.resourceId = item.id;
return item return item;
}) });
this.setState({ this.setState({
loadintroduce: !hasIntro, loadintroduce: !hasIntro,
coverId, coverId,
coverUrl, coverUrl,
// videoName,
// videoDuration,
scheduleMedia, scheduleMedia,
courseName, courseName,
scheduleVideoUrl, scheduleVideoUrl,
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
categoryName,
categoryId, categoryId,
courseChapterList: _courseChapterVOList courseChapterList: _courseChapterVOList,
}) });
}) });
} };
getTextDetail = (key, url) => { getTextDetail = (key, url) => {
$.ajax({ $.ajax({
...@@ -211,7 +175,7 @@ class AddVideoCourse extends React.Component { ...@@ -211,7 +175,7 @@ class AddVideoCourse extends React.Component {
}; };
handleGoBack = () => { handleGoBack = () => {
const { coverId,courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state const { coverId, courseName, scheduleMedia, courseChapterList, categoryId, shelfState, whetherVisitorsJoin } = this.state;
if ( if (
!courseChapterList.length || !courseChapterList.length ||
!_.isEqual(scheduleMedia, defaultScheduleMedia) || !_.isEqual(scheduleMedia, defaultScheduleMedia) ||
...@@ -281,17 +245,17 @@ class AddVideoCourse extends React.Component { ...@@ -281,17 +245,17 @@ class AddVideoCourse extends React.Component {
// 显示预览弹窗 // 显示预览弹窗
handleShowPreviewModal = () => { handleShowPreviewModal = () => {
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia,introduce, courseChapterList, categoryName } = this.state const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, introduce, courseChapterList, categoryName } = this.state;
const courseBasinInfo = { const courseBasinInfo = {
coverUrl, coverUrl,
scheduleVideoUrl, scheduleVideoUrl,
courseName, courseName,
} };
const courseIntroInfo = { const courseIntroInfo = {
liveCourseMediaRequests: scheduleMedia, liveCourseMediaRequests: scheduleMedia,
introduce, introduce,
categoryName categoryName,
} };
const previewCourseModal = ( const previewCourseModal = (
<PreviewCourseModal <PreviewCourseModal
...@@ -311,42 +275,41 @@ class AddVideoCourse extends React.Component { ...@@ -311,42 +275,41 @@ class AddVideoCourse extends React.Component {
}; };
// 选择视频 // 选择视频
handleSelectVideo = (addFolderIds,selectedFileList) => { handleSelectVideo = (addFolderIds, selectedFileList) => {
this.setState({ this.setState({
showSelectFileModal: false showSelectFileModal: false,
}) });
let { courseChapterList } = this.state; let { courseChapterList } = this.state;
let _courseChapterList = [...courseChapterList]; let _courseChapterList = [...courseChapterList];
if(selectedFileList.length + courseChapterList.length > 20){ if (selectedFileList.length + courseChapterList.length > 20) {
message.warning(`最多只能上传20个文件`); message.warning(`最多只能上传20个文件`);
return; return;
} }
selectedFileList.map((file,index) => { selectedFileList.map((file, index) => {
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file; const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
const _mediaName =folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`,'') const _mediaName = folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`, '');
console.log('folderFormat',folderFormat); console.log('folderFormat', folderFormat);
if(folderFormat === 'MP4' || folderFormat === 'video/mp4'){ if (folderFormat === 'MP4' || folderFormat === 'video/mp4') {
const videoDom = document.createElement('video') const videoDom = document.createElement('video');
videoDom.src = ossUrl videoDom.src = ossUrl;
videoDom.onloadedmetadata = () => { videoDom.onloadedmetadata = () => {
_courseChapterList.push({ _courseChapterList.push({
mediaContent: resourceId, mediaContent: resourceId,
contentType: 'SCHEDULE', contentType: 'SCHEDULE',
mediaType: "VIDEO", mediaType: 'VIDEO',
mediaName: _mediaName, mediaName: _mediaName,
videoDuration: videoDom.duration, videoDuration: videoDom.duration,
resourceId, resourceId,
mediaUrl: ossUrl, mediaUrl: ossUrl,
sort: _courseChapterList.length sort: _courseChapterList.length,
}) });
this.setState({ this.setState({
courseChapterList: _courseChapterList courseChapterList: _courseChapterList,
}) });
} };
}else if( folderFormat==="WORD" || folderFormat==="PDF" || SUPPORT_WORD_PDF.indexOf(folderFormat)>-1){ } 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({ _courseChapterList.push({
mediaContent: resourceId, mediaContent: resourceId,
...@@ -355,60 +318,59 @@ class AddVideoCourse extends React.Component { ...@@ -355,60 +318,59 @@ class AddVideoCourse extends React.Component {
mediaName: _mediaName, mediaName: _mediaName,
resourceId, resourceId,
mediaUrl: ossUrl, mediaUrl: ossUrl,
sort: _courseChapterList.length sort: _courseChapterList.length,
}) });
this.setState({ this.setState({
courseChapterList: _courseChapterList courseChapterList: _courseChapterList,
}) });
}
})
} }
});
};
// 校验课节名称 // 校验课节名称
handleValidateChapterName = (chapterName)=> { handleValidateChapterName = (chapterName) => {
let hasError = false; let hasError = false;
return new Promise((resolve) => { return new Promise((resolve) => {
if(!chapterName) { if (!chapterName) {
this.setState({ this.setState({
chapterNameValidateStatus: "error", chapterNameValidateStatus: 'error',
chapterNameHelpMsg: '请输入课节名称' chapterNameHelpMsg: '请输入课节名称',
}) });
hasError = true; hasError = true;
resolve(false) resolve(false);
return false return false;
} }
if(chapterName.length > 40) { if (chapterName.length > 40) {
this.setState({ this.setState({
chapterNameValidateStatus: "error", chapterNameValidateStatus: 'error',
chapterNameHelpMsg: '不要超过40字' chapterNameHelpMsg: '不要超过40字',
}) });
hasError = true; hasError = true;
resolve(false) resolve(false);
return false return false;
} }
if(!hasError){ if (!hasError) {
resolve(true) resolve(true);
this.setState({ this.setState({
chapterNameValidateStatus: "", chapterNameValidateStatus: '',
chapterNameHelpMsg: "" chapterNameHelpMsg: '',
}) });
}
})
} }
});
};
// 保存 // 保存
handleSubmit = () => { handleSubmit = () => {
//过期判断 //过期判断
if (User.getExpirationTime() && moment().valueOf() > Number(User.getExpirationTime())) { if (User.getExpirationTime() && moment().valueOf() > Number(User.getExpirationTime())) {
Modal.warning({ Modal.warning({
title:"服务已到期", title: '服务已到期',
content: "当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买", content: '当前企业购买的小麦企学院服务已到期,如需继续使用学院功能,请尽快续费购买',
okText: "我知道了" okText: '我知道了',
}) });
return return;
} }
const { const {
...@@ -425,11 +387,11 @@ class AddVideoCourse extends React.Component { ...@@ -425,11 +387,11 @@ class AddVideoCourse extends React.Component {
introduce, introduce,
courseChapterList, courseChapterList,
editorTextLength, editorTextLength,
} = this.state } = this.state;
const commonParams = { const commonParams = {
// videoName, // videoName,
videoDuration:0, //后端的必要参数,不能传空 videoDuration: 0, //后端的必要参数,不能传空
scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent), scheduleMedia: scheduleMedia.filter((item) => !!item.mediaContent),
categoryId, categoryId,
courseName, courseName,
...@@ -439,11 +401,11 @@ class AddVideoCourse extends React.Component { ...@@ -439,11 +401,11 @@ class AddVideoCourse extends React.Component {
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
courseType: 'VOICE', courseType: 'VOICE',
courseChapterList courseChapterList,
} };
// 校验必填字段:课程名称, 课程视频 // 校验必填字段:课程名称, 课程视频
this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength).then((res) => { this.handleValidate(courseName, courseChapterList, categoryId, scheduleMedia, editorTextLength).then((res) => {
if (!res) return if (!res) return;
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => { Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } }); this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } });
}); });
...@@ -453,8 +415,8 @@ class AddVideoCourse extends React.Component { ...@@ -453,8 +415,8 @@ class AddVideoCourse extends React.Component {
submitRemote = ({ id, pageType, commonParams }) => { submitRemote = ({ id, pageType, commonParams }) => {
if (pageType === 'add') { if (pageType === 'add') {
Service.Hades('public/hades/createVideoSchedule', commonParams).then((res) => { Service.Hades('public/hades/createVideoSchedule', commonParams).then((res) => {
if (!res) return if (!res) return;
message.success('新建成功') message.success('新建成功');
window.RCHistory.push({ window.RCHistory.push({
pathname: `/video-course`, pathname: `/video-course`,
}); });
...@@ -462,11 +424,11 @@ class AddVideoCourse extends React.Component { ...@@ -462,11 +424,11 @@ class AddVideoCourse extends React.Component {
} else { } else {
const editParams = { const editParams = {
courseId: id, courseId: id,
...commonParams ...commonParams,
} };
Service.Hades('public/hades/editVideoSchedule', editParams).then((res) => { Service.Hades('public/hades/editVideoSchedule', editParams).then((res) => {
if (!res) return if (!res) return;
message.success('保存成功') message.success('保存成功');
window.RCHistory.push({ window.RCHistory.push({
pathname: `/video-course`, pathname: `/video-course`,
}); });
...@@ -482,9 +444,9 @@ class AddVideoCourse extends React.Component { ...@@ -482,9 +444,9 @@ class AddVideoCourse extends React.Component {
return false; return false;
} }
if (!courseChapterList.length) { if (!courseChapterList.length) {
message.warning('请上传课节') message.warning('请上传课节');
resolve(false) resolve(false);
return false return false;
} }
if (!categoryId) { if (!categoryId) {
message.warning('请选择课程分类'); message.warning('请选择课程分类');
...@@ -500,8 +462,8 @@ class AddVideoCourse extends React.Component { ...@@ -500,8 +462,8 @@ class AddVideoCourse extends React.Component {
}); });
}; };
handleSelectCover = (file) => { handleSelectCover = (file) => {
if(!file){ if (!file) {
message.info("请选择文件!"); message.info('请选择文件!');
return; return;
} }
this.setState({ this.setState({
...@@ -527,14 +489,14 @@ class AddVideoCourse extends React.Component { ...@@ -527,14 +489,14 @@ class AddVideoCourse extends React.Component {
this.setState({ this.setState({
showSelectCoverModal: false, showSelectCoverModal: false,
coverUrl: coverClicpPath, coverUrl: coverClicpPath,
coverId: coverId coverId: coverId,
}) });
} };
handleRenameCourseChapter = (chapterId, chapterIndex) => { handleRenameCourseChapter = (chapterId, chapterIndex) => {
const { mediaNameAlias } = this.state; const { mediaNameAlias } = this.state;
this.handleValidateChapterName(mediaNameAlias).then(res => { this.handleValidateChapterName(mediaNameAlias).then((res) => {
// 校验不通过不能点确定保存修改课节名称 // 校验不通过不能点确定保存修改课节名称
if (!res) { if (!res) {
return message.warning('重命名失败'); return message.warning('重命名失败');
...@@ -542,88 +504,89 @@ class AddVideoCourse extends React.Component { ...@@ -542,88 +504,89 @@ class AddVideoCourse extends React.Component {
let { courseChapterList } = this.state; let { courseChapterList } = this.state;
let _courseChapterList = []; let _courseChapterList = [];
_courseChapterList = courseChapterList.map((item,index)=>{ _courseChapterList = courseChapterList.map((item, index) => {
if(item.resourceId === chapterId && chapterIndex === index){ if (item.resourceId === chapterId && chapterIndex === index) {
item.mediaName = mediaNameAlias; item.mediaName = mediaNameAlias;
item.visible = false; item.visible = false;
} }
return item return item;
}) });
this.setState({ this.setState({
courseChapterList: _courseChapterList, courseChapterList: _courseChapterList,
chapterNameValidateStatus: '', chapterNameValidateStatus: '',
        chapterNameHelpMsg: '', chapterNameHelpMsg: '',
mediaNameAlias: '', mediaNameAlias: '',
})
}); });
});
};
} handleChangePopConfirmVisible = (chapterId, chapterNameIndex, visible) => {
handleChangePopConfirmVisible = (chapterId, chapterNameIndex, visible)=> {
let { courseChapterList } = this.state; let { courseChapterList } = this.state;
let _courseChapterList = []; let _courseChapterList = [];
_courseChapterList = courseChapterList.map((item,index)=>{ _courseChapterList = courseChapterList.map((item, index) => {
if(item.resourceId === chapterId && chapterNameIndex === index){ if (item.resourceId === chapterId && chapterNameIndex === index) {
item.visible = visible item.visible = visible;
} else { } else {
item.visible = false item.visible = false;
} }
return item return item;
}) });
this.setState({ this.setState({
courseChapterList: _courseChapterList, courseChapterList: _courseChapterList,
}) });
} };
handleDeleteCourseChapter = (chapterId, chapterIndex) => { handleDeleteCourseChapter = (chapterId, chapterIndex) => {
console.log('chapterId---',chapterId, chapterIndex); console.log('chapterId---', chapterId, chapterIndex);
let { courseChapterList } = this.state; let { courseChapterList } = this.state;
let _courseChapterList = courseChapterList.filter((item,index) => { 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) => { _courseChapterList.map((item, index) => {
item.sort = index item.sort = index;
}) });
this.setState({ this.setState({
courseChapterList :_courseChapterList courseChapterList: _courseChapterList,
}) });
} };
renderChapterTitle = (item) => { renderChapterTitle = (item) => {
const { chapterNameValidateStatus, chapterNameHelpMsg} = this.state; const { chapterNameValidateStatus, chapterNameHelpMsg } = this.state;
return <div className="course-chapter-title-popover"> return (
<div className="tag-title">课节名称</div> <div className='course-chapter-title-popover'>
<div className='tag-title'>课节名称</div>
<Form> <Form>
<Form.Item <Form.Item validateStatus={chapterNameValidateStatus} help={chapterNameHelpMsg}>
validateStatus={chapterNameValidateStatus}
help={chapterNameHelpMsg}
>
<TextArea <TextArea
defaultValue={item.mediaName} defaultValue={item.mediaName}
placeholder="请输入课节名称" placeholder='请输入课节名称'
maxLength={40} maxLength={40}
autoSize autoSize
style={{ width: '318px'}} style={{ width: '318px' }}
onChange={(e) => { onChange={(e) => {
this.setState({ this.setState(
mediaNameAlias: e.target.value.trim() {
}, () => { mediaNameAlias: e.target.value.trim(),
this.handleValidateChapterName(this.state.mediaNameAlias) },
}) () => {
this.handleValidateChapterName(this.state.mediaNameAlias);
}
);
}} }}
/> />
</Form.Item> </Form.Item>
</Form> </Form>
</div> </div>
} );
};
// 上下移动 // 上下移动
handleChangeIndex = (isUp, sortIndex) => { handleChangeIndex = (isUp, sortIndex) => {
const { courseChapterList} = this.state; const { courseChapterList } = this.state;
// 第一个上移和最后一个下移不能使用 // 第一个上移和最后一个下移不能使用
if((isUp && sortIndex === 0) || (!isUp && sortIndex === (courseChapterList.length -1))){ if ((isUp && sortIndex === 0) || (!isUp && sortIndex === courseChapterList.length - 1)) {
return; return;
} }
...@@ -631,12 +594,13 @@ class AddVideoCourse extends React.Component { ...@@ -631,12 +594,13 @@ class AddVideoCourse extends React.Component {
const temp = courseChapterList[sortIndex]; const temp = courseChapterList[sortIndex];
// 若上移 // 若上移
if(isUp){ if (isUp) {
_courseChapterList[sortIndex -1] = temp; _courseChapterList[sortIndex - 1] = temp;
_courseChapterList[sortIndex -1].sort = sortIndex -1; _courseChapterList[sortIndex - 1].sort = sortIndex - 1;
_courseChapterList[sortIndex] = courseChapterList[sortIndex - 1]; _courseChapterList[sortIndex] = courseChapterList[sortIndex - 1];
_courseChapterList[sortIndex].sort = sortIndex; _courseChapterList[sortIndex].sort = sortIndex;
} else { // 若下移 } else {
// 若下移
_courseChapterList[sortIndex + 1] = temp; _courseChapterList[sortIndex + 1] = temp;
_courseChapterList[sortIndex + 1].sort = sortIndex + 1; _courseChapterList[sortIndex + 1].sort = sortIndex + 1;
_courseChapterList[sortIndex] = courseChapterList[sortIndex + 1]; _courseChapterList[sortIndex] = courseChapterList[sortIndex + 1];
...@@ -644,50 +608,60 @@ class AddVideoCourse extends React.Component { ...@@ -644,50 +608,60 @@ class AddVideoCourse extends React.Component {
} }
this.setState({ this.setState({
courseChapterList: _courseChapterList courseChapterList: _courseChapterList,
}) });
} };
renderTypemenu =()=>{ renderTypemenu = () => {
return <Menu> return (
<Menu>
<Menu.Item> <Menu.Item>
<span onClick={()=>{this.selectFileType("VIDEO")}}> <span
onClick={() => {
this.selectFileType('VIDEO');
}}>
视频文件 视频文件
</span> </span>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<span onClick={()=>{this.selectFileType("WORD_PDF")}}> <span
onClick={() => {
this.selectFileType('WORD_PDF');
}}>
资料文件 资料文件
</span> </span>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
} );
selectFileType = (type) =>{ };
selectFileType = (type) => {
const { courseChapterList } = this.state; const { courseChapterList } = this.state;
if(courseChapterList.length >= 20) { if (courseChapterList.length >= 20) {
message.warning(`最多只能上传20个文件`); message.warning(`最多只能上传20个文件`);
return; return;
} }
if(type==="VIDEO"){ if (type === 'VIDEO') {
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
selectTypeList:['MP4'], selectTypeList: ['MP4'],
accept:'video/mp4' accept: 'video/mp4',
}) });
}else{ } else {
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
selectTypeList:['DOC','DOCX','PDF'], selectTypeList: ['DOC', 'DOCX', 'PDF'],
accept:'.doc,.docx,.pdf' accept: '.doc,.docx,.pdf',
}) });
}
} }
};
renderToolTipTitle = ()=> { renderToolTipTitle = () => {
return (<div> return (
<div>
<p>视频支持mp4格式,大小不超过2G;</p> <p>视频支持mp4格式,大小不超过2G;</p>
<p>文件支持PDF、docx、doc格式,大小不超过100M</p> <p>文件支持PDF、docx、doc格式,大小不超过100M</p>
</div>) </div>
} );
};
render() { render() {
const { const {
...@@ -699,21 +673,19 @@ class AddVideoCourse extends React.Component { ...@@ -699,21 +673,19 @@ class AddVideoCourse extends React.Component {
diskList, diskList,
// videoType, // videoType,
shelfState, shelfState,
categoryName, categoryId,
courseCatalogList,
whetherVisitorsJoin, whetherVisitorsJoin,
visible, visible,
showSelectCoverModal, showSelectCoverModal,
hasImgReady,
cutImageBlob,
introduce, introduce,
loadintroduce, loadintroduce,
id, id,
courseChapterList, courseChapterList,
imageFile, imageFile,
selectTypeList, selectTypeList,
accept accept,
} = this.state } = this.state;
const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'; const defaultCover = 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png';
const isDefaultCover = coverUrl === defaultCover || coverUrl == null; const isDefaultCover = coverUrl === defaultCover || coverUrl == null;
...@@ -745,71 +717,100 @@ class AddVideoCourse extends React.Component { ...@@ -745,71 +717,100 @@ class AddVideoCourse extends React.Component {
<span className='label required upload-chapter'>上传课节:</span> <span className='label required upload-chapter'>上传课节:</span>
</div> </div>
<div className='sub-content'> <div className='sub-content'>
<div className="btn-wrap"> <div className='btn-wrap'>
{/* <Button
onClick={() => {
if(courseChapterList.length >= 20) {
message.warning(`最多只能上传20个文件`);
return;
}
this.setState({
showSelectFileModal: true
})
}}>添加视频</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'}}> &#xe61d;</i> <i className='icon iconfont' style={{ cursor: 'pointer', color: '#bfbfbf', fontSize: '14px' }}>
{' '}
&#xe61d;
</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'>{item.mediaName && item.mediaName.length > 24 ? <Tooltip title={item.mediaName}>{item.mediaName}</Tooltip>:item.mediaName}</div> <div className='course-ware__name'>
<div className="course-chapter__opt" id={item.resourceId}> {item.mediaName && item.mediaName.length > 24 ? <Tooltip title={item.mediaName}>{item.mediaName}</Tooltip> : item.mediaName}
<div className={`up ${Number(index) === 0 ? 'disabled':''}`} onClick={()=> this.handleChangeIndex(true,item.sort,item.resourceId)}>上移</div> </div>
<div className="line">|</div> <div className='course-chapter__opt' id={item.resourceId}>
<div className={`down ${Number(index) === (courseChapterList.length - 1) ? 'disabled':''}`} onClick={()=> this.handleChangeIndex(false,item.sort,item.resourceId)}>下移</div> <div
<div className="line">|</div> className={`up ${Number(index) === 0 ? 'disabled' : ''}`}
onClick={() => this.handleChangeIndex(true, item.sort, item.resourceId)}>
上移
</div>
<div className='line'>|</div>
<div
className={`down ${Number(index) === courseChapterList.length - 1 ? 'disabled' : ''}`}
onClick={() => this.handleChangeIndex(false, item.sort, item.resourceId)}>
下移
</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' trigger="click" color='#fff'
overlayClassName="chapter-popover" trigger='click'
getPopupContainer={() => overlayClassName='chapter-popover'
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 && this.setState({ !visible &&
chapterNameValidateStatus: '', this.setState({
        chapterNameHelpMsg: '', chapterNameValidateStatus: '',
chapterNameHelpMsg: '',
mediaNameAlias: '', mediaNameAlias: '',
}) });
}} }}
onCancel={()=> this.handleChangePopConfirmVisible(item.resourceId, index, false)} onCancel={() => this.handleChangePopConfirmVisible(item.resourceId, index, false)}>
> <div
<div className="rename" onClick={() => {this.setState({mediaNameAlias: item.mediaName}, ()=>{ className='rename'
this.handleChangePopConfirmVisible(item.resourceId, index, true)}) onClick={() => {
}}>重命名</div> this.setState({ mediaNameAlias: item.mediaName }, () => {
this.handleChangePopConfirmVisible(item.resourceId, index, true);
});
}}>
重命名
</div>
</Popconfirm> </Popconfirm>
<div className="line">|</div> <div className='line'>|</div>
<div className="delete" onClick={()=>this.handleDeleteCourseChapter(item.resourceId, index)}>移除</div> <div className='delete' onClick={() => this.handleDeleteCourseChapter(item.resourceId, index)}>
移除
</div> </div>
</div> </div>
}) </div>
} );
})}
</div> </div>
</div> </div>
</If> </If>
...@@ -821,15 +822,15 @@ class AddVideoCourse extends React.Component { ...@@ -821,15 +822,15 @@ class AddVideoCourse extends React.Component {
<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>
...@@ -838,9 +839,7 @@ class AddVideoCourse extends React.Component { ...@@ -838,9 +839,7 @@ class AddVideoCourse extends React.Component {
</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>
...@@ -848,38 +847,12 @@ class AddVideoCourse extends React.Component { ...@@ -848,38 +847,12 @@ class AddVideoCourse extends React.Component {
</div> </div>
<div className='course-catalog required'> <div className='course-catalog required'>
<span className='label'>课程分类:</span> <span className='label'>课程分类:</span>
{pageType === 'add' && ( <CourseCatalogSelect
<Cascader value={categoryId}
defaultValue={[]} onChange={(value, label) => {
options={courseCatalogList} this.handleChangeCatalogList(value, label);
displayRender={(label) => label.join('-')} }}
fieldNames={fieldNames}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder='请选择课程分类'
suffixIcon={
<span className='icon iconfont' style={{ fontSize: '12px', color: '#BFBFBF' }}>
&#xe835;
</span>
}
/>
)}
{pageType === 'edit' && categoryName && (
<Cascader
defaultValue={[categoryName]}
options={courseCatalogList}
displayRender={(label) => label.join('-')}
fieldNames={fieldNames}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder='请选择课程分类'
suffixIcon={
<span className='icon iconfont' style={{ fontSize: '12px', color: '#BFBFBF' }}>
&#xe835;
</span>
}
/> />
)}
</div> </div>
<div className='intro-info mt16'> <div className='intro-info mt16'>
<AddVideoIntro <AddVideoIntro
...@@ -915,7 +888,7 @@ class AddVideoCourse extends React.Component { ...@@ -915,7 +888,7 @@ class AddVideoCourse extends React.Component {
queryTypeEnum={'ONLINE'} queryTypeEnum={'ONLINE'}
confirm={{ confirm={{
title: '文件过大,无法上传', title: '文件过大,无法上传',
content: '上传的视频大小不能超过2G,文件大小不能超过100M' content: '上传的视频大小不能超过2G,文件大小不能超过100M',
}} }}
tooltip={''} tooltip={''}
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
......
import React from "react" import React from 'react'
import { Modal, message, Tooltip, Switch, Dropdown } from "antd" import { Modal, message, Tooltip, Switch, Dropdown } from 'antd'
import _ from "underscore" import _ from 'underscore'
import { PageControl } from "@/components" import { PageControl } from '@/components'
import { LIVE_SHARE } from "@/domains/course-domain/constants" import { LIVE_SHARE } from '@/domains/course-domain/constants'
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom'
import ShareLiveModal from "@/modules/course-manage/modal/ShareLiveModal" import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal'
import CourseService from "@/domains/course-domain/CourseService" import CourseService from '@/domains/course-domain/CourseService'
import RelatedPlanModal from "../../modal/RelatedPlanModal" import RelatedPlanModal from '../../modal/RelatedPlanModal'
import User from "@/common/js/user" import User from '@/common/js/user'
import VideoCourseDetail from '../VideoCourseDetail'; import VideoCourseDetail from '../VideoCourseDetail'
import WatchData from "./WatchData"; import WatchData from './WatchData'
import { XMTable } from '@/components'; import { XMTable } from '@/components'
import college from '@/common/lottie/college'; import college from '@/common/lottie/college'
import "./VideoCourseList.less" import './VideoCourseList.less'
class VideoCourseList extends React.Component { class VideoCourseList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
id: '', // 视频课ID id: '', // 视频课ID
studentIds: [], studentIds: [],
...@@ -24,54 +24,48 @@ class VideoCourseList extends React.Component { ...@@ -24,54 +24,48 @@ class VideoCourseList extends React.Component {
selectPlanList: {}, selectPlanList: {},
ShelfLoading: false, ShelfLoading: false,
// dataSource: [], // dataSource: [],
}; }
} }
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)
} }
} }
// 跳转课程详情页 // 跳转课程详情页
handleLinkToCourseDetail = (courseId) => { handleLinkToCourseDetail = (courseId) => {
const { match } = this.props; const { match } = this.props
window.RCHistory.push(`${match.url}/video-course-detail?courseId=${courseId}`) window.RCHistory.push(`${match.url}/video-course-detail?courseId=${courseId}`)
} }
// 观看数据弹窗 // 观看数据弹窗
handleShowWatchDataModal = (item) => { handleShowWatchDataModal = (item) => {
const { match } = this.props; const { match } = this.props
window.RCHistory.push({ window.RCHistory.push({
pathname: `${match.url}/course-data?courseName=${item.courseName}&courseId=${item.id}` pathname: `${match.url}/course-data?courseName=${item.courseName}&courseId=${item.id}`,
}) })
} }
// 请求表头 // 请求表头
parseColumns = () => { parseColumns = () => {
const { type } = this.props; const { type } = this.props
const { ShelfLoading } = this.state; const { ShelfLoading } = this.state
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 <img className='course-cover' src={coverUrl || 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'} alt='封面图' />
className='course-cover'
src={
coverUrl || 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'
}
alt='封面图'
/>
<Choose> <Choose>
<When condition={record.courseName.length > 25}> <When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}> <Tooltip title={record.courseName}>
...@@ -83,7 +77,7 @@ class VideoCourseList extends React.Component { ...@@ -83,7 +77,7 @@ class VideoCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
); )
}, },
}, },
{ {
...@@ -99,35 +93,23 @@ class VideoCourseList extends React.Component { ...@@ -99,35 +93,23 @@ class VideoCourseList extends React.Component {
</If> </If>
</span> </span>
), ),
key: "categoryName", key: 'categoryName',
dataIndex: "categoryName", dataIndex: 'categoryName',
width: 150, width: 150,
render: (val, record) => { render: (val, record) => {
return ( return <div className='record__item'>{record.categorySonName}</div>
<Choose>
<When condition={type === 'internal'}>
<div className='record__item'>
{record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div>
</When>
<Otherwise>
<div className='record__item'>{record.categorySonName}</div>
</Otherwise>
</Choose>
);
}, },
}, },
{ {
title: '课节数', title: '课节数',
key: 'chapterNum', key: 'chapterNum',
dataIndex: 'chapterNum', dataIndex: 'chapterNum',
className: "chapterNum", className: 'chapterNum',
width: 100, width: 100,
align: 'right', align: 'right',
render: (val,item) => { render: (val, item) => {
return <div onClick={()=>this.handleLinkToCourseDetail(item.id)}>{val || 1}</div> return <div onClick={() => this.handleLinkToCourseDetail(item.id)}>{val || 1}</div>
} },
}, },
{ {
title: ( title: (
...@@ -158,26 +140,30 @@ class VideoCourseList extends React.Component { ...@@ -158,26 +140,30 @@ class VideoCourseList extends React.Component {
checked={item.shelfState === 'YES'} checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState} defaultChecked={item.shelfState}
onClick={(checked) => { onClick={(checked) => {
this.changeShelfState(checked, item, index); this.changeShelfState(checked, item, index)
}} }}
/> />
); )
}, },
}, },
{ {
title: "观看学员数", title: '观看学员数',
width: 150, width: 150,
key: "watchUserCount", key: 'watchUserCount',
dataIndex: "watchUserCount", dataIndex: 'watchUserCount',
align: 'right', align: 'right',
render: (val, item) => { render: (val, item) => {
return <div className='watchUserCount' onClick={() => this.handleShowWatchDataModal(item)}>{val || 0}</div> return (
} <div className='watchUserCount' onClick={() => this.handleShowWatchDataModal(item)}>
{val || 0}
</div>
)
},
}, },
{ {
title: "创建人", title: '创建人',
key: "createName", key: 'createName',
dataIndex: "createName", dataIndex: 'createName',
width: 100, width: 100,
render: (val) => { render: (val) => {
return ( return (
...@@ -189,7 +175,7 @@ class VideoCourseList extends React.Component { ...@@ -189,7 +175,7 @@ class VideoCourseList extends React.Component {
)} )}
</div> </div>
) )
} },
}, },
{ {
title: '创建时间', title: '创建时间',
...@@ -198,7 +184,7 @@ class VideoCourseList extends React.Component { ...@@ -198,7 +184,7 @@ class VideoCourseList extends React.Component {
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)
}, },
}, },
{ {
...@@ -208,7 +194,7 @@ class VideoCourseList extends React.Component { ...@@ -208,7 +194,7 @@ class VideoCourseList extends React.Component {
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)
}, },
}, },
{ {
...@@ -227,7 +213,7 @@ class VideoCourseList extends React.Component { ...@@ -227,7 +213,7 @@ class VideoCourseList extends React.Component {
<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>
...@@ -236,7 +222,7 @@ class VideoCourseList extends React.Component { ...@@ -236,7 +222,7 @@ class VideoCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
); )
}, },
}, },
{ {
...@@ -248,7 +234,7 @@ class VideoCourseList extends React.Component { ...@@ -248,7 +234,7 @@ class VideoCourseList extends React.Component {
render: (val, record) => { render: (val, record) => {
return ( return (
<div className='operate'> <div className='operate'>
<If condition={type === "internal"}> <If condition={type === 'internal'}>
<div className='operate__item' onClick={() => this.handleShowShareModal(record)}> <div className='operate__item' onClick={() => this.handleShowShareModal(record)}>
分享 分享
</div> </div>
...@@ -263,17 +249,17 @@ class VideoCourseList extends React.Component { ...@@ -263,17 +249,17 @@ class VideoCourseList extends React.Component {
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
); )
}, },
}, },
]; ]
type !== 'internal' && columns.splice(5, 1); type !== 'internal' && columns.splice(5, 1)
return columns; return columns
}; }
renderMoreOperate = (item) => { renderMoreOperate = (item) => {
const { type } = this.props; const { type } = this.props
return ( return (
<div className='live-course-more-menu'> <div className='live-course-more-menu'>
<If condition={type !== 'internal'}> <If condition={type !== 'internal'}>
...@@ -290,7 +276,7 @@ class VideoCourseList extends React.Component { ...@@ -290,7 +276,7 @@ class VideoCourseList extends React.Component {
<div <div
className='operate__item' className='operate__item'
onClick={() => { onClick={() => {
window.RCHistory.push(`/create-video-course?type=edit&id=${item.id}`); window.RCHistory.push(`/create-video-course?type=edit&id=${item.id}`)
}}> }}>
编辑 编辑
</div> </div>
...@@ -299,41 +285,41 @@ class VideoCourseList extends React.Component { ...@@ -299,41 +285,41 @@ class VideoCourseList extends React.Component {
</div> </div>
</If> </If>
</div> </div>
); )
}; }
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;
};
//改变上架状态 //改变上架状态
changeShelfState = (checked, item, index) => { changeShelfState = (checked, item, index) => {
let _shelfState = checked ? 'YES' : 'NO'; let _shelfState = checked ? 'YES' : 'NO'
if (checked) { if (checked) {
_shelfState = 'YES'; _shelfState = 'YES'
} else { } else {
_shelfState = 'NO'; _shelfState = 'NO'
} }
const params = { const params = {
courseId: item.id, courseId: item.id,
shelfState: _shelfState, shelfState: _shelfState,
}; }
CourseService.changeVideoShelfState(params).then(() => { CourseService.changeVideoShelfState(params).then(() => {
if (_shelfState === 'YES') { if (_shelfState === 'YES') {
message.success('已开启展示'); message.success('已开启展示')
} else { } else {
message.success('已取消展示'); message.success('已取消展示')
}
this.props.changeShelfState(index, _shelfState)
})
} }
this.props.changeShelfState(index, _shelfState);
});
};
// 删除线上课 // 删除线上课
handleDeleteVideoCourse = (scheduleId) => { handleDeleteVideoCourse = (scheduleId) => {
...@@ -348,28 +334,28 @@ class VideoCourseList extends React.Component { ...@@ -348,28 +334,28 @@ class VideoCourseList extends React.Component {
const param = { const param = {
courseId: scheduleId, courseId: scheduleId,
storeId: User.getStoreId(), storeId: User.getStoreId(),
}; }
CourseService.delVideoSchedule(param).then(() => { CourseService.delVideoSchedule(param).then(() => {
message.success('删除成功'); message.success('删除成功')
this.props.onChange(); this.props.onChange()
}); })
}, },
}); })
}; }
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (record, needStr = false) => { handleShowShareModal = (record, needStr = false) => {
const { type } = this.props; const { type } = this.props
const { id, scheduleVideoUrl } = record; const { id, scheduleVideoUrl } = record
const htmlUrl = `${LIVE_SHARE}video_detail/${id}?id=${User.getStoreId()}`; const htmlUrl = `${LIVE_SHARE}video_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
...@@ -381,82 +367,82 @@ class VideoCourseList extends React.Component { ...@@ -381,82 +367,82 @@ class VideoCourseList extends React.Component {
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 { dataSource = [], totalCount, query, type, match } = this.props; const { dataSource = [], totalCount, query, type, match } = this.props
const { current, size } = query; const { current, size } = query
const { RelatedPlanModalVisible, selectPlanList, selectCourseId } = this.state; const { RelatedPlanModalVisible, selectPlanList, selectCourseId } = this.state
return ( return (
<div className={`video-course-list ${type !== 'internal' ? 'video-course-list-mt' : ''}`}> <div className={`video-course-list ${type !== 'internal' ? 'video-course-list-mt' : ''}`}>
<XMTable <XMTable
...@@ -480,8 +466,8 @@ class VideoCourseList extends React.Component { ...@@ -480,8 +466,8 @@ class VideoCourseList extends React.Component {
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>
...@@ -500,8 +486,8 @@ class VideoCourseList extends React.Component { ...@@ -500,8 +486,8 @@ class VideoCourseList extends React.Component {
<Route path={`${match.url}/video-course-detail`} component={VideoCourseDetail} /> <Route path={`${match.url}/video-course-detail`} component={VideoCourseDetail} />
<Route path={`${match.url}/course-data`} component={WatchData} /> <Route path={`${match.url}/course-data`} component={WatchData} />
</div> </div>
); )
} }
} }
export default withRouter(VideoCourseList); export default withRouter(VideoCourseList)
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react'
import { Select, Tooltip, Carousel, Popover } from 'antd'; import { Select, Tooltip, Carousel, Popover } from 'antd'
import DataSet from "@antv/data-set"; import DataSet from '@antv/data-set'
import { Chart as G2Chart } from '@antv/g2'; import { Chart as G2Chart } from '@antv/g2'
import { import { G2, Chart, Geom, Axis, Tooltip as G2Tooltip, Coord, Label, Legend, View, Guide, Shape, Facet, Util } from 'bizcharts'
G2,
Chart,
Geom,
Axis,
Tooltip as G2Tooltip,
Coord,
Label,
Legend,
View,
Guide,
Shape,
Facet,
Util
} from "bizcharts";
import moment from 'moment' import moment from 'moment'
import Service from "@/common/js/service"; import Service from '@/common/js/service'
import User from '@/common/js/user'; import User from '@/common/js/user'
import HomeTip from './HomeTip'; import HomeTip from './HomeTip'
import './Home.less'; import './Home.less'
const Option = Select.Option; const Option = Select.Option
class Home extends React.Component { class Home extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
scheduleType: 'LIVE', scheduleType: 'LIVE',
list: [], list: [],
...@@ -48,54 +34,54 @@ class Home extends React.Component { ...@@ -48,54 +34,54 @@ class Home extends React.Component {
incWeekVisitCustomerNum: 0, incWeekVisitCustomerNum: 0,
courseNum: 0, //课程总数 courseNum: 0, //课程总数
inCourseNum: 0, //本月新增课程总数 inCourseNum: 0, //本月新增课程总数
}; }
this._chart = null; this._chart = null
} }
componentDidMount() { componentDidMount() {
this.getPanelInfo(); this.getPanelInfo()
this.getStudyInfo(); this.getStudyInfo()
this.getHotCourse(); this.getHotCourse()
this.getTrainingInfo(); this.getTrainingInfo()
} }
getTrainingInfo() { getTrainingInfo() {
Service.Hades('public/hades/planOverview', { storeId: User.getStoreId() }).then((res) => { Service.Hades('public/hades/planOverview', { storeId: User.getStoreId() }).then((res) => {
if (res.success) { if (res.success) {
this.setState(res.result); this.setState(res.result)
} }
}); })
} }
getHotCourse() { getHotCourse() {
const { timeRange, scheduleType } = this.state; const { timeRange, scheduleType } = this.state
const data = { const data = {
hotNum: 5, hotNum: 5,
scheduleType, scheduleType,
storeId: User.getStoreId(), storeId: User.getStoreId(),
timeRange, timeRange,
}; }
Service.Hades('public/courseCloud/hotCourse', data).then((res) => { Service.Hades('public/courseCloud/hotCourse', data).then((res) => {
if (res.success) { if (res.success) {
this.setState({ this.setState({
list: res.result, list: res.result,
}); })
} }
}); })
} }
getStudyInfo() { getStudyInfo() {
const { studyTimeRange } = this.state; const { studyTimeRange } = this.state
Service.Hades('public/hades/studyInfo', { storeId: User.getStoreId(), timeRange: studyTimeRange }).then((res) => { Service.Hades('public/hades/studyInfo', { storeId: User.getStoreId(), timeRange: studyTimeRange }).then((res) => {
if (res.success) { if (res.success) {
const dataList = res.result.map((item) => ({ const dataList = res.result.map((item) => ({
time: moment(item.dateline).format('MM-DD'), time: moment(item.dateline).format('MM-DD'),
studyNum: item.studyNum, studyNum: item.studyNum,
studyTime: Math.round(item.studyTime / 6) / 10, studyTime: Math.round(item.studyTime / 6) / 10,
})); }))
this.createChart(dataList); this.createChart(dataList)
} }
}); })
} }
getPanelInfo() { getPanelInfo() {
...@@ -120,22 +106,22 @@ class Home extends React.Component { ...@@ -120,22 +106,22 @@ class Home extends React.Component {
incWeekVisitCustomerNum: res.result.incWeekVisitCustomerNum, incWeekVisitCustomerNum: res.result.incWeekVisitCustomerNum,
courseNum: res.result.videoCourseNum + res.result.liveCourseNum + res.result.pictureCourseNum + res.result.offlineCourseNum, courseNum: res.result.videoCourseNum + res.result.liveCourseNum + res.result.pictureCourseNum + res.result.offlineCourseNum,
inCourseNum: res.result.incLiveCourseNum + res.result.incVideoCourseNum + res.result.incPictureCourseNum + res.result.incOfflineCourseNum, inCourseNum: res.result.incLiveCourseNum + res.result.incVideoCourseNum + res.result.incPictureCourseNum + res.result.incOfflineCourseNum,
}); })
} }
}); })
} }
showNumber(index) { showNumber(index) {
switch (index) { switch (index) {
case 0: case 0:
return 'https://image.xiaomaiketang.com/xm/D64QhNn74S.png'; return 'https://image.xiaomaiketang.com/xm/D64QhNn74S.png'
case 1: case 1:
return 'https://image.xiaomaiketang.com/xm/Qfib4mnGJT.png'; return 'https://image.xiaomaiketang.com/xm/Qfib4mnGJT.png'
case 2: case 2:
return 'https://image.xiaomaiketang.com/xm/8jKXHyrDaG.png'; return 'https://image.xiaomaiketang.com/xm/8jKXHyrDaG.png'
default: default:
return 'https://image.xiaomaiketang.com/xm/D64QhNn74S.png'; return 'https://image.xiaomaiketang.com/xm/D64QhNn74S.png'
} }
} }
...@@ -146,28 +132,28 @@ class Home extends React.Component { ...@@ -146,28 +132,28 @@ class Home extends React.Component {
forceFit: true, forceFit: true,
height: 290, height: 290,
padding: [48, 64], padding: [48, 64],
}); })
} }
this._chart.clear(); this._chart.clear()
this._chart.source(data, { this._chart.source(data, {
studyTime: { studyTime: {
formatter: (val) => { formatter: (val) => {
return val; return val
}, },
tickCount: 5, tickCount: 5,
}, },
time: { time: {
formatter: (val) => { formatter: (val) => {
return `${val}`; return `${val}`
}, },
}, },
studyNum: { studyNum: {
formatter: (val) => { formatter: (val) => {
return val; return val
}, },
tickCount: 5, tickCount: 5,
}, },
}); })
this._chart.axis('time', { this._chart.axis('time', {
label: { label: {
offset: 20, offset: 20,
...@@ -182,7 +168,7 @@ class Home extends React.Component { ...@@ -182,7 +168,7 @@ class Home extends React.Component {
tickLine: { tickLine: {
stroke: '#E8E8E8', stroke: '#E8E8E8',
}, },
}); })
this._chart.axis('submitCount', { this._chart.axis('submitCount', {
label: { label: {
textStyle: { textStyle: {
...@@ -190,7 +176,7 @@ class Home extends React.Component { ...@@ -190,7 +176,7 @@ class Home extends React.Component {
fontSize: 14, fontSize: 14,
}, },
}, },
}); })
this._chart.axis('studyTime', { this._chart.axis('studyTime', {
label: { label: {
textStyle: { textStyle: {
...@@ -198,7 +184,7 @@ class Home extends React.Component { ...@@ -198,7 +184,7 @@ class Home extends React.Component {
fontSize: 14, fontSize: 14,
}, },
}, },
}); })
this._chart this._chart
.line() .line()
.position('time*studyNum') .position('time*studyNum')
...@@ -207,8 +193,8 @@ class Home extends React.Component { ...@@ -207,8 +193,8 @@ class Home extends React.Component {
return { return {
name: '学习人数', name: '学习人数',
value: studyNum + '人', value: studyNum + '人',
}; }
}); })
this._chart this._chart
.line() .line()
.position('time*studyTime') .position('time*studyTime')
...@@ -217,10 +203,10 @@ class Home extends React.Component { ...@@ -217,10 +203,10 @@ class Home extends React.Component {
return { return {
name: '人均学习时长', name: '人均学习时长',
value: studyTime + '分钟', value: studyTime + '分钟',
}; }
}); })
this._chart.legend(false); this._chart.legend(false)
this._chart.tooltip({ this._chart.tooltip({
containerTpl: containerTpl:
'<div class="g2-tooltip" style="background: #fff !important;">' + '<div class="g2-tooltip" style="background: #fff !important;">' +
...@@ -228,9 +214,9 @@ class Home extends React.Component { ...@@ -228,9 +214,9 @@ class Home extends React.Component {
'<ul class="g2-tooltip-list"></ul></div>', // tooltip 容器模板 '<ul class="g2-tooltip-list"></ul></div>', // tooltip 容器模板
itemTpl: itemTpl:
'<li data-index={index}><span style="background-color:{color};width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:8px;"></span>{name}<span style="display: inline-block; float: right; margin-left: 30px;">{value}</span></li>', // tooltip 每项记录的默认模板 '<li data-index={index}><span style="background-color:{color};width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:8px;"></span>{name}<span style="display: inline-block; float: right; margin-left: 30px;">{value}</span></li>', // tooltip 每项记录的默认模板
}); })
this._chart.render(); this._chart.render()
}; }
render() { render() {
const { const {
...@@ -259,7 +245,7 @@ class Home extends React.Component { ...@@ -259,7 +245,7 @@ class Home extends React.Component {
offlineCourseNum, offlineCourseNum,
weekVisitCustomerNum, weekVisitCustomerNum,
incWeekVisitCustomerNum, incWeekVisitCustomerNum,
} = this.state; } = this.state
const data = [ const data = [
{ {
item: '已完成培训', item: '已完成培训',
...@@ -269,26 +255,26 @@ class Home extends React.Component { ...@@ -269,26 +255,26 @@ class Home extends React.Component {
item: '未完成培训', item: '未完成培训',
count: unfinishedNum, count: unfinishedNum,
}, },
]; ]
const { DataView } = DataSet; const { DataView } = DataSet
const { Html } = Guide; const { Html } = Guide
const sum = data[0].count + data[1].count; const sum = data[0].count + data[1].count
const dv = new DataView(); const dv = new DataView()
sum && sum &&
dv.source(data).transform({ dv.source(data).transform({
type: 'percent', type: 'percent',
field: 'count', field: 'count',
dimension: 'item', dimension: 'item',
as: 'percent', as: 'percent',
}); })
const cols = { const cols = {
percent: { percent: {
formatter: (val) => { formatter: (val) => {
val = val * 100 + '%'; val = val * 100 + '%'
return val; return val
}, },
}, },
}; }
return ( return (
<div className='home-page'> <div className='home-page'>
<HomeTip /> <HomeTip />
...@@ -359,7 +345,7 @@ class Home extends React.Component { ...@@ -359,7 +345,7 @@ class Home extends React.Component {
</div> </div>
</div> </div>
<div className='course-item'> <div className='course-item'>
<div className='course-title'>线下</div> <div className='course-title'>线下活动</div>
<div className='data'> <div className='data'>
<span className='course-number'>{offlineCourseNum}</span> <span className='course-number'>{offlineCourseNum}</span>
{incOfflineCourseNum > 0 && <span className='icon iconfont'>&#xe635;</span>} {incOfflineCourseNum > 0 && <span className='icon iconfont'>&#xe635;</span>}
...@@ -409,8 +395,9 @@ class Home extends React.Component { ...@@ -409,8 +395,9 @@ class Home extends React.Component {
</span> </span>
<span <span
className={`tab${scheduleType === 'VOICE' ? ' selected' : ''}`} className={`tab${scheduleType === 'VOICE' ? ' selected' : ''}`}
onClick={() => this.setState({ scheduleType: 'VOICE' }, () => this.getHotCourse())} onClick={() => this.setState({ scheduleType: 'VOICE' }, () => this.getHotCourse())}>
>线上课</span> 线上课
</span>
<span <span
className={`tab${scheduleType === 'PICTURE' ? ' selected' : ''}`} className={`tab${scheduleType === 'PICTURE' ? ' selected' : ''}`}
onClick={() => this.setState({ scheduleType: 'PICTURE' }, () => this.getHotCourse())}> onClick={() => this.setState({ scheduleType: 'PICTURE' }, () => this.getHotCourse())}>
...@@ -429,7 +416,7 @@ class Home extends React.Component { ...@@ -429,7 +416,7 @@ class Home extends React.Component {
style={{ width: 88 }} style={{ width: 88 }}
value={timeRange} value={timeRange}
onChange={(value) => { onChange={(value) => {
this.setState({ timeRange: value }, () => this.getHotCourse()); this.setState({ timeRange: value }, () => this.getHotCourse())
}}> }}>
<Option value='7'>近7天</Option> <Option value='7'>近7天</Option>
<Option value='15'>近15天</Option> <Option value='15'>近15天</Option>
...@@ -509,11 +496,11 @@ class Home extends React.Component { ...@@ -509,11 +496,11 @@ class Home extends React.Component {
tooltip={[ tooltip={[
'item*percent', 'item*percent',
(item, percent) => { (item, percent) => {
percent = Math.round(percent * 100) + '%'; percent = Math.round(percent * 100) + '%'
return { return {
name: item, name: item,
value: percent, value: percent,
}; }
}, },
]} ]}
style={{ style={{
...@@ -567,7 +554,7 @@ class Home extends React.Component { ...@@ -567,7 +554,7 @@ class Home extends React.Component {
style={{ width: 88 }} style={{ width: 88 }}
value={studyTimeRange} value={studyTimeRange}
onChange={(value) => { onChange={(value) => {
this.setState({ studyTimeRange: value }, () => this.getStudyInfo()); this.setState({ studyTimeRange: value }, () => this.getStudyInfo())
}}> }}>
<Option value='7'>近7天</Option> <Option value='7'>近7天</Option>
<Option value='15'>近15天</Option> <Option value='15'>近15天</Option>
...@@ -595,8 +582,8 @@ class Home extends React.Component { ...@@ -595,8 +582,8 @@ class Home extends React.Component {
</div> </div>
</div> </div>
</div> </div>
); )
} }
} }
export default Home; export default Home
...@@ -5,57 +5,43 @@ ...@@ -5,57 +5,43 @@
* @Last Modified time: 2020-06-23 14:54:14 * @Last Modified time: 2020-06-23 14:54:14
* @Description: 网络磁盘(我的文件、公共文件、员工文件) * @Description: 网络磁盘(我的文件、公共文件、员工文件)
*/ */
import React from 'react'; import React from 'react'
import { DISK_MAP } from '@/common/constants/academic/lessonEnum'
import { DISK_MAP } from "@/common/constants/academic/lessonEnum";
function DiskList(props) { function DiskList(props) {
const { diskList, currentRootDisk } = props
const { diskList, currentRootDisk } = props;
return ( return (
<div className="disk-list__wrap"> <div className='disk-list__wrap'>
<div className="disk-list"> <div className='disk-list'>
{ {diskList.map((item) => {
diskList.map((item) => { const isActive = item.disk === currentRootDisk.disk
const isActive = item.disk === currentRootDisk.disk;
return ( return (
<div <div
key={item.disk} key={item.disk}
className={`item ${isActive ? 'active' : ''}`} className={`item ${isActive ? 'active' : ''}`}
onClick={() => { props.onChange(item)}} onClick={() => {
> props.onChange(item)
{ }}>
item.disk === 'MYSELF' && {item.disk === 'MYSELF' && <span className='icon iconfont'>&#xe7a5;</span>}
<span className="icon iconfont">&#xe7a5;</span> {item.disk === 'COMMON' && <span className='icon iconfont'>&#xe79d;</span>}
} {item.disk === 'EMPLOYEE' && <span className='icon iconfont'>&#xe7a3;</span>}
{ <span className='disk-name'>{item.folderName}</span>
item.disk === 'COMMON' &&
<span className="icon iconfont">&#xe79d;</span>
}
{
item.disk === 'EMPLOYEE' &&
<span className="icon iconfont">&#xe7a3;</span>
}
<span className="disk-name">{ item.folderName }</span>
</div> </div>
) )
}) })}
}
</div> </div>
<a <a
className="guide-href" className='guide-href'
href={window.NewVersion ? 'https://mp.weixin.qq.com/s/s0XN0Gk4Xul192SmTd6znw' : 'https://mp.weixin.qq.com/s/2EMWaaa3LQwkJd59bmy8pA'} href={window.NewVersion ? 'https://mp.weixin.qq.com/s/s0XN0Gk4Xul192SmTd6znw' : 'https://mp.weixin.qq.com/s/2EMWaaa3LQwkJd59bmy8pA'}
target="_blank" target='_blank'>
> 进一步了解素材库
进一步了解资料云盘
</a> </a>
</div> </div>
) )
}; }
export default DiskList; export default DiskList
\ No newline at end of file
import React from 'react'; import React from 'react'
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom'
import { Modal, Button } from 'antd'; import { Modal, Button } from 'antd'
import User from '@/common/js/user'; import User from '@/common/js/user'
import FolderManage from './components/FolderManage'; import FolderManage from './components/FolderManage'
import DiskList from './components/DiskList'; import DiskList from './components/DiskList'
import { DISK_MAP } from "@/common/constants/academic/lessonEnum"; import { DISK_MAP } from '@/common/constants/academic/lessonEnum'
import './index.less'; import './index.less'
const { teacherId, gmtCreate } = window.currentUserInstInfo; const { teacherId, gmtCreate } = window.currentUserInstInfo
// 判断是否是5.0或4.0T端 // 判断是否是5.0或4.0T端
const isTeacher = !!teacherId; const isTeacher = !!teacherId
// 判断是新用户还是老用户(gmtCreate小于上线日期的话就是老用户) // 判断是新用户还是老用户(gmtCreate小于上线日期的话就是老用户)
const onlineDate = +new Date('2020-07-17 00:00:00'); const onlineDate = +new Date('2020-07-17 00:00:00')
const isOldUser = gmtCreate <= onlineDate; const isOldUser = gmtCreate <= onlineDate
const defaultRootDisk = { const defaultRootDisk = {
folderName: '我的文件', folderName: '我的文件',
disk: 'MYSELF', disk: 'MYSELF',
uploadPower: false uploadPower: false,
} }
class PrepareLessonPage extends React.Component { class PrepareLessonPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
const prepareLessonTips = localStorage.getItem('prepare_lesson_tips'); const prepareLessonTips = localStorage.getItem('prepare_lesson_tips')
this.state = { this.state = {
prepareLessonTips, prepareLessonTips,
diskList: [], // 可见磁盘目录 diskList: [], // 可见磁盘目录
currentRootDisk: defaultRootDisk currentRootDisk: defaultRootDisk,
} }
} }
componentWillMount() { componentWillMount() {
this.handleFetchDiskList(); this.handleFetchDiskList()
} }
handleFetchDiskList = async () => { handleFetchDiskList = async () => {
const res = await axios.Apollo('public/apollo/getUserDisk', {}); const res = await axios.Apollo('public/apollo/getUserDisk', {})
const { result = [] } = res; const { result = [] } = res
const diskList = result.map((item) => { const diskList = result.map((item) => {
return { return {
...item, ...item,
folderName: DISK_MAP[item.disk] folderName: DISK_MAP[item.disk],
} }
}); })
this.setState({ this.setState({
diskList, diskList,
currentRootDisk: diskList[0] || defaultRootDisk currentRootDisk: diskList[0] || defaultRootDisk,
}); })
} }
handleChangeDisk = (disk) => { handleChangeDisk = (disk) => {
this.setState({ this.setState({
currentRootDisk: disk currentRootDisk: disk,
}); })
} }
render() { render() {
const { currentRootDisk, prepareLessonTips, diskList } = this.state; const { currentRootDisk, prepareLessonTips, diskList } = this.state
return ( return (
<div className="prepare-lesson-page page"> <div className='prepare-lesson-page page'>
<div className="content-header">资料云盘</div> <div className='content-header'>素材库</div>
<div className="box content-body"> <div className='box content-body'>
<DiskList <DiskList diskList={diskList} currentRootDisk={currentRootDisk} onChange={this.handleChangeDisk} />
diskList={diskList} <FolderManage currentRootDisk={currentRootDisk} />
currentRootDisk={currentRootDisk}
onChange={this.handleChangeDisk}
/>
<FolderManage
currentRootDisk={currentRootDisk}
/>
</div> </div>
{/* 老用户显示弹窗提示 */} {/* 老用户显示弹窗提示 */}
<Modal <Modal
title="备课本改版" title='备课本改版'
visible={!prepareLessonTips && isOldUser} visible={!prepareLessonTips && isOldUser}
footer={null} footer={null}
width={680} width={680}
maskClosable={false} maskClosable={false}
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>} closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>}
className="prepare-lesson-upgrade-modal" className='prepare-lesson-upgrade-modal'
onCancel={() => { onCancel={() => {
this.setState({ this.setState({
prepareLessonTips: true prepareLessonTips: true,
}) })
}} }}>
> <div className='title'>“备课本” 升级为 “素材库” 了!</div>
<div className="title">“备课本” 升级为 “资料云盘” 了!</div> <div className='upgrade-list'>
<div className="upgrade-list"> <div className='upgrade-list__item'>
<div className="upgrade-list__item"> <img src='https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780611301.png' alt='' />
<img src="https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780611301.png" alt=""/> <div className='item-title'>存储更便捷</div>
<div className="item-title">存储更便捷</div> <div className='item-sub-title'>讲次关联模式升级文件夹模式,存储不再受讲次限制</div>
<div className="item-sub-title">讲次关联模式升级文件夹模式,存储不再受讲次限制</div>
</div> </div>
<div className="upgrade-list__item"> <div className='upgrade-list__item'>
<img src="https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780629259.png" alt=""/> <img src='https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780629259.png' alt='' />
<div className="item-title">结构更清晰</div> <div className='item-title'>结构更清晰</div>
<div className="item-sub-title">新增“我的文件”“公共文件”“员工文件”,满足机构存储需求</div> <div className='item-sub-title'>新增“我的文件”“公共文件”“员工文件”,满足机构存储需求</div>
</div> </div>
<div className="upgrade-list__item"> <div className='upgrade-list__item'>
<img src="https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780641665.png" alt=""/> <img src='https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594780641665.png' alt='' />
<div className="item-title">同步更方便</div> <div className='item-title'>同步更方便</div>
<div className="item-sub-title">支持主管直接查看员工文件,优质资料一目了然</div> <div className='item-sub-title'>支持主管直接查看员工文件,优质资料一目了然</div>
</div> </div>
</div> </div>
<div <div
className="footer" className='footer'
onClick={() => { onClick={() => {
this.setState({ prepareLessonTips: true }); this.setState({ prepareLessonTips: true })
localStorage.setItem('prepare_lesson_tips', true); localStorage.setItem('prepare_lesson_tips', true)
}} }}>
>我知道了</div> 我知道了
</div>
</Modal> </Modal>
</div> </div>
) )
} }
} }
export default PrepareLessonPage; export default PrepareLessonPage
\ No newline at end of file
...@@ -6,44 +6,43 @@ ...@@ -6,44 +6,43 @@
* @Description: 文件夹列表 * @Description: 文件夹列表
*/ */
import React from 'react'; import React from 'react'
import { Table, Menu, Dropdown, Modal, message,Tooltip } from 'antd'; import { Table, Menu, Dropdown, Modal, message, Tooltip } from 'antd'
import _ from 'underscore'; import _ from 'underscore'
import { PageControl } from 'xiaomai-b-components'; import { PageControl } from 'xiaomai-b-components'
import { XMTable } from '@/components'; import { XMTable } from '@/components'
import Service from '@/common/js/service'; import Service from '@/common/js/service'
import { formatDate } from '@/domains/basic-domain/utils'; import { formatDate } from '@/domains/basic-domain/utils'
import { FILE_TYPE_ICON_MAP, SUPPORT_FILE_TYPE_MAP, DEFAULT_SIZE_UNIT } from '@/domains/resource-disk/constants'; import { FILE_TYPE_ICON_MAP, SUPPORT_FILE_TYPE_MAP, DEFAULT_SIZE_UNIT } from '@/domains/resource-disk/constants'
import { getFileTypeByName } from '@/domains/resource-disk/utils'; import { getFileTypeByName } from '@/domains/resource-disk/utils'
import addData from '../../lottie/addData/data.json'; import addData from '../../lottie/addData/data.json'
import search from '../../lottie/search/data.json'; import search from '../../lottie/search/data.json'
import UploadProgressModal from '@/bu-components/UploadProgressModal'; import UploadProgressModal from '@/bu-components/UploadProgressModal'
import SelectPrepareFileModal from '@/bu-components/SelectPrepareFileModal'; import SelectPrepareFileModal from '@/bu-components/SelectPrepareFileModal'
import CopyFileModal from '@/bu-components/CopyFileModal'; import CopyFileModal from '@/bu-components/CopyFileModal'
import ManagingMembersModal from '@/bu-components/ManagingMembersModal'; import ManagingMembersModal from '@/bu-components/ManagingMembersModal'
import PreviewFileModal from '@/bu-components/PreviewFileModal'; import PreviewFileModal from '@/bu-components/PreviewFileModal'
import {YZ_APPId,YZ_PREVIEW_URL,OFFICE_PREVIEW_URL} from '@/domains/basic-domain/constants'; import { YZ_APPId, YZ_PREVIEW_URL, OFFICE_PREVIEW_URL } from '@/domains/basic-domain/constants'
import BaseService from "@/domains/basic-domain/baseService"; import BaseService from '@/domains/basic-domain/baseService'
import ScanFileModal from '../modal/ScanFileModal'; import ScanFileModal from '../modal/ScanFileModal'
import CreateFolderModal from '../modal/CreateFolderModal'; import CreateFolderModal from '../modal/CreateFolderModal'
import User from '@/common/js/user'; import User from '@/common/js/user'
import axios from 'axios'; import axios from 'axios'
const appId = "yozoqvpO2Hvz8346"; const appId = 'yozoqvpO2Hvz8346'
const DEL_FOLDER_URL_MAP = { const DEL_FOLDER_URL_MAP = {
'MYSELF': 'public/hadesStore/delFolder', MYSELF: 'public/hadesStore/delFolder',
'COMMON': 'public/hadesStore/delFolder' COMMON: 'public/hadesStore/delFolder',
} }
// 支持本地上传的文件类型 // 支持本地上传的文件类型
const loaclFileType = SUPPORT_FILE_TYPE_MAP.join(','); const loaclFileType = SUPPORT_FILE_TYPE_MAP.join(',')
let count = 0; let count = 0
class FolderList extends React.Component { class FolderList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
localFileList: [], // 本地文件列表(待上传) localFileList: [], // 本地文件列表(待上传)
currentFolder: {}, // 当前文件/文件夹(操作列表中的文件/文件夹的时候需要用到) currentFolder: {}, // 当前文件/文件夹(操作列表中的文件/文件夹的时候需要用到)
...@@ -55,26 +54,26 @@ class FolderList extends React.Component { ...@@ -55,26 +54,26 @@ class FolderList extends React.Component {
showManagingModal: false, // 管理文件查看编辑权限 showManagingModal: false, // 管理文件查看编辑权限
nonCompliantFileList: [], // 不符合上限的文件列表 nonCompliantFileList: [], // 不符合上限的文件列表
parentRights: '', // 继承父级文件夹权限 parentRights: '', // 继承父级文件夹权限
showPreviewModal:false, //是否显示loading showPreviewModal: false, //是否显示loading
previewing:false, //是否正在预览 previewing: false, //是否正在预览
previewStatus:'UPLOAD' //预览文件的生成状态 previewStatus: 'UPLOAD', //预览文件的生成状态
} }
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { folderPathList } = nextProps const { folderPathList } = nextProps
const currentFolder = folderPathList[folderPathList.length - 1]; const currentFolder = folderPathList[folderPathList.length - 1]
this.setState({ this.setState({
currentFolder currentFolder,
}) })
} }
//预览文件 //预览文件
handleSelect = (folder) => { handleSelect = (folder) => {
// 只有文件才有预览功能 // 只有文件才有预览功能
if (folder.folderType === 'FOLDER') { if (folder.folderType === 'FOLDER') {
this.handleSelectFolder(folder); this.handleSelectFolder(folder)
} else { } else {
this.handleScanFile(folder); this.handleScanFile(folder)
} }
} }
...@@ -82,52 +81,52 @@ class FolderList extends React.Component { ...@@ -82,52 +81,52 @@ class FolderList extends React.Component {
handleDataDot = (folderFormat) => { handleDataDot = (folderFormat) => {
switch (folderFormat) { switch (folderFormat) {
case 'PDF': case 'PDF':
window.WEBTRACING('resource_disk_file_preview_pdf', '资料云盘_点击预览_pdf'); window.WEBTRACING('resource_disk_file_preview_pdf', '资料云盘_点击预览_pdf')
break; break
case 'WORD': case 'WORD':
case 'DOCX': case 'DOCX':
case 'DOC': case 'DOC':
window.WEBTRACING('resource_disk_file_preview_word', '资料云盘_点击预览_word'); window.WEBTRACING('resource_disk_file_preview_word', '资料云盘_点击预览_word')
break; break
case 'EXCEL': case 'EXCEL':
window.WEBTRACING('resource_disk_file_preview_excel', '资料云盘_点击预览_excel'); window.WEBTRACING('resource_disk_file_preview_excel', '资料云盘_点击预览_excel')
break; break
case 'PPT': case 'PPT':
case 'PPTX': case 'PPTX':
window.WEBTRACING('resource_disk_file_preview_ppt', '资料云盘_点击预览_ppt'); window.WEBTRACING('resource_disk_file_preview_ppt', '资料云盘_点击预览_ppt')
break; break
default: default:
break; break
} }
} }
handleYZPreviewDataDot =(folderFormat) => { handleYZPreviewDataDot = (folderFormat) => {
switch (folderFormat) { switch (folderFormat) {
case 'PDF': case 'PDF':
window.WEBTRACING('resource_disk_yz_file_preview_pdf', '资料云盘_点击永中预览_pdf'); window.WEBTRACING('resource_disk_yz_file_preview_pdf', '资料云盘_点击永中预览_pdf')
break; break
case 'WORD': case 'WORD':
case 'DOCX': case 'DOCX':
case 'DOC': case 'DOC':
window.WEBTRACING('resource_disk_yz_file_preview_word', '资料云盘_点击永中预览_word'); window.WEBTRACING('resource_disk_yz_file_preview_word', '资料云盘_点击永中预览_word')
break; break
case 'EXCEL': case 'EXCEL':
window.WEBTRACING('resource_disk_yz_file_preview_excel', '资料云盘_点击永中预览_excel'); window.WEBTRACING('resource_disk_yz_file_preview_excel', '资料云盘_点击永中预览_excel')
break; break
case 'PPT': case 'PPT':
case 'PPTX': case 'PPTX':
window.WEBTRACING('resource_disk_yz_file_preview_ppt', '资料云盘_点击永中预览_ppt'); window.WEBTRACING('resource_disk_yz_file_preview_ppt', '资料云盘_点击永中预览_ppt')
break; break
default: default:
break; break
} }
} }
// 预览文件 // 预览文件
handleScanFile = async (folder) => { handleScanFile = async (folder) => {
const { folderFormat, folderSize, ossUrl,rights,fileVersionId,id,folderName} = folder; const { folderFormat, folderSize, ossUrl, rights, fileVersionId, id, folderName } = folder
const {currentRootDisk } = this.props; const { currentRootDisk } = this.props
//如果是公共文件且只有查看的权限的用户的预览对接的三方是永中 //如果是公共文件且只有查看的权限的用户的预览对接的三方是永中
const that = this; const that = this
if(currentRootDisk.disk==="COMMON" && rights==="LOOK"){ if (currentRootDisk.disk === 'COMMON' && rights === 'LOOK') {
switch (folderFormat) { switch (folderFormat) {
case 'PDF': case 'PDF':
case 'WORD': case 'WORD':
...@@ -136,155 +135,160 @@ class FolderList extends React.Component { ...@@ -136,155 +135,160 @@ class FolderList extends React.Component {
case 'EXCEL': case 'EXCEL':
case 'PPT': case 'PPT':
case 'PPTX': case 'PPTX':
that.handleYZPreviewDataDot(folderFormat); that.handleYZPreviewDataDot(folderFormat)
if(!fileVersionId){ if (!fileVersionId) {
this.setState({ this.setState(
previewing:true, {
showPreviewModal:true, previewing: true,
previewStatus:'UPLOAD' showPreviewModal: true,
},async ()=>{ previewStatus: 'UPLOAD',
const uploadParams ={ },
fileUrl:ossUrl, async () => {
instId:User.getStoreId(), const uploadParams = {
yoZoTypeEnum:'UPLOAD' fileUrl: ossUrl,
} instId: User.getStoreId(),
const uploadSign = await BaseService.getYoZoSign(uploadParams); yoZoTypeEnum: 'UPLOAD',
BaseService.yoZoUpload(ossUrl,YZ_APPId,uploadSign).then(async function (response){ }
const saveParams ={ const uploadSign = await BaseService.getYoZoSign(uploadParams)
fileVersionId:response.data.data.fileVersionId, BaseService.yoZoUpload(ossUrl, YZ_APPId, uploadSign).then(async function (response) {
folderId:id, const saveParams = {
instId:User.getStoreId(), fileVersionId: response.data.data.fileVersionId,
} folderId: id,
BaseService.saveYoZoFileVersionId(saveParams); instId: User.getStoreId(),
const { previewing } = that.state; }
if(previewing){ BaseService.saveYoZoFileVersionId(saveParams)
const previewParams ={ const { previewing } = that.state
fileVersionId:response.data.data.fileVersionId, if (previewing) {
instId:User.getStoreId(), const previewParams = {
yoZoTypeEnum:'VIEW', fileVersionId: response.data.data.fileVersionId,
htmlTitle:folderName instId: User.getStoreId(),
} yoZoTypeEnum: 'VIEW',
const previewSign = await BaseService.getYoZoSign(previewParams); htmlTitle: folderName,
}
const previewSign = await BaseService.getYoZoSign(previewParams)
const url = `${YZ_PREVIEW_URL}?fileVersionId=${response.data.data.fileVersionId}&appId=${YZ_APPId}&sign=${previewSign}&htmlTitle=${folderName}` const url = `${YZ_PREVIEW_URL}?fileVersionId=${response.data.data.fileVersionId}&appId=${YZ_APPId}&sign=${previewSign}&htmlTitle=${folderName}`
that.setState({ that.setState({
previewStatus:'UPLOAD_SUCCESS', previewStatus: 'UPLOAD_SUCCESS',
url url,
}) })
} }
}) })
}
}) )
}else{ } else {
const previewParams ={ const previewParams = {
fileVersionId, fileVersionId,
instId:User.getStoreId(), instId: User.getStoreId(),
yoZoTypeEnum:'VIEW', yoZoTypeEnum: 'VIEW',
htmlTitle:folderName htmlTitle: folderName,
} }
const previewSign = await BaseService.getYoZoSign(previewParams); const previewSign = await BaseService.getYoZoSign(previewParams)
const url = `${YZ_PREVIEW_URL}?fileVersionId=${fileVersionId}&appId=${YZ_APPId}&sign=${previewSign}&htmlTitle=${folderName}` const url = `${YZ_PREVIEW_URL}?fileVersionId=${fileVersionId}&appId=${YZ_APPId}&sign=${previewSign}&htmlTitle=${folderName}`
const a = document.createElement('a'); const a = document.createElement('a')
document.body.appendChild(a); document.body.appendChild(a)
a.setAttribute('href', url); a.setAttribute('href', url)
a.setAttribute('target', '_blank'); a.setAttribute('target', '_blank')
a.click(); a.click()
document.body.removeChild(a) document.body.removeChild(a)
} }
break; break
default: default:
const scanFileModal = ( const scanFileModal = (
<ScanFileModal <ScanFileModal
fileType={folderFormat} fileType={folderFormat}
item={folder} item={folder}
close={() => { close={() => {
this.setState({ scanFileModal: null }); this.setState({ scanFileModal: null })
}} }}
/> />
); )
this.setState({ scanFileModal }); this.setState({ scanFileModal })
break; break
} }
}else{ } else {
switch (folderFormat) { switch (folderFormat) {
case 'PDF': case 'PDF':
window.open(ossUrl, "_blank"); window.open(ossUrl, '_blank')
break; break
case "WORD": case 'WORD':
case "DOCX": case 'DOCX':
case "DOC": case 'DOC':
case "EXCEL": case 'EXCEL':
case "PPT": case 'PPT':
case "PPTX": case 'PPTX':
case "PDF": case 'PDF':
if ((folderFormat === 'PPT' || folderFormat === 'PPTX' || if (
folderFormat === 'DOCX' || folderFormat === 'WORD' || (folderFormat === 'PPT' || folderFormat === 'PPTX' || folderFormat === 'DOCX' || folderFormat === 'WORD' || folderFormat === 'DOC') &&
folderFormat === 'DOC') && folderSize > 10 * DEFAULT_SIZE_UNIT) { folderSize > 10 * DEFAULT_SIZE_UNIT
) {
Modal.confirm({ Modal.confirm({
title: '抱歉,不能在线预览', title: '抱歉,不能在线预览',
content: '由于文件较大,不支持在线预览,请下载后再查看', content: '由于文件较大,不支持在线预览,请下载后再查看',
okText: "下载", okText: '下载',
onOk: () => { onOk: () => {
const a = document.createElement('a'); const a = document.createElement('a')
a.href = ossUrl; a.href = ossUrl
a.click(); a.click()
} },
}); })
break; break
} }
const prefixUrl = `${OFFICE_PREVIEW_URL}?src=`; const prefixUrl = `${OFFICE_PREVIEW_URL}?src=`
const scanUrl = `${prefixUrl}${encodeURIComponent(ossUrl)}` const scanUrl = `${prefixUrl}${encodeURIComponent(ossUrl)}`
window.open(scanUrl, "_blank"); window.open(scanUrl, '_blank')
break; break
default: default:
const scanFileModal = <ScanFileModal const scanFileModal = (
<ScanFileModal
fileType={folderFormat} fileType={folderFormat}
item={folder} item={folder}
close={() => { close={() => {
this.setState({ scanFileModal: null }) this.setState({ scanFileModal: null })
}} }}
/> />
this.setState({ scanFileModal }); )
break; this.setState({ scanFileModal })
break
} }
} }
// 预览文件埋点 // 预览文件埋点
this.handleDataDot(folderFormat); this.handleDataDot(folderFormat)
} }
cancelPreview = ()=>{ cancelPreview = () => {
this.setState({ this.setState({
previewing:false, previewing: false,
showPreviewModal:false, showPreviewModal: false,
previewStatus:'UPLOAD' previewStatus: 'UPLOAD',
}) })
} }
// 选择文件夹 // 选择文件夹
handleSelectFolder = (folder) => { handleSelectFolder = (folder) => {
const { folderPathList, showResultPage, currentRootDisk } = this.props; const { folderPathList, showResultPage, currentRootDisk } = this.props
// 判断是否是员工文件的根目录 // 判断是否是员工文件的根目录
const employeeDisk = currentRootDisk.disk === 'EMPLOYEE' && folderPathList.length === 1; const employeeDisk = currentRootDisk.disk === 'EMPLOYEE' && folderPathList.length === 1
if (showResultPage) { if (showResultPage) {
folderPathList.pop(); folderPathList.pop()
} }
folderPathList.push({ folderPathList.push({
id: folder.id, id: folder.id,
folderName: folder.folderName folderName: folder.folderName,
}); })
this.setState({ this.setState({
parentRights: folder.rights, parentRights: folder.rights,
}) })
this.props.onChangeFolderPath(folderPathList); this.props.onChangeFolderPath(folderPathList)
this.props.onRefresh({ this.props.onRefresh({
parentId: folder.id, parentId: folder.id,
parentRights: folder.rights, parentRights: folder.rights,
folderIdType: employeeDisk ? 'USER' : 'FOLDER' folderIdType: employeeDisk ? 'USER' : 'FOLDER',
}); })
} }
// 修改文件路径 // 修改文件路径
handleChangeFolderPath = (folder) => { handleChangeFolderPath = (folder) => {
const { instId } = window.currentUserInstInfo; const { instId } = window.currentUserInstInfo
const { id } = folder; const { id } = folder
const { currentRootDisk } = this.props; const { currentRootDisk } = this.props
const params = { const params = {
id, id,
instId, instId,
...@@ -292,16 +296,16 @@ class FolderList extends React.Component { ...@@ -292,16 +296,16 @@ class FolderList extends React.Component {
} }
Service.Hades('public/hadesStore/folderPath', params).then((res) => { Service.Hades('public/hadesStore/folderPath', params).then((res) => {
const { result = [] } = res; const { result = [] } = res
this.props.onChangeFolderPath(result, false); this.props.onChangeFolderPath(result, false)
}) })
} }
parseColumns = () => { parseColumns = () => {
const { currentRootDisk, showResultPage, folderPathList } = this.props; const { currentRootDisk, showResultPage, folderPathList } = this.props
const hasManagementAuthority = currentRootDisk.uploadPower; const hasManagementAuthority = currentRootDisk.uploadPower
// 判断是否是员工文件的根目录 // 判断是否是员工文件的根目录
const employeeDisk = currentRootDisk.disk === 'EMPLOYEE' && folderPathList.length === 1; const employeeDisk = currentRootDisk.disk === 'EMPLOYEE' && folderPathList.length === 1
const columns = [ const columns = [
{ {
...@@ -309,81 +313,66 @@ class FolderList extends React.Component { ...@@ -309,81 +313,66 @@ class FolderList extends React.Component {
key: 'folderName', key: 'folderName',
dataIndex: 'folderName', dataIndex: 'folderName',
width: '28%', width: '28%',
sorter: (employeeDisk || !hasManagementAuthority) ? false : true, sorter: employeeDisk || !hasManagementAuthority ? false : true,
render: (value, record) => { render: (value, record) => {
const { folderType, folderFormat } = record; const { folderType, folderFormat } = record
const isFolder = folderType === 'FOLDER'; const isFolder = folderType === 'FOLDER'
let imgSrc = !isFolder ? let imgSrc = !isFolder ? FILE_TYPE_ICON_MAP[folderFormat] : 'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594871430788.png'
FILE_TYPE_ICON_MAP[folderFormat] :
'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594871430788.png';
if (employeeDisk) { if (employeeDisk) {
imgSrc = 'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594871440736.png' imgSrc = 'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1594871440736.png'
} }
return ( return (
<div <div className='file-name' onClick={() => this.handleSelect(record)}>
className="file-name" {<img alt='img-src' className='file-name__icon' src={imgSrc} />}
onClick={() => this.handleSelect(record)} <span className={`file-name__text ${!isFolder ? 'highlight' : ''}`}>{value}</span>
>
{
<img
alt="img-src"
className="file-name__icon"
src={imgSrc}
/>
}
<span
className={`file-name__text ${!isFolder ? 'highlight' : ''}`}
>
{value}
</span>
</div> </div>
) )
} },
}, },
{ {
title: '更新时间', title: '更新时间',
key: 'updated', key: 'updated',
dataIndex: 'updated', dataIndex: 'updated',
sorter: (employeeDisk || !hasManagementAuthority) ? false : true, sorter: employeeDisk || !hasManagementAuthority ? false : true,
render: (value) => { render: (value) => {
return <span>{formatDate('YYYY-MM-DD H:i', value)}</span> return <span>{formatDate('YYYY-MM-DD H:i', value)}</span>
} },
}, },
{ {
title: '大小', title: '大小',
key: 'folderSize', key: 'folderSize',
dataIndex: 'folderSize', dataIndex: 'folderSize',
width: '10%', width: '10%',
sorter: (employeeDisk || !hasManagementAuthority) ? false : true, sorter: employeeDisk || !hasManagementAuthority ? false : true,
render: (value, record) => { render: (value, record) => {
const { folderType } = record; const { folderType } = record
const _fileSize = Number(value); const _fileSize = Number(value)
let _size = `${(_fileSize / DEFAULT_SIZE_UNIT).toFixed(1)}M`; let _size = `${(_fileSize / DEFAULT_SIZE_UNIT).toFixed(1)}M`
if (_fileSize < 0.1 * DEFAULT_SIZE_UNIT) { if (_fileSize < 0.1 * DEFAULT_SIZE_UNIT) {
_size = `${(_fileSize / 1024).toFixed(1)}kb`; _size = `${(_fileSize / 1024).toFixed(1)}kb`
}
return (
<span>{folderType === 'FILE' ? _size : '-'}</span>
)
} }
return <span>{folderType === 'FILE' ? _size : '-'}</span>
},
}, },
{ {
title: '操作', title: '操作',
key: 'operate', key: 'operate',
render: (value, record) => { render: (value, record) => {
if ((!(currentRootDisk.disk === 'COMMON' && (folderPathList.length === 1 || record.folderType === 'FOLDER')) || if (
hasManagementAuthority) && !(record.rights==="LOOK") ){ (!(currentRootDisk.disk === 'COMMON' && (folderPathList.length === 1 || record.folderType === 'FOLDER')) || hasManagementAuthority) &&
!(record.rights === 'LOOK')
) {
return ( return (
<Dropdown overlay={this.renderMenu(record)} trigger={['hover']}> <Dropdown overlay={this.renderMenu(record)} trigger={['hover']}>
<span className="icon iconfont">&#xe62c;</span> <span className='icon iconfont'>&#xe62c;</span>
</Dropdown> </Dropdown>
) )
} }
return <span>-</span> return <span>-</span>
} },
} },
] ]
// 公共文件需要显示创建者 // 公共文件需要显示创建者
...@@ -391,8 +380,8 @@ class FolderList extends React.Component { ...@@ -391,8 +380,8 @@ class FolderList extends React.Component {
columns.splice(1, 0, { columns.splice(1, 0, {
title: '创建者', title: '创建者',
key: 'createName', key: 'createName',
dataIndex: 'createName' dataIndex: 'createName',
}); })
} }
// 搜索结果需要显示所在目录 // 搜索结果需要显示所在目录
...@@ -402,38 +391,39 @@ class FolderList extends React.Component { ...@@ -402,38 +391,39 @@ class FolderList extends React.Component {
key: 'parentName', key: 'parentName',
dataIndex: 'parentName', dataIndex: 'parentName',
render: (value, record) => { render: (value, record) => {
return <span return (
className="file-path" <span className='file-path' onClick={() => this.handleChangeFolderPath(record)}>
onClick={() => this.handleChangeFolderPath(record)}
>
{value || currentRootDisk.folderName} {value || currentRootDisk.folderName}
</span> </span>
} )
},
}) })
} }
return columns; return columns
} }
// 删除文件 // 删除文件
handleDeleteFolder = (folder) => { handleDeleteFolder = (folder) => {
const { currentRootDisk: { disk } } = this.props; const {
currentRootDisk: { disk },
} = this.props
Modal.confirm({ Modal.confirm({
title: '确认删除所选的文件吗?', title: '确认删除所选的文件吗?',
content: '删除后,数据将无法恢复。', content: '删除后,数据将无法恢复。',
icon:<span className="icon iconfont default-confirm-icon">&#xe839; </span>, icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>,
okType: 'danger', okType: 'danger',
onOk: () => { onOk: () => {
const { currentFolder } = this.state; const { currentFolder } = this.state
Service.Hades(DEL_FOLDER_URL_MAP[disk], { Service.Hades(DEL_FOLDER_URL_MAP[disk], {
operatorId: User.getUserId(), operatorId: User.getUserId(),
storeId: User.getStoreId(), storeId: User.getStoreId(),
ids: [folder.id], ids: [folder.id],
}).then(() => { }).then(() => {
message.success('删除成功'); message.success('删除成功')
this.props.onRefresh({ parentId: currentFolder.id || null }); this.props.onRefresh({ parentId: currentFolder.id || null })
})
},
}) })
}
});
} }
// 重命名 // 重命名
...@@ -443,90 +433,90 @@ class FolderList extends React.Component { ...@@ -443,90 +433,90 @@ class FolderList extends React.Component {
visible: true, visible: true,
id: folder.id, id: folder.id,
folderName: folder.folderName, folderName: folder.folderName,
} },
}); })
} }
// 重命名完成或者取消重命名之后隐藏重命名弹窗 // 重命名完成或者取消重命名之后隐藏重命名弹窗
handleRenameDone = (folderName) => { handleRenameDone = (folderName) => {
return new Promise((resolve) => { return new Promise((resolve) => {
const { renameModalData, currentFolder } = this.state; const { renameModalData, currentFolder } = this.state
const { folderPathList } = this.props; const { folderPathList } = this.props
// 名称未修改不发送请求 // 名称未修改不发送请求
if (folderName === renameModalData.folderName) { if (folderName === renameModalData.folderName) {
this.setState({ renameModalData: {} }); this.setState({ renameModalData: {} })
return; return
} }
// 判断是否有同名文件 // 判断是否有同名文件
this.handleGetSameNameFiles(folderName).then((res) => { this.handleGetSameNameFiles(folderName).then((res) => {
if ((!!res) || (res && Object.keys(res).length)) { if (!!res || (res && Object.keys(res).length)) {
if (!res.isLook && folderPathList.length === 1) { if (!res.isLook && folderPathList.length === 1) {
message.warning('此目录下已存在同名文件,有疑问请联系机构校长'); message.warning('此目录下已存在同名文件,有疑问请联系机构校长')
} else { } else {
message.warning('此目录下已存在同名文件'); message.warning('此目录下已存在同名文件')
} }
return; return
} }
Service.Hades('public/hadesStore/renameFolder', { Service.Hades('public/hadesStore/renameFolder', {
id: renameModalData.id, id: renameModalData.id,
name: folderName name: folderName,
}).then(res2 => { }).then((res2) => {
if (!res2.success) { if (!res2.success) {
const errorMessage = '此目录下已存在同名文件'; const errorMessage = '此目录下已存在同名文件'
message.warning(errorMessage); message.warning(errorMessage)
return; return
} else { } else {
message.success('重命名成功'); message.success('重命名成功')
this.setState({ renameModalData: {} }); this.setState({ renameModalData: {} })
this.props.onRefresh({ parentId: currentFolder.id || null }); this.props.onRefresh({ parentId: currentFolder.id || null })
} }
}); })
}); })
}) })
} }
// 获取同名文件 // 获取同名文件
handleGetSameNameFiles = async (folderName) => { handleGetSameNameFiles = async (folderName) => {
const { currentRootDisk, folderPathList } = this.props; const { currentRootDisk, folderPathList } = this.props
const currentFolder = folderPathList[folderPathList.length - 1]; const currentFolder = folderPathList[folderPathList.length - 1]
const { instId } = window.currentUserInstInfo; const { instId } = window.currentUserInstInfo
const params = { const params = {
createId:User.getUserId(), createId: User.getUserId(),
name: folderName, name: folderName,
disk: currentRootDisk.disk, disk: currentRootDisk.disk,
parentId: currentFolder.id, parentId: currentFolder.id,
folderType: 'FOLDER', folderType: 'FOLDER',
} }
const res = await Service.Hades('public/hadesStore/sameNameFile', params); const res = await Service.Hades('public/hadesStore/sameNameFile', params)
const { result } = res; const { result } = res
return result; return result
} }
// 显示移动文件弹窗 // 显示移动文件弹窗
handleShowSelectFileModal = (file) => { handleShowSelectFileModal = (file) => {
this.setState({ this.setState({
currentFile: file, currentFile: file,
showSelectFileModal: true showSelectFileModal: true,
}); })
} }
// 显示复制文件弹窗 // 显示复制文件弹窗
handleShowCopyFileModal = (file) => { handleShowCopyFileModal = (file) => {
this.setState({ this.setState({
currentFile: file, currentFile: file,
showCopyFileModal: true showCopyFileModal: true,
}); })
} }
// 显示管理成员弹窗 // 显示管理成员弹窗
handleShowManagingModal = (file) => { handleShowManagingModal = (file) => {
this.setState({ this.setState({
currentFile: file, currentFile: file,
showManagingModal: true showManagingModal: true,
}); })
} }
getBlob = (url) => { getBlob = (url) => {
...@@ -584,40 +574,40 @@ class FolderList extends React.Component { ...@@ -584,40 +574,40 @@ class FolderList extends React.Component {
// return; // return;
// } // }
const dom = document.querySelector('#detailFileInput'); const dom = document.querySelector('#detailFileInput')
dom.click(); dom.click()
} }
// 准备上传 // 准备上传
handleUpload = (event) => { handleUpload = (event) => {
const fileList = event.target.files; const fileList = event.target.files
// 判断文件的大小是否超出了限制 // 判断文件的大小是否超出了限制
const nonCompliantFileList = []; const nonCompliantFileList = []
const _fileList = [...fileList]; const _fileList = [...fileList]
_fileList.map((file, index) => { _fileList.map((file, index) => {
let { size, type, name } = file; let { size, type, name } = file
if (!type) { if (!type) {
type = getFileTypeByName(name); type = getFileTypeByName(name)
} }
if (type.indexOf('image') > -1 && size > 50 * DEFAULT_SIZE_UNIT) { if (type.indexOf('image') > -1 && size > 50 * DEFAULT_SIZE_UNIT) {
nonCompliantFileList.push(file); nonCompliantFileList.push(file)
_fileList.splice(index, 1); _fileList.splice(index, 1)
} }
if (type.indexOf('audio') > -1 && size > 50 * DEFAULT_SIZE_UNIT) { if (type.indexOf('audio') > -1 && size > 50 * DEFAULT_SIZE_UNIT) {
nonCompliantFileList.push(file); nonCompliantFileList.push(file)
_fileList.splice(index, 1); _fileList.splice(index, 1)
} }
if (type.indexOf('video') > -1 && size > 2000 * DEFAULT_SIZE_UNIT) { if (type.indexOf('video') > -1 && size > 2000 * DEFAULT_SIZE_UNIT) {
nonCompliantFileList.push(file); nonCompliantFileList.push(file)
_fileList.splice(index, 1); _fileList.splice(index, 1)
} }
if (loaclFileType.indexOf(type) > -1 && size > 100 * DEFAULT_SIZE_UNIT) { if (loaclFileType.indexOf(type) > -1 && size > 100 * DEFAULT_SIZE_UNIT) {
nonCompliantFileList.push(file); nonCompliantFileList.push(file)
_fileList.splice(index, 1); _fileList.splice(index, 1)
} }
file.key = count++; file.key = count++
return file; return file
}); })
// 不符合规则的文件列表 // 不符合规则的文件列表
if (nonCompliantFileList.length > 0) { if (nonCompliantFileList.length > 0) {
this.setState({ this.setState({
...@@ -625,38 +615,38 @@ class FolderList extends React.Component { ...@@ -625,38 +615,38 @@ class FolderList extends React.Component {
showNonCompliantFileModal: true, showNonCompliantFileModal: true,
}) })
} else { } else {
this.handleShowUploadModal(_fileList); this.handleShowUploadModal(_fileList)
} }
// 清空文件,防止第二次无法上传同一个文件 // 清空文件,防止第二次无法上传同一个文件
const dom = document.querySelector('#detailFileInput'); const dom = document.querySelector('#detailFileInput')
dom.value = ''; dom.value = ''
} }
// 显示上传进度弹窗 // 显示上传进度弹窗
handleShowUploadModal = (fileList) => { handleShowUploadModal = (fileList) => {
// 保存当前路径 // 保存当前路径
const { folderPathList } = this.props; const { folderPathList } = this.props
if (fileList.length) { if (fileList.length) {
this.setState({ this.setState({
showUploadModal: true, showUploadModal: true,
localFileList: fileList, localFileList: fileList,
uploadFolderPath: folderPathList[folderPathList.length - 1] uploadFolderPath: folderPathList[folderPathList.length - 1],
}); })
} }
} }
// 上传成功 // 上传成功
handleUploadDone = (file, resourceId) => { handleUploadDone = (file, resourceId) => {
this.props.onCreate(file, resourceId); this.props.onCreate(file, resourceId)
} }
// 取消上传 // 取消上传
handleHiddenUploadModal = () => { handleHiddenUploadModal = () => {
this.setState({ this.setState({
showUploadModal: false, showUploadModal: false,
localFileList: [] localFileList: [],
}); })
} }
// 余额欠费提示弹窗 // 余额欠费提示弹窗
...@@ -664,111 +654,123 @@ class FolderList extends React.Component { ...@@ -664,111 +654,123 @@ class FolderList extends React.Component {
Modal.info({ Modal.info({
title: '无法继续操作', title: '无法继续操作',
content: '直播系统已升级,请联系运营老师。', content: '直播系统已升级,请联系运营老师。',
icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span> icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>,
}) })
} }
// 排序 // 排序
handleChangeTable = (pagination, filters, sorter) => { handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter; const { columnKey, order } = sorter
let sort = null; let sort = null
if (columnKey === 'folderName' && order === 'ascend') { sort = 'NAME_ASC'; } if (columnKey === 'folderName' && order === 'ascend') {
if (columnKey === 'folderName' && order === 'descend') { sort = 'NAME_DESC'; } sort = 'NAME_ASC'
if (columnKey === 'folderSize' && order === 'ascend') { sort = 'SIZE_ASC'; } }
if (columnKey === 'folderSize' && order === 'descend') { sort = 'SIZE_DESC'; } if (columnKey === 'folderName' && order === 'descend') {
if (columnKey === 'updated' && order === 'ascend') { sort = 'UPDATE_ASC'; } sort = 'NAME_DESC'
if (columnKey === 'updated' && order === 'descend') { sort = 'UPDATE_DESC'; } }
if (columnKey === 'folderSize' && order === 'ascend') {
sort = 'SIZE_ASC'
}
if (columnKey === 'folderSize' && order === 'descend') {
sort = 'SIZE_DESC'
}
if (columnKey === 'updated' && order === 'ascend') {
sort = 'UPDATE_ASC'
}
if (columnKey === 'updated' && order === 'descend') {
sort = 'UPDATE_DESC'
}
const { currentFolder } = this.state; const { currentFolder } = this.state
this.props.onRefresh({ this.props.onRefresh({
sort, sort,
parentId: currentFolder.id || null parentId: currentFolder.id || null,
}); })
} }
// 操作选项 // 操作选项
renderMenu = (record) => { renderMenu = (record) => {
const { currentRootDisk } = this.props; const { currentRootDisk } = this.props
// 是否有编辑权限 // 是否有编辑权限
const hasManagementAuthority = currentRootDisk.uploadPower; const hasManagementAuthority = currentRootDisk.uploadPower
// 公共文件权限和复制权限 // 公共文件权限和复制权限
const { folderType, rights } = record; const { folderType, rights } = record
const menu = ( const menu = (
<Menu> <Menu>
{ {rights === 'EDIT' &&
rights === "EDIT" && !record.parentId && !record.parentId && [
[ <Menu.Item key='administration'>
<Menu.Item key="administration">
<span onClick={() => this.handleShowManagingModal(record)}>权限管理</span> <span onClick={() => this.handleShowManagingModal(record)}>权限管理</span>
</Menu.Item>, </Menu.Item>,
<Menu.Divider key="administration-bottom"/> <Menu.Divider key='administration-bottom' />,
] ]}
} {folderType === 'FILE' && (rights === 'LOOK_DOWNLOAD' || rights === 'EDIT') && (
{(folderType === 'FILE' && (rights === "LOOK_DOWNLOAD" || rights === 'EDIT') ) && <Menu.Item key='download'>
<Menu.Item key="download"> <span
<span onClick={() => { this.handleDownload(record) }}>下载</span> onClick={() => {
this.handleDownload(record)
}}>
下载
</span>
</Menu.Item> </Menu.Item>
} )}
{(rights === "LOOK_DOWNLOAD" || rights === 'EDIT') && {(rights === 'LOOK_DOWNLOAD' || rights === 'EDIT') && (
<Menu.Item key='copy'>
<Menu.Item key="copy">
<span onClick={() => this.handleShowCopyFileModal(record)}>复制到</span> <span onClick={() => this.handleShowCopyFileModal(record)}>复制到</span>
</Menu.Item> </Menu.Item>
} )}
{ {hasManagementAuthority &&
hasManagementAuthority && rights === "EDIT" && rights === 'EDIT' && [
[ <Menu.Item key='move'>
<Menu.Item key="move">
<span onClick={() => this.handleShowSelectFileModal(record)}>移动到</span> <span onClick={() => this.handleShowSelectFileModal(record)}>移动到</span>
</Menu.Item>, </Menu.Item>,
<Menu.Item key="rename"> <Menu.Item key='rename'>
<span onClick={() => this.handleRename(record)}>重命名</span> <span onClick={() => this.handleRename(record)}>重命名</span>
</Menu.Item>, </Menu.Item>,
<Menu.Divider key="administration-top"/>, <Menu.Divider key='administration-top' />,
<Menu.Item key="delete"> <Menu.Item key='delete'>
<span onClick={() => this.handleDeleteFolder(record)}>删除</span> <span onClick={() => this.handleDeleteFolder(record)}>删除</span>
</Menu.Item> </Menu.Item>,
] ]}
}
</Menu> </Menu>
); )
return menu; return menu
} }
render() { render() {
const {
currentFolder, currentFile, renameModalData, showSelectFileModal,
showUploadModal, localFileList, showCopyFileModal, showManagingModal,
showPreviewModal, previewStatus,url
} = this.state;
const { const {
selectedFileIds, folderList, showResultPage, currentFolder,
currentRootDisk, query, totalCount, folderPathList currentFile,
} = this.props; renameModalData,
const _disk = folderPathList[0].disk; showSelectFileModal,
showUploadModal,
localFileList,
showCopyFileModal,
showManagingModal,
showPreviewModal,
previewStatus,
url,
} = this.state
const { selectedFileIds, folderList, showResultPage, currentRootDisk, query, totalCount, folderPathList } = this.props
const _disk = folderPathList[0].disk
// 是否有编辑权限 // 是否有编辑权限
const hasManagementAuthority = currentRootDisk.uploadPower; const hasManagementAuthority = currentRootDisk.uploadPower
return ( return (
<div className="file-list"> <div className='file-list'>
<Choose> <Choose>
<When condition={!_.isEmpty(folderList)}> <When condition={!_.isEmpty(folderList)}>
<Table <Table
key="table" key='table'
rowKey={(record) => record.id} rowKey={(record) => record.id}
columns={this.parseColumns()} columns={this.parseColumns()}
showSorterTooltip={false} showSorterTooltip={false}
dataSource={folderList} dataSource={folderList}
rowSelection={ rowSelection={{
{
selectedRowKeys: selectedFileIds, selectedRowKeys: selectedFileIds,
onChange: this.props.onChangeRow onChange: this.props.onChangeRow,
} }}
}
pagination={false} pagination={false}
onChange={this.handleChangeTable} onChange={this.handleChangeTable}
/> />
...@@ -778,42 +780,43 @@ class FolderList extends React.Component { ...@@ -778,42 +780,43 @@ class FolderList extends React.Component {
total={totalCount} total={totalCount}
showSizeChanger={true} showSizeChanger={true}
toPage={(page) => { toPage={(page) => {
this.props.onChangePage('current', page + 1); this.props.onChangePage('current', page + 1)
}} }}
onShowSizeChange={(current, size) => { onShowSizeChange={(current, size) => {
const that = this; const that = this
setTimeout(()=>{ setTimeout(() => {
this.props.onChangePage('size', size) this.props.onChangePage('size', size)
},1000) }, 1000)
}} }}
/> />
</When> </When>
<Otherwise> <Otherwise>
<XMTable <XMTable
className="add-empty" className='add-empty'
renderEmpty={{ renderEmpty={{
image: !showResultPage ? addData : search, image: !showResultPage ? addData : search,
description: <Choose> description: (
<Choose>
<When condition={!showResultPage}> <When condition={!showResultPage}>
<input <input
multiple multiple
type="file" type='file'
style={{ display: 'none' }} style={{ display: 'none' }}
id="detailFileInput" id='detailFileInput'
accept=".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls" accept='.ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls'
onChange={(e) => this.handleUpload(e)} onChange={(e) => this.handleUpload(e)}
/> />
{ {
<Choose> <Choose>
<When condition={hasManagementAuthority}> <When condition={hasManagementAuthority}>
<div className="lottie-icon-title">你还没有上传文件,点击 <div className='lottie-icon-title'>
<Tooltip title="支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4,上传后默认私密,可邀请其他成员协作,支持批量上传文件"> 你还没有上传文件,点击
<span <Tooltip title='支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4,上传后默认私密,可邀请其他成员协作,支持批量上传文件'>
className="upload-btn" <span className='upload-btn' onClick={this.handleChooseFile}>
onClick={this.handleChooseFile} 上传文件
>上传文件</span> </span>
</Tooltip> </Tooltip>
按钮 按钮
</div> </div>
...@@ -825,9 +828,10 @@ class FolderList extends React.Component { ...@@ -825,9 +828,10 @@ class FolderList extends React.Component {
} }
</When> </When>
<Otherwise> <Otherwise>
<div className="desc">搜索无结果</div> <div className='desc'>搜索无结果</div>
</Otherwise> </Otherwise>
</Choose> </Choose>
),
}} }}
/> />
</Otherwise> </Otherwise>
...@@ -839,12 +843,11 @@ class FolderList extends React.Component { ...@@ -839,12 +843,11 @@ class FolderList extends React.Component {
folderPathList={folderPathList} folderPathList={folderPathList}
isOpen={renameModalData.visible} isOpen={renameModalData.visible}
onClose={() => { onClose={() => {
this.setState({ renameModalData: {} }); this.setState({ renameModalData: {} })
}} }}
onOk={this.handleRenameDone} onOk={this.handleRenameDone}
/> />
<UploadProgressModal <UploadProgressModal
isOpen={showUploadModal} isOpen={showUploadModal}
currentFolder={currentFolder} currentFolder={currentFolder}
...@@ -857,43 +860,39 @@ class FolderList extends React.Component { ...@@ -857,43 +860,39 @@ class FolderList extends React.Component {
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
currentRootDisk={currentRootDisk} currentRootDisk={currentRootDisk}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }); this.setState({ showSelectFileModal: false })
}} }}
onMove={(query) => { onMove={(query) => {
this.setState({ showSelectFileModal: false }); this.setState({ showSelectFileModal: false })
this.props.onMove(query, [currentFile.id],[currentFile.folderType]); this.props.onMove(query, [currentFile.id], [currentFile.folderType])
}} }}
/> />
{ {showCopyFileModal && (
showCopyFileModal &&
<CopyFileModal <CopyFileModal
isOpen={showCopyFileModal} isOpen={showCopyFileModal}
dataInfo={currentFile} dataInfo={currentFile}
currentRootDisk={currentRootDisk} currentRootDisk={currentRootDisk}
onClose={() => { onClose={() => {
this.setState({ showCopyFileModal: false }); this.setState({ showCopyFileModal: false })
}} }}
/> />
} )}
{ {showManagingModal && (
showManagingModal &&
<ManagingMembersModal <ManagingMembersModal
isOpen={showManagingModal} isOpen={showManagingModal}
dataInfo={currentFile} dataInfo={currentFile}
disk={_disk} disk={_disk}
onClose={() => { onClose={() => {
this.setState({ showManagingModal: false }); this.setState({ showManagingModal: false })
}} }}
/> />
} )}
{ showPreviewModal && {showPreviewModal && <PreviewFileModal onCancel={() => this.cancelPreview()} previewStatus={previewStatus} url={url} />}
<PreviewFileModal onCancel={()=>this.cancelPreview()} previewStatus={previewStatus} url={url}/> {this.state.scanFileModal}
} {this.state.chargeModal}
{ this.state.scanFileModal }
{ this.state.chargeModal }
</div> </div>
) )
} }
} }
export default FolderList; export default FolderList
\ No newline at end of file
import React from 'react'; import React from 'react'
import Service from '@/common/js/service'; import Service from '@/common/js/service'
import { DISK_MAP } from '@/domains/resource-disk/constants'; import { DISK_MAP } from '@/domains/resource-disk/constants'
import FolderManage from './components/FolderManage'; import FolderManage from './components/FolderManage'
import DiskList from './components/DiskList'; import DiskList from './components/DiskList'
import './index.less'; import './index.less'
const defaultRootDisk = { const defaultRootDisk = {
folderName: '公共文件', folderName: '公共文件',
disk: 'COMMON', disk: 'COMMON',
uploadPower: true uploadPower: true,
} }
class PrepareLessonPage extends React.Component { class PrepareLessonPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
// 目前只有公共文件,先由前端定义 // 目前只有公共文件,先由前端定义
diskList: [ diskList: [
{ {
folderName: '公共文件', folderName: '公共文件',
disk: 'COMMON', disk: 'COMMON',
uploadPower: true uploadPower: true,
} },
], // 可见磁盘目录 ], // 可见磁盘目录
currentRootDisk: defaultRootDisk currentRootDisk: defaultRootDisk,
} }
} }
handleChangeDisk = (disk) => { handleChangeDisk = (disk) => {
this.setState({ this.setState({
currentRootDisk: disk currentRootDisk: disk,
}); })
} }
render() { render() {
const { currentRootDisk, diskList } = this.state; const { currentRootDisk, diskList } = this.state
console.log('currentRootDisk',currentRootDisk); console.log('currentRootDisk', currentRootDisk)
return ( return (
<div className="prepare-lesson-page page"> <div className='prepare-lesson-page page'>
<div className="content-header">资料云盘</div> <div className='content-header'>素材库</div>
<div className="box content-body"> <div className='box content-body'>
<DiskList <DiskList diskList={diskList} currentRootDisk={currentRootDisk} onChange={this.handleChangeDisk} />
diskList={diskList} <FolderManage currentRootDisk={currentRootDisk} />
currentRootDisk={currentRootDisk}
onChange={this.handleChangeDisk}
/>
<FolderManage
currentRootDisk={currentRootDisk}
/>
</div> </div>
</div> </div>
) )
} }
} }
export default PrepareLessonPage; export default PrepareLessonPage
\ No newline at end of file
.store-decoration-page { .store-decoration-page {
.box { .box {
padding-top:11px!important; padding-top: 11px !important;
} }
thead { thead {
display: none; display: none;
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
} }
.banner-thumbnail { .banner-thumbnail {
width: 230px; width: 230px;
height: 79px; height: 96px;
} }
.web-banner-thumbnail { .web-banner-thumbnail {
width: 389px; width: 389px;
height: 67px; height: 162px;
} }
.index-num { .index-num {
...@@ -51,18 +51,17 @@ ...@@ -51,18 +51,17 @@
.operation { .operation {
.edit { .edit {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
} }
.divider-line { .divider-line {
color:#BFBFBF color: #bfbfbf;
} }
.delete { .delete {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
} }
} }
} }
.clip-box { .clip-box {
display: flex; display: flex;
...@@ -86,7 +85,7 @@ ...@@ -86,7 +85,7 @@
.preview-url { .preview-url {
width: 500px; width: 500px;
height: 73px; height: 73px;
background: #E6E6E6; background: #e6e6e6;
} }
#preview-url-box { #preview-url-box {
...@@ -112,11 +111,11 @@ ...@@ -112,11 +111,11 @@
} }
.banner-thumbnail { .banner-thumbnail {
width: 230px; width: 230px;
height: 79px; height: 96px;
} }
.web-banner-thumbnail { .web-banner-thumbnail {
width: 389px; width: 389px;
height: 67px; height: 162px;
} }
.index-num { .index-num {
height: 33px; height: 33px;
......
...@@ -7,185 +7,164 @@ ...@@ -7,185 +7,164 @@
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from "react"; import React from 'react'
import { withRouter } from "react-router-dom"; import { withRouter } from 'react-router-dom'
import _ from "underscore"; import _ from 'underscore'
import { Modal, message, Button } from "antd"; import { Modal, message, Button } from 'antd'
import StoreService from "@/domains/store-domain/storeService"; import StoreService from '@/domains/store-domain/storeService'
import { import { sortableContainer, sortableElement, sortableHandle } from 'react-sortable-hoc'
sortableContainer, import { MenuOutlined } from '@ant-design/icons'
sortableElement, import arrayMove from 'array-move'
sortableHandle, import User from '@/common/js/user'
} from "react-sortable-hoc"; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'
import { MenuOutlined } from "@ant-design/icons"; import './StoreDecorationPage.less'
import arrayMove from "array-move"; import Upload from '@/core/upload'
import User from "@/common/js/user"; import { XMTable } from '@/components'
import SelectPrepareFileModal from "@/modules/prepare-lesson/modal/SelectPrepareFileModal"; import college from '@/common/lottie/college'
import "./StoreDecorationPage.less";
import Upload from "@/core/upload";
import { XMTable } from '@/components';
import college from '@/common/lottie/college';
import ImgClipModal from '@/components/ImgClipModal' import ImgClipModal from '@/components/ImgClipModal'
const { confirm } = Modal; const { confirm } = Modal
const DragHandle = sortableHandle(() => ( const DragHandle = sortableHandle(() => <MenuOutlined style={{ cursor: 'pointer', color: '#999' }} className='drag-icon' />)
<MenuOutlined const SortableItem = sortableElement((props) => <tr {...props} />)
style={{ cursor: "pointer", color: "#999" }} const SortableContainer = sortableContainer((props) => <tbody {...props} />)
className="drag-icon" let cutFlag = false
/>
));
const SortableItem = sortableElement((props) => <tr {...props} />);
const SortableContainer = sortableContainer((props) => <tbody {...props} />);
let cutFlag = false;
class StoreH5Decoration extends React.Component { class StoreH5Decoration extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
storeDecorationlist: [], storeDecorationlist: [],
query: { query: {
storeId: User.getStoreId(), storeId: User.getStoreId(),
termType: "H5_ADMIN", termType: 'H5_ADMIN',
}, },
showSelectFileModal: false, showSelectFileModal: false,
diskList: [], diskList: [],
photoclip: null, photoclip: null,
preview: "", preview: '',
cutImageBlob: null, cutImageBlob: null,
hasImgReady: false, // 图片是否上传成功 hasImgReady: false, // 图片是否上传成功
imageFile: null // 需要被截取的图片 imageFile: null, // 需要被截取的图片
}; }
} }
timer = null timer = null
componentDidMount() { componentDidMount() {
this.getStoreDecorationList(); this.getStoreDecorationList()
} }
getStoreDecorationList = () => { getStoreDecorationList = () => {
StoreService.getStoreDecorationList(this.state.query).then((res) => { StoreService.getStoreDecorationList(this.state.query).then((res) => {
const data = _.map(res.result, (item, index) => { const data = _.map(res.result, (item, index) => {
item.index = index; item.index = index
item.key = index; item.key = index
return item; return item
}); })
this.setState({ this.setState({
storeDecorationlist: data, storeDecorationlist: data,
}); })
}); })
}; }
parseColumn = () => { parseColumn = () => {
return [ return [
{ {
title: "Sort", title: 'Sort',
dataIndex: "sort", dataIndex: 'sort',
width: 30, width: 30,
className: "drag-visible", className: 'drag-visible',
render: () => <DragHandle />, render: () => <DragHandle />,
}, },
{ {
title: "sequence", title: 'sequence',
dataIndex: "sequence", dataIndex: 'sequence',
key: "sequence", key: 'sequence',
className: "drag-visible", className: 'drag-visible',
width: 20, width: 20,
render: (val, record, index) => { render: (val, record, index) => {
return <div className="index-num">{index + 1}</div>; return <div className='index-num'>{index + 1}</div>
}, },
}, },
{ {
title: "banner", title: 'banner',
dataIndex: "bannerPath", dataIndex: 'bannerPath',
key: "bannerPath", key: 'bannerPath',
className: "drag-visible", className: 'drag-visible',
render: (val) => { render: (val) => {
return <img src={val} alt="banner" className="banner-thumbnail" />; return <img src={val} alt='banner' className='banner-thumbnail' />
}, },
}, },
{ {
title: "操作", title: '操作',
dataIndex: "operation", dataIndex: 'operation',
width: "20%", width: '20%',
render: (val, record, index) => { render: (val, record, index) => {
return ( return (
<div className="operation"> <div className='operation'>
<span <span className='edit' onClick={() => this.handleReplaceDecoration(record, index)}>
className="edit"
onClick={() => this.handleReplaceDecoration(record,index)}
>
替换 替换
</span> </span>
<span className="divider-line">{" | "}</span> <span className='divider-line'>{' | '}</span>
<span <span className='delete' onClick={() => this.handleDeleteDecorationConfirm(record)}>
className="delete"
onClick={() => this.handleDeleteDecorationConfirm(record)}
>
删除 删除
</span> </span>
</div> </div>
); )
}, },
}, },
]; ]
}; }
handleToAddStoreDecoration = () => { handleToAddStoreDecoration = () => {
const { choosedBannerId } = this.state; const { choosedBannerId } = this.state
if (this.state.storeDecorationlist.length >= 5 && !choosedBannerId) { if (this.state.storeDecorationlist.length >= 5 && !choosedBannerId) {
message.info("最多可添加5条"); message.info('最多可添加5条')
return; return
} }
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
choosedBannerId: "" choosedBannerId: '',
}); })
}; }
handleReplaceDecoration = (record, index) => { handleReplaceDecoration = (record, index) => {
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
choosedBannerId: record.id, choosedBannerId: record.id,
choosedBannerItem:record choosedBannerItem: record,
}); })
}; }
handleDeleteDecoration = (record) => { handleDeleteDecoration = (record) => {
StoreService.deleteStoreDecorationList({ StoreService.deleteStoreDecorationList({
storeBannerId: record.id, storeBannerId: record.id,
termType: "H5_ADMIN", termType: 'H5_ADMIN',
}).then((res) => { }).then((res) => {
message.success("已删除"); message.success('已删除')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
handleDeleteDecorationConfirm = (record) => { handleDeleteDecorationConfirm = (record) => {
return confirm({ return confirm({
title: "你确定要删除这个banner吗?", title: '你确定要删除这个banner吗?',
icon: ( icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>,
<span className="icon iconfont default-confirm-icon">&#xe839; </span> okText: '删除',
),
okText: "删除",
okType: 'danger', okType: 'danger',
cancelText: "取消", cancelText: '取消',
onOk: () => { onOk: () => {
this.handleDeleteDecoration(record); this.handleDeleteDecoration(record)
}, },
}); })
}; }
onSortEnd = ({ oldIndex, newIndex }) => { onSortEnd = ({ oldIndex, newIndex }) => {
const { storeDecorationlist } = this.state; const { storeDecorationlist } = this.state
if (oldIndex !== newIndex) { if (oldIndex !== newIndex) {
const newData = arrayMove( const newData = arrayMove([].concat(storeDecorationlist), oldIndex, newIndex).filter((el) => !!el)
[].concat(storeDecorationlist),
oldIndex,
newIndex
).filter((el) => !!el);
this.setState( this.setState(
{ {
storeDecorationlist: newData, storeDecorationlist: newData,
...@@ -193,132 +172,108 @@ class StoreH5Decoration extends React.Component { ...@@ -193,132 +172,108 @@ class StoreH5Decoration extends React.Component {
storeBannerId: storeDecorationlist[oldIndex].id, storeBannerId: storeDecorationlist[oldIndex].id,
}, },
() => { () => {
this.moveBannerSequence(); this.moveBannerSequence()
}
)
} }
);
} }
};
DraggableBodyRow = ({ className, style, ...restProps }) => { DraggableBodyRow = ({ className, style, ...restProps }) => {
const { storeDecorationlist } = this.state; const { storeDecorationlist } = this.state
// function findIndex base on Table rowKey props and should always be a right array index // function findIndex base on Table rowKey props and should always be a right array index
const index = storeDecorationlist.findIndex( const index = storeDecorationlist.findIndex((x) => x.index === restProps['data-row-key'])
(x) => x.index === restProps["data-row-key"] return <SortableItem index={index} {...restProps} />
); }
return <SortableItem index={index} {...restProps} />;
};
// 选择云盘资源 // 选择云盘资源
handleSelectImg = (file) => { handleSelectImg = (file) => {
if(file){ if (file) {
this.setState({ this.setState({
visible: true, visible: true,
imageFile:file imageFile: file,
}); })
}
} }
};
//获取resourceId //获取resourceId
getSignature = (blob) => { getSignature = (blob) => {
Upload.uploadBlobToOSS(blob, "avatar" + new Date().valueOf()).then( Upload.uploadBlobToOSS(blob, 'avatar' + new Date().valueOf()).then((addBannerPath) => {
(addBannerPath) => { this.setState(
this.setState({ {
addBannerPath, addBannerPath,
visible: false visible: false,
}, () => { },
this.state.choosedBannerId () => {
? this.editStoreBanner() this.state.choosedBannerId ? this.editStoreBanner() : this.addStoreBanner()
: this.addStoreBanner(); }
}); )
})
} }
);
};
editStoreBanner = () => { editStoreBanner = () => {
const { addBannerPath, choosedBannerId } = this.state; const { addBannerPath, choosedBannerId } = this.state
const params = { const params = {
bannerPath: addBannerPath, bannerPath: addBannerPath,
storeBannerId: choosedBannerId, storeBannerId: choosedBannerId,
termType: "H5_ADMIN", termType: 'H5_ADMIN',
}; }
StoreService.editStoreBanner(params).then((res) => { StoreService.editStoreBanner(params).then((res) => {
message.success("设置成功"); message.success('设置成功')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
moveBannerSequence = () => { moveBannerSequence = () => {
const { newSequence, storeBannerId } = this.state; const { newSequence, storeBannerId } = this.state
const params = { const params = {
sequence: newSequence, sequence: newSequence,
storeBannerId: storeBannerId, storeBannerId: storeBannerId,
termType: "H5_ADMIN", termType: 'H5_ADMIN',
}; }
StoreService.moveBannerSequence(params).then((res) => { StoreService.moveBannerSequence(params).then((res) => {
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
addStoreBanner = () => { addStoreBanner = () => {
const { addBannerPath } = this.state; const { addBannerPath } = this.state
const params = { const params = {
bannerPath: addBannerPath, bannerPath: addBannerPath,
storeId: User.getStoreId(), storeId: User.getStoreId(),
termType: "H5_ADMIN", termType: 'H5_ADMIN',
}; }
StoreService.addStoreBanner(params).then((res) => { StoreService.addStoreBanner(params).then((res) => {
message.success("设置成功"); message.success('设置成功')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
render() { render() {
const { const { storeDecorationlist, showSelectFileModal, diskList, visible, cutImageBlob, hasImgReady, imageFile } = this.state
storeDecorationlist, const DraggableContainer = (props) => <SortableContainer useDragHandle helperClass='row-dragging' onSortEnd={this.onSortEnd} {...props} />
showSelectFileModal,
diskList,
visible,
cutImageBlob,
hasImgReady,
imageFile,
} = this.state;
const DraggableContainer = (props) => (
<SortableContainer
useDragHandle
helperClass="row-dragging"
onSortEnd={this.onSortEnd}
{...props}
/>
);
return ( return (
<div className="store-decoration-h5-page"> <div className='store-decoration-h5-page'>
<div className="box-header"> <div className='box-header'>
<div className="banner-setting"> <div className='banner-setting'>
<div className="title">banner设置</div> <div className='title'>banner设置</div>
<div className="tip"> <div className='tip'>图片支持bmp、jpeg、jpg、png、gif格式,最大5M,最多可添加5张,拖动可排序。建议尺寸750*252px。</div>
图片支持bmp、jpeg、jpg、png、gif格式,最大5M,最多可添加5张,拖动可排序。建议尺寸750*252px。
</div>
</div> </div>
<Button <Button
onClick={() => { onClick={() => {
this.handleToAddStoreDecoration(); this.handleToAddStoreDecoration()
}} }}
type="primary" type='primary'
className="add-show-btn" className='add-show-btn'>
>
添加Banner 添加Banner
</Button> </Button>
</div> </div>
<div className="box-body"> <div className='box-body'>
<XMTable <XMTable
renderEmpty={{ renderEmpty={{
image: college, image: college,
description: '暂无数据' description: '暂无数据',
}} }}
size={"middle"} size={'middle'}
pagination={false} pagination={false}
dataSource={storeDecorationlist} dataSource={storeDecorationlist}
columns={this.parseColumn()} columns={this.parseColumn()}
...@@ -333,23 +288,32 @@ class StoreH5Decoration extends React.Component { ...@@ -333,23 +288,32 @@ class StoreH5Decoration extends React.Component {
/> />
</div> </div>
<SelectPrepareFileModal <SelectPrepareFileModal
operateType="select" operateType='select'
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={showSelectFileModal} isOpen={showSelectFileModal}
diskList={diskList} diskList={diskList}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }); this.setState({ showSelectFileModal: false })
}} }}
onSelect={this.handleSelectImg} onSelect={this.handleSelectImg}
/> />
{ visible && {visible && (
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='500/172' cropBoxHeight='172' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/> <ImgClipModal
} visible={visible}
imgUrl={imageFile.ossUrl}
aspectRatio='500/169'
cropBoxHeight='169'
onConfirm={this.getSignature}
onClose={() => {
this.setState({ visible: false })
}}
/>
)}
</div> </div>
); )
} }
} }
export default withRouter(StoreH5Decoration); export default withRouter(StoreH5Decoration)
...@@ -7,184 +7,163 @@ ...@@ -7,184 +7,163 @@
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from "react"; import React from 'react'
import { withRouter } from "react-router-dom"; import { withRouter } from 'react-router-dom'
import _ from "underscore"; import _ from 'underscore'
import { Modal, message, Button } from "antd"; import { Modal, message, Button } from 'antd'
import StoreService from "@/domains/store-domain/storeService"; import StoreService from '@/domains/store-domain/storeService'
import { import { sortableContainer, sortableElement, sortableHandle } from 'react-sortable-hoc'
sortableContainer, import { MenuOutlined } from '@ant-design/icons'
sortableElement, import arrayMove from 'array-move'
sortableHandle, import User from '@/common/js/user'
} from "react-sortable-hoc"; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'
import { MenuOutlined } from "@ant-design/icons"; import './StoreDecorationPage.less'
import arrayMove from "array-move"; import Upload from '@/core/upload'
import User from "@/common/js/user"; import { XMTable } from '@/components'
import SelectPrepareFileModal from "@/modules/prepare-lesson/modal/SelectPrepareFileModal"; import college from '@/common/lottie/college'
import "./StoreDecorationPage.less";
import Upload from "@/core/upload";
import { XMTable } from '@/components';
import college from '@/common/lottie/college';
import ImgClipModal from '@/components/ImgClipModal' import ImgClipModal from '@/components/ImgClipModal'
const { confirm } = Modal; const { confirm } = Modal
const DragHandle = sortableHandle(() => ( const DragHandle = sortableHandle(() => <MenuOutlined style={{ cursor: 'pointer', color: '#999' }} className='drag-icon' />)
<MenuOutlined const SortableItem = sortableElement((props) => <tr {...props} />)
style={{ cursor: "pointer", color: "#999" }} const SortableContainer = sortableContainer((props) => <tbody {...props} />)
className="drag-icon" let cutFlag = false
/>
));
const SortableItem = sortableElement((props) => <tr {...props} />);
const SortableContainer = sortableContainer((props) => <tbody {...props} />);
let cutFlag = false;
class StoreWebDecoration extends React.Component { class StoreWebDecoration extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
storeDecorationlist: [], storeDecorationlist: [],
query: { query: {
storeId: User.getStoreId(), storeId: User.getStoreId(),
termType: "WEB_ADMIN", termType: 'WEB_ADMIN',
}, },
showSelectFileModal: false, showSelectFileModal: false,
diskList: [], diskList: [],
photoclip: null, photoclip: null,
preview: "", preview: '',
cutImageBlob: null, cutImageBlob: null,
hasImgReady: false,// 图片是否上传成功 hasImgReady: false, // 图片是否上传成功
imageFile: null // 需要被截取的图片 imageFile: null, // 需要被截取的图片
}; }
} }
timer = null timer = null
componentDidMount() { componentDidMount() {
this.getStoreDecorationList(); this.getStoreDecorationList()
} }
getStoreDecorationList = () => { getStoreDecorationList = () => {
StoreService.getStoreDecorationList(this.state.query).then((res) => { StoreService.getStoreDecorationList(this.state.query).then((res) => {
const data = _.map(res.result, (item, index) => { const data = _.map(res.result, (item, index) => {
item.index = index; item.index = index
item.key = index; item.key = index
return item; return item
}); })
this.setState({ this.setState({
storeDecorationlist: data, storeDecorationlist: data,
}); })
}); })
}; }
parseColumn = () => { parseColumn = () => {
return [ return [
{ {
title: "Sort", title: 'Sort',
dataIndex: "sort", dataIndex: 'sort',
width: 30, width: 30,
className: "drag-visible", className: 'drag-visible',
render: () => <DragHandle />, render: () => <DragHandle />,
}, },
{ {
title: "sequence", title: 'sequence',
dataIndex: "sequence", dataIndex: 'sequence',
key: "sequence", key: 'sequence',
className: "drag-visible", className: 'drag-visible',
width: 20, width: 20,
render: (val, record, index) => { render: (val, record, index) => {
return <div className="index-num">{index + 1}</div>; return <div className='index-num'>{index + 1}</div>
}, },
}, },
{ {
title: "banner", title: 'banner',
dataIndex: "bannerPath", dataIndex: 'bannerPath',
key: "bannerPath", key: 'bannerPath',
className: "drag-visible", className: 'drag-visible',
render: (val) => { render: (val) => {
return <img src={val} alt="banner" className="web-banner-thumbnail" />; return <img src={val} alt='banner' className='web-banner-thumbnail' />
}, },
}, },
{ {
title: "操作", title: '操作',
dataIndex: "operation", dataIndex: 'operation',
width: "20%", width: '20%',
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="operation"> <div className='operation'>
<span <span className='edit' onClick={() => this.handleReplaceDecoration(record)}>
className="edit"
onClick={() => this.handleReplaceDecoration(record)}
>
替换 替换
</span> </span>
<span className="divider-line">{" | "}</span> <span className='divider-line'>{' | '}</span>
<span <span className='delete' onClick={() => this.handleDeleteDecorationConfirm(record)}>
className="delete"
onClick={() => this.handleDeleteDecorationConfirm(record)}
>
删除 删除
</span> </span>
</div> </div>
); )
}, },
}, },
]; ]
}; }
handleToAddStoreDecoration = () => { handleToAddStoreDecoration = () => {
const { choosedBannerId } = this.state; const { choosedBannerId } = this.state
if (this.state.storeDecorationlist.length >= 5 && !choosedBannerId) { if (this.state.storeDecorationlist.length >= 5 && !choosedBannerId) {
message.info("最多可添加5条"); message.info('最多可添加5条')
return; return
} }
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
choosedBannerId: "" choosedBannerId: '',
}); })
}; }
handleReplaceDecoration = (record) => { handleReplaceDecoration = (record) => {
this.setState({ this.setState({
showSelectFileModal: true, showSelectFileModal: true,
choosedBannerId: record.id, choosedBannerId: record.id,
choosedBannerItem:record choosedBannerItem: record,
}); })
}; }
handleDeleteDecoration = (record) => { handleDeleteDecoration = (record) => {
StoreService.deleteStoreDecorationList({ StoreService.deleteStoreDecorationList({
storeBannerId: record.id, storeBannerId: record.id,
termType: "WEB_ADMIN", termType: 'WEB_ADMIN',
}).then((res) => { }).then((res) => {
message.success("已删除"); message.success('已删除')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
handleDeleteDecorationConfirm = (record) => { handleDeleteDecorationConfirm = (record) => {
return confirm({ return confirm({
title: "你确定要删除这个banner吗?", title: '你确定要删除这个banner吗?',
icon: ( icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>,
<span className="icon iconfont default-confirm-icon">&#xe839; </span> okText: '删除',
),
okText: "删除",
okType: 'danger', okType: 'danger',
cancelText: "取消", cancelText: '取消',
onOk: () => { onOk: () => {
this.handleDeleteDecoration(record); this.handleDeleteDecoration(record)
}, },
}); })
}; }
onSortEnd = ({ oldIndex, newIndex }) => { onSortEnd = ({ oldIndex, newIndex }) => {
const { storeDecorationlist } = this.state; const { storeDecorationlist } = this.state
if (oldIndex !== newIndex) { if (oldIndex !== newIndex) {
const newData = arrayMove( const newData = arrayMove([].concat(storeDecorationlist), oldIndex, newIndex).filter((el) => !!el)
[].concat(storeDecorationlist),
oldIndex,
newIndex
).filter((el) => !!el);
this.setState( this.setState(
{ {
storeDecorationlist: newData, storeDecorationlist: newData,
...@@ -192,131 +171,107 @@ class StoreWebDecoration extends React.Component { ...@@ -192,131 +171,107 @@ class StoreWebDecoration extends React.Component {
storeBannerId: storeDecorationlist[oldIndex].id, storeBannerId: storeDecorationlist[oldIndex].id,
}, },
() => { () => {
this.moveBannerSequence(); this.moveBannerSequence()
}
)
} }
);
} }
};
DraggableBodyRow = ({ className, style, ...restProps }) => { DraggableBodyRow = ({ className, style, ...restProps }) => {
const { storeDecorationlist } = this.state; const { storeDecorationlist } = this.state
// function findIndex base on Table rowKey props and should always be a right array index // function findIndex base on Table rowKey props and should always be a right array index
const index = storeDecorationlist.findIndex( const index = storeDecorationlist.findIndex((x) => x.index === restProps['data-row-key'])
(x) => x.index === restProps["data-row-key"] return <SortableItem index={index} {...restProps} />
); }
return <SortableItem index={index} {...restProps} />;
};
// 选择云盘资源 // 选择云盘资源
handleSelectImg = (file) => { handleSelectImg = (file) => {
if(file){ if (file) {
this.setState({ this.setState({
visible: true, visible: true,
imageFile:file imageFile: file,
}); })
}
} }
};
//获取resourceId //获取resourceId
getSignature = (blob) => { getSignature = (blob) => {
Upload.uploadBlobToOSS(blob, "avatar" + new Date().valueOf()).then( Upload.uploadBlobToOSS(blob, 'avatar' + new Date().valueOf()).then((addBannerPath) => {
(addBannerPath) => { this.setState(
this.setState({ {
addBannerPath, addBannerPath,
visible: false visible: false,
}, () => { },
this.state.choosedBannerId () => {
? this.editStoreBanner() this.state.choosedBannerId ? this.editStoreBanner() : this.addStoreBanner()
: this.addStoreBanner(); }
}); )
})
} }
);
};
editStoreBanner = () => { editStoreBanner = () => {
const { addBannerPath, choosedBannerId } = this.state; const { addBannerPath, choosedBannerId } = this.state
const params = { const params = {
bannerPath: addBannerPath, bannerPath: addBannerPath,
storeBannerId: choosedBannerId, storeBannerId: choosedBannerId,
termType: "WEB_ADMIN", termType: 'WEB_ADMIN',
}; }
StoreService.editStoreBanner(params).then((res) => { StoreService.editStoreBanner(params).then((res) => {
message.success("设置成功"); message.success('设置成功')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
moveBannerSequence = () => { moveBannerSequence = () => {
const { newSequence, storeBannerId } = this.state; const { newSequence, storeBannerId } = this.state
const params = { const params = {
sequence: newSequence, sequence: newSequence,
storeBannerId: storeBannerId, storeBannerId: storeBannerId,
termType: "WEB_ADMIN", termType: 'WEB_ADMIN',
}; }
StoreService.moveBannerSequence(params).then((res) => { StoreService.moveBannerSequence(params).then((res) => {
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
addStoreBanner = () => { addStoreBanner = () => {
const { addBannerPath } = this.state; const { addBannerPath } = this.state
const params = { const params = {
bannerPath: addBannerPath, bannerPath: addBannerPath,
storeId: User.getStoreId(), storeId: User.getStoreId(),
termType: "WEB_ADMIN", termType: 'WEB_ADMIN',
}; }
StoreService.addStoreBanner(params).then((res) => { StoreService.addStoreBanner(params).then((res) => {
message.success("设置成功"); message.success('设置成功')
this.getStoreDecorationList(); this.getStoreDecorationList()
}); })
}; }
render() { render() {
const { const { storeDecorationlist, showSelectFileModal, diskList, visible, cutImageBlob, hasImgReady, imageFile } = this.state
storeDecorationlist, const DraggableContainer = (props) => <SortableContainer useDragHandle helperClass='row-dragging' onSortEnd={this.onSortEnd} {...props} />
showSelectFileModal,
diskList,
visible,
cutImageBlob,
hasImgReady,
imageFile
} = this.state;
const DraggableContainer = (props) => (
<SortableContainer
useDragHandle
helperClass="row-dragging"
onSortEnd={this.onSortEnd}
{...props}
/>
);
return ( return (
<div className="store-decoration-web-page"> <div className='store-decoration-web-page'>
<div className="box-header"> <div className='box-header'>
<div className="banner-setting"> <div className='banner-setting'>
<div className="title">banner设置</div> <div className='title'>banner设置</div>
<div className="tip"> <div className='tip'>图片支持bmp、jpeg、jpg、png、gif格式,最大5M,最多可添加5张,拖动可排序。建议尺寸1232*212px。</div>
图片支持bmp、jpeg、jpg、png、gif格式,最大5M,最多可添加5张,拖动可排序。建议尺寸1232*212px。
</div>
</div> </div>
<Button <Button
onClick={() => { onClick={() => {
this.handleToAddStoreDecoration(); this.handleToAddStoreDecoration()
}} }}
type="primary" type='primary'
className="add-show-btn" className='add-show-btn'>
>
添加Banner 添加Banner
</Button> </Button>
</div> </div>
<div className="box-body"> <div className='box-body'>
<XMTable <XMTable
renderEmpty={{ renderEmpty={{
image: college, image: college,
description: '暂无数据' description: '暂无数据',
}} }}
size={"middle"} size={'middle'}
pagination={false} pagination={false}
dataSource={storeDecorationlist} dataSource={storeDecorationlist}
columns={this.parseColumn()} columns={this.parseColumn()}
...@@ -331,23 +286,32 @@ class StoreWebDecoration extends React.Component { ...@@ -331,23 +286,32 @@ class StoreWebDecoration extends React.Component {
/> />
</div> </div>
<SelectPrepareFileModal <SelectPrepareFileModal
operateType="select" operateType='select'
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={showSelectFileModal} isOpen={showSelectFileModal}
diskList={diskList} diskList={diskList}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }); this.setState({ showSelectFileModal: false })
}} }}
onSelect={this.handleSelectImg} onSelect={this.handleSelectImg}
/> />
{ visible && {visible && (
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='500/73' cropBoxHeight='73' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/> <ImgClipModal
} visible={visible}
imgUrl={imageFile.ossUrl}
aspectRatio='500/134'
cropBoxHeight='134'
onConfirm={this.getSignature}
onClose={() => {
this.setState({ visible: false })
}}
/>
)}
</div> </div>
); )
} }
} }
export default withRouter(StoreWebDecoration); export default withRouter(StoreWebDecoration)
...@@ -5,37 +5,37 @@ ...@@ -5,37 +5,37 @@
* @LastEditTime: 2021-05-19 19:44:08 * @LastEditTime: 2021-05-19 19:44:08
* @Description: 内容线路由配置 * @Description: 内容线路由配置
*/ */
import Home from '@/modules/home/Home'; import Home from '@/modules/home/Home'
import EmployeesManagePage from '@/modules/store-manage/EmployeesManagePage'; import EmployeesManagePage from '@/modules/store-manage/EmployeesManagePage'
import EmployeeManage from '@/modules/college-manage/EmployeeManage'; import EmployeeManage from '@/modules/college-manage/EmployeeManage'
import personalInfoPage from '@/modules/personalInfo'; import personalInfoPage from '@/modules/personalInfo'
import UserManagePage from '@/modules/store-manage/UserManagePage'; import UserManagePage from '@/modules/store-manage/UserManagePage'
import UserManage from '@/modules/college-manage/UserManagePage'; import UserManage from '@/modules/college-manage/UserManagePage'
import StoreDecorationPage from '@/modules/store-manage/StoreDecorationPage'; import StoreDecorationPage from '@/modules/store-manage/StoreDecorationPage'
import CourseCatalogPage from '@/modules/store-manage/CourseCatalogPage'; import CourseCatalogPage from '@/modules/store-manage/CourseCatalogPage'
import LiveCoursePage from '@/modules/course-manage/LiveCoursePage'; import LiveCoursePage from '@/modules/course-manage/LiveCoursePage'
import AddLivePage from '@/modules/course-manage/AddLive'; import AddLivePage from '@/modules/course-manage/AddLive'
import VideoCoursePage from '@/modules/course-manage/video-course'; import VideoCoursePage from '@/modules/course-manage/video-course'
import GraphicsCoursePage from '@/modules/course-manage/graphics-course'; import GraphicsCoursePage from '@/modules/course-manage/graphics-course'
import OfflineCoursePage from '@/modules/course-manage/offline-course'; import OfflineCoursePage from '@/modules/course-manage/offline-course'
import AddVideoCoursePage from '@/modules/course-manage/video-course/AddVideoCourse'; import AddVideoCoursePage from '@/modules/course-manage/video-course/AddVideoCourse'
import AddGraphicsCoursePage from '@/modules/course-manage/graphics-course/AddGraphicsCourse'; import AddGraphicsCoursePage from '@/modules/course-manage/graphics-course/AddGraphicsCourse'
import AddOfflineCoursePage from '@/modules/course-manage/offline-course/AddOfflineCourse'; import AddOfflineCoursePage from '@/modules/course-manage/offline-course/AddOfflineCourse'
// import DataList from '@/modules/course-manage/DataList/DataList'; // import DataList from '@/modules/course-manage/DataList/DataList';
// import ClassBook from '@/modules/resource-disk'; // import ClassBook from '@/modules/resource-disk';
import ResourceDisk from '@/modules/resource-disk'; import ResourceDisk from '@/modules/resource-disk'
import SwitchRoute from '@/modules/root/SwitchRoute'; import SwitchRoute from '@/modules/root/SwitchRoute'
import PlanPage from '@/modules/plan-manage/PlanPage'; import PlanPage from '@/modules/plan-manage/PlanPage'
import AddPlanPage from '@/modules/plan-manage/AddPlan'; import AddPlanPage from '@/modules/plan-manage/AddPlan'
import LearningDataPage from '@/modules/plan-manage/LearningData'; import LearningDataPage from '@/modules/plan-manage/LearningData'
import StoreInfoPage from '@/modules/store-manage/StoreInfo'; import StoreInfoPage from '@/modules/store-manage/StoreInfo'
import CourseCategoryManage from '@/modules/teach-tool/components/CourseCategoryManage'; import CourseCategoryManage from '@/modules/teach-tool/components/CourseCategoryManage'
import QuestionManageIndex from '@/modules/teach-tool/question-manage/Index'; import QuestionManageIndex from '@/modules/teach-tool/question-manage/Index'
import PaperManageIndex from '@/modules/teach-tool/paper-manage/Index'; import PaperManageIndex from '@/modules/teach-tool/paper-manage/Index'
import ExaminationManagerIndex from '@/modules/teach-tool/examination-manager/Index'; import ExaminationManagerIndex from '@/modules/teach-tool/examination-manager/Index'
import ExaminationManagerTestDetail from '@/modules/teach-tool/examination-manager/TestDetailPage'; import ExaminationManagerTestDetail from '@/modules/teach-tool/examination-manager/TestDetailPage'
import KnowledgeBase from '@/modules/knowledge-base/index'; import KnowledgeBase from '@/modules/knowledge-base/index'
import CollegeInfoPage from '@/modules/college-manage/CollegeInfoPage'; import CollegeInfoPage from '@/modules/college-manage/CollegeInfoPage'
const mainRoutes = [ const mainRoutes = [
{ {
...@@ -91,7 +91,7 @@ const mainRoutes = [ ...@@ -91,7 +91,7 @@ const mainRoutes = [
{ {
path: '/offline-course', path: '/offline-course',
component: OfflineCoursePage, component: OfflineCoursePage,
name: '线下', name: '线下活动',
}, },
{ {
path: '/create-live-course', path: '/create-live-course',
...@@ -117,12 +117,12 @@ const mainRoutes = [ ...@@ -117,12 +117,12 @@ const mainRoutes = [
{ {
path: '/create-offline-course', path: '/create-offline-course',
component: AddOfflineCoursePage, component: AddOfflineCoursePage,
name: '创建线下', name: '创建线下活动',
}, },
{ {
path: '/resource-disk', path: '/resource-disk',
component: ResourceDisk, component: ResourceDisk,
name: '资料云盘', name: '素材库',
}, },
{ {
path: '/question-manage-index', path: '/question-manage-index',
...@@ -180,6 +180,6 @@ const mainRoutes = [ ...@@ -180,6 +180,6 @@ const mainRoutes = [
component: LearningDataPage, component: LearningDataPage,
name: '学习数据', name: '学习数据',
}, },
]; ]
export default mainRoutes; export default mainRoutes
...@@ -28,8 +28,8 @@ export const menuList: any = [ ...@@ -28,8 +28,8 @@ export const menuList: any = [
link: '/live-course', link: '/live-course',
}, },
{ {
groupName: "线上课", groupName: '线上课',
groupCode: "CourseVideoClass", groupCode: 'CourseVideoClass',
link: '/video-course', link: '/video-course',
}, },
{ {
...@@ -38,7 +38,7 @@ export const menuList: any = [ ...@@ -38,7 +38,7 @@ export const menuList: any = [
link: '/graphics-course', link: '/graphics-course',
}, },
{ {
groupName: '线下', groupName: '线下活动',
groupCode: 'OfflineClass', groupCode: 'OfflineClass',
link: '/offline-course', link: '/offline-course',
}, },
...@@ -91,7 +91,7 @@ export const menuList: any = [ ...@@ -91,7 +91,7 @@ export const menuList: any = [
selectImg: 'https://image.xiaomaiketang.com/xm/hJKCfibC22.png', selectImg: 'https://image.xiaomaiketang.com/xm/hJKCfibC22.png',
}, },
{ {
groupName: '资料云盘', groupName: '素材库',
groupCode: 'CloudDisk', groupCode: 'CloudDisk',
icon: '&#xe8aa;', icon: '&#xe8aa;',
link: '/resource-disk', link: '/resource-disk',
...@@ -151,4 +151,4 @@ export const menuList: any = [ ...@@ -151,4 +151,4 @@ export const menuList: any = [
}, },
], ],
}, },
]; ]
import LiveCoursePage from "@/modules/course-manage/LiveCoursePage"; import LiveCoursePage from '@/modules/course-manage/LiveCoursePage'
import ResourceDisk from "@/modules/resource-disk"; import ResourceDisk from '@/modules/resource-disk'
const redirectRoutes = [ const redirectRoutes = [
{ {
path: "/redirect-to-live-course", path: '/redirect-to-live-course',
component: LiveCoursePage, component: LiveCoursePage,
name: "课程管理", name: '课程管理',
}, },
{ {
path: "/redirect-to-resource-disk", path: '/redirect-to-resource-disk',
component: ResourceDisk, component: ResourceDisk,
name: "资料云盘", name: '素材库',
}, },
]; ]
export default redirectRoutes; export default redirectRoutes
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