Commit 5bd610bd by guomingpang

fix:1。修复知识库。添加分类视频课时,分类筛选未初始化的问题。2、修复课程管理视频课程无法分享的问题

parent e22f9e10
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:12:45 * @Date: 2020-08-05 10:12:45
* @LastEditors: wufan * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-30 17:33:54 * @LastEditTime: 2021-05-31 18:04:10
* @Description: 视频课-列表模块 * @Description: 视频课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react' import React from 'react';
import { Table, Modal, message, Tooltip, Switch, Dropdown } from 'antd' import { Table, 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 ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal' import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal';
import WatchDataModal from '../modal/WatchDataModal' import WatchDataModal from '../modal/WatchDataModal';
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 './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: [],
...@@ -30,14 +30,14 @@ class VideoCourseList extends React.Component { ...@@ -30,14 +30,14 @@ 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);
} }
} }
...@@ -50,17 +50,17 @@ class VideoCourseList extends React.Component { ...@@ -50,17 +50,17 @@ class VideoCourseList extends React.Component {
close={() => { close={() => {
this.setState({ this.setState({
watchDataModal: null, watchDataModal: null,
}) });
}} }}
/> />
) );
this.setState({ watchDataModal }) this.setState({ watchDataModal });
} };
// 请求表头 // 请求表头
parseColumns = () => { parseColumns = () => {
const { type } = this.props const { type } = this.props;
const { ShelfLoading } = this.state const { ShelfLoading } = this.state;
const columns = [ const columns = [
{ {
title: '视频课', title: '视频课',
...@@ -69,7 +69,7 @@ class VideoCourseList extends React.Component { ...@@ -69,7 +69,7 @@ class VideoCourseList extends React.Component {
width: 321, width: 321,
fixed: 'left', fixed: 'left',
render: (val, record) => { render: (val, record) => {
const { coverUrl, scheduleVideoUrl } = record const { coverUrl, scheduleVideoUrl } = record;
return ( return (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
...@@ -92,7 +92,7 @@ class VideoCourseList extends React.Component { ...@@ -92,7 +92,7 @@ class VideoCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) );
}, },
}, },
{ {
...@@ -124,7 +124,7 @@ class VideoCourseList extends React.Component { ...@@ -124,7 +124,7 @@ class VideoCourseList extends React.Component {
<div className='record__item'>{record.categorySonName}</div> <div className='record__item'>{record.categorySonName}</div>
</Otherwise> </Otherwise>
</Choose> </Choose>
) );
}, },
}, },
{ {
...@@ -141,14 +141,27 @@ class VideoCourseList extends React.Component { ...@@ -141,14 +141,27 @@ class VideoCourseList extends React.Component {
</Tooltip> </Tooltip>
)} )}
</div> </div>
) );
}, },
}, },
{ {
title: <span> title: (
<span>
<span>学院展示</span> <span>学院展示</span>
<Tooltip title={<div>开启后,学员可在学院内查看到此课程。<br/>关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。</div>}><i className="icon iconfont" style={{ marginLeft: '5px',cursor:'pointer',color:'#bfbfbf',fontSize:'14px',fontWeight:'normal'}}>&#xe61d;</i></Tooltip> <Tooltip
</span>, title={
<div>
开启后,学员可在学院内查看到此课程。
<br />
关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。
</div>
}>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d;
</i>
</Tooltip>
</span>
),
width: 120, width: 120,
key: 'shelfState', key: 'shelfState',
dataIndex: 'shelfState', dataIndex: 'shelfState',
...@@ -159,10 +172,10 @@ class VideoCourseList extends React.Component { ...@@ -159,10 +172,10 @@ 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);
}} }}
/> />
) );
}, },
}, },
{ {
...@@ -171,7 +184,7 @@ class VideoCourseList extends React.Component { ...@@ -171,7 +184,7 @@ class VideoCourseList extends React.Component {
key: 'watchUserCount', key: 'watchUserCount',
dataIndex: 'watchUserCount', dataIndex: 'watchUserCount',
render: (val, item) => { render: (val, item) => {
return <div className='watchUserCount'>{val || 0}</div> return <div className='watchUserCount'>{val || 0}</div>;
}, },
}, },
{ {
...@@ -181,7 +194,7 @@ class VideoCourseList extends React.Component { ...@@ -181,7 +194,7 @@ class VideoCourseList extends React.Component {
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return formatDate('YYYY-MM-DD H:i', val) return formatDate('YYYY-MM-DD H:i', val);
}, },
}, },
{ {
...@@ -191,7 +204,7 @@ class VideoCourseList extends React.Component { ...@@ -191,7 +204,7 @@ class VideoCourseList extends React.Component {
dataIndex: 'updated', dataIndex: 'updated',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return formatDate('YYYY-MM-DD H:i', val) return formatDate('YYYY-MM-DD H:i', val);
}, },
}, },
{ {
...@@ -210,7 +223,7 @@ class VideoCourseList extends React.Component { ...@@ -210,7 +223,7 @@ class VideoCourseList 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>
...@@ -219,7 +232,7 @@ class VideoCourseList extends React.Component { ...@@ -219,7 +232,7 @@ class VideoCourseList extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) );
}, },
}, },
{ {
...@@ -234,7 +247,6 @@ class VideoCourseList extends React.Component { ...@@ -234,7 +247,6 @@ class VideoCourseList extends React.Component {
<div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}> <div className='operate__item' onClick={() => this.handleShowWatchDataModal(record)}>
观看数据 观看数据
</div> </div>
<If condition={type === 'internal'}> <If condition={type === 'internal'}>
<span className='operate__item split'> | </span> <span className='operate__item split'> | </span>
<div className='operate__item' onClick={() => this.handleShowShareModal(record)}> <div className='operate__item' onClick={() => this.handleShowShareModal(record)}>
...@@ -243,28 +255,25 @@ class VideoCourseList extends React.Component { ...@@ -243,28 +255,25 @@ class VideoCourseList extends React.Component {
</If> </If>
<span className='operate__item split'> | </span> <span className='operate__item split'> | </span>
<Dropdown overlay={this.renderMoreOperate(record)}> <Dropdown overlay={this.renderMoreOperate(record)}>
<span className="more-operate"> <span className='more-operate'>
<span className="operate-text">更多</span> <span className='operate-text'>更多</span>
<span <span className='iconfont icon' style={{ color: '#2966FF' }}>
className="iconfont icon"
style={{ color: "#2966FF" }}
>
&#xe824; &#xe824;
</span> </span>
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
) );
}, },
}, },
] ];
type !== 'internal' && columns.splice(2, 1) type !== 'internal' && columns.splice(2, 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'}>
...@@ -281,7 +290,7 @@ class VideoCourseList extends React.Component { ...@@ -281,7 +290,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>
...@@ -290,41 +299,41 @@ class VideoCourseList extends React.Component { ...@@ -290,41 +299,41 @@ class VideoCourseList extends React.Component {
</div> </div>
</If> </If>
</div> </div>
) );
} };
handlePlanName = (planArray) => { handlePlanName = (planArray) => {
let planStr = '' let planStr = '';
planArray.map((item, index) => { planArray.map((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) => {
...@@ -339,28 +348,28 @@ class VideoCourseList extends React.Component { ...@@ -339,28 +348,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
...@@ -372,82 +381,82 @@ class VideoCourseList extends React.Component { ...@@ -372,82 +381,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 } = this.props const { dataSource = [], totalCount, query, type } = 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' : ''}`}>
<Table <Table
...@@ -467,8 +476,8 @@ class VideoCourseList extends React.Component { ...@@ -467,8 +476,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>
...@@ -485,8 +494,8 @@ class VideoCourseList extends React.Component { ...@@ -485,8 +494,8 @@ class VideoCourseList extends React.Component {
{this.state.shareLiveModal} {this.state.shareLiveModal}
{this.state.watchDataModal} {this.state.watchDataModal}
</div> </div>
) );
} }
} }
export default VideoCourseList export default VideoCourseList;
...@@ -2,30 +2,30 @@ ...@@ -2,30 +2,30 @@
* @Description: * @Description:
* @Author: zangsuyun * @Author: zangsuyun
* @Date: 2021-03-13 09:54:26 * @Date: 2021-03-13 09:54:26
* @LastEditors: wufan * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-30 17:35:11 * @LastEditTime: 2021-05-31 18:23:28
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react' import React from 'react';
import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from 'antd' import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from 'antd';
import { PageControl } from '@/components' import { PageControl } from '@/components';
import TableSelectedData from '@/components/TableSelectedData' import TableSelectedData from '@/components/TableSelectedData';
import KnowledgeAPI from '@/data-source/knowledge/request-api' import KnowledgeAPI from '@/data-source/knowledge/request-api';
import AidToolService from '@/domains/aid-tool-domain/AidToolService' import AidToolService from '@/domains/aid-tool-domain/AidToolService';
import User from '@/common/js/user' import User from '@/common/js/user';
import './LiveList.less' import './LiveList.less';
import _ from 'underscore' import _ from 'underscore';
import dealTimeDuration from '../../course-manage/utils/dealTimeDuration' import dealTimeDuration from '../../course-manage/utils/dealTimeDuration';
const { Search } = Input const { Search } = Input;
const { TabPane } = Tabs const { TabPane } = Tabs;
const courseStateShow = { const courseStateShow = {
UN_START: { UN_START: {
code: 1, code: 1,
title: "待开课", title: '待开课',
color: "#FFB129", color: '#FFB129',
}, },
STARTING: { STARTING: {
code: 2, code: 2,
...@@ -42,11 +42,11 @@ const courseStateShow = { ...@@ -42,11 +42,11 @@ const courseStateShow = {
title: '未成功开课', title: '未成功开课',
color: '#999', color: '#999',
}, },
} };
class AddCourse extends React.Component { class AddCourse extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props);
this.state = { this.state = {
liveDataSource: [], liveDataSource: [],
liveSize: 10, liveSize: 10,
...@@ -126,13 +126,13 @@ class AddCourse extends React.Component { ...@@ -126,13 +126,13 @@ class AddCourse extends React.Component {
selectPicture: [], //弹窗内已选择的图文课程 selectPicture: [], //弹窗内已选择的图文课程
categoryList: [], //内部分类列表 categoryList: [], //内部分类列表
categoryListExternal: [], //外部分类列表 categoryListExternal: [], //外部分类列表
} };
} }
componentDidMount() { componentDidMount() {
this.handleFetchLiveList() this.handleFetchLiveList();
this.handleFetchVideoList() this.handleFetchVideoList();
this.handleFetchPictureList() this.handleFetchPictureList();
this.queryCategoryTree() this.queryCategoryTree();
} }
// 查询分类树 // 查询分类树
...@@ -140,27 +140,27 @@ class AddCourse extends React.Component { ...@@ -140,27 +140,27 @@ class AddCourse extends React.Component {
let query = { let query = {
storeId: User.getStoreId(), storeId: User.getStoreId(),
withCount: false, withCount: false,
} };
let queryInternal = { let queryInternal = {
bizType: 'QUESTION', bizType: 'QUESTION',
source: 2, source: 2,
tenantId: User.getStoreId(), tenantId: User.getStoreId(),
userId: User.getStoreUserId(), userId: User.getStoreUserId(),
count: false, count: false,
} };
AidToolService.queryExternalCategoryTree(queryInternal).then((res) => { AidToolService.queryExternalCategoryTree(queryInternal).then((res) => {
const { categoryList = [] } = res.result const { categoryList = [] } = res.result;
this.setState({ this.setState({
categoryListExternal: this.renderTreeNodes(categoryList), categoryListExternal: this.renderTreeNodes(categoryList),
}) });
}) });
KnowledgeAPI.getCategoryTree(query).then((res) => { KnowledgeAPI.getCategoryTree(query).then((res) => {
const { categoryList = [] } = res.result const { categoryList = [] } = res.result;
this.setState({ this.setState({
categoryList: this.renderTreeNodes(categoryList), categoryList: this.renderTreeNodes(categoryList),
}) });
}) });
} };
renderTreeNodes = (data) => { renderTreeNodes = (data) => {
let newTreeData = data.map((item) => { let newTreeData = data.map((item) => {
...@@ -171,50 +171,50 @@ class AddCourse extends React.Component { ...@@ -171,50 +171,50 @@ class AddCourse extends React.Component {
</span> </span>
{item.categoryName} {item.categoryName}
</span> </span>
) );
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;
};
// 获取直播课列表 // 获取直播课列表
handleFetchLiveList = () => { handleFetchLiveList = () => {
const { liveQuery, liveSize } = this.state const { liveQuery, liveSize } = this.state;
const params = { const params = {
...liveQuery, ...liveQuery,
size: liveSize, size: liveSize,
} };
// CourseService.getLiveCloudCoursePage(params).then((res) => { // CourseService.getLiveCloudCoursePage(params).then((res) => {
KnowledgeAPI.knowledgeLiveCoursePage(params).then((res) => { KnowledgeAPI.knowledgeLiveCoursePage(params).then((res) => {
const { result = {} } = res const { result = {} } = res;
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
liveDataSource: records, liveDataSource: records,
liveTotalCount: Number(total), liveTotalCount: Number(total),
}) });
}) });
} };
// 获取视频课列表 // 获取视频课列表
handleFetchVideoList = () => { handleFetchVideoList = () => {
const { videoQuery, videoSize, videoCourseDivision, videoDataSource, videoTotalCount } = this.state const { videoQuery, videoSize, videoCourseDivision, videoDataSource, videoTotalCount } = this.state;
const params = { const params = {
...videoQuery[videoCourseDivision], ...videoQuery[videoCourseDivision],
size: videoSize[videoCourseDivision], size: videoSize[videoCourseDivision],
courseDivision: videoCourseDivision === 'internal' ? 'INTERNAL' : 'EXTERNAL', courseDivision: videoCourseDivision === 'internal' ? 'INTERNAL' : 'EXTERNAL',
} };
// CourseService.videoSchedulePage(query).then((res) => { // CourseService.videoSchedulePage(query).then((res) => {
KnowledgeAPI.knowledgeMediaCoursePage(params).then((res) => { KnowledgeAPI.knowledgeMediaCoursePage(params).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {};
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
videoDataSource: { videoDataSource: {
...videoDataSource, ...videoDataSource,
...@@ -224,71 +224,71 @@ class AddCourse extends React.Component { ...@@ -224,71 +224,71 @@ class AddCourse extends React.Component {
...videoTotalCount, ...videoTotalCount,
[videoCourseDivision]: Number(total), [videoCourseDivision]: Number(total),
}, },
}) });
}) });
} };
// 获取图文课列表 // 获取图文课列表
handleFetchPictureList = () => { handleFetchPictureList = () => {
const { pictureQuery, pictureSize } = this.state const { pictureQuery, pictureSize } = this.state;
const params = { const params = {
...pictureQuery, ...pictureQuery,
size: pictureSize, size: pictureSize,
} };
// CourseService.pictureSchedulePage(query).then((res) => { // CourseService.pictureSchedulePage(query).then((res) => {
KnowledgeAPI.knowledgeMediaCoursePage(params).then((res) => { KnowledgeAPI.knowledgeMediaCoursePage(params).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {};
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
pictureDataSource: records, pictureDataSource: records,
pictureTotalCount: Number(total), pictureTotalCount: Number(total),
}) });
}) });
} };
onShowLiveSizeChange = (current, size) => { onShowLiveSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
liveSize: size, liveSize: size,
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList();
} },
) );
} };
onShowVideoSizeChange = (current, size) => { onShowVideoSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
videoSize: size, videoSize: size,
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList();
} },
) );
} };
onShowPictureSizeChange = (current, size) => { onShowPictureSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
pictureSize: size, pictureSize: size,
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList();
} },
) );
} };
liveColumns = () => { liveColumns = () => {
const columns = [ const columns = [
...@@ -300,13 +300,12 @@ class AddCourse extends React.Component { ...@@ -300,13 +300,12 @@ class AddCourse extends React.Component {
<i <i
className='icon iconfont' className='icon iconfont'
style={{ style={{
marginLeft: "5px", marginLeft: '5px',
cursor: "pointer", cursor: 'pointer',
color: "#bfbfbf", color: '#bfbfbf',
fontSize: "14px", fontSize: '14px',
fontWeight:"400" fontWeight: '400',
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
...@@ -316,13 +315,13 @@ class AddCourse extends React.Component { ...@@ -316,13 +315,13 @@ class AddCourse 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) => { {record.courseMediaVOS.map((item) => {
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/YNfi45JwFA.png'} alt='' />} {!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} alt='' />}
...@@ -349,7 +348,7 @@ class AddCourse extends React.Component { ...@@ -349,7 +348,7 @@ class AddCourse extends React.Component {
</div> </div>
</div> </div>
</div> </div>
) );
}, },
}, },
{ {
...@@ -363,7 +362,7 @@ class AddCourse extends React.Component { ...@@ -363,7 +362,7 @@ class AddCourse extends React.Component {
{formatDate('YYYY-MM-DD', parseInt(item.startTime))} <br></br> {formatDate('YYYY-MM-DD', parseInt(item.startTime))} <br></br>
{formatDate('H:i', parseInt(item.startTime))}~{formatDate('H:i', parseInt(item.endTime))} {formatDate('H:i', parseInt(item.startTime))}~{formatDate('H:i', parseInt(item.endTime))}
</span> </span>
) );
}, },
}, },
...@@ -378,16 +377,16 @@ class AddCourse extends React.Component { ...@@ -378,16 +377,16 @@ class AddCourse extends React.Component {
{record.categoryOneName} {record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''} {record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div> </div>
) );
}, },
}, },
] ];
return columns return columns;
} };
videoColumns = () => { videoColumns = () => {
const { videoCourseDivision } = this.state const { videoCourseDivision } = this.state;
const columns = [ const columns = [
{ {
title: ( title: (
...@@ -397,13 +396,12 @@ class AddCourse extends React.Component { ...@@ -397,13 +396,12 @@ class AddCourse extends React.Component {
<i <i
className='icon iconfont' className='icon iconfont'
style={{ style={{
marginLeft: "5px", marginLeft: '5px',
cursor: "pointer", cursor: 'pointer',
color: "#bfbfbf", color: '#bfbfbf',
fontSize: "14px", fontSize: '14px',
fontWeight:"400" fontWeight: '400',
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
...@@ -413,7 +411,7 @@ class AddCourse extends React.Component { ...@@ -413,7 +411,7 @@ class AddCourse extends React.Component {
dataIndex: 'scheduleName', dataIndex: 'scheduleName',
width: 300, width: 300,
render: (val, record) => { render: (val, record) => {
const { coverUrl, mediaCourseUrl } = record const { coverUrl, mediaCourseUrl } = record;
return ( return (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
...@@ -438,7 +436,7 @@ class AddCourse extends React.Component { ...@@ -438,7 +436,7 @@ class AddCourse extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) );
}, },
}, },
{ {
...@@ -447,7 +445,7 @@ class AddCourse extends React.Component { ...@@ -447,7 +445,7 @@ class AddCourse extends React.Component {
width: 80, width: 80,
dataIndex: 'videoDuration', dataIndex: 'videoDuration',
render: (text, item) => { render: (text, item) => {
return <span>{text ? dealTimeDuration(text) : '-'}</span> return <span>{text ? dealTimeDuration(text) : '-'}</span>;
}, },
}, },
...@@ -468,12 +466,12 @@ class AddCourse extends React.Component { ...@@ -468,12 +466,12 @@ class AddCourse extends React.Component {
<div className='record__item'>{record.categorySonName}</div> <div className='record__item'>{record.categorySonName}</div>
</Otherwise> </Otherwise>
</Choose> </Choose>
) );
}, },
}, },
] ];
return columns return columns;
} };
pictureColumns = () => { pictureColumns = () => {
const columns = [ const columns = [
...@@ -485,13 +483,12 @@ class AddCourse extends React.Component { ...@@ -485,13 +483,12 @@ class AddCourse extends React.Component {
<i <i
className='icon iconfont' className='icon iconfont'
style={{ style={{
marginLeft: "5px", marginLeft: '5px',
cursor: "pointer", cursor: 'pointer',
color: "#bfbfbf", color: '#bfbfbf',
fontSize: "14px", fontSize: '14px',
fontWeight:"400" fontWeight: '400',
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
...@@ -501,7 +498,7 @@ class AddCourse extends React.Component { ...@@ -501,7 +498,7 @@ class AddCourse extends React.Component {
dataIndex: 'scheduleName', dataIndex: 'scheduleName',
width: 371, width: 371,
render: (val, record) => { render: (val, record) => {
const { coverUrl } = record const { coverUrl } = record;
return ( return (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
...@@ -517,7 +514,7 @@ class AddCourse extends React.Component { ...@@ -517,7 +514,7 @@ class AddCourse extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</div> </div>
) );
}, },
}, },
{ {
...@@ -530,34 +527,34 @@ class AddCourse extends React.Component { ...@@ -530,34 +527,34 @@ class AddCourse extends React.Component {
{record.categoryOneName} {record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''} {record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div> </div>
) );
}, },
}, },
] ];
return columns return columns;
} };
selectLiveList = (record, selected) => { selectLiveList = (record, selected) => {
let { selectLive } = this.state let { selectLive } = this.state;
let _list = [] let _list = [];
if (selected || !_.find(selectLive, (item) => item.liveCourseId === record.liveCourseId)) { if (selected || !_.find(selectLive, (item) => item.liveCourseId === record.liveCourseId)) {
_list = _.uniq(selectLive.concat([record]), false, (item) => item.liveCourseId) _list = _.uniq(selectLive.concat([record]), false, (item) => item.liveCourseId);
} else { } else {
_list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId) _list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId);
}
this.setState({ selectLive: _list })
} }
this.setState({ selectLive: _list });
};
selectVideoList = (record, selected) => { selectVideoList = (record, selected) => {
const { selectVideo, videoCourseDivision } = this.state const { selectVideo, videoCourseDivision } = this.state;
let { [videoCourseDivision]: selectList } = selectVideo let { [videoCourseDivision]: selectList } = selectVideo;
let _list = [] let _list = [];
if (selected || !_.find(selectList, (item) => item.id === record.id)) { if (selected || !_.find(selectList, (item) => item.id === record.id)) {
_list = _.uniq(selectList.concat([record]), false, (item) => item.id) _list = _.uniq(selectList.concat([record]), false, (item) => item.id);
} else { } else {
_list = _.reject(selectList, (item) => item.id === record.id) _list = _.reject(selectList, (item) => item.id === record.id);
} }
this.setState({ this.setState({
...@@ -565,79 +562,79 @@ class AddCourse extends React.Component { ...@@ -565,79 +562,79 @@ class AddCourse extends React.Component {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list, [videoCourseDivision]: _list,
}, },
}) });
} };
selectPictureList = (record, selected) => { selectPictureList = (record, selected) => {
console.log(record) console.log(record);
let { selectPicture } = this.state let { selectPicture } = this.state;
let _list = [] let _list = [];
if (selected || !_.find(selectPicture, (item) => item.id == record.id)) { if (selected || !_.find(selectPicture, (item) => item.id == record.id)) {
_list = _.uniq(selectPicture.concat([record]), false, (item) => item.id) _list = _.uniq(selectPicture.concat([record]), false, (item) => item.id);
} else { } else {
_list = _.reject(selectPicture, (item) => item.id === record.id) _list = _.reject(selectPicture, (item) => item.id === record.id);
}
this.setState({ selectPicture: _list })
} }
this.setState({ selectPicture: _list });
};
callback(key) { callback(key) {
console.log(key) console.log(key);
} }
handleChangVideoFilter = (key, value) => { handleChangVideoFilter = (key, value) => {
const { videoQuery, videoCourseDivision, videoSearchDefalt } = this.state const { videoQuery, videoCourseDivision, videoSearchDefalt } = this.state;
videoQuery[videoCourseDivision][key] = value videoQuery[videoCourseDivision][key] = value;
videoSearchDefalt[videoCourseDivision][key] = value videoSearchDefalt[videoCourseDivision][key] = value;
videoQuery[videoCourseDivision].current = 1 videoQuery[videoCourseDivision].current = 1;
this.setState( this.setState(
{ {
videoQuery, videoQuery,
videoSearchDefalt, videoSearchDefalt,
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList();
} },
) );
} };
handleChangVideoCourseName = (e) => { handleChangVideoCourseName = (e) => {
const { videoSearchDefalt, videoCourseDivision } = this.state const { videoSearchDefalt, videoCourseDivision } = this.state;
videoSearchDefalt[videoCourseDivision].courseName = e.target.value videoSearchDefalt[videoCourseDivision].courseName = e.target.value;
this.setState({ this.setState({
videoSearchDefalt, videoSearchDefalt,
}) });
} };
handleChangLiveFilter = (key, value) => { handleChangLiveFilter = (key, value) => {
const { liveQuery } = this.state const { liveQuery } = this.state;
liveQuery[key] = value liveQuery[key] = value;
liveQuery.current = 1 liveQuery.current = 1;
this.setState( this.setState(
{ {
liveQuery, liveQuery,
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList();
} },
) );
} };
handleChangPictureFilter = (key, value) => { handleChangPictureFilter = (key, value) => {
const { pictureQuery } = this.state const { pictureQuery } = this.state;
pictureQuery[key] = value pictureQuery[key] = value;
pictureQuery.current = 1 pictureQuery.current = 1;
this.setState( this.setState(
{ {
pictureQuery, pictureQuery,
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList();
} },
) );
} };
handAddCourse = () => { handAddCourse = () => {
const { selectVideo, selectLive, selectPicture } = this.state const { selectVideo, selectLive, selectPicture } = this.state;
const batchAddList = [] const batchAddList = [];
if (selectVideo.external.length) { if (selectVideo.external.length) {
batchAddList.push({ batchAddList.push({
categoryId: this.props.categoryId, categoryId: this.props.categoryId,
...@@ -645,7 +642,7 @@ class AddCourse extends React.Component { ...@@ -645,7 +642,7 @@ class AddCourse extends React.Component {
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'VOICE', type: 'VOICE',
createId: User.getStoreUserId(), createId: User.getStoreUserId(),
}) });
} }
if (selectVideo.internal.length) { if (selectVideo.internal.length) {
batchAddList.push({ batchAddList.push({
...@@ -654,7 +651,7 @@ class AddCourse extends React.Component { ...@@ -654,7 +651,7 @@ class AddCourse extends React.Component {
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'VOICE', type: 'VOICE',
createId: User.getStoreUserId(), createId: User.getStoreUserId(),
}) });
} }
if (selectLive.length) { if (selectLive.length) {
batchAddList.push({ batchAddList.push({
...@@ -663,7 +660,7 @@ class AddCourse extends React.Component { ...@@ -663,7 +660,7 @@ class AddCourse extends React.Component {
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'LIVE', type: 'LIVE',
createId: User.getStoreUserId(), createId: User.getStoreUserId(),
}) });
} }
if (selectPicture.length) { if (selectPicture.length) {
batchAddList.push({ batchAddList.push({
...@@ -672,20 +669,20 @@ class AddCourse extends React.Component { ...@@ -672,20 +669,20 @@ class AddCourse extends React.Component {
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'PICTURE', type: 'PICTURE',
createId: User.getStoreUserId(), createId: User.getStoreUserId(),
}) });
} }
KnowledgeAPI.addDifTypeKnowledge({ batchAddList }).then(({ success }) => { KnowledgeAPI.addDifTypeKnowledge({ batchAddList }).then(({ success }) => {
if (success) { if (success) {
message.success('新增成功') message.success('新增成功');
this.props.onClose() this.props.onClose();
this.props.onChange() this.props.onChange();
this.props.updateCategoryTree() this.props.updateCategoryTree();
}
})
} }
});
};
videoCourseDivisionChange = (e) => { videoCourseDivisionChange = (e) => {
const { videoQuery, videoSearchDefalt } = this.state const { videoQuery, videoSearchDefalt } = this.state;
this.setState( this.setState(
{ {
videoCourseDivision: e.target.value, videoCourseDivision: e.target.value,
...@@ -698,13 +695,13 @@ class AddCourse extends React.Component { ...@@ -698,13 +695,13 @@ class AddCourse extends React.Component {
}, },
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList();
} },
) );
} };
renderFooter = () => { renderFooter = () => {
const { selectVideo, selectPicture, selectLive } = this.state const { selectVideo, selectPicture, selectLive } = this.state;
return ( return (
<div> <div>
<Button onClick={this.props.onClose}>取消</Button> <Button onClick={this.props.onClose}>取消</Button>
...@@ -715,8 +712,8 @@ class AddCourse extends React.Component { ...@@ -715,8 +712,8 @@ class AddCourse extends React.Component {
确定 确定
</Button> </Button>
</div> </div>
) );
} };
render() { render() {
const { const {
...@@ -739,54 +736,54 @@ class AddCourse extends React.Component { ...@@ -739,54 +736,54 @@ class AddCourse extends React.Component {
videoSearchDefalt, videoSearchDefalt,
categoryList, categoryList,
categoryListExternal, categoryListExternal,
} = this.state } = this.state;
const LiveSelection = { const LiveSelection = {
selectedRowKeys: _.pluck(selectLive, 'liveCourseId'), selectedRowKeys: _.pluck(selectLive, 'liveCourseId'),
onSelect: this.selectLiveList, onSelect: this.selectLiveList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectLive.concat(changeRows), false, (item) => item.liveCourseId) _list = _.uniq(selectLive.concat(changeRows), false, (item) => item.liveCourseId);
} else { } else {
_list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId)) _list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId));
} }
this.setState({ selectLive: _list }) this.setState({ selectLive: _list });
}, },
} };
const VideoSelection = { const VideoSelection = {
selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], 'id'), selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], 'id'),
onSelect: this.selectVideoList, onSelect: this.selectVideoList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectVideo[videoCourseDivision].concat(changeRows), false, (item) => item.id) _list = _.uniq(selectVideo[videoCourseDivision].concat(changeRows), false, (item) => item.id);
} else { } else {
_list = _.reject(selectVideo[videoCourseDivision], (item) => _.find(changeRows, (data) => data.id === item.id)) _list = _.reject(selectVideo[videoCourseDivision], (item) => _.find(changeRows, (data) => data.id === item.id));
} }
this.setState({ this.setState({
selectVideo: { selectVideo: {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list, [videoCourseDivision]: _list,
}, },
}) });
}, },
} };
const PictureSelection = { const PictureSelection = {
selectedRowKeys: _.pluck(selectPicture, 'id'), selectedRowKeys: _.pluck(selectPicture, 'id'),
onSelect: this.selectPictureList, onSelect: this.selectPictureList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectPicture.concat(changeRows), false, (item) => item.id) _list = _.uniq(selectPicture.concat(changeRows), false, (item) => item.id);
} else { } else {
_list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id)) _list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id));
} }
this.setState({ selectPicture: _list }) this.setState({ selectPicture: _list });
}, },
} };
return ( return (
<Modal visible={true} width={800} title='新增课程' footer={this.renderFooter()} onCancel={this.props.onClose} className='add-course-modal'> <Modal visible={true} width={800} title='新增课程' footer={this.renderFooter()} onCancel={this.props.onClose} className='add-course-modal'>
...@@ -801,7 +798,7 @@ class AddCourse extends React.Component { ...@@ -801,7 +798,7 @@ class AddCourse extends React.Component {
style={{ width: 'calc(100% - 75px)' }} style={{ width: 'calc(100% - 75px)' }}
placeholder='搜索课程名称' placeholder='搜索课程名称'
onSearch={(value) => { onSearch={(value) => {
this.handleChangLiveFilter('courseName', value) this.handleChangLiveFilter('courseName', value);
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
...@@ -817,7 +814,7 @@ class AddCourse extends React.Component { ...@@ -817,7 +814,7 @@ class AddCourse extends React.Component {
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangLiveFilter('categoryId', value) this.handleChangLiveFilter('categoryId', value);
}} }}
/> />
</div> </div>
...@@ -833,7 +830,7 @@ class AddCourse extends React.Component { ...@@ -833,7 +830,7 @@ class AddCourse extends React.Component {
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: [],
}) });
}} }}
/> />
<Table <Table
...@@ -854,15 +851,15 @@ class AddCourse extends React.Component { ...@@ -854,15 +851,15 @@ class AddCourse extends React.Component {
pageSize={liveSize} pageSize={liveSize}
total={parseInt(liveTotalCount)} total={parseInt(liveTotalCount)}
toPage={(page) => { toPage={(page) => {
const _query = { ...liveQuery, current: page + 1 } const _query = { ...liveQuery, current: page + 1 };
this.setState( this.setState(
{ {
liveQuery: _query, liveQuery: _query,
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList();
} },
) );
}} }}
onShowSizeChange={this.onShowLiveSizeChange} onShowSizeChange={this.onShowLiveSizeChange}
/> />
...@@ -886,7 +883,7 @@ class AddCourse extends React.Component { ...@@ -886,7 +883,7 @@ class AddCourse extends React.Component {
placeholder='搜索课程名称' placeholder='搜索课程名称'
onChange={this.handleChangVideoCourseName} onChange={this.handleChangVideoCourseName}
onSearch={(value) => { onSearch={(value) => {
this.handleChangVideoFilter('courseName', value) this.handleChangVideoFilter('courseName', value);
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
...@@ -897,13 +894,14 @@ class AddCourse extends React.Component { ...@@ -897,13 +894,14 @@ class AddCourse extends React.Component {
treeNodeFilterProp='categoryName' treeNodeFilterProp='categoryName'
showSearch showSearch
style={{ minWidth: 'calc(100% - 75px)' }} style={{ minWidth: 'calc(100% - 75px)' }}
value={videoQuery[videoCourseDivision].categoryId || null}
dropdownMatchSelectWidth={false} dropdownMatchSelectWidth={false}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={videoCourseDivision === 'internal' ? categoryList : categoryListExternal} treeData={videoCourseDivision === 'internal' ? categoryList : categoryListExternal}
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangVideoFilter('categoryId', value) this.handleChangVideoFilter('categoryId', value);
}} }}
/> />
</div> </div>
...@@ -919,7 +917,7 @@ class AddCourse extends React.Component { ...@@ -919,7 +917,7 @@ class AddCourse extends React.Component {
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: [],
}) });
}} }}
/> />
<Table <Table
...@@ -941,8 +939,8 @@ class AddCourse extends React.Component { ...@@ -941,8 +939,8 @@ class AddCourse extends React.Component {
pageSize={videoSize[videoCourseDivision]} pageSize={videoSize[videoCourseDivision]}
total={videoTotalCount[videoCourseDivision]} total={videoTotalCount[videoCourseDivision]}
toPage={(page) => { toPage={(page) => {
const _query = { ...videoQuery[videoCourseDivision], current: page + 1 } const _query = { ...videoQuery[videoCourseDivision], current: page + 1 };
console.log('_query', _query) console.log('_query', _query);
this.setState( this.setState(
{ {
videoQuery: { videoQuery: {
...@@ -951,9 +949,9 @@ class AddCourse extends React.Component { ...@@ -951,9 +949,9 @@ class AddCourse extends React.Component {
}, },
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList();
} },
) );
}} }}
onShowSizeChange={this.onShowVideoSizeChange} onShowSizeChange={this.onShowVideoSizeChange}
/> />
...@@ -972,7 +970,7 @@ class AddCourse extends React.Component { ...@@ -972,7 +970,7 @@ class AddCourse extends React.Component {
style={{ width: 'calc(100% - 75px)' }} style={{ width: 'calc(100% - 75px)' }}
placeholder='搜索课程名称' placeholder='搜索课程名称'
onSearch={(value) => { onSearch={(value) => {
this.handleChangPictureFilter('courseName', value) this.handleChangPictureFilter('courseName', value);
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
...@@ -988,7 +986,7 @@ class AddCourse extends React.Component { ...@@ -988,7 +986,7 @@ class AddCourse extends React.Component {
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangPictureFilter('categoryId', value) this.handleChangPictureFilter('categoryId', value);
}} }}
/> />
</div> </div>
...@@ -1004,7 +1002,7 @@ class AddCourse extends React.Component { ...@@ -1004,7 +1002,7 @@ class AddCourse extends React.Component {
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: [],
}) });
}} }}
/> />
<Table <Table
...@@ -1025,15 +1023,15 @@ class AddCourse extends React.Component { ...@@ -1025,15 +1023,15 @@ class AddCourse extends React.Component {
pageSize={pictureSize} pageSize={pictureSize}
total={parseInt(pictureTotalCount)} total={parseInt(pictureTotalCount)}
toPage={(page) => { toPage={(page) => {
const _query = { ...pictureQuery, current: page + 1 } const _query = { ...pictureQuery, current: page + 1 };
this.setState( this.setState(
{ {
pictureQuery: _query, pictureQuery: _query,
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList();
} },
) );
}} }}
onShowSizeChange={this.onShowPictureSizeChange} onShowSizeChange={this.onShowPictureSizeChange}
/> />
...@@ -1043,7 +1041,7 @@ class AddCourse extends React.Component { ...@@ -1043,7 +1041,7 @@ class AddCourse extends React.Component {
</TabPane> </TabPane>
</Tabs> </Tabs>
</Modal> </Modal>
) );
} }
} }
export default AddCourse export default AddCourse;
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