Commit 61a5d6d2 by maolipeng

feat:企微直播。。。。

parent 682da867
......@@ -52,16 +52,27 @@ export function getLiveCloudCourseDetail(params: object) {
return Service.Hades("public/courseCloud/getLiveCloudCourseDetail", params);
}
export function getWorkWXLiveCourseDetail(params: object) {
return Service.Hades("public/courseCloud/getWechatLiveCourseDetail", params)
}
export function updateLiveCloudCourse(params: object) {
return Service.Hades("public/courseCloud/updateLiveCloudCourse", params);
}
export function updateWorkWXLiveCourse(params: object) {
return Service.Hades("public/courseCloud/editWechatLiveCourse", params);
}
export function turnOnOrOffLiveCloudCourse(params: object) {
return Service.Hades("public/courseCloud/turnOnOrOffLiveCloudCourse", params);
}
export function delLiveCloudCourse(params: object) {
return Service.Hades("public/courseCloud/delLiveCloudCourse", params);
}
export function delWorkWXLiveCourse(params: object) {
return Service.Hades("public/courseCloud/delWechatLiveCourse", params);
}
//该接口主要用于培训计划关联直播课的接口(会筛选掉已关联的直播课)
export function getLiveCloudCourseBasePage(params: object) {
return Service.Hades("public/courseCloud/getLiveCloudCourseBasePage", params);
......
......@@ -10,7 +10,7 @@ import {
fetchLecturerData, getCategoryTree, knowledgeMediaCoursePage, fetchUserData, exportStudentCourseData, exportPlayBackCourseData, fetchPlaybackList, createLiveCloudCourse, getLiveCloudCoursePage,
getLiveCloudCourseDetail, updateLiveCloudCourse, turnOnOrOffLiveCloudCourse, delLiveCloudCourse, changeVideoShelfState, createVideoSchedule, delVideoSchedule,
editVideoSchedule, userWatchInfo, videoSchedulePage, videoScheduleDetail, videoWatchInfo, getQrcode, getLiveCloudCourseBasePage, videoScheduleBasePage, relatedCourseToPlan,
lineDetailWatchInfo, createWorkWXLiveCourse, fetchWorkWXLecturerData, fetchWorkWXUserData
lineDetailWatchInfo, createWorkWXLiveCourse, fetchWorkWXLecturerData, fetchWorkWXUserData, getWorkWXLiveCourseDetail, updateWorkWXLiveCourse, delWorkWXLiveCourse
} from '@/data-source/course/request-api';
export default class courseService {
......@@ -65,15 +65,27 @@ export default class courseService {
static getLiveCloudCourseDetail(params: any) {
return getLiveCloudCourseDetail(params);
}
//获取企微直播详情
static getWorkWXLiveCourseDetail(params: any) {
return getWorkWXLiveCourseDetail(params);
}
static updateLiveCloudCourse(params: any) {
return updateLiveCloudCourse(params);
}
//编辑企微直播
static updateWorkWXLiveCourse(params: any) {
return updateWorkWXLiveCourse(params);
}
static turnOnOrOffLiveCloudCourse(params: any) {
return turnOnOrOffLiveCloudCourse(params);
}
static delLiveCloudCourse(params: any) {
return delLiveCloudCourse(params);
}
//删除企微直播
static delWorkWXLiveCourse(params: any) {
return delWorkWXLiveCourse(params);
}
static changeVideoShelfState(params: any) {
return changeVideoShelfState(params);
}
......
......@@ -4,6 +4,7 @@ import StoreService from "@/domains/store-domain/storeService";
import "./AddLiveClassInfoWorkWX.less";
import GraphicsEditor from "./GraphicsEditor";
import moment from "moment";
import _ from "underscore";
const { Option } = Select;
const defaultTeacherQuery = {
......@@ -16,39 +17,64 @@ export default function AddLiveClassInfoWorkWX(props) {
const [teacherQuery, setTeacherQuery] = useState(defaultTeacherQuery)
const [teacherList, setTeacherList] = useState([])
const [introduce, setIntroduce] = useState()
const [duration, setDuration] = useState(0)
const [introduce, setIntroduce] = useState({content:props.introduce})
const [duration, setDuration] = useState(props.data.duration)
const [cusTime, setCusTime] = useState(false)
const [beginDate, setBeginDate] = useState(moment().startOf('day').valueOf())
const [endDate, setEndDate] = useState(moment().startOf('day').valueOf())
const [beginDate, setBeginDate] = useState(0)
const [beginTime, setBeginTime] = useState(0)
const [endDate, setEndDate] = useState(0)
const [endTime, setEndTime] = useState(0)
const [teacherId, setTeacherId] = useState()
const [remindTime, setRemindTime] = useState(0)
useEffect(()=> {
getTeacherList()
},[])
//开始时间
useEffect(()=> {
setBeginTime(props.data.startTime)
setBeginDate(moment(props.data.startTime).startOf('day').valueOf())
setEndTime(props.data.startTime+Number(props.data.duration))
setEndDate(moment(props.data.startTime+Number(props.data.duration)).startOf('day').valueOf())
setTeacherId(props.data.teacherId)
setRemindTime(props.data.remindTime)
},[props.data])
useEffect(()=> {
let intro = {content:props.introduce};
setIntroduce(intro)
},[props.introduce])
//开始日期
function onBeginDateChange(date, dateString) {
if (date) {
setBeginDate(date.startOf('day').valueOf())
} else {
setBeginDate(0)
}
}
function onBeginDateOK(date) {
console.log(date)
}
//开始时间
function onBeginTimeChange(date, dateString) {
console.log("onBeginTimeChange",date)
// props.onChange("beginTime",date.valueOf())
}
function onBeginTimeOK(time) {
props.onChange("beginTime",beginDate+(time.hour()*60+time.minute())*60*1000)
let begin = beginDate+(time.hour()*60+time.minute())*60*1000
setBeginTime(begin)
props.onChange("beginTime",begin)
if (!cusTime) {
props.onChange("endTime",begin+duration)
}
}
//结束时间
//结束日期
function onEndDateChange(date, dateString) {
if (date) {
setEndDate(date.startOf('day').valueOf())
......@@ -61,34 +87,41 @@ export default function AddLiveClassInfoWorkWX(props) {
function onEndDateOK(date) {
}
//结束时间
function onEndTimeChange(date, dateString) {
// props.onChange("endTime",date.valueOf())
}
function onEndTimeOK(time) {
props.onChange("endTime",endDate+(time.hour()*60+time.minute())*60*1000)
let end = endDate+(time.hour()*60+time.minute())*60*1000
setEndTime(end)
props.onChange("endTime",end)
}
function onDurationChange(value, option) {
if (value === "0") {
if (value === 0) {
setCusTime(true)
return
}
let d = Number(value)*60*1000;
let d = value*60*1000;
setDuration(d)
props.onChange("duration",d)
props.onChange("endTime",beginDate+d)
}
function onTeacherChange(value, option) {
setTeacherId(value)
props.onChange("teacherId",value)
}
function onRemindChange(value, option) {
props.onChange("remindTime",Number(value)*60)
setRemindTime(value)
props.onChange("remindTime",value)
}
function onChangeIntro(val) {
let intro = {...introduce}
intro.content = val
setIntroduce(intro)
props.onChange("intro",val)
}
......@@ -107,30 +140,48 @@ export default function AddLiveClassInfoWorkWX(props) {
});
}
// console.log(moment(beginDate).format("YYYY-MM-DD HH:mm"))
// console.log(moment(endDate).format("YYYY-MM-DD HH:mm"))
return (
<div className="AddLiveClassInfoWorkWX">
<div className="begin-time item">
<span className="label"><span className="require">*</span>开始时间:</span>
<DatePicker defaultValue={moment()} onChange={onBeginDateChange} onOk={onBeginDateOK} />
<TimePicker defaultValue={moment()} onChange={onBeginTimeChange} onOk={onBeginTimeOK} format="HH:mm" />
<DatePicker
value={beginTime===0?undefined:moment(beginTime)}
onChange={onBeginDateChange}
onOk={onBeginDateOK}
/>
<TimePicker
value={beginTime===0?undefined:moment(beginTime)}
onChange={onBeginTimeChange}
onOk={onBeginTimeOK}
format="HH:mm" />
</div>
<div className="duration-time item">
{
cusTime ? (
cusTime || props.type === "edit" ? (
<>
<span className="label"><span className="require">*</span>结束时间:</span>
<DatePicker defaultValue={moment()} onChange={onEndDateChange} onOk={onEndDateOK} />
<TimePicker defaultValue={moment()} onChange={onEndTimeChange} onOk={onEndTimeOK} format="HH:mm" />
<DatePicker
value={endTime === 0?undefined:moment(endTime)}
onChange={onEndDateChange}
onOk={onEndDateOK}
/>
<TimePicker
value={endTime === 0?undefined:moment(endTime)}
onChange={onEndTimeChange}
onOk={onEndTimeOK}
format="HH:mm" />
</>
) : (
<>
<span className="label"><span className="require">*</span>时长:</span>
<Select onChange={onDurationChange} defaultValue="60" style={{width:"140px"}}>
<Option value="30">0.5小时</Option>
<Option value="60">1.0小时</Option>
<Option value="120">2.0小时</Option>
<Option value="180">3.0小时</Option>
<Option value="0">自定义结束时间</Option>
<Select onChange={onDurationChange} defaultValue={60} style={{width:"140px"}}>
<Option value={30}>0.5小时</Option>
<Option value={60}>1.0小时</Option>
<Option value={120}>2.0小时</Option>
<Option value={180}>3.0小时</Option>
<Option value={0}>自定义结束时间</Option>
</Select>
</>
)
......@@ -140,6 +191,7 @@ export default function AddLiveClassInfoWorkWX(props) {
<div className="teacher item">
<span className="label"><span className="require">*</span>讲师:</span>
<Select
value={teacherId}
onChange={onTeacherChange}
style={{width:"240px"}}
placeholder="请选择讲师"
......@@ -147,7 +199,7 @@ export default function AddLiveClassInfoWorkWX(props) {
{
_.map(teacherList, (item, index) => {
return (
<Select.Option value={item.userId} key={item.userId}>{item.nickName}</Select.Option>
<Select.Option value={item.id} key={item.id}>{item.nickName}</Select.Option>
);
})
}
......@@ -155,11 +207,11 @@ export default function AddLiveClassInfoWorkWX(props) {
</div>
<div className="remind-time item">
<span className="label"><span className="require">*</span>提醒时间:</span>
<Select onChange={onRemindChange} defaultValue="0" style={{width:"100px"}}>
<Option value="0"></Option>
<Option value="5">5分钟前</Option>
<Option value="60">1小时前</Option>
<Option value="1440">1天前</Option>
<Select value={remindTime} onChange={onRemindChange} defaultValue={0} style={{width:"100px"}}>
<Option value={0}></Option>
<Option value={300}>5分钟前</Option>
<Option value={3600}>1小时前</Option>
<Option value={86400}>1天前</Option>
</Select>
</div>
<div className="introduce item">
......@@ -169,9 +221,7 @@ export default function AddLiveClassInfoWorkWX(props) {
id='intro'
isIntro={true}
maxLimit={1000}
detail={{
content: introduce,
}}
detail={introduce}
onChange={(val) => {
onChangeIntro(val);
}}
......
......@@ -41,7 +41,6 @@ const defaultBasicInfo = {
const defaultClassInfo = {
categoryId: '',
teacherId: '', //讲师的Id
courseName: '', //课程名称
duration: 3600000, //直播时长默认1小时
......@@ -75,7 +74,7 @@ function CreateWorkWXCourse() {
function getCourseDetail() {
setLoading(true)
CourseService.getLiveCloudCourseDetail({
CourseService.getWorkWXLiveCourseDetail({
liveCourseId: id,
}).then((res) => {
const {
......@@ -83,31 +82,21 @@ function CreateWorkWXCourse() {
teacherName,
courseName,
startTime,
endTime,
courseMediaVOS,
nickname,
needRecord,
whetherVisitorsJoin,
warmMedia,
duration,
courseMediaVOList,
categoryId,
categoryName,
admins,
courseState,
remindTime
} = res.result;
let coverId;
let coverUrl;
let liveCourseMediaRequests = [];
let liveCourseWarmMedia;
let hasIntro = false;
courseMediaVOS.map((item) => {
courseMediaVOList && courseMediaVOList.map((item) => {
switch (item.contentType) {
case 'COVER':
coverId = item.mediaContent;
coverUrl = item.mediaUrl;
break;
case 'WARMUP':
liveCourseWarmMedia = item;
break;
case 'INTRO':
hasIntro = true;
getIntroduce('introduce', item.mediaUrl);
......@@ -119,7 +108,7 @@ function CreateWorkWXCourse() {
return item;
});
const addLiveBasicInfo = {
const _basicInfo = {
courseName,
coverUrl: coverUrl || defaultCover,
coverId,
......@@ -127,31 +116,12 @@ function CreateWorkWXCourse() {
categoryName,
};
const liveDate = startTime;
const timeHorizonStart = startTime;
const timeHorizonEnd = endTime;
const assistant = _.pluck(admins, 'adminId');
const assistantStoreUserId = _.pluck(admins, 'adminStoreUserId'); //编辑时的选中的助教的查询用storeUserId查询
const assistantNames = _.pluck(admins, 'adminName');
const addLiveClassInfo = {
assistant,
liveDate,
nickname,
const _classInfo = {
teacherId,
teacherName,
timeHorizonStart,
timeHorizonEnd,
duration,
startTime,
endTime,
assistantNames,
assistantStoreUserId,
};
const addLiveIntroInfo = {
liveCourseWarmMedia,
needRecord,
whetherVisitorsJoin,
liveCourseMediaRequests,
remindTime,
};
// 晚于开课前30分钟
......@@ -160,9 +130,8 @@ function CreateWorkWXCourse() {
}
setLoadintroduce(!hasIntro)
setLoading(false)
setAddLiveBasicInfo(addLiveBasicInfo)
setAddLiveClassInfo(addLiveClassInfo)
setAddLiveIntroInfo(addLiveIntroInfo)
setBasicInfo(_basicInfo)
setClassInfo(_classInfo)
setCourseState(courseState)
});
};
......@@ -213,10 +182,12 @@ function CreateWorkWXCourse() {
setIntroduce(value)
break;
case 'beginTime':
console.log(value)
classinfo.startTime = value
setClassInfo(classinfo)
break;
case 'endTime':
console.log(value)
setEndTime(value)
break;
case 'duration':
......@@ -281,17 +252,12 @@ function CreateWorkWXCourse() {
function submitRemote({ introduceId, id }) {
if (type === 'add') {
} else {
const _liveDate = moment(liveDate).format('YYYY-MM-DD');
const _timeHorizonStart = moment(timeHorizonStart).format('HH:mm');
const _timeHorizonEnd = moment(timeHorizonEnd).format('HH:mm');
startTime = moment(_liveDate + ' ' + _timeHorizonStart).format('x');
endTime = moment(_liveDate + ' ' + _timeHorizonEnd).format('x');
}
if (type === 'add') {
if (endTime !== 0) {
classInfo.duration = endTime - classInfo.startTime
classInfo.duration = String(endTime - classInfo.startTime)
}
const params = {
...classInfo,
......@@ -309,14 +275,18 @@ function CreateWorkWXCourse() {
}
});
} else {
if (endTime !== 0) {
classInfo.duration = String(endTime - classInfo.startTime)
}
const params = {
...commonParams,
updateUserId: User.getUserId(),
liveCourseId: id,
...classInfo,
operatorId:User.getUserId(),
introduceId,
storeId: User.getStoreId()
storeId: User.getStoreId(),
...basicInfo,
liveCourseId: id
};
CourseService.updateLiveCloudCourse(params).then((res) => {
CourseService.updateWorkWXLiveCourse(params).then((res) => {
if (res.success) {
message.success('更新成功');
window.RCHistory.push({
......@@ -429,7 +399,7 @@ function CreateWorkWXCourse() {
// const { addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, type, courseState } = this.state;
const previewLiveCourseModal = (
<PreviewCourseModal
courseBasicInfo={addLiveBasicInfo}
courseBasicInfo={basicInfo}
courseClassInfo={addLiveClassInfo}
courseIntroInfo={addLiveIntroInfo}
type={type}
......@@ -478,7 +448,7 @@ function CreateWorkWXCourse() {
<div className='class-info__wrap'>
<div className='title'>上课信息</div>
{/* <AddLiveClass isEdit={isEdit} pageType={type} data={{ ...addLiveClassInfo, id }} onChange={handleChangeClassInfo} /> */}
<AddLiveClassInfoWorkWX onChange={onClassInfoChange}/>
<AddLiveClassInfoWorkWX type={type} data={classInfo} introduce={introduce} onChange={onClassInfoChange}/>
</div>
</div>
......
......@@ -14,7 +14,7 @@ import BaseService from '@/domains/basic-domain/baseService';
import { LIVE_SHARE } from '@/domains/course-domain/constants';
import CourseService from '@/domains/course-domain/CourseService';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { Dropdown, message, Badge, Modal, Switch, Tooltip } from 'antd';
import { Dropdown, message, Badge, Modal, Switch, Tooltip, Menu } from 'antd';
import React from 'react';
import { Route, withRouter } from 'react-router-dom';
import _ from 'underscore';
......@@ -333,7 +333,7 @@ class LiveCourseList extends React.Component {
<Tooltip title={this.handlePlanName(record.relatedPlanList)} placement='top' arrowPointAtCenter>
{record.relatedPlanList.map((item, index) => {
return (
<span>
<span key={index}>
{item.planName} {index < record.relatedPlanList.length - 1 && <span></span>}{' '}
</span>
);
......@@ -628,22 +628,45 @@ class LiveCourseList extends React.Component {
renderMoreOperate = (item) => {
return (
<div className='live-course-more-menu'>
{(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
<div className='operate__item' onClick={() => this.handleRelatedModalShow(item)}>
关联培训计划
</div>
)}
<div className='operate__item' onClick={() => this.toEditCoursePage(item)}>
<Menu
onClick={({key})=> {
if (key === "link") {
this.handleRelatedModalShow(item)
} else if (key === "edit") {
this.toEditCoursePage(item)
} else if (key === "del") {
this.handleDelete(item)
}
}}
>
<Menu.Item disabled={!(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager')} key="link">
关联培训计划
</Menu.Item>
<Menu.Item disabled={item.courseState === "STARTING" || item.courseState === "FINISH"} key="edit">
编辑
</div>
{item.courseState !== 'STARTING' && (
<div className='operate__item' onClick={() => this.handleDelete(item)}>
删除
</div>
)}
</div>
);
</Menu.Item>
<Menu.Item disabled={item.courseState === "STARTING"} key="del">
删除
</Menu.Item>
</Menu>
)
// return (
// <div className='live-course-more-menu'>
// {(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
// <div className='operate__item' onClick={() => this.handleRelatedModalShow(item)}>
// 关联培训计划
// </div>
// )}
// <div className='operate__item' onClick={() => this.toEditCoursePage(item)}>
// 编辑
// </div>
// {item.courseState !== 'STARTING' && (
// <div className='operate__item' onClick={() => this.handleDelete(item)}>
// 删除
// </div>
// )}
// </div>
// );
};
handleDelete = (record) => {
return confirm({
......@@ -664,17 +687,35 @@ class LiveCourseList extends React.Component {
const params = {
liveCourseId: item.liveCourseId,
};
CourseService.delLiveCloudCourse(params).then((res) => {
if (res.success) {
message.success('已删除');
this.props.onChange();
}
});
if (item.thirdPartType === "WECHAT") {
CourseService.delWorkWXLiveCourse(params).then((res) => {
if (res.success) {
message.success('已删除');
this.props.onChange();
}
});
} else {
CourseService.delLiveCloudCourse(params).then((res) => {
if (res.success) {
message.success('已删除');
this.props.onChange();
}
});
}
};
toEditCoursePage = (item) => {
window.RCHistory.push({
pathname: `/create-live-course?type=edit&id=${item.liveCourseId}`,
});
if (item.thirdPartType === "WECHAT") {
window.RCHistory.push({
pathname: `/live-course/createqwcourse?type=edit&id=${item.liveCourseId}`,
});
} else {
window.RCHistory.push({
pathname: `/create-live-course?type=edit&id=${item.liveCourseId}`,
});
}
};
refreshCourseList = () => {
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