Commit 8349d5fb by zhangleyuan

feat:修改课程里的添加图片相关

parent f802bc34
...@@ -9,7 +9,6 @@ import { Tooltip, Input, Spin, Select, Avatar, Row, Col } from 'antd'; ...@@ -9,7 +9,6 @@ import { Tooltip, Input, Spin, Select, Avatar, Row, Col } from 'antd';
import _ from 'underscore'; import _ from 'underscore';
import "./CommonSelect.less"; import "./CommonSelect.less";
import "./TeacherSearchSelect.less"; import "./TeacherSearchSelect.less";
import classNames from 'classNames'
const baseImg ='https://image.xiaomaiketang.com/xm/rJeQaZxtc7.png' const baseImg ='https://image.xiaomaiketang.com/xm/rJeQaZxtc7.png'
class TeacherSearchSelect extends React.Component { class TeacherSearchSelect extends React.Component {
......
...@@ -26,12 +26,9 @@ import './AddLive.less'; ...@@ -26,12 +26,9 @@ import './AddLive.less';
const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'; const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
const defaultBasicInfo = { const defaultBasicInfo = {
courseName: null, // 课程名称 courseName: null, // 课程名称
coverId: null,
coverUrl: defaultCover, coverUrl: defaultCover,
parentCatalogId:null,
sonCatalogId:null,
categoryId:null, categoryId:null,
categoryName:null categoryName:null,
}; };
const defaultClassInfo = { const defaultClassInfo = {
...@@ -71,12 +68,9 @@ class AddLive extends React.Component { ...@@ -71,12 +68,9 @@ class AddLive extends React.Component {
// 直播课基本信息 // 直播课基本信息
addLiveBasicInfo: { addLiveBasicInfo: {
courseName: null, // 课程名称 courseName: null, // 课程名称
coverId: null,
coverUrl: defaultCover, coverUrl: defaultCover,
parentCatalogId:null,
sonCatalogId:null,
categoryId:null, categoryId:null,
categoryName:null categoryName:null,
}, },
// 直播课上课信息 // 直播课上课信息
...@@ -122,8 +116,6 @@ class AddLive extends React.Component { ...@@ -122,8 +116,6 @@ class AddLive extends React.Component {
const { const {
teacherId, teacherId,
courseName, courseName,
coverUrl,
coverId,
startTime, startTime,
endTime, endTime,
courseMediaVOS, courseMediaVOS,
...@@ -135,15 +127,29 @@ class AddLive extends React.Component { ...@@ -135,15 +127,29 @@ class AddLive extends React.Component {
categoryName, categoryName,
admins admins
} = res.result; } = res.result;
let coverUrl;
let liveCourseMediaRequests = [];
let liveCourseWarmMedia;
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
item.key = window.random_string(16); switch (item.contentType){
case "COVER":
coverUrl = item.mediaContent;
break;
case "WARMUP":
liveCourseWarmMedia = item;
break;
case "INTRO":
liveCourseMediaRequests = [...liveCourseMediaRequests,item]
break;
default:
break;
}
return item; return item;
}) })
const addLiveBasicInfo = { const addLiveBasicInfo = {
courseName, courseName,
coverId,
coverUrl: coverUrl || defaultCover, coverUrl: coverUrl || defaultCover,
categoryId, categoryId,
categoryName categoryName
...@@ -153,7 +159,6 @@ class AddLive extends React.Component { ...@@ -153,7 +159,6 @@ class AddLive extends React.Component {
const timeHorizonStart = startTime; const timeHorizonStart = startTime;
const timeHorizonEnd = endTime; const timeHorizonEnd = endTime;
const assistant = _.pluck(admins, "adminId"); const assistant = _.pluck(admins, "adminId");
console.log('assistant',assistant);
const addLiveClassInfo = { const addLiveClassInfo = {
assistant, assistant,
liveDate, liveDate,
...@@ -165,12 +170,12 @@ class AddLive extends React.Component { ...@@ -165,12 +170,12 @@ class AddLive extends React.Component {
endTime, endTime,
} }
const liveCourseMediaRequests = courseMediaVOS.length liveCourseMediaRequests = liveCourseMediaRequests.length
? [...courseMediaVOS] ? [...liveCourseMediaRequests]
: [{ contentType:"INTRO",mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...courseMediaVOS]; : [{ contentType:"INTRO",mediaType: 'TEXT', mediaContent: '', key: window.random_string(16) }, ...liveCourseMediaRequests];
const addLiveIntroInfo = { const addLiveIntroInfo = {
liveCourseWarmMedia: warmMedia, liveCourseWarmMedia,
needRecord, needRecord,
whetherVisitorsJoin, whetherVisitorsJoin,
liveCourseMediaRequests, liveCourseMediaRequests,
...@@ -191,13 +196,11 @@ class AddLive extends React.Component { ...@@ -191,13 +196,11 @@ class AddLive extends React.Component {
} }
// 修改基本信息 // 修改基本信息
handleChangeBasicInfo = (field, value, _coverUrl) => { handleChangeBasicInfo = (field, value) => {
const { coverUrl } = this.state.addLiveBasicInfo;
this.setState({ this.setState({
addLiveBasicInfo: { addLiveBasicInfo: {
...this.state.addLiveBasicInfo, ...this.state.addLiveBasicInfo,
[field]: value, [field]: value,
coverUrl: _coverUrl ? _coverUrl : coverUrl,
} }
},()=>{console.log(this.state.addLiveBasicInfo)}) },()=>{console.log(this.state.addLiveBasicInfo)})
} }
...@@ -259,7 +262,7 @@ class AddLive extends React.Component { ...@@ -259,7 +262,7 @@ 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,sonCatalogId,categoryId} = addLiveBasicInfo; const { courseName, coverUrl,categoryId} = addLiveBasicInfo;
const { const {
liveDate, liveDate,
teacherId, teacherId,
...@@ -282,6 +285,11 @@ class AddLive extends React.Component { ...@@ -282,6 +285,11 @@ 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 coverObj ={
contentType:'COVER',
mediaContent:coverUrl,
mediaType:'PICTURE'
}
const commonParams = { const commonParams = {
adminIds:assistant, adminIds:assistant,
calendarTime, calendarTime,
...@@ -293,7 +301,7 @@ class AddLive extends React.Component { ...@@ -293,7 +301,7 @@ class AddLive extends React.Component {
storeId:User.getStoreId(), storeId:User.getStoreId(),
teacherId:teacherId, teacherId:teacherId,
whetherVisitorsJoin, whetherVisitorsJoin,
// scheduleMediaRequests:[...liveCourseMediaRequests] scheduleMediaRequests:[coverObj,liveCourseWarmMedia,...liveCourseMediaRequests]
} }
if (type === 'add') { if (type === 'add') {
...@@ -330,7 +338,7 @@ class AddLive extends React.Component { ...@@ -330,7 +338,7 @@ 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;
const { courseName,parentCatalogId,categoryId} = addLiveBasicInfo; const { courseName,categoryId} = addLiveBasicInfo;
const { const {
liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime liveDate, timeHorizonStart, timeHorizonEnd, teacherId, calendarTime
} = addLiveClassInfo; } = addLiveClassInfo;
......
...@@ -7,14 +7,18 @@ ...@@ -7,14 +7,18 @@
*/ */
import React from 'react'; import React from 'react';
import { Input, Button, message ,Cascader } from 'antd'; import { Input, Button, message ,Cascader,Modal} from 'antd';
import UploadOss from "@/core/upload"; import UploadOss from "@/core/upload";
import { ImgCutModalNew } from '@/components'; import { ImgCutModalNew } from '@/components';
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal';
import Upload from '@/core/upload';
import './AddLiveBasic.less'; import './AddLiveBasic.less';
const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'; const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }; const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' };
let cutFlag = false;
class AddLiveBasic extends React.Component { class AddLiveBasic extends React.Component {
constructor(props) { constructor(props) {
...@@ -22,7 +26,8 @@ class AddLiveBasic extends React.Component { ...@@ -22,7 +26,8 @@ class AddLiveBasic extends React.Component {
this.state = { this.state = {
imageFile: null, imageFile: null,
showCutModal: false, showCutModal: false,
courseCatalogList:[] courseCatalogList:[],
showSelectFileModal: false
} }
} }
componentWillUnmount() { componentWillUnmount() {
...@@ -55,7 +60,7 @@ class AddLiveBasic extends React.Component { ...@@ -55,7 +60,7 @@ class AddLiveBasic extends React.Component {
// 如果已经是默认图的话,不做任何任何处理 // 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return; if (isDefaultCover) return;
message.success('已替换为默认图'); message.success('已替换为默认图');
this.props.onChange('coverId', null, defaultCover); this.props.onChange('coverUrl',defaultCover);
} }
catalogChange= (value) => { catalogChange= (value) => {
...@@ -71,16 +76,115 @@ class AddLiveBasic extends React.Component { ...@@ -71,16 +76,115 @@ class AddLiveBasic extends React.Component {
break; break;
} }
} }
handleSelectCover = (file) => {
this.uploadImage(file);
// this.setState({
// showSelectFileModal: false
// })
// const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
// const coverObj = {
// contentType: 'COVER',
// mediaType: 'PICTURE',
// mediaContent: resourceId,
// mediaUrl: ossUrl,
// mediaName: folderName,
// size: folderSize
// }
// this.props.onChange('coverObj', coverObj);
}
//上传图片
uploadImage = (imageFile) => {
const { folderName } = imageFile;
const fileName =
window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
this.setState(
{
visible: true,
},
() => {
setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal");
const viewImgDom = document.querySelector('#preview-url-box');
const options = {
size: [500, 73],
rotateFree: false,
ok: okBtnDom,
view: viewImgDom,
maxZoom: 3,
style: {
jpgFillColor: "transparent",
},
done: (dataUrl) => {
const cutImage = this.convertBase64UrlToBlob(dataUrl);
this.getSignature(cutImage, fileName);
setTimeout(() => {
cutFlag = false;
}, 2000);
},
fail: (failInfo) => {
},
loadComplete:(img)=>{
this.setState({
previewUrl: img.src
})
}
};
if (!this.state.photoclip) {
const photoclip = new PhotoClip("#headPicModal", options);
photoclip.load(imageFile.ossUrl);
console.log("photoclip-222",photoclip);
this.setState({
photoclip,
});
} else {
this.state.photoclip.clear();
this.state.photoclip.load(imageFile.ossUrl);
}
},200);
}
);
};
//获取resourceId
getSignature = (blob, fileName) => {
const { choosedBannerId } = this.state;
Upload.uploadBlobToOSS(blob, 'avatar' + (new Date()).valueOf()).then((coverClicpPath) => {
this.setState({
coverClicpPath
})
});
};
// base64转换成blob
convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i);
}
return new Blob([ab], { type: "image/png" });
};
updateCover = () =>{
const {coverClicpPath} = this.state
this.setState({
showSelectFileModal: false
})
// const coverObj = {
// contentType: 'COVER',
// mediaType: 'PICTURE',
// mediaContent: coverClicpPath,
// }
// console.log("coverObj",coverObj);
this.props.onChange('coverUrl', coverClicpPath);
}
render() { render() {
const { showCutModal, imageFile,courseCatalogList} = this.state; const { showCutModal, imageFile,courseCatalogList,showSelectFileModal,visible } = this.state;
const { data,pageType,isEdit} = this.props; const { data,pageType,isEdit} = this.props;
const { courseName, coverUrl,categoryName} = data; const { courseName,categoryName,coverUrl} = data;
console.log('categoryName',categoryName);
const fileName = ''; const fileName = '';
// 当前是否使用的是默认图片 // 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover;
return ( return (
<div className="add-live__basic-info"> <div className="add-live__basic-info">
<div className="course-name"> <div className="course-name">
...@@ -105,20 +209,21 @@ class AddLiveBasic extends React.Component { ...@@ -105,20 +209,21 @@ class AddLiveBasic extends React.Component {
<img src={coverUrl} /> <img src={coverUrl} />
</div> </div>
<div className="opt-btns"> <div className="opt-btns">
<input {/* <input
type="file" type="file"
value={fileName} // 避免选择同一文件 value不改变 不触发onChange事件 value={fileName} // 避免选择同一文件 value不改变 不触发onChange事件
accept="image/png, image/jpeg, image/bmp, image/jpg" accept="image/png, image/jpeg, image/bmp, image/jpg"
ref="stagePicInputFile" ref="stagePicInputFile"
style={{display: 'none'}} style={{display: 'none'}}
onChange={(event) => { this.handleShowImgCutModal(event) }} onChange={() => { this.setState({
/> showSelectFileModal: true
}) }}
/> */}
<Button onClick={() => { <Button onClick={() => {
this.setState({ this.setState({
currentInputFile: this.refs.stagePicInputFile showSelectFileModal: true
}); })
this.refs.stagePicInputFile.click();
}}>上传图片</Button> }}>上传图片</Button>
<span <span
className={`default-btn ${isDefaultCover ? 'disabled' : ''}`} className={`default-btn ${isDefaultCover ? 'disabled' : ''}`}
...@@ -155,6 +260,67 @@ class AddLiveBasic extends React.Component { ...@@ -155,6 +260,67 @@ class AddLiveBasic extends React.Component {
onClose={() => this.setState({ showCutModal: false })} onClose={() => this.setState({ showCutModal: false })}
reUpload={() => { this.state.currentInputFile.click() }} reUpload={() => { this.state.currentInputFile.click() }}
/> />
<SelectPrepareFileModal
operateType="select"
accept="video/mp4,image/jpeg,image/png,image/jpg"
selectTypeList={['MP4', 'JPG', 'JPEG', 'PNG']}
tooltip='支持文件类型:jpg、jpeg、png、mp4'
isOpen={showSelectFileModal}
onClose={() => {
this.setState({ showSelectFileModal: false })
}}
onSelect={this.handleSelectCover}
/>
<Modal
title="设置图片"
width={1080}
visible={visible}
onCancel={() => {
this.setState({ visible: false });
}}
footer={[
<Button
key="back"
onClick={() => {
this.setState({ visible: false });
}}
>
重新上传
</Button>,
<Button
key="submit"
type="primary"
onClick={() => {
if (!cutFlag) {
cutFlag = true;
this.refs.hiddenBtn.click();
}
this.setState({ visible: false });
this.updateCover()
}}
>
确定
</Button>,
]}
>
<div className="clip-box">
<div
id="headPicModal"
style={{
width: "500px",
height: "430px",
marginBottom: 0,
}}
></div>
<div id="clipBtn" style={{ display: "none" }} ref="hiddenBtn"></div>
<div className="preview-img">
<div className="title">效果预览</div>
{/* <img src={previewUrl} alt="图片预览" className="preview-url" /> */}
<div id="preview-url-box"></div>
</div>
</div>
</Modal>
</div> </div>
) )
} }
......
...@@ -17,6 +17,7 @@ import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepare ...@@ -17,6 +17,7 @@ import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepare
import { DISK_MAP } from '@/common/constants/academic/lessonEnum'; import { DISK_MAP } from '@/common/constants/academic/lessonEnum';
import { ImgCutModalNew } from '@/components'; import { ImgCutModalNew } from '@/components';
const { TextArea } = Input; const { TextArea } = Input;
const defaultCover = 'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1599635741526.png'; const defaultCover = 'https://xiaomai-image.oss-cn-hangzhou.aliyuncs.com/1599635741526.png';
class AddLiveIntro extends React.Component { class AddLiveIntro extends React.Component {
...@@ -27,6 +28,7 @@ class AddLiveIntro extends React.Component { ...@@ -27,6 +28,7 @@ class AddLiveIntro extends React.Component {
warmUrl: defaultCover, warmUrl: defaultCover,
showSelectFileModal: false, showSelectFileModal: false,
diskList: [], diskList: [],
selectType:null
} }
} }
...@@ -39,36 +41,56 @@ class AddLiveIntro extends React.Component { ...@@ -39,36 +41,56 @@ class AddLiveIntro extends React.Component {
showCutModal: true, showCutModal: true,
}); });
} }
// 选择暖场资源 // 选择暖场资源
handleSelectVideo = (file) => { handleSelectVideo = (file) => {
const { selectType } = this.state;
this.setState({ this.setState({
showSelectFileModal: false showSelectFileModal: false
}) })
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file; const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
const liveCourseWarmMedia = { if(selectType === 'WARMUP'){
contentType: 'WARMUP', const liveCourseWarmMedia = {
mediaType: folderFormat === 'MP4' ? 'VIDEO' : 'PICTURE', contentType: 'WARMUP',
mediaContent: resourceId, mediaType: folderFormat === 'MP4' ? 'VIDEO' : 'PICTURE',
mediaUrl: ossUrl, mediaContent: resourceId,
mediaName: folderName, mediaUrl: ossUrl,
size: folderSize mediaName: folderName,
size: folderSize
}
this.props.onChange('liveCourseWarmMedia', liveCourseWarmMedia);
}else{
// 最多添加九图片
const { liveCourseMediaRequests } = this.props.data;
if (liveCourseMediaRequests.length > 8) {
message.warning("最多添加9张图片");
return;
}
liveCourseMediaRequests.push({
contentType: 'INTRO',
size: folderSize,
mediaName: folderName,
mediaContent: resourceId,
mediaType: 'PICTURE',
mediaUrl: ossUrl,
});
this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
} }
console.log('liveCourseWarmMedia',liveCourseWarmMedia);
this.props.onChange('liveCourseWarmMedia', liveCourseWarmMedia);
} }
// 获取机构可见的磁盘 // 获取机构可见的磁盘
handleFetchDiskList = () => { // handleFetchDiskList = () => {
// axios.Apollo('public/apollo/getUserDisk', {}).then((res) => { // axios.Apollo('public/apollo/getUserDisk', {}).then((res) => {
// const { result = [] } = res; // const { result = [] } = res;
// const diskList = result.map((item) => { // const diskList = result.map((item) => {
// return { // return {
// ...item, // ...item,
// folderName: DISK_MAP[item.disk] // folderName: DISK_MAP[item.disk]
// } // }
// }); // });
// this.setState({ diskList }); // this.setState({ diskList });
// }); // });
} // }
// 删除简介 // 删除简介
handleDeleteIntro = (index) => { handleDeleteIntro = (index) => {
...@@ -145,66 +167,60 @@ class AddLiveIntro extends React.Component { ...@@ -145,66 +167,60 @@ class AddLiveIntro extends React.Component {
} }
handleUpload = (Blob) => { handleUpload = (Blob) => {
this.setState({
showSelectFileModal: true,
selectType:'INTRO'
})
// 最多添加九图片 // 最多添加九图片
const { liveCourseMediaRequests } = this.props.data; // const { liveCourseMediaRequests } = this.props.data;
const list = _.filter(liveCourseMediaRequests, (item) => { // const list = _.filter(liveCourseMediaRequests, (item) => {
return item.mediaType == "PICTURE"; // return item.mediaType == "PICTURE";
}); // });
if (list.length > 8) { // if (list.length > 8) {
message.warning("最多添加9张图片"); // message.warning("最多添加9张图片");
return; // return;
} // }
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) => { // const params = {
// resourceName,
// accessTypeEnum: 'PUBLIC',
// bizCode: 'LIVE_COURSE_MEDIA',
// instId:User.getStoreId(),
// }
// Service.Hades("public/hades/commonOssAuthority", params).then((res) => {
// const { resourceId } = res.result;
// const signInfo = res.result;
// // 构建上传的表单
// const xhr = new XMLHttpRequest();
// const formData = new FormData();
// formData.append("OSSAccessKeyId", signInfo.accessId);
// formData.append("policy", signInfo.policy);
// formData.append("callback", signInfo.callback);
// formData.append("Signature", signInfo.signature);
// formData.append("key", signInfo.key);
// formData.append("file", Blob);
// formData.append("success_action_status", 200);
// xhr.open("POST", signInfo.host);
// xhr.onload = () => {
// liveCourseMediaRequests.push({ // liveCourseMediaRequests.push({
// contentType:"INTRO",
// size, // size,
// mediaName: name, // mediaName: name,
// mediaContent: imgAddress.resourceId, // mediaContent: resourceId,
// mediaType: 'PICTURE', // mediaType: 'PICTURE',
// mediaUrl: window.URL.createObjectURL(Blob),
// }); // });
// this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests); // this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
// };
// xhr.onerror = () => {
// xhr.abort();
// };
// xhr.send(formData);
// this.setState({ xhr })
// }); // });
const params = {
resourceName,
accessTypeEnum: 'PUBLIC',
bizCode: 'LIVE_COURSE_MEDIA',
instId:User.getStoreId(),
}
Service.Hades("public/hades/commonOssAuthority", params).then((res) => {
const { resourceId } = res.result;
const signInfo = res.result;
// 构建上传的表单
const xhr = new XMLHttpRequest();
const formData = new FormData();
formData.append("OSSAccessKeyId", signInfo.accessId);
formData.append("policy", signInfo.policy);
formData.append("callback", signInfo.callback);
formData.append("Signature", signInfo.signature);
formData.append("key", signInfo.key);
formData.append("file", Blob);
formData.append("success_action_status", 200);
xhr.open("POST", signInfo.host);
xhr.onload = () => {
liveCourseMediaRequests.push({
size,
mediaName: name,
mediaContent: resourceId,
mediaType: 'PICTURE',
mediaUrl: window.URL.createObjectURL(Blob),
});
this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
};
xhr.onerror = () => {
xhr.abort();
};
xhr.send(formData);
this.setState({ xhr })
});
} }
whetherVisitorsJoinChange = ()=>{ whetherVisitorsJoinChange = ()=>{
if(this.props.data.whetherVisitorsJoin==="NO"){ if(this.props.data.whetherVisitorsJoin==="NO"){
...@@ -214,7 +230,7 @@ class AddLiveIntro extends React.Component { ...@@ -214,7 +230,7 @@ class AddLiveIntro extends React.Component {
} }
} }
componentWillMount() { componentWillMount() {
this.handleFetchDiskList(); // this.handleFetchDiskList();
} }
// componentWillUnmount() { // componentWillUnmount() {
// const { xhr } = this.state; // const { xhr } = this.state;
...@@ -288,7 +304,8 @@ class AddLiveIntro extends React.Component { ...@@ -288,7 +304,8 @@ class AddLiveIntro extends React.Component {
disabled={!isEdit} disabled={!isEdit}
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectFileModal: true showSelectFileModal: true,
selectType:'WARMUP'
}) })
}}>上传图片/视频</Button> }}>上传图片/视频</Button>
...@@ -346,8 +363,11 @@ class AddLiveIntro extends React.Component { ...@@ -346,8 +363,11 @@ class AddLiveIntro extends React.Component {
<span className="icon iconfont">&#xe639;</span> <span className="icon iconfont">&#xe639;</span>
<span className="text">文字</span> <span className="text">文字</span>
</div> </div>
<div className="operate__item" onClick={this.handleUpload}>
<Upload <span className="icon iconfont">&#xe63b;</span>
<span className="text">图片</span>
</div>
{/* <Upload
fileList={[]} fileList={[]}
accept="image/jpeg, image/png, image/jpg, image/gif" accept="image/jpeg, image/png, image/jpg, image/gif"
beforeUpload={(Blob) => { beforeUpload={(Blob) => {
...@@ -359,7 +379,7 @@ class AddLiveIntro extends React.Component { ...@@ -359,7 +379,7 @@ class AddLiveIntro extends React.Component {
<span className="icon iconfont">&#xe63b;</span> <span className="icon iconfont">&#xe63b;</span>
<span className="text">图片</span> <span className="text">图片</span>
</div> </div>
</Upload> </Upload> */}
</div> </div>
<div className="tips"> <div className="tips">
• 图片支持jpeg、jpg、png、gif格式 • 图片支持jpeg、jpg、png、gif格式
...@@ -374,12 +394,12 @@ class AddLiveIntro extends React.Component { ...@@ -374,12 +394,12 @@ class AddLiveIntro extends React.Component {
selectTypeList={['MP4', 'JPG', 'JPEG', 'PNG']} selectTypeList={['MP4', 'JPG', 'JPEG', 'PNG']}
tooltip='支持文件类型:jpg、jpeg、png、mp4' tooltip='支持文件类型:jpg、jpeg、png、mp4'
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
diskList={diskList}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }) this.setState({ showSelectFileModal: false })
}} }}
onSelect={this.handleSelectVideo} onSelect={this.handleSelectVideo}
/> />
</div> </div>
) )
} }
......
...@@ -97,8 +97,6 @@ class SelectPrepareFileModal extends React.Component { ...@@ -97,8 +97,6 @@ class SelectPrepareFileModal extends React.Component {
// 根据当前根节点获取文件列表 // 根据当前根节点获取文件列表
const { selectTypeList } = this.props; const { selectTypeList } = this.props;
const { query, folderList, currentRootDisk } = this.state; const { query, folderList, currentRootDisk } = this.state;
const { instId } = window.currentUserInstInfo;
const _params = { const _params = {
...query, ...query,
...params, ...params,
......
...@@ -128,7 +128,6 @@ class UploadProgressModal extends React.Component { ...@@ -128,7 +128,6 @@ class UploadProgressModal extends React.Component {
}).then(url => { }).then(url => {
file.status = 'success'; file.status = 'success';
this.setState({ fileList }); this.setState({ fileList });
console.log('fileList',fileList);
this.props.onUpload(fileContent, resourceId); this.props.onUpload(fileContent, resourceId);
}).catch(err => { }).catch(err => {
file.status = 'fail'; file.status = 'fail';
...@@ -150,6 +149,7 @@ class UploadProgressModal extends React.Component { ...@@ -150,6 +149,7 @@ class UploadProgressModal extends React.Component {
if (size > 100 * 1024) { if (size > 100 * 1024) {
file.checkpoints[checkpoint.uploadId] = checkpoint; file.checkpoints[checkpoint.uploadId] = checkpoint;
} }
} }
// 断点续传 // 断点续传
......
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