Commit de8085ee by zhangleyuan

feat:联调课程相关接口

parent 8ed646dd
...@@ -61,6 +61,7 @@ const CropperModal = (props: CropperModalProps) => { ...@@ -61,6 +61,7 @@ const CropperModal = (props: CropperModalProps) => {
}); });
}); });
} }
function _handleSave(): any { function _handleSave(): any {
const $image = $('#image'); const $image = $('#image');
......
...@@ -52,6 +52,7 @@ const defaultIntroInfo = { ...@@ -52,6 +52,7 @@ const defaultIntroInfo = {
liveCourseWarmMedia: {}, liveCourseWarmMedia: {},
// 讲师简介 // 讲师简介
liveCourseMediaRequests: [{ liveCourseMediaRequests: [{
contentType:"INTRO",
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
}], }],
...@@ -95,6 +96,7 @@ class AddLive extends React.Component { ...@@ -95,6 +96,7 @@ class AddLive extends React.Component {
whetherVisitorsJoin:'NO', whetherVisitorsJoin:'NO',
liveCourseWarmMedia: {}, liveCourseWarmMedia: {},
liveCourseMediaRequests: [{ liveCourseMediaRequests: [{
contentType:"INTRO",
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
}] }]
...@@ -125,9 +127,10 @@ class AddLive extends React.Component { ...@@ -125,9 +127,10 @@ class AddLive extends React.Component {
courseMediaVOS, courseMediaVOS,
nickname, nickname,
needRecord, needRecord,
whetherVisitorsJoin,
warmMedia, warmMedia,
} = res.result; } = res.result;
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
item.key = window.random_string(16); item.key = window.random_string(16);
return item; return item;
...@@ -153,11 +156,12 @@ class AddLive extends React.Component { ...@@ -153,11 +156,12 @@ class AddLive extends React.Component {
} }
const liveCourseMediaRequests = courseMediaVOS.length const liveCourseMediaRequests = courseMediaVOS.length
? [...courseMediaVOS] ? [...courseMediaVOS]
: [{ mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS]; : [{ contentType:"INTRO",mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS];
const addLiveIntroInfo = { const addLiveIntroInfo = {
liveCourseWarmMedia: warmMedia, liveCourseWarmMedia: warmMedia,
needRecord, needRecord,
whetherVisitorsJoin,
liveCourseMediaRequests, liveCourseMediaRequests,
} }
// 晚于开课前30分钟 // 晚于开课前30分钟
...@@ -177,7 +181,6 @@ class AddLive extends React.Component { ...@@ -177,7 +181,6 @@ class AddLive extends React.Component {
// 修改基本信息 // 修改基本信息
handleChangeBasicInfo = (field, value, _coverUrl) => { handleChangeBasicInfo = (field, value, _coverUrl) => {
const { coverUrl } = this.state.addLiveBasicInfo; const { coverUrl } = this.state.addLiveBasicInfo;
console.log(field,value);
this.setState({ this.setState({
addLiveBasicInfo: { addLiveBasicInfo: {
...this.state.addLiveBasicInfo, ...this.state.addLiveBasicInfo,
...@@ -255,7 +258,7 @@ class AddLive extends React.Component { ...@@ -255,7 +258,7 @@ class AddLive extends React.Component {
} = addLiveClassInfo; } = addLiveClassInfo;
let { startTime, endTime } = addLiveClassInfo; let { startTime, endTime } = addLiveClassInfo;
const { liveCourseMediaRequests, needRecord, liveCourseWarmMedia} = addLiveIntroInfo; const { liveCourseMediaRequests, needRecord,whetherVisitorsJoin,liveCourseWarmMedia} = addLiveIntroInfo;
if(type === 'add') { if(type === 'add') {
startTime = startTime; startTime = startTime;
endTime = endTime; endTime = endTime;
...@@ -276,6 +279,8 @@ class AddLive extends React.Component { ...@@ -276,6 +279,8 @@ class AddLive extends React.Component {
courseName: courseName.trim(), courseName: courseName.trim(),
storeId:User.getStoreId(), storeId:User.getStoreId(),
teacherId:teacherId, teacherId:teacherId,
whetherVisitorsJoin,
scheduleMediaRequests:[...liveCourseMediaRequests]
} }
if (type === 'add') { if (type === 'add') {
const params = { const params = {
...@@ -312,8 +317,6 @@ class AddLive extends React.Component { ...@@ -312,8 +317,6 @@ class AddLive extends React.Component {
handleValidate = (addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, isEdit) => { handleValidate = (addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, isEdit) => {
return new Promise((resolve) => { return new Promise((resolve) => {
const { type } = this.state; const { type } = this.state;
// 校验基本信息(直播课名称)
console.log("addLiveBasicInfo",addLiveBasicInfo);
const { courseName,parentCatalogId} = addLiveBasicInfo; const { courseName,parentCatalogId} = addLiveBasicInfo;
const { const {
liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime
...@@ -447,7 +450,6 @@ class AddLive extends React.Component { ...@@ -447,7 +450,6 @@ 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) ||
......
...@@ -8,11 +8,10 @@ ...@@ -8,11 +8,10 @@
import React from 'react'; import React from 'react';
import { Input, message, Upload, Radio, Row, Col, Button, Popover, Switch } from 'antd'; import { Input, message, Upload, Radio, Row, Col, Button, Popover, Switch } from 'antd';
import Service from '@/common/js/service';
import UploadOss from "@/core/upload";
import EditorBox from '../components/EditorBox'; import EditorBox from '../components/EditorBox';
import User from '@/common/js/user';
import UploadOss from '@/core/upload';
import './AddLiveIntro.less'; import './AddLiveIntro.less';
// import SelectPrepareFileModal from '../modal/SelectPrepareFileModal'; // import SelectPrepareFileModal from '../modal/SelectPrepareFileModal';
import { DISK_MAP } from '@/common/constants/academic/lessonEnum'; import { DISK_MAP } from '@/common/constants/academic/lessonEnum';
...@@ -135,6 +134,7 @@ class AddLiveIntro extends React.Component { ...@@ -135,6 +134,7 @@ class AddLiveIntro extends React.Component {
handleAddIntroText = () => { handleAddIntroText = () => {
const { liveCourseMediaRequests } = this.props.data; const { liveCourseMediaRequests } = this.props.data;
liveCourseMediaRequests.push({ liveCourseMediaRequests.push({
contentType:"INTRO",
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
key: window.random_string(16) key: window.random_string(16)
...@@ -158,16 +158,25 @@ class AddLiveIntro extends React.Component { ...@@ -158,16 +158,25 @@ class AddLiveIntro extends React.Component {
const { instId } = window.currentUserInstInfo; const { instId } = window.currentUserInstInfo;
const { name, size } = Blob; const { name, size } = Blob;
const resourceName = window.random_string(16) + name.slice(name.lastIndexOf('.')); const resourceName = window.random_string(16) + name.slice(name.lastIndexOf('.'));
// UploadOss.uploadBlobToOSS(Blob, 'avatar' + (new Date()).valueOf(),'', 'id').then((imgAddress) => {
// liveCourseMediaRequests.push({
// contentType:"INTRO",
// size,
// mediaName: name,
// mediaContent: imgAddress.resourceId,
// mediaType: 'PICTURE',
// });
// this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
// });
const params = { const params = {
resourceName, resourceName,
accessTypeEnum: 'PUBLIC', accessTypeEnum: 'PUBLIC',
bizCode: 'LIVE_COURSE_MEDIA', bizCode: 'LIVE_COURSE_MEDIA',
instId: instId || LS.get('instId'), instId:User.getStoreId(),
} }
window.axios.Apollo("public/apollo/commonOssAuthority", params).then((res) => { Service.Hades("public/hades/commonOssAuthority", params).then((res) => {
const { resourceId } = res.result; const { resourceId } = res.result;
const signInfo = res.result; const signInfo = res.result;
// 构建上传的表单 // 构建上传的表单
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
const formData = new FormData(); const formData = new FormData();
...@@ -179,7 +188,6 @@ class AddLiveIntro extends React.Component { ...@@ -179,7 +188,6 @@ class AddLiveIntro extends React.Component {
formData.append("file", Blob); formData.append("file", Blob);
formData.append("success_action_status", 200); formData.append("success_action_status", 200);
xhr.open("POST", signInfo.host); xhr.open("POST", signInfo.host);
xhr.onload = () => { xhr.onload = () => {
liveCourseMediaRequests.push({ liveCourseMediaRequests.push({
size, size,
...@@ -188,7 +196,6 @@ class AddLiveIntro extends React.Component { ...@@ -188,7 +196,6 @@ class AddLiveIntro extends React.Component {
mediaType: 'PICTURE', mediaType: 'PICTURE',
mediaUrl: window.URL.createObjectURL(Blob), mediaUrl: window.URL.createObjectURL(Blob),
}); });
this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests); this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
}; };
xhr.onerror = () => { xhr.onerror = () => {
...@@ -198,16 +205,24 @@ class AddLiveIntro extends React.Component { ...@@ -198,16 +205,24 @@ class AddLiveIntro extends React.Component {
this.setState({ xhr }) this.setState({ xhr })
}); });
} }
whetherVisitorsJoinChange = ()=>{
if(this.props.data.whetherVisitorsJoin==="NO"){
this.props.onChange('whetherVisitorsJoin','YES')
}else{
this.props.onChange('whetherVisitorsJoin','NO')
}
}
componentWillMount() { componentWillMount() {
this.handleFetchDiskList(); this.handleFetchDiskList();
} }
componentWillUnmount() { // componentWillUnmount() {
const { xhr } = this.state; // const { xhr } = this.state;
xhr && xhr.abort(); // xhr && xhr.abort();
} // }
render() { render() {
const {liveType, isXiaomai, isEdit, data: { introduction, needRecord,whetherVisitorsJoin, liveCourseMediaRequests = [], liveCourseWarmMedia = {}, isAutoSendReport } } = this.props; const {liveType, isXiaomai, isEdit, data: { introduction, needRecord,whetherVisitorsJoin,liveCourseMediaRequests = [], liveCourseWarmMedia = {} } } = this.props;
console.log("whetherVisitorsJoin",whetherVisitorsJoin);
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">
...@@ -244,7 +259,7 @@ class AddLiveIntro extends React.Component { ...@@ -244,7 +259,7 @@ class AddLiveIntro extends React.Component {
<div className="content"> <div className="content">
<Row> <Row>
<Col span={3}> <Col span={3}>
<Switch defaultChecked={whetherVisitorsJoin==="YES"?true:false}/> <Switch checked={whetherVisitorsJoin==="YES"? true:false} onChange={this.whetherVisitorsJoinChange}/>
</Col> </Col>
<Col span={21}> <Col span={21}>
<div>开启:用户可直接进入直播间观看直播</div> <div>开启:用户可直接进入直播间观看直播</div>
...@@ -286,7 +301,6 @@ class AddLiveIntro extends React.Component { ...@@ -286,7 +301,6 @@ class AddLiveIntro extends React.Component {
}> }>
<div className="checkExample">查看示例</div> <div className="checkExample">查看示例</div>
</Popover> </Popover>
</div> </div>
</div> </div>
...@@ -352,7 +366,7 @@ class AddLiveIntro extends React.Component { ...@@ -352,7 +366,7 @@ class AddLiveIntro extends React.Component {
</div> </div>
</div> </div>
{/* 选择暖场图文件弹窗 */} {/* 选择暖场图文件弹窗 */}
{/* <SelectPrepareFileModal {/* <SelectPrepareFileModal
operateType="select" operateType="select"
accept="video/mp4,image/jpeg,image/png,image/jpg" accept="video/mp4,image/jpeg,image/png,image/jpg"
......
...@@ -177,7 +177,15 @@ class LiveCourseList extends React.Component { ...@@ -177,7 +177,15 @@ class LiveCourseList extends React.Component {
<div> <div>
<span>讲师:{record.teacherName}</span> <span>讲师:{record.teacherName}</span>
<span> | </span> <span> | </span>
<span>助教:周晓</span>
<span>助教:
{ record.admins.map((item,index)=>{
return <span>{item.adminName}</span>
})
}
</span>
</div> </div>
</div> </div>
</div> </div>
......
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