Commit 3f74ea5d by yuananting

fix:解决合并代码的冲突

parents e8ae7a18 5ed3f210
......@@ -77,7 +77,6 @@ class LiveCourseList extends React.Component {
const htmlUrl = `${LIVE_SHARE}live_detail/${liveCourseId}?id=${User.getStoreId()}`;
const longUrl = htmlUrl;
console.log('htmlUrl', htmlUrl, longUrl);
const shareData = { ...item, longUrl };
const shareLiveModal = (
......@@ -928,15 +927,14 @@ class LiveCourseList extends React.Component {
handleRelatedModalShow = (item) => {
const selectPlanList = {};
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.taskId] = {};
selectPlanList[item.taskId].taskId = item.taskId;
selectPlanList[item.taskId].taskBaseVOList = [{ taskId: item.taskId }];
item.relatedPlanList.map((childItem, index) => {
selectPlanList[childItem.taskId] = {};
selectPlanList[childItem.taskId].taskId = childItem.taskId;
selectPlanList[childItem.taskId].taskBaseVOList = [{ stageId: childItem.stageId }];
return item;
});
}
console.log('selectPlanList:', selectPlanList);
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.liveCourseId,
......@@ -949,6 +947,7 @@ class LiveCourseList extends React.Component {
});
};
onChangeSelectPlanList = (selectPlanList) => {
console.log('selectPlanList', selectPlanList);
this.setState({
selectPlanList: selectPlanList,
});
......
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:12:45
* @LastEditors: wufan
* @LastEditTime: 2021-08-06 17:42:37
* @LastEditors: yuananting
* @LastEditTime: 2021-08-16 23:34:03
* @Description: 线上课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -194,7 +194,7 @@ class GraphicsCourseList extends React.Component {
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => {
return (
<span key={item.planId}>
<span key={item.taskId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span>
);
......@@ -245,10 +245,10 @@ class GraphicsCourseList extends React.Component {
handleRelatedModalShow = (item) => {
const selectPlanList = {};
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {};
selectPlanList[item.planId].planId = item.planId;
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }];
item.relatedPlanList.map((childItem, index) => {
selectPlanList[childItem.taskId] = {};
selectPlanList[childItem.taskId].taskId = childItem.taskId;
selectPlanList[childItem.taskId].taskBaseVOList = [{ stageId: childItem.stageId }];
return item;
});
}
......@@ -408,22 +408,7 @@ class GraphicsCourseList extends React.Component {
};
this.props.onChange(_query);
};
handleRelatedModalShow = (item) => {
const selectPlanList = {};
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {};
selectPlanList[item.planId].planId = item.planId;
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }];
return item;
});
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
});
};
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
......@@ -487,16 +472,6 @@ class GraphicsCourseList extends React.Component {
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{RelatedPlanModalVisible && (
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
)}
{this.state.shareLiveModal}
{this.state.watchDataModal}
</div>
......
......@@ -123,9 +123,8 @@ class RelatedPlanModal extends React.Component {
}
_selectPlanList[taskId].taskBaseVOList = [];
_selectPlanList[taskId].taskId = taskId;
_selectPlanList[taskId].taskBaseVOList.push(record);
_selectPlanList[taskId].taskBaseVOList.push({ ...record, stageId: record.taskId });
} else {
console.log(_selectPlanList[taskId]);
if (!_selectPlanList[taskId]) {
_selectPlanList[taskId] = {};
}
......@@ -141,7 +140,7 @@ class RelatedPlanModal extends React.Component {
if (selectPlanList[key].taskBaseVOList) {
item.taskId = selectPlanList[key].taskId;
if (selectPlanList[key].taskBaseVOList[0]) {
item.stageId = selectPlanList[key].taskBaseVOList[0].taskId;
item.stageId = selectPlanList[key].taskBaseVOList[0].stageId;
}
}
if (item.stageId) {
......@@ -177,7 +176,6 @@ class RelatedPlanModal extends React.Component {
render() {
const { size, dataSource, totalCount, query } = this.state;
const { visible, selectPlanList } = this.props;
console.log('selectPlanListselectPlanListselectPlanListselectPlanListselectPlanList', selectPlanList);
return (
<Modal
title='关联培训任务'
......@@ -237,8 +235,6 @@ class RelatedPlanModal extends React.Component {
taskBaseVOList = selectPlan.taskBaseVOList;
}
console.log('selectPlan==============taskBaseVOList:', taskBaseVOList);
return (
<div>
<XMTable
......@@ -253,7 +249,7 @@ class RelatedPlanModal extends React.Component {
className='child-table'
rowSelection={{
type: 'checkbox',
selectedRowKeys: _.pluck(taskBaseVOList, 'taskId'),
selectedRowKeys: _.pluck(taskBaseVOList, 'stageId'),
onSelect: (record, selected) => {
this.selectPlanList(record, selected, _record.taskId);
},
......
import React from 'react'
import { Modal, message, Tooltip, Switch, Dropdown } from 'antd'
import _ from 'underscore'
import { PageControl } from '@/components'
import { LIVE_SHARE } from '@/domains/course-domain/constants'
import { Route, withRouter } from 'react-router-dom'
import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal'
import CourseService from '@/domains/course-domain/CourseService'
import RelatedPlanModal from '../../modal/RelatedPlanModal'
import User from '@/common/js/user'
import VideoCourseDetail from '../VideoCourseDetail'
import WatchData from './WatchData'
import { XMTable } from '@/components'
import college from '@/common/lottie/college'
import './VideoCourseList.less'
import React from 'react';
import { Modal, message, Tooltip, Switch, Dropdown } from 'antd';
import _ from 'underscore';
import { PageControl } from '@/components';
import { LIVE_SHARE } from '@/domains/course-domain/constants';
import { Route, withRouter } from 'react-router-dom';
import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal';
import CourseService from '@/domains/course-domain/CourseService';
import RelatedPlanModal from '../../modal/RelatedPlanModal';
import User from '@/common/js/user';
import VideoCourseDetail from '../VideoCourseDetail';
import WatchData from './WatchData';
import { XMTable } from '@/components';
import college from '@/common/lottie/college';
import './VideoCourseList.less';
class VideoCourseList extends React.Component {
constructor(props) {
super(props)
super(props);
this.state = {
id: '', // 视频课ID
studentIds: [],
......@@ -24,36 +24,36 @@ class VideoCourseList extends React.Component {
selectPlanList: {},
ShelfLoading: false,
// dataSource: [],
}
};
}
componentDidMount() {
const videoCourseItem = localStorage.getItem('videoCourseItem')
const videoCourseItem = localStorage.getItem('videoCourseItem');
if (videoCourseItem) {
const _videoCourseItem = JSON.parse(videoCourseItem)
this.handleShowShareModal(_videoCourseItem, true)
const _videoCourseItem = JSON.parse(videoCourseItem);
this.handleShowShareModal(_videoCourseItem, true);
}
}
// 跳转课程详情页
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) => {
const { match } = this.props
const { match } = this.props;
window.RCHistory.push({
pathname: `${match.url}/course-data?courseName=${item.courseName}&courseId=${item.id}`,
})
}
});
};
// 请求表头
parseColumns = () => {
const { type } = this.props
const { ShelfLoading } = this.state
const { type } = this.props;
const { ShelfLoading } = this.state;
const columns = [
{
title: '线上课',
......@@ -62,7 +62,7 @@ class VideoCourseList extends React.Component {
width: 321,
fixed: 'left',
render: (val, record) => {
const { coverUrl } = record
const { coverUrl } = record;
return (
<div className='record__item'>
<img className='course-cover' src={coverUrl || 'https://image.xiaomaiketang.com/xm/TwtGPQGE4K.png'} alt='封面图' />
......@@ -77,7 +77,7 @@ class VideoCourseList extends React.Component {
</Otherwise>
</Choose>
</div>
)
);
},
},
{
......@@ -97,7 +97,7 @@ class VideoCourseList extends React.Component {
dataIndex: 'categoryName',
width: 150,
render: (val, record) => {
return <div className='record__item'>{record.categorySonName}</div>
return <div className='record__item'>{record.categorySonName}</div>;
},
},
{
......@@ -108,7 +108,7 @@ class VideoCourseList extends React.Component {
width: 100,
align: 'right',
render: (val, item) => {
return <div onClick={() => this.handleLinkToCourseDetail(item.id)}>{val || 1}</div>
return <div onClick={() => this.handleLinkToCourseDetail(item.id)}>{val || 1}</div>;
},
},
{
......@@ -140,10 +140,10 @@ class VideoCourseList extends React.Component {
checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState}
onClick={(checked) => {
this.changeShelfState(checked, item, index)
this.changeShelfState(checked, item, index);
}}
/>
)
);
},
},
{
......@@ -157,7 +157,7 @@ class VideoCourseList extends React.Component {
<div className='watchUserCount' onClick={() => this.handleShowWatchDataModal(item)}>
{val || 0}
</div>
)
);
},
},
{
......@@ -174,7 +174,7 @@ class VideoCourseList extends React.Component {
</Tooltip>
)}
</div>
)
);
},
},
{
......@@ -184,7 +184,7 @@ class VideoCourseList extends React.Component {
dataIndex: 'created',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
return window.formatDate('YYYY-MM-DD H:i', val);
},
},
{
......@@ -194,7 +194,7 @@ class VideoCourseList extends React.Component {
dataIndex: 'updated',
sorter: true,
render: (val) => {
return window.formatDate('YYYY-MM-DD H:i', val)
return window.formatDate('YYYY-MM-DD H:i', val);
},
},
{
......@@ -210,10 +210,10 @@ class VideoCourseList extends React.Component {
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => {
return (
<span key={item.planId}>
<span key={item.taskId}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}
</span>
)
);
})}
</Tooltip>
</When>
......@@ -222,7 +222,7 @@ class VideoCourseList extends React.Component {
</Otherwise>
</Choose>
</div>
)
);
},
},
{
......@@ -249,17 +249,17 @@ class VideoCourseList extends React.Component {
</span>
</Dropdown>
</div>
)
);
},
},
]
];
type !== 'internal' && columns.splice(5, 1)
return columns
}
type !== 'internal' && columns.splice(5, 1);
return columns;
};
renderMoreOperate = (item) => {
const { type } = this.props
const { type } = this.props;
return (
<div className='live-course-more-menu'>
<If condition={type !== 'internal'}>
......@@ -276,7 +276,7 @@ class VideoCourseList extends React.Component {
<div
className='operate__item'
onClick={() => {
window.RCHistory.push(`/create-video-course?type=edit&id=${item.id}`)
window.RCHistory.push(`/create-video-course?type=edit&id=${item.id}`);
}}>
编辑
</div>
......@@ -285,41 +285,41 @@ class VideoCourseList extends React.Component {
</div>
</If>
</div>
)
}
);
};
handlePlanName = (planArray) => {
let planStr = ''
let planStr = '';
planArray.forEach((item, index) => {
if (index < planArray.length - 1) {
planStr = planStr + item.planName + '、'
planStr = planStr + item.planName + '、';
} else {
planStr = planStr + item.planName
}
})
return planStr
planStr = planStr + item.planName;
}
});
return planStr;
};
//改变上架状态
changeShelfState = (checked, item, index) => {
let _shelfState = checked ? 'YES' : 'NO'
let _shelfState = checked ? 'YES' : 'NO';
if (checked) {
_shelfState = 'YES'
_shelfState = 'YES';
} else {
_shelfState = 'NO'
_shelfState = 'NO';
}
const params = {
courseId: item.id,
shelfState: _shelfState,
}
};
CourseService.changeVideoShelfState(params).then(() => {
if (_shelfState === 'YES') {
message.success('已开启展示')
message.success('已开启展示');
} else {
message.success('已取消展示')
}
this.props.changeShelfState(index, _shelfState)
})
message.success('已取消展示');
}
this.props.changeShelfState(index, _shelfState);
});
};
// 删除线上课
handleDeleteVideoCourse = (scheduleId) => {
......@@ -334,28 +334,28 @@ class VideoCourseList extends React.Component {
const param = {
courseId: scheduleId,
storeId: User.getStoreId(),
}
};
CourseService.delVideoSchedule(param).then(() => {
message.success('删除成功')
this.props.onChange()
})
message.success('删除成功');
this.props.onChange();
});
},
})
}
});
};
// 显示分享弹窗
handleShowShareModal = (record, needStr = false) => {
const { type } = this.props
const { id, scheduleVideoUrl, chapterNum } = record
const htmlUrl = chapterNum > 1 ? `${LIVE_SHARE}course_detail/${id}?id=${User.getStoreId()}` : `${LIVE_SHARE}video_detail/${id}?id=${User.getStoreId()}`
const longUrl = htmlUrl
const { coverUrl, courseName } = record
const { type } = this.props;
const { id, scheduleVideoUrl, chapterNum } = record;
const htmlUrl = chapterNum > 1 ? `${LIVE_SHARE}course_detail/${id}?id=${User.getStoreId()}` : `${LIVE_SHARE}video_detail/${id}?id=${User.getStoreId()}`;
const longUrl = htmlUrl;
const { coverUrl, courseName } = record;
const shareData = {
longUrl,
coverUrl,
scheduleVideoUrl,
courseName,
}
};
const shareLiveModal = (
<ShareLiveModal
......@@ -367,82 +367,82 @@ class VideoCourseList extends React.Component {
close={() => {
this.setState({
shareLiveModal: null,
})
localStorage.setItem('videoCourseItem', '')
});
localStorage.setItem('videoCourseItem', '');
}}
/>
)
);
this.setState({ shareLiveModal })
}
this.setState({ shareLiveModal });
};
handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter
const { query } = this.props
let { order: _order } = query
const { columnKey, order } = sorter;
const { query } = this.props;
let { order: _order } = query;
// 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') {
_order = 'CREATED_ASC'
_order = 'CREATED_ASC';
}
// 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') {
_order = 'CREATED_DESC'
_order = 'CREATED_DESC';
}
// 按更新时间升序排序
if (columnKey === 'updated' && order === 'ascend') {
_order = 'UPDATED_ASC'
_order = 'UPDATED_ASC';
}
// 按更新时间降序排序
if (columnKey === 'updated' && order === 'descend') {
_order = 'UPDATED_DESC'
_order = 'UPDATED_DESC';
}
const _query = {
...query,
orderEnum: _order,
}
this.props.onChange(_query)
}
};
this.props.onChange(_query);
};
handleRelatedModalShow = (item) => {
const selectPlanList = {}
const selectPlanList = {};
if (item.relatedPlanList) {
item.relatedPlanList.map((item, index) => {
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId
selectPlanList[item.planId].taskBaseVOList = [{ taskId: item.taskId }]
return item
})
item.relatedPlanList.map((childItem, index) => {
selectPlanList[childItem.taskId] = {};
selectPlanList[childItem.taskId].taskId = childItem.taskId;
selectPlanList[childItem.taskId].taskBaseVOList = [{ stageId: childItem.stageId }];
return item;
});
}
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectPlanList: selectPlanList,
})
}
});
};
closeRelatedPlanModalVisible = () => {
this.setState({
RelatedPlanModalVisible: false,
})
}
});
};
onChangeSelectPlanList = (selectPlanList) => {
this.setState({
selectPlanList: selectPlanList,
})
}
});
};
onConfirmSelectPlanList = () => {
this.setState(
{
RelatedPlanModalVisible: false,
},
() => {
this.props.onChange()
}
)
this.props.onChange();
}
);
};
render() {
const { dataSource = [], totalCount, query, type, match } = this.props
const { current, size } = query
const { RelatedPlanModalVisible, selectPlanList, selectCourseId } = this.state
const { dataSource = [], totalCount, query, type, match } = this.props;
const { current, size } = query;
const { RelatedPlanModalVisible, selectPlanList, selectCourseId } = this.state;
return (
<div className={`video-course-list ${type !== 'internal' ? 'video-course-list-mt' : ''}`}>
<XMTable
......@@ -466,8 +466,8 @@ class VideoCourseList extends React.Component {
pageSize={size}
total={totalCount}
toPage={(page) => {
const _query = { ...query, current: page + 1 }
this.props.onChange(_query)
const _query = { ...query, current: page + 1 };
this.props.onChange(_query);
}}
/>
</div>
......@@ -486,8 +486,8 @@ class VideoCourseList extends React.Component {
<Route path={`${match.url}/video-course-detail`} component={VideoCourseDetail} />
<Route path={`${match.url}/course-data`} component={WatchData} />
</div>
)
);
}
}
export default withRouter(VideoCourseList)
export default withRouter(VideoCourseList);
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