Commit f6dd4e5e by zhangleyuan

feat:解决合并代码后的一些冲突

parent c233f4f6
...@@ -28,9 +28,10 @@ const Breadcrumbs = (props: BreadcrumbsProps) => { ...@@ -28,9 +28,10 @@ const Breadcrumbs = (props: BreadcrumbsProps) => {
const isArray = _.isArray(navList); const isArray = _.isArray(navList);
return ( return (
<div className="xm-breadCrumb"> <div className="xm-breadCrumb">
<span onClick={_onClick} className="back-btn" /> <span onClick={_onClick} className="back-btn">
<LeftOutlined/> <LeftOutlined/>
<span className="text ml5" >{text ? text : '返回'}</span> <span className="text ml5" >{text ? text : '返回'}</span>
</span>
<div className="divide"></div> <div className="divide"></div>
<Breadcrumb> <Breadcrumb>
{isString && <Breadcrumb.Item>{navList}</Breadcrumb.Item>} {isString && <Breadcrumb.Item>{navList}</Breadcrumb.Item>}
......
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-12-12 11:57:10 * @Date: 2020-12-12 11:57:10
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-16 15:01:26 * @LastEditTime: 2020-12-16 15:49:11
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -35,3 +35,14 @@ export function exportPlayBackCourseData(params: object) { ...@@ -35,3 +35,14 @@ export function exportPlayBackCourseData(params: object) {
export function fetchPlaybackList(params: object) { export function fetchPlaybackList(params: object) {
return Service.Hades("public/courseCloud/getUserReplayRecordPage", params); return Service.Hades("public/courseCloud/getUserReplayRecordPage", params);
} }
export function getLiveCloudCourseDetail(params: object) {
return Service.Hades("public/courseCloud/getLiveCloudCourseDetail", params);
}
export function updateLiveCloudCourse(params: object) {
return Service.Hades("public/courseCloud/updateLiveCloudCourse", params);
}
export function delOrRecoverLiveCloudCourse(params: object) {
return Service.Hades("public/courseCloud/delOrRecoverLiveCloudCourse", params);
}
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-15 14:27:36 * @LastEditTime: 2020-12-16 15:50:43
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { fetchLecturerData, fetchUserData, exportStudentCourseData, createLiveCloudCourse, getLiveCloudCoursePage, exportPlayBackCourseData, fetchPlaybackList } from '@/data-source/course/request-api'; import { fetchLecturerData, fetchUserData, exportStudentCourseData,exportPlayBackCourseData, fetchPlaybackList,createLiveCloudCourse,getLiveCloudCoursePage,getLiveCloudCourseDetail,updateLiveCloudCourse,delOrRecoverLiveCloudCourse} from '@/data-source/course/request-api';
export default class courseService { export default class courseService {
// 获取讲师上课数据 // 获取讲师上课数据
...@@ -40,4 +40,13 @@ export default class courseService { ...@@ -40,4 +40,13 @@ export default class courseService {
return fetchPlaybackList(params); return fetchPlaybackList(params);
} }
static getLiveCloudCourseDetail(params: any) {
return getLiveCloudCourseDetail(params);
}
static updateLiveCloudCourse(params: any) {
return updateLiveCloudCourse(params);
}
static delOrRecoverLiveCloudCourse(params: any) {
return delOrRecoverLiveCloudCourse(params);
}
} }
\ No newline at end of file
...@@ -17,7 +17,6 @@ import AddLiveBasic from './components/AddLiveBasic'; ...@@ -17,7 +17,6 @@ import AddLiveBasic from './components/AddLiveBasic';
import AddLiveClass from './components/AddLiveClass'; import AddLiveClass from './components/AddLiveClass';
import AddLiveIntro from './components/AddLiveIntro'; import AddLiveIntro from './components/AddLiveIntro';
import PreviewCourseModal from './modal/PreviewCourseModal'; import PreviewCourseModal from './modal/PreviewCourseModal';
import LackConsumeStudentModal from './modal/LackConsumeStudentModal';
import CourseService from "@/domains/course-domain/CourseService"; import CourseService from "@/domains/course-domain/CourseService";
import moment from 'moment'; import moment from 'moment';
import User from '@/common/js/user'; import User from '@/common/js/user';
...@@ -36,8 +35,8 @@ const defaultBasicInfo = { ...@@ -36,8 +35,8 @@ const defaultBasicInfo = {
}; };
const defaultClassInfo = { const defaultClassInfo = {
teacherId: null, teacherId: null, //讲师的Id
adminId:null, adminId:null, //助教的Id
teacherName: null, teacherName: null,
liveDate: null, liveDate: null,
timeHorizonStart: null, timeHorizonStart: null,
...@@ -45,7 +44,6 @@ const defaultClassInfo = { ...@@ -45,7 +44,6 @@ const defaultClassInfo = {
calendarTime: [], calendarTime: [],
startTime: new Date().getTime() + 300000, startTime: new Date().getTime() + 300000,
endTime: new Date().getTime() + 300000, endTime: new Date().getTime() + 300000,
applyMode: ''
}; };
const defaultIntroInfo = { const defaultIntroInfo = {
...@@ -55,55 +53,26 @@ const defaultIntroInfo = { ...@@ -55,55 +53,26 @@ const defaultIntroInfo = {
liveCourseMediaRequests: [{ liveCourseMediaRequests: [{
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
// key: editBoxKey
}], }],
} }
class AddLive extends React.Component { class AddLive extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const id = getParameterByName("id"); const id = getParameterByName("id");
const type = getParameterByName("type"); const type = getParameterByName("type");
this.state = { this.state = {
id, id,
type, type,
after: false,
isXiaomai: false,
loading: false, loading: false,
isEdit: true, isEdit: true,
selectedAssistant: [], // 已经选择的助教数量
// 直播课基本信息 // 直播课基本信息
addLiveBasicInfo: { addLiveBasicInfo: {
courseName: null, // 课程名称 courseName: null, // 课程名称
coverId: null, coverId: null,
coverUrl: defaultCover, coverUrl: defaultCover,
parentCatalogId:'', parentCatalogId:'',
sonCatalogId:'', sonCatalogId:''
courseCatalogOption:[
{
value: '1',
label: 'Zhejiang',
children: [
{
value: '2',
label: 'Hangzhou',
},
],
},
{
value: '3',
label: 'Jiangsu',
children: [
{
value: '4',
label: 'Nanjing',
}
],
},
]
}, },
// 直播课上课信息 // 直播课上课信息
...@@ -114,12 +83,6 @@ class AddLive extends React.Component { ...@@ -114,12 +83,6 @@ class AddLive extends React.Component {
liveDate: null, liveDate: null,
timeHorizonStart: null, timeHorizonStart: null,
timeHorizonEnd: null, timeHorizonEnd: null,
studentList: [], // 不扣课时学员列表
consumeStudentList: [], // 扣课时学员列表
excludeStudentIds: [], // 已经入库的不扣课时学员
excludeConsumeStudentIds: [], // 已经入口的扣课时学员
assistant: [], // 已经选择的助教老师
applyMode: '',
calendarTime: [], // 批量排课 calendarTime: [], // 批量排课
startTime: new Date().getTime() + 300000, // 批量开始时分 startTime: new Date().getTime() + 300000, // 批量开始时分
endTime: new Date().getTime() + 300000 // 批量结束时分 endTime: new Date().getTime() + 300000 // 批量结束时分
...@@ -132,9 +95,7 @@ class AddLive extends React.Component { ...@@ -132,9 +95,7 @@ class AddLive extends React.Component {
liveCourseMediaRequests: [{ liveCourseMediaRequests: [{
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
// key: editBoxKey }]
}],
isAutoSendReport: true
}, },
} }
} }
...@@ -143,110 +104,72 @@ class AddLive extends React.Component { ...@@ -143,110 +104,72 @@ class AddLive extends React.Component {
const { type } = this.state; const { type } = this.state;
if (type === 'edit') { if (type === 'edit') {
this.getCourseDetail(); this.getCourseDetail();
} else {
} }
} }
getCourseDetail = () => { getCourseDetail = () => {
let { isEdit } = this.state; let { isEdit } = this.state;
this.setState({ loading: true }); this.setState({ loading: true });
// axios.Apollo('public/businessLive/getCourseDetail', { CourseService.getLiveCloudCourseDetail({
// liveCourseId: this.state.id liveCourseId: this.state.id
// }).then((res) => { }).then((res) => {
// const { const {
// teacherId, teacherId,
// studentIds, courseName,
// consumeStudentIds, coverUrl,
// courseName, coverId,
// coverUrl, startTime,
// coverId, endTime,
// intro, courseMediaVOS,
// courseState, nickname,
// startTime, needRecord,
// endTime, warmMedia,
// liveType, } = res.result;
// adminShowVOList,
// channel,
// podium,
// courseMediaVOS,
// nickname,
// needRecord,
// consumeHourNum,
// consumeClassTime,
// warmMedia,
// applyMode,
// autoSendReport
// } = res.result;
// const studentList = [];
// _.each(studentIds, (item) => {
// studentList.push({ studentId: item });
// });
// const selectedAssistant = _.map(adminShowVOList, (item) => ({
// id: item.adminId,
// adminName: item.adminName,
// }));
// const assistantId = _.pluck(adminShowVOList, "adminId");
// courseMediaVOS.map((item) => {
// item.key = window.random_string(16);
// return item;
// })
// const addLiveBasicInfo = { courseMediaVOS.map((item) => {
// courseName, item.key = window.random_string(16);
// coverId, return item;
// coverUrl: coverUrl || defaultCover, })
// };
const addLiveBasicInfo = {
// const liveDate = startTime; courseName,
// const timeHorizonStart = startTime; coverId,
// const timeHorizonEnd = endTime; coverUrl: coverUrl || defaultCover,
// const addLiveClassInfo = { };
// liveType,
// liveDate, const liveDate = startTime;
// nickname, const timeHorizonStart = startTime;
// teacherId, const timeHorizonEnd = endTime;
// studentList, const addLiveClassInfo = {
// consumeHourNum, liveDate,
// consumeClassTime, nickname,
// consumeStudentList: consumeStudentIds, teacherId,
// timeHorizonStart, timeHorizonStart,
// timeHorizonEnd, timeHorizonEnd,
// assistant: assistantId, startTime,
// excludeStudentIds: studentIds, endTime,
// excludeConsumeStudentIds: _.pluck(consumeStudentIds, 'studentId'), }
// applyMode const liveCourseMediaRequests = courseMediaVOS.length
// } ? [...courseMediaVOS]
// const liveCourseMediaRequests = courseMediaVOS.length : [{ mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS];
// ? [...courseMediaVOS]
// : [{ mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS]; const addLiveIntroInfo = {
liveCourseWarmMedia: warmMedia,
// const addLiveIntroInfo = { needRecord,
// liveCourseWarmMedia: warmMedia, liveCourseMediaRequests,
// needRecord, }
// liveCourseMediaRequests, // 晚于开课前30分钟
// isAutoSendReport: !!(autoSendReport === "AUTO") if(new Date().getTime() > startTime - 1800000) {
// } isEdit = false
// // 晚于开课前30分钟 }
// if(new Date().getTime() > startTime - 1800000) { this.setState({
// isEdit = false isEdit,
// } loading: false,
// this.setState({ addLiveIntroInfo,
// isEdit, addLiveClassInfo,
// loading: false, addLiveBasicInfo,
// selectedAssistant, });
// addLiveIntroInfo, })
// addLiveClassInfo,
// addLiveBasicInfo,
// after: courseState !== "UN_START",
// isXiaomai: channel === "XIAOMAI",
// });
// })
} }
// 修改基本信息 // 修改基本信息
...@@ -319,27 +242,18 @@ class AddLive extends React.Component { ...@@ -319,27 +242,18 @@ class AddLive extends React.Component {
this.handleValidate(addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, isEdit).then((res) => { this.handleValidate(addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, isEdit).then((res) => {
if (!res) return; if (!res) return;
const { type } = this.state; const { type } = this.state;
const { courseName, coverId, coverUrl,parentCatalogId} = addLiveBasicInfo; const { courseName, coverId, coverUrl,parentCatalogId} = addLiveBasicInfo;
const { const {
podium,
liveType,
liveDate, liveDate,
teacherId, teacherId,
adminId, adminId,
assistant,
studentList,
consumeHourNum,
timeHorizonEnd, timeHorizonEnd,
consumeClassTime,
timeHorizonStart, timeHorizonStart,
consumeStudentList,
applyMode,
calendarTime, calendarTime,
} = addLiveClassInfo; } = addLiveClassInfo;
let { startTime, endTime } = addLiveClassInfo; let { startTime, endTime } = addLiveClassInfo;
const { liveCourseMediaRequests, needRecord, liveCourseWarmMedia, isAutoSendReport} = addLiveIntroInfo; const { liveCourseMediaRequests, needRecord, liveCourseWarmMedia} = addLiveIntroInfo;
if(type === 'add') { if(type === 'add') {
startTime = startTime; startTime = startTime;
endTime = endTime; endTime = endTime;
...@@ -350,43 +264,45 @@ class AddLive extends React.Component { ...@@ -350,43 +264,45 @@ class AddLive extends React.Component {
startTime = moment(_liveDate + ' ' + _timeHorizonStart).format('x'); startTime = moment(_liveDate + ' ' + _timeHorizonStart).format('x');
endTime = moment(_liveDate + ' ' + _timeHorizonEnd).format('x'); endTime = moment(_liveDate + ' ' + _timeHorizonEnd).format('x');
} }
const commonParams = { const commonParams = {
adminIds:[adminId], adminIds:[adminId],
calendarTime, calendarTime,
categoryId:parentCatalogId, categoryId:parentCatalogId,
endTime, endTime,
needRecord, needRecord,
operatorId:User.getUserId(),
startTime, startTime,
storeId:User.getUserId(),
courseName: courseName.trim(), courseName: courseName.trim(),
storeId:User.getStoreId(), storeId:User.getStoreId(),
teacherId:teacherId, teacherId:teacherId,
} }
if (type === 'add') { if (type === 'add') {
const params = { const params = {
...commonParams, ...commonParams,
operatorId:User.getUserId(),
} }
CourseService.createLiveCloudCourse(params).then((res) => { CourseService.createLiveCloudCourse(params).then((res) => {
if (res.success){ if (res.success){
message.success("新建成功"); message.success("新建成功");
window.RCHistory.goBack();
} }
}); });
} else { } else {
const params = { const params = {
...commonParams, ...commonParams,
updateUserId:User.getUserId(),
liveCourseId: id, liveCourseId: id,
} }
if(params.liveCourseWarmMedia && !params.liveCourseWarmMedia.mediaUrl) { // if(params.liveCourseWarmMedia && !params.liveCourseWarmMedia.mediaUrl) {
delete params.liveCourseWarmMedia // delete params.liveCourseWarmMedia
} // }
axios.Apollo("public/businessLive/updateCourse", params).then((res) => { CourseService.updateLiveCloudCourse(params).then((res) => {
if (res.success){
message.success("更新成功"); message.success("更新成功");
this.setState({ loading: false });
window.RCHistory.goBack(); window.RCHistory.goBack();
}
}); });
} }
}) })
...@@ -398,7 +314,7 @@ class AddLive extends React.Component { ...@@ -398,7 +314,7 @@ class AddLive extends React.Component {
console.log("addLiveBasicInfo",addLiveBasicInfo); console.log("addLiveBasicInfo",addLiveBasicInfo);
const { courseName,parentCatalogId} = addLiveBasicInfo; const { courseName,parentCatalogId} = addLiveBasicInfo;
const { const {
liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime, consumeStudentList, consumeHourNum, consumeClassTime, applyMode liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime
} = addLiveClassInfo; } = addLiveClassInfo;
const { liveCourseMediaRequests } = addLiveIntroInfo; const { liveCourseMediaRequests } = addLiveIntroInfo;
...@@ -413,8 +329,9 @@ class AddLive extends React.Component { ...@@ -413,8 +329,9 @@ class AddLive extends React.Component {
resolve(false); resolve(false);
return; return;
} }
if(type === 'add') {
const { startTime, endTime } = addLiveClassInfo; const { startTime, endTime } = addLiveClassInfo;
if(calendarTime.length === 0) { if(calendarTime.length && calendarTime.length === 0) {
message.warning('请选择上课日期'); message.warning('请选择上课日期');
resolve(false); resolve(false);
return; return;
...@@ -440,13 +357,45 @@ class AddLive extends React.Component { ...@@ -440,13 +357,45 @@ class AddLive extends React.Component {
} }
} }
} }
resolve(true) } else {
// if(consumeClassTime > (endTime - startTime) / 60000) { const _liveDate = moment(liveDate).format("YYYY-MM-DD");
// message.warning('到课规则时长不能超过排课时长'); const _timeHorizonStart = moment(timeHorizonStart).format('HH:mm');
// resolve(false); const _timeHorizonEnd = moment(timeHorizonEnd).format('HH:mm');
// return;
// }
const startTime = moment(_liveDate + ' ' + _timeHorizonStart).format('x');
const endTime = moment(_liveDate + ' ' + _timeHorizonEnd).format('x');
if(!startTime || !endTime) {
message.warning('日期不能为空');
resolve(false);
return;
} else if (!timeHorizonStart) {
message.warning('开始时间不能为空');
resolve(false);
return;
} else if (!timeHorizonEnd) {
message.warning('结束时间不能为空');
resolve(false);
return;
} else if (isEdit && startTime < currentTime) {
message.warning('开始时间不能早于当前时间');
resolve(false);
return;
} else if (isEdit && endTime < currentTime) {
message.warning('结束时间不能早于当前时间');
resolve(false);
return;
} else if (isEdit && endTime <= startTime) {
message.warning("结束时间不能早于开始时间");
resolve(false);
return;
}
}
if(!teacherId){
message.warning('上课老师不能为空');
resolve(false);
return;
}
resolve(true)
// if(!teacherId) { // if(!teacherId) {
// message.warning('上课老师不能为空'); // message.warning('上课老师不能为空');
// resolve(false); // resolve(false);
...@@ -496,6 +445,7 @@ class AddLive extends React.Component { ...@@ -496,6 +445,7 @@ class AddLive extends React.Component {
// 取消编辑并返回上一级路由 // 取消编辑并返回上一级路由
handleGoBack = () => { handleGoBack = () => {
console.log('111');
// 比较state的addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo和默认数据是否相等 // 比较state的addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo和默认数据是否相等
const { addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo } = this.state; const { addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo } = this.state;
if (!_.isEqual(addLiveBasicInfo, defaultBasicInfo) || if (!_.isEqual(addLiveBasicInfo, defaultBasicInfo) ||
...@@ -513,7 +463,6 @@ class AddLive extends React.Component { ...@@ -513,7 +463,6 @@ class AddLive extends React.Component {
} }
}) })
} else { } else {
// 直接返回
window.RCHistory.goBack(); window.RCHistory.goBack();
} }
} }
...@@ -521,7 +470,7 @@ class AddLive extends React.Component { ...@@ -521,7 +470,7 @@ class AddLive extends React.Component {
render() { render() {
const { const {
id, type, after, isXiaomai, selectedAssistant, id, type,
addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo,
isEdit isEdit
} = this.state; } = this.state;
...@@ -540,7 +489,6 @@ class AddLive extends React.Component { ...@@ -540,7 +489,6 @@ class AddLive extends React.Component {
<div className="basic-info__wrap"> <div className="basic-info__wrap">
<div className="title">基本信息</div> <div className="title">基本信息</div>
<AddLiveBasic <AddLiveBasic
liveScene="large"
isEdit={isEdit} isEdit={isEdit}
data={addLiveBasicInfo} data={addLiveBasicInfo}
onChange={this.handleChangeBasicInfo} onChange={this.handleChangeBasicInfo}
...@@ -550,13 +498,9 @@ class AddLive extends React.Component { ...@@ -550,13 +498,9 @@ class AddLive extends React.Component {
<div className="class-info__wrap"> <div className="class-info__wrap">
<div className="title">上课信息</div> <div className="title">上课信息</div>
<AddLiveClass <AddLiveClass
liveScene="large"
isEdit={isEdit} isEdit={isEdit}
after={after}
pageType={type} pageType={type}
isXiaomai={isXiaomai}
data={{...addLiveClassInfo, id} } data={{...addLiveClassInfo, id} }
selectedAssistant={selectedAssistant}
onChange={this.handleChangeClassInfo} onChange={this.handleChangeClassInfo}
/> />
</div> </div>
...@@ -564,10 +508,8 @@ class AddLive extends React.Component { ...@@ -564,10 +508,8 @@ class AddLive extends React.Component {
<div className="intro-info__wrap"> <div className="intro-info__wrap">
<div className="title">更多信息</div> <div className="title">更多信息</div>
<AddLiveIntro <AddLiveIntro
liveScene="large"
isEdit={isEdit} isEdit={isEdit}
data={addLiveIntroInfo} data={addLiveIntroInfo}
isXiaomai={isXiaomai}
onChange={this.handleChangeIntroInfo} onChange={this.handleChangeIntroInfo}
/> />
</div> </div>
......
...@@ -9,13 +9,11 @@ class LiveCoursePage extends React.Component { ...@@ -9,13 +9,11 @@ class LiveCoursePage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
// const { instId, teacherId } = window.currentUserInstInfo;
this.state = { this.state = {
courseList: [], // 直播课列表 courseList: [], // 直播课列表
query: { query: {
current: 1, current: 1,
size: 10, size: 10,
storeId:User.getStoreId()
}, },
total: 0, total: 0,
loading: true, loading: true,
...@@ -26,10 +24,9 @@ class LiveCoursePage extends React.Component { ...@@ -26,10 +24,9 @@ class LiveCoursePage extends React.Component {
} }
// 获取直播课列表 // 获取直播课列表
handleFetchLiveList = (_query) => { handleFetchLiveList = (_query) => {
const { query } = this.state;
const params = { const params = {
...query,
..._query, ..._query,
storeId:User.getStoreId()
}; };
this.setState({ query: params }); this.setState({ query: params });
CourseService.getLiveCloudCoursePage(params).then((res) => { CourseService.getLiveCloudCoursePage(params).then((res) => {
...@@ -42,49 +39,11 @@ class LiveCoursePage extends React.Component { ...@@ -42,49 +39,11 @@ class LiveCoursePage extends React.Component {
this.setState({ loading: false }); this.setState({ loading: false });
}); });
} }
// handleFetchLiveList= (_query) => {
// const _courseList=[
// {
// applyMode: "ANYONE",
// autoSendReport: "AUTO",
// channel: "XIAOMAI",
// consumeClassTime: 30,
// consumeHourNum: 1,
// courseDocumentCount: 0,
// courseMediaVOS: [],
// courseName: "0988",
// courseState: "EXPIRED",
// createdReport: "INVALID",
// endTime: 1607515751000,
// haveRecord: "NO",
// instId: "1213001850820476929",
// intro: "",
// liveCourseId: "1336612757182279681",
// liveType: "LARGE_CLASS_LIVE",
// needRecord: "YES",
// nickname: "张莹",
// podium: 0,
// quota: 1,
// roomId: 9984,
// startTime: 1607508551000,
// teacherId: "1226497609046880257",
// thirdPartType: "TENCENT",
// whetherRecord: "YES",
// }
// ];
// this.setState({
// courseList: _courseList,
// total:1
// });
// }
render() { render() {
const { query, total, courseList } = this.state; const { query, total, courseList } = this.state;
return ( return (
<div className="page big-live-page"> <div className="page big-live-page">
<div className="content-header">大班直播</div> <div className="content-header">直播课</div>
<div className="box"> <div className="box">
<LiveCourseFilter <LiveCourseFilter
onChange={this.handleFetchLiveList} onChange={this.handleFetchLiveList}
......
...@@ -77,7 +77,7 @@ class AddLiveBasic extends React.Component { ...@@ -77,7 +77,7 @@ class AddLiveBasic extends React.Component {
} }
render() { render() {
const { showCutModal, imageFile,courseCatalogList} = this.state; const { showCutModal, imageFile,courseCatalogList} = this.state;
const { data, liveScene } = this.props; const { data} = this.props;
const { courseName, coverUrl} = data; const { courseName, coverUrl} = data;
const fileName = ''; const fileName = '';
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
*/ */
import React from 'react'; import React from 'react';
import {TimePicker, Select, Spin, Tooltip } from 'antd'; import {TimePicker, Select, Spin, Tooltip,DatePicker} from 'antd';
import {InfoCircleFilled} from '@ant-design/icons'; import {InfoCircleFilled} from '@ant-design/icons';
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
...@@ -124,25 +124,21 @@ class AddLiveClass extends React.Component { ...@@ -124,25 +124,21 @@ class AddLiveClass extends React.Component {
assistantQuery assistantQuery
} = this.state; } = this.state;
const { pageType, liveScene, data, selectedAssistant, isXiaomai,isEdit, after} = this.props; const { pageType,data,isEdit} = this.props;
const { const {
endTime, endTime,
startTime, startTime,
studentList,
consumeStudentList,
calendarTime, calendarTime,
teacherId,
liveDate,
timeHorizonStart,
timeHorizonEnd
} = data; } = data;
// 已选择的上课学员数量(不扣课时) console.log("teacherId",teacherId);
const hasSelectedStu = studentList.length;
// 已选择的上课学员数量(扣课时)
const hasSelectedDeductionStu = consumeStudentList.length;
return ( return (
<Spin spinning={loading}> <Spin spinning={loading}>
<div className="add-live__class-info"> <div className="add-live__class-info">
<div className="course"> {/* <div className="course">
<div className="day"> <div className="day">
<span className="label"> <span className="label">
<span className="require">*</span> <span className="require">*</span>
...@@ -192,12 +188,113 @@ class AddLiveClass extends React.Component { ...@@ -192,12 +188,113 @@ class AddLiveClass extends React.Component {
}} }}
/> />
</div> </div>
</div> */}
{pageType === 'add' &&
<div className="course">
<div className="day">
<span className="label">
<span className="require">*</span>
上课日期
<Tooltip
overlayStyle={{maxWidth: 300, zIndex: '9999'}}
title={<div style={{width: '266px'}}>支持按上课日期批量创建直播课,创建后按“课程名称_日期”命名,例如:<br/>张三的语文课_9月18日<br/>张三的语文课_9月19日......</div>}>
<span className="iconfont">&#xe6f2;</span>
</Tooltip>
</span>
<div>
<div className='select-day'>
已选
<span className="mark-day">
{isLongArr(calendarTime)
? calendarTime.length : 0
}
</span>
</div>
<MultipleDatePicker
selectDateList={calendarTime}
onSelect={this.selectMultiDate}
canSelectTodayBefore={false}
/>
</div> </div>
</div>
<div className="hour" id="hour">
<span className="label"><span className="require">*</span>上课时间:</span>
<TimePicker
format="HH:mm"
value={startTime ? moment(startTime) : null}
placeholder="开始时间"
style={{ width: 100, minWidth: 100}}
onChange={(time) => {
this.props.onChange('startTime', time);
}}
/>&nbsp;&nbsp;~&nbsp;&nbsp;
<TimePicker
format="HH:mm"
value={endTime ? moment(endTime) : null}
placeholder="结束时间"
style={{ width: 100, minWidth: 100 }}
onChange={(time) => {
this.props.onChange('endTime', time)
}}
/>
</div>
</div>
}
{pageType === 'edit' &&
<div className="time" id="time">
<div className="content">
<span className="label"><span className="require">*</span>上课时间:</span>
<DatePicker
disabled={!isEdit}
format="YYYY-MM-DD"
value={liveDate ? moment(Number(liveDate)) : null}
style={{ width: 160, minWidth: 130, marginRight: 10 }}
placeholder="上课日期"
getCalendarContainer={() =>
document.getElementById("time")
}
disabledDate={this.disabledDate}
onChange={(date) => { this.props.onChange('liveDate', date) }}
/>
<TimePicker
disabled={!isEdit}
format="HH:mm"
value={timeHorizonStart ? moment(Number(timeHorizonStart)) : null}
defaultOpenValue={moment(new Date().setHours(0,0,0,0))}
placeholder="开始时间"
style={{ width: 100, minWidth: 100, marginRight: 10 }}
getPopupContainer={() =>
document.getElementById("time")
}
onChange={(time) => { this.props.onChange('timeHorizonStart', time) }}
/>
<TimePicker
disabled={!isEdit}
format="HH:mm"
value={timeHorizonEnd ? moment(Number(timeHorizonEnd)) : null}
defaultOpenValue={moment(new Date().setHours(0,0,0,0))}
placeholder="结束时间"
style={{ width: 100, minWidth: 100 }}
getPopupContainer={() =>
document.getElementById("time")
}
onChange={(time) => { this.props.onChange('timeHorizonEnd', time) }}
/>
</div>
</div>
}
<div className="teacher"> <div className="teacher">
<span className="label"><span className="require">* </span>讲师:</span> <span className="label"><span className="require">* </span>讲师:</span>
<Select <Select
placeholder="请选择讲师" placeholder="请选择讲师"
style={{ width: 240, marginTop: 6 }} style={{ width: 240, marginTop: 6 }}
showSearch
allowClear
value={teacherId}
filterOption={(input, option) => option} filterOption={(input, option) => option}
onPopupScroll={this.handleScrollTeacherList} onPopupScroll={this.handleScrollTeacherList}
onChange={(value) => { onChange={(value) => {
...@@ -208,7 +305,7 @@ class AddLiveClass extends React.Component { ...@@ -208,7 +305,7 @@ class AddLiveClass extends React.Component {
this.setState({ this.setState({
teacherQuery teacherQuery
}, () => { }, () => {
this.handleScrollTeacherList() this.getTeacherList()
}) })
}} }}
> >
...@@ -224,6 +321,8 @@ class AddLiveClass extends React.Component { ...@@ -224,6 +321,8 @@ class AddLiveClass extends React.Component {
<Select <Select
id="assistant" id="assistant"
placeholder="请选择助教老师" placeholder="请选择助教老师"
showSearch
allowClear
style={{ width: 240, marginTop: 6 }} style={{ width: 240, marginTop: 6 }}
filterOption={(input, option) => option} filterOption={(input, option) => option}
onPopupScroll={this.handleScrollAssistantList} onPopupScroll={this.handleScrollAssistantList}
......
...@@ -207,7 +207,7 @@ class AddLiveIntro extends React.Component { ...@@ -207,7 +207,7 @@ class AddLiveIntro extends React.Component {
} }
render() { render() {
const { liveScene, liveType, isXiaomai, isEdit, data: { introduction, needRecord, whetherRecord, liveCourseMediaRequests = [], liveCourseWarmMedia = {}, isAutoSendReport } } = this.props; const {liveType, isXiaomai, isEdit, data: { introduction, needRecord, whetherRecord, liveCourseMediaRequests = [], liveCourseWarmMedia = {}, isAutoSendReport } } = this.props;
const { showCutModal, warmUrl, showSelectFileModal, diskList, imageFile } = this.state const { showCutModal, warmUrl, showSelectFileModal, diskList, imageFile } = this.state
return ( return (
<div className="add-live__intro-info"> <div className="add-live__intro-info">
...@@ -269,7 +269,7 @@ class AddLiveIntro extends React.Component { ...@@ -269,7 +269,7 @@ class AddLiveIntro extends React.Component {
</div> </div>
<div className="opt-btns"> <div className="opt-btns">
<Button <Button
disabled={liveScene === 'large' && !isEdit} disabled={!isEdit}
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectFileModal: true showSelectFileModal: true
......
...@@ -13,7 +13,8 @@ import Bus from '@/core/bus'; ...@@ -13,7 +13,8 @@ import Bus from '@/core/bus';
import TeacherSearchSelect from "@/modules/common/TeacherSearchSelect"; import TeacherSearchSelect from "@/modules/common/TeacherSearchSelect";
import RangePicker from "@/modules/common/DateRangePicker"; import RangePicker from "@/modules/common/DateRangePicker";
import moment from 'moment';
import StoreService from "@/domains/store-domain/storeService";
import './LiveCourseFilter.less'; import './LiveCourseFilter.less';
const { Search } = Input; const { Search } = Input;
...@@ -22,28 +23,54 @@ const { Option } = Select; ...@@ -22,28 +23,54 @@ const { Option } = Select;
const defaultQuery = { const defaultQuery = {
courseName: null, courseName: null,
startTime: null, startTime: null,
teacherName: null, teacherId: null,
courseState: null, courseState: null,
shelfState:null, shelfState:null,
} }
const defaultTeacherQuery = {
size: 10,
current: 1,
nickName:null
}
class LiveCourseFilter extends React.Component { class LiveCourseFilter extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
query: {...defaultQuery}, query: {...defaultQuery},
teacherQuery: defaultTeacherQuery,
teacherList:[],
expandFilter:false expandFilter:false
} }
} }
componentDidMount() {
componentWillReceiveProps(nextProps) { this.getTeacherList();
const { match: { path } } = nextProps; }
const { match: { path: curPath } } = this.props; getTeacherList(current = 1, selectList){
if (path !== curPath) { const { teacherQuery,teacherList} = this.state;
const _query = {
...teacherQuery,
current,
size:10
};
StoreService.getEmployeeList( _query).then((res) => {
const { result = {} } = res;
const { records = [], total = 0, hasNext } = result;
const list = current > 1 ? teacherList.concat(records) : records;
this.setState({ this.setState({
query: {...defaultQuery} hasNext,
teacherList: list,
}) })
});
}
// 滑动加载更多讲师列表
handleScrollTeacherList = (e) => {
const { hasNext } = this.state;
const container = e.target;
const scrollToBottom = container && container.scrollHeight <= container.clientHeight + container.scrollTop;
if (scrollToBottom && hasNext) {
const { teacherQuery } = this.state;
this.getTeacherList(teacherQuery.current + 1);
} }
} }
...@@ -117,7 +144,7 @@ class LiveCourseFilter extends React.Component { ...@@ -117,7 +144,7 @@ class LiveCourseFilter extends React.Component {
courseState, teacherName, teacherId, courseState, teacherName, teacherId,
shelfState shelfState
} = this.state.query; } = this.state.query;
const {expandFilter} = this.state; const {expandFilter,teacherList,teacherQuery} = this.state;
const { teacherId: _teahcerId } = {}; const { teacherId: _teahcerId } = {};
const isTeacher = !!_teahcerId; // 判断是否是老师身份 const isTeacher = !!_teahcerId; // 判断是否是老师身份
...@@ -147,20 +174,35 @@ class LiveCourseFilter extends React.Component { ...@@ -147,20 +174,35 @@ class LiveCourseFilter extends React.Component {
style={{ width: "calc(100% - 70px)" }} style={{ width: "calc(100% - 70px)" }}
/> />
</div> </div>
{!isTeacher &&
<div className="search-condition__item"> <div className="search-condition__item">
<TeacherSearchSelect <span>讲师:</span>
id="teacher_select" <Select
ref="TeacherSelect" placeholder="请选择讲师"
label="讲师" style={{ width: 240, marginTop: 6 }}
placeholder="请选择" showSearch
teacherName={teacherName} allowClear
onSelect={this.handleSelectTeacher} filterOption={(input, option) => option}
defaultValue={teacherId} onPopupScroll={this.handleScrollTeacherList}
/> onChange={(value) => {
this.handleChangeQuery('teacherId', value)
}}
onSearch={(value) => {
teacherQuery.nickName = value
this.setState({
teacherQuery
}, () => {
this.getTeacherList()
})
}}
>
{_.map(teacherList, (item, index) => {
return (
<Select.Option value={item.userId} key={item.userId}>{item.nickName}</Select.Option>
);
})}
</Select>
</div> </div>
}
{ expandFilter && { expandFilter &&
<div className="search-condition__item"> <div className="search-condition__item">
<span className="select-status">上课状态:</span> <span className="select-status">上课状态:</span>
...@@ -188,8 +230,8 @@ class LiveCourseFilter extends React.Component { ...@@ -188,8 +230,8 @@ class LiveCourseFilter extends React.Component {
value={shelfState} value={shelfState}
onChange={(value) => { this.handleChangeQuery('shelfState', value) }} onChange={(value) => { this.handleChangeQuery('shelfState', value) }}
> >
<Option value="UN_START">上架中</Option> <Option value="YES">上架中</Option>
<Option value="STARTING">未上架</Option> <Option value="NO">未上架</Option>
</Select> </Select>
</div> </div>
} }
......
...@@ -79,7 +79,6 @@ class LiveCourseList extends React.Component { ...@@ -79,7 +79,6 @@ class LiveCourseList extends React.Component {
getDownloadVersion() { getDownloadVersion() {
} }
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (item, needStr = false) => { handleShowShareModal = (item, needStr = false) => {
const _appId = appId; const _appId = appId;
...@@ -107,7 +106,15 @@ class LiveCourseList extends React.Component { ...@@ -107,7 +106,15 @@ class LiveCourseList extends React.Component {
this.setState({ shareLiveModal }) this.setState({ shareLiveModal })
} }
//改变上架状态
changeShelfState = (item) =>{
if(item.shelfState==='NO'){
item.shelfState = "YES"
}else{
}
}
// 前往上课数据页面 // 前往上课数据页面
handleLinkToClassData = (item) => { handleLinkToClassData = (item) => {
// TODOLIST 确定后端是否是根据liveCourseId 返回数据 // TODOLIST 确定后端是否是根据liveCourseId 返回数据
...@@ -131,7 +138,7 @@ class LiveCourseList extends React.Component { ...@@ -131,7 +138,7 @@ class LiveCourseList extends React.Component {
const columns = [ const columns = [
{ {
title: "直播课", title: "直播课",
width: "20%", width: "25%",
key: "course", key: "course",
dataIndex: "courseName", dataIndex: "courseName",
render: (val, record) => { render: (val, record) => {
...@@ -139,13 +146,13 @@ class LiveCourseList extends React.Component { ...@@ -139,13 +146,13 @@ class LiveCourseList extends React.Component {
<div className="record__item"> <div className="record__item">
<img className="course-cover" src={'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} /> <img className="course-cover" src={'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} />
<div> <div>
<div className="course-name">课程名称</div> <div className="course-name">{record.courseName}</div>
<div> <div>
<span className="course-time">2020-11-09 10:00~11:00</span> <span className="course-time">{formatDate("YYYY-MM-DD H:i",parseInt(record.startTime))}~{formatDate("H:i", parseInt(record.endTime))}</span>
<span>待开课</span> <span>{courseStateShow[record.courseState].title}</span>
</div> </div>
<div> <div>
<span>讲师:吴帆</span> <span>讲师:{record.teacherName}</span>
<span> | </span> <span> | </span>
<span>助教:周晓</span> <span>助教:周晓</span>
</div> </div>
...@@ -161,7 +168,7 @@ class LiveCourseList extends React.Component { ...@@ -161,7 +168,7 @@ class LiveCourseList extends React.Component {
dataIndex: "couseCatalog", dataIndex: "couseCatalog",
render: (val, item) => { render: (val, item) => {
return ( return (
<div>一阶培训</div> <div>{item.categoryName}</div>
) )
}, },
}, },
...@@ -172,7 +179,7 @@ class LiveCourseList extends React.Component { ...@@ -172,7 +179,7 @@ class LiveCourseList extends React.Component {
dataIndex: "courseware", dataIndex: "courseware",
render: (val, item) => { render: (val, item) => {
return ( return (
<span>2个</span> <span>{item.courseDocumentCount}</span>
); );
}, },
}, },
...@@ -185,7 +192,7 @@ class LiveCourseList extends React.Component { ...@@ -185,7 +192,7 @@ class LiveCourseList extends React.Component {
return ( return (
<span className="iconfont icon" onClick={() => { <span className="iconfont icon" onClick={() => {
this.handleLinkToClassData(item) this.handleLinkToClassData(item)
}}>&#xe7d6; </span> }}>&#xe7d6;</span>
); );
}, },
}, },
...@@ -195,29 +202,40 @@ class LiveCourseList extends React.Component { ...@@ -195,29 +202,40 @@ class LiveCourseList extends React.Component {
dataIndex: "courseware", dataIndex: "courseware",
render: (val, item, index) => { render: (val, item, index) => {
return ( return (
<Switch defaultChecked /> <Switch checked={item.shelfState==="YES"?true:false} onChange={()=>this.changeShelfState(item)}/>
) )
}, },
}, },
{ {
title: "操作", title: "操作",
width: "20%", width: "15%",
key: "operate", key: "operate",
dataIndex: "operate", dataIndex: "operate",
render: (val, item) => { render: (val, item) => {
return ( return (
<div className="operate"> <div className="operate">
{ (item.courseState==="UN_START" || item.courseState==="STARTING") &&
<div <div
key="enter_live_room1" key="enter_live_room1"
className="operate__item" className="operate__item"
onClick={() => { this.handleEnterLiveRoom(item) }} onClick={() => { this.handleEnterLiveRoom(item) }}
>进入直播间 >进入直播间
</div> </div>
}
{ (item.courseState==="FINISH") &&
<>
<span className="operate__item split" key="enter_live_room1_split"> | </span> <span className="operate__item split" key="enter_live_room1_split"> | </span>
<div <div
key="view_play_back" key="view_play_back"
className="operate__item" className="operate__item"
>查看回放</div> >查看回放</div>
</>
}
{ item.courseState!=="EXPIRED" &&
<>
<span className="operate__item split" key="view_play_back_split"> | </span> <span className="operate__item split" key="view_play_back_split"> | </span>
<div <div
key="share" key="share"
...@@ -226,6 +244,10 @@ class LiveCourseList extends React.Component { ...@@ -226,6 +244,10 @@ class LiveCourseList extends React.Component {
> >
分享 分享
</div> </div>
</>
}
{ item.courseState!=="EXPIRED" &&
<>
<span key="split1" className="operate__item split"> | </span> <span key="split1" className="operate__item split"> | </span>
<div className="big-live"> <div className="big-live">
<Dropdown overlay={this.renderMoreOperate(item)}> <Dropdown overlay={this.renderMoreOperate(item)}>
...@@ -240,6 +262,14 @@ class LiveCourseList extends React.Component { ...@@ -240,6 +262,14 @@ class LiveCourseList extends React.Component {
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
</>
}
{ item.courseState==="EXPIRED" &&
<div
className="operate__item"
onClick={this.handleDelete}
>删除</div>
}
</div> </div>
) )
} }
...@@ -253,12 +283,14 @@ class LiveCourseList extends React.Component { ...@@ -253,12 +283,14 @@ class LiveCourseList extends React.Component {
<div className="live-course-more-menu"> <div className="live-course-more-menu">
<div <div
className="operate__item" className="operate__item"
onClick={this.toEditCoursePage(item)} onClick={()=>this.toEditCoursePage(item)}
>编辑</div> >编辑</div>
{ item.courseState !=="STARTING" &&
<div <div
className="operate__item" className="operate__item"
onClick={this.handleDelete} onClick={this.handleDelete}
>删除</div> >删除</div>
}
</div> </div>
) )
} }
...@@ -276,12 +308,13 @@ class LiveCourseList extends React.Component { ...@@ -276,12 +308,13 @@ class LiveCourseList extends React.Component {
}) })
} }
deleteConfirm = (item)=>{ deleteConfirm = (item)=>{
message.success("已删除"); message.success("已删除");
} }
toEditCoursePage =(item)=>{ toEditCoursePage =(item)=>{
// window.RCHistory.push({ window.RCHistory.push({
// pathname: '/create-live-course?type=edit', pathname: `/create-live-course?type=edit&id=${item.liveCourseId}`,
// }) })
} }
refreshCourseList = ()=>{ refreshCourseList = ()=>{
this.props.onChange(this.props.query); this.props.onChange(this.props.query);
......
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