Commit 05f7474b by zhangleyuan

feat:创建课程条助教选项改为多选

parent 9df2307f
......@@ -405,7 +405,7 @@ class SelectPrepareFileModal extends React.Component {
parentId: id
}
Service.Hades('public/apollo/saveFolder', params).then((res) => {
Service.Hades('public/hadesStore/saveFolder', params).then((res) => {
const { query, selectedFileList, currentRootDisk } = this.state;
const _query = _.clone(query);
const _selectedFileList = [...selectedFileList, res.result];
......
/*
* @Author: 吴文洁
* @Date: 2020-07-15 17:29:12
* @Last Modified by: 吴文洁
* @Last Modified time: 2020-07-15 18:16:05
* @Description: 新建/编辑直播课-基本信息
*/
import React from 'react';
import { Input, Button, message ,Cascader } from 'antd';
import UploadOss from "@/core/upload";
import { ImgCutModalNew } from '@/components';
import StoreService from "@/domains/store-domain/storeService";
import './AddLiveBasic.less';
const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' };
class AddLiveBasic extends React.Component {
constructor(props) {
super(props);
this.state = {
imageFile: null,
showCutModal: false,
courseCatalogList:[]
}
}
componentWillUnmount() {
}
componentDidMount(){
this.getCourseCatalogList();
}
getCourseCatalogList = ()=>{
StoreService.getCourseCatalogList({current:1,size:1000}).then((res) => {
this.setState({
courseCatalogList:res.result.records
})
});
}
// 上传封面图
handleShowImgCutModal = (event) => {
const imageFile = event.target.files[0];
if (!imageFile) return;
this.setState({
imageFile,
showCutModal: true,
});
}
// 使用默认封面图
handleResetCoverUrl = () => {
const { data: { coverUrl } } = this.props;
const isDefaultCover = coverUrl === defaultCover;
// 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return;
message.success('已替换为默认图');
this.props.onChange('coverId', null, defaultCover);
}
catalogChange= (value) => {
const changeValueLength = value.length;
switch (changeValueLength){
case 1:
this.props.onChange('categoryId',value[0]);
break;
case 2:
this.props.onChange('categoryId',value[1]);
break;
default:
break;
}
}
render() {
const { showCutModal, imageFile,courseCatalogList} = this.state;
const { data,pageType,isEdit} = this.props;
const { courseName, coverUrl,categoryName} = data;
console.log('categoryName',categoryName);
const fileName = '';
// 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover;
return (
<div className="add-live__basic-info">
<div className="course-name">
<span className="label"><span className="require">*</span>课程名称:</span>
<Input
value={courseName}
placeholder="请输入直播名称(40字以内)"
maxLength={40}
style={{ width: 240 }}
onChange={(e) => { this.props.onChange('courseName', e.target.value)}}
/>
</div>
<div className="course-cover">
<span className="label">封面图:</span>
<div className="course-cover__wrap">
<div className="img-content">
{
isDefaultCover && <span className="tag">默认图</span>
}
<img src={coverUrl} />
</div>
<div className="opt-btns">
<input
type="file"
value={fileName} // 避免选择同一文件 value不改变 不触发onChange事件
accept="image/png, image/jpeg, image/bmp, image/jpg"
ref="stagePicInputFile"
style={{display: 'none'}}
onChange={(event) => { this.handleShowImgCutModal(event) }}
/>
<Button onClick={() => {
this.setState({
currentInputFile: this.refs.stagePicInputFile
});
this.refs.stagePicInputFile.click();
}}>上传图片</Button>
<span
className={`default-btn ${isDefaultCover ? 'disabled' : ''}`}
onClick={this.handleResetCoverUrl}
>使用默认图</span>
<div className="tips">建议尺寸690*398像素,图片支持jpg、jpeg、png格式。</div>
</div>
</div>
</div>
<div className="course-catalog">
<span className="label"><span className="require">*</span>课程分类:</span>
{ pageType === 'add' &&
<Cascader defaultValue={[categoryName]} options={courseCatalogList} displayRender={ label => label.join('-')} fieldNames={fieldNames} onChange={this.catalogChange} style={{ width: 240 }} placeholder="请选择课程分类" />
}
{ (pageType === 'edit' && categoryName) &&
<Cascader disabled={!isEdit ? true: false} defaultValue={[categoryName]} options={courseCatalogList} displayRender={ label => label.join('-')} fieldNames={fieldNames} onChange={this.catalogChange} style={{ width: 240 }} placeholder="请选择课程分类" />
}
</div>
<ImgCutModalNew
title="裁剪"
width={550}
cutWidth={500}
cutHeight={282}
cutContentWidth={500}
cutContentHeight={300}
visible={showCutModal}
imageFile={imageFile}
bizCode='LIVE_COURSE_MEDIA'
onOk={(urlStr, resourceId) => {
this.setState({ showCutModal: false });
this.props.onChange('coverId', resourceId, urlStr);
this.state.currentInputFile.value = '';
}}
onClose={() => this.setState({ showCutModal: false })}
reUpload={() => { this.state.currentInputFile.click() }}
/>
</div>
)
}
}
export default AddLiveBasic;
\ No newline at end of file
.live-course-list {
margin-top: 16px;
.record__item {
display: flex;
align-items: center;
.course-cover {
min-width: 90px;
max-width: 90px;
height: 50px;
border-radius: 2px;
margin-right: 8px;
}
.course-name{
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
font-weight: bold;
}
.course-time{
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 20px;
}
.course-status {
font-size:12px;
line-height:18px;
display:inline-block;
border-radius:2px;
padding:0 8px;
margin-left:4px;
}
.teacher{
font-size: 12px;
color: #666666;
line-height: 20px;
}
.assistant{
font-size: 12px;
color: #666666;
line-height: 20px;
}
.split {
margin: 0 4px;
color: #BFBFBF;
}
}
.categoryName{
font-size: 14px;
color: #666666;
line-height: 20px;
}
.courseware{
font-size: 14px;
color: #5289FA;
line-height: 20px;
}
.quota-icon{
color:#5289FA;
}
.operate {
display: flex;
align-items: center;
flex-wrap: wrap;
.operate__item {
color: #5289FA;
cursor: pointer;
&.split {
margin: 0 8px;
color: #BFBFBF;
}
}
}
.operate-text {
color: #5289FA;
cursor: pointer;
}
.course-start-end {
margin-left: 16px;
width: 78px;
height: 20px;
border-radius: 2px;
border: 1px solid rgba(204, 204, 204, 1);
display: flex;
align-items: center;
cursor: pointer;
white-space: nowrap;
.start-icon {
color: #3296fa;
font-size: 12px;
transform: scale(0.8);
margin: 0 5px;
}
.end-icon {
color: #00d700;
font-size: 12px;
transform: scale(0.8);
margin: 0 5px;
}
.start-end-text {
font-size: 12px;
}
}
}
.live-course-more-menu {
background: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
border-radius: 4px;
div {
line-height: 30px;
padding: 0 15px;
cursor: pointer;
&:hover {
background: #f3f6fa;
}
}
}
.tipTitle {
.type {
font-weight: 700;
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import { getEllipsText } from "@/core/util";
import DefaultIcon from '@/modules/common/DefaultIcon';
import UploadProgressModal from './UploadProgressModal';
import NonCompliantFileModal from './NonCompliantFileModal';
import Service from '@/common/js/service';
import {
DEFAULT_SIZE_UNIT, FileTypeIcon, NonCompliantFileMap,
DISK_LIST, SupportFileType, LocalFileType
......@@ -38,8 +38,13 @@ const defaultRootDisk = {
}
const FOLDERLIST_URL_MAP = {
<<<<<<< HEAD
'MYSELF': 'public/apollo/folderList',
'COMMON': 'public/hadesStore/folderList',
=======
'MYSELF': 'public/hadesStore/folderList',
'COMMON': 'public/apollo/commonFolderList',
>>>>>>> 1c42770... feat:创建课程条助教选项改为多选
'EMPLOYEE': 'public/apollo/employeeFolderList'
};
......@@ -110,7 +115,7 @@ class SelectPrepareFileModal extends React.Component {
_params.folderFileType = selectTypeList
}
axios.Apollo(FOLDERLIST_URL_MAP[currentRootDisk.disk], _params).then((res) => {
Service.Hades(FOLDERLIST_URL_MAP[currentRootDisk.disk], _params).then((res) => {
const { result = {} } = res;
const { records = [], total = 0 } = result;
this.setState({
......@@ -423,7 +428,7 @@ class SelectPrepareFileModal extends React.Component {
parentId: id
}
axios.Apollo('public/apollo/saveFolder', params).then((res) => {
Service.Hades('public/hadesStore/saveFolder', params).then((res) => {
const { query, selectedFileList, currentRootDisk } = this.state;
const _query = _.clone(query);
{/* TODO:麦麦打卡类目申请下来后解开视频入口 */}
......
......@@ -189,7 +189,7 @@ class FolderManage extends React.Component {
parentId: id
}
Service.Hades('public/apollo/saveFolder', params).then((res) => {
Service.Hades('public/hadesStore/saveFolder', params).then((res) => {
const query = _.clone(this.state.query);
query.current = 1;
this.setState({ query }, () => {
......@@ -214,7 +214,7 @@ class FolderManage extends React.Component {
if (selectFolderPathList.length > 1) {
params.newParentId = id
}
Service.Hades('public/apollo/moveFolder', params).then((res) => {
Service.Hades('public/hadesStore/moveFolderr', params).then((res) => {
// 判断是否将文件移动到了自身或者子目录
const { result = {} } = res;
......
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