Commit de8085ee by zhangleyuan

feat:联调课程相关接口

parent 8ed646dd
......@@ -62,6 +62,7 @@ const CropperModal = (props: CropperModalProps) => {
});
}
function _handleSave(): any {
const $image = $('#image');
($image as any).cropper('getCroppedCanvas').toBlob((blob: any) => {
......
......@@ -52,6 +52,7 @@ const defaultIntroInfo = {
liveCourseWarmMedia: {},
// 讲师简介
liveCourseMediaRequests: [{
contentType:"INTRO",
mediaType: 'TEXT',
mediaContent: '',
}],
......@@ -95,6 +96,7 @@ class AddLive extends React.Component {
whetherVisitorsJoin:'NO',
liveCourseWarmMedia: {},
liveCourseMediaRequests: [{
contentType:"INTRO",
mediaType: 'TEXT',
mediaContent: '',
}]
......@@ -125,6 +127,7 @@ class AddLive extends React.Component {
courseMediaVOS,
nickname,
needRecord,
whetherVisitorsJoin,
warmMedia,
} = res.result;
......@@ -153,11 +156,12 @@ class AddLive extends React.Component {
}
const liveCourseMediaRequests = courseMediaVOS.length
? [...courseMediaVOS]
: [{ mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS];
: [{ contentType:"INTRO",mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS];
const addLiveIntroInfo = {
liveCourseWarmMedia: warmMedia,
needRecord,
whetherVisitorsJoin,
liveCourseMediaRequests,
}
// 晚于开课前30分钟
......@@ -177,7 +181,6 @@ class AddLive extends React.Component {
// 修改基本信息
handleChangeBasicInfo = (field, value, _coverUrl) => {
const { coverUrl } = this.state.addLiveBasicInfo;
console.log(field,value);
this.setState({
addLiveBasicInfo: {
...this.state.addLiveBasicInfo,
......@@ -255,7 +258,7 @@ class AddLive extends React.Component {
} = addLiveClassInfo;
let { startTime, endTime } = addLiveClassInfo;
const { liveCourseMediaRequests, needRecord, liveCourseWarmMedia} = addLiveIntroInfo;
const { liveCourseMediaRequests, needRecord,whetherVisitorsJoin,liveCourseWarmMedia} = addLiveIntroInfo;
if(type === 'add') {
startTime = startTime;
endTime = endTime;
......@@ -276,6 +279,8 @@ class AddLive extends React.Component {
courseName: courseName.trim(),
storeId:User.getStoreId(),
teacherId:teacherId,
whetherVisitorsJoin,
scheduleMediaRequests:[...liveCourseMediaRequests]
}
if (type === 'add') {
const params = {
......@@ -312,8 +317,6 @@ class AddLive extends React.Component {
handleValidate = (addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo, isEdit) => {
return new Promise((resolve) => {
const { type } = this.state;
// 校验基本信息(直播课名称)
console.log("addLiveBasicInfo",addLiveBasicInfo);
const { courseName,parentCatalogId} = addLiveBasicInfo;
const {
liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime
......@@ -447,7 +450,6 @@ class AddLive extends React.Component {
// 取消编辑并返回上一级路由
handleGoBack = () => {
console.log('111');
// 比较state的addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo和默认数据是否相等
const { addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo } = this.state;
if (!_.isEqual(addLiveBasicInfo, defaultBasicInfo) ||
......
......@@ -8,11 +8,10 @@
import React from 'react';
import { Input, message, Upload, Radio, Row, Col, Button, Popover, Switch } from 'antd';
import UploadOss from "@/core/upload";
import Service from '@/common/js/service';
import EditorBox from '../components/EditorBox';
import User from '@/common/js/user';
import UploadOss from '@/core/upload';
import './AddLiveIntro.less';
// import SelectPrepareFileModal from '../modal/SelectPrepareFileModal';
import { DISK_MAP } from '@/common/constants/academic/lessonEnum';
......@@ -135,6 +134,7 @@ class AddLiveIntro extends React.Component {
handleAddIntroText = () => {
const { liveCourseMediaRequests } = this.props.data;
liveCourseMediaRequests.push({
contentType:"INTRO",
mediaType: 'TEXT',
mediaContent: '',
key: window.random_string(16)
......@@ -158,16 +158,25 @@ class AddLiveIntro extends React.Component {
const { instId } = window.currentUserInstInfo;
const { name, size } = Blob;
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 = {
resourceName,
accessTypeEnum: 'PUBLIC',
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 signInfo = res.result;
// 构建上传的表单
const xhr = new XMLHttpRequest();
const formData = new FormData();
......@@ -179,7 +188,6 @@ class AddLiveIntro extends React.Component {
formData.append("file", Blob);
formData.append("success_action_status", 200);
xhr.open("POST", signInfo.host);
xhr.onload = () => {
liveCourseMediaRequests.push({
size,
......@@ -188,7 +196,6 @@ class AddLiveIntro extends React.Component {
mediaType: 'PICTURE',
mediaUrl: window.URL.createObjectURL(Blob),
});
this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
};
xhr.onerror = () => {
......@@ -198,16 +205,24 @@ class AddLiveIntro extends React.Component {
this.setState({ xhr })
});
}
whetherVisitorsJoinChange = ()=>{
if(this.props.data.whetherVisitorsJoin==="NO"){
this.props.onChange('whetherVisitorsJoin','YES')
}else{
this.props.onChange('whetherVisitorsJoin','NO')
}
}
componentWillMount() {
this.handleFetchDiskList();
}
componentWillUnmount() {
const { xhr } = this.state;
xhr && xhr.abort();
}
// componentWillUnmount() {
// const { xhr } = this.state;
// xhr && xhr.abort();
// }
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
return (
<div className="add-live__intro-info">
......@@ -244,7 +259,7 @@ class AddLiveIntro extends React.Component {
<div className="content">
<Row>
<Col span={3}>
<Switch defaultChecked={whetherVisitorsJoin==="YES"?true:false}/>
<Switch checked={whetherVisitorsJoin==="YES"? true:false} onChange={this.whetherVisitorsJoinChange}/>
</Col>
<Col span={21}>
<div>开启:用户可直接进入直播间观看直播</div>
......@@ -286,7 +301,6 @@ class AddLiveIntro extends React.Component {
}>
<div className="checkExample">查看示例</div>
</Popover>
</div>
</div>
......
......@@ -177,7 +177,15 @@ class LiveCourseList extends React.Component {
<div>
<span>讲师:{record.teacherName}</span>
<span> | </span>
<span>助教:周晓</span>
<span>助教:
{ record.admins.map((item,index)=>{
return <span>{item.adminName}</span>
})
}
</span>
</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