|
|
@ -1,7 +1,7 @@
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import { Modal,Checkbox,Select,Input,Upload,Button,Icon,message,DatePicker,Tooltip} from "antd";
|
|
|
|
import { Modal,Checkbox,Select,Input,Upload,Button,Icon,message,DatePicker,Tooltip} from "antd";
|
|
|
|
import axios from'axios';
|
|
|
|
import axios from'axios';
|
|
|
|
import {getUrl,handleDateString} from 'educoder';
|
|
|
|
import {getUrl,handleDateString,appendFileSizeToUploadFileAll} from 'educoder';
|
|
|
|
import locale from 'antd/lib/date-picker/locale/zh_CN';
|
|
|
|
import locale from 'antd/lib/date-picker/locale/zh_CN';
|
|
|
|
import moment from 'moment';
|
|
|
|
import moment from 'moment';
|
|
|
|
import Modals from '../../modals/Modals';
|
|
|
|
import Modals from '../../modals/Modals';
|
|
|
@ -252,12 +252,12 @@ class Selectsetting extends Component{
|
|
|
|
let fileList = info.fileList;
|
|
|
|
let fileList = info.fileList;
|
|
|
|
if(info.file.status!="removed"){
|
|
|
|
if(info.file.status!="removed"){
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
fileList,
|
|
|
|
fileList: appendFileSizeToUploadFileAll(fileList),
|
|
|
|
fileListtype:true
|
|
|
|
fileListtype:true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
fileList,
|
|
|
|
fileList: appendFileSizeToUploadFileAll(fileList),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -290,10 +290,10 @@ class Selectsetting extends Component{
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (id) => {
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
|
|
|
|
|
|
|
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
|
|
|
|
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
|
|
|
|
const url = `/attachments/${id}.json`
|
|
|
|
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
|
|
|
|
axios.delete(url, {
|
|
|
|
axios.delete(url, {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then((response) => {
|
|
|
|
.then((response) => {
|
|
|
@ -319,6 +319,9 @@ class Selectsetting extends Component{
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
fileListtype:false,
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onChangeTimepublishs= (date, dateString,key) => {
|
|
|
|
onChangeTimepublishs= (date, dateString,key) => {
|
|
|
@ -373,7 +376,7 @@ class Selectsetting extends Component{
|
|
|
|
width: 600,
|
|
|
|
width: 600,
|
|
|
|
// https://github.com/ant-design/ant-design/issues/15505
|
|
|
|
// https://github.com/ant-design/ant-design/issues/15505
|
|
|
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
|
|
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
|
|
|
showUploadList: false,
|
|
|
|
// showUploadList: false,
|
|
|
|
action: `${getUrl()}/api/attachments.json`,
|
|
|
|
action: `${getUrl()}/api/attachments.json`,
|
|
|
|
onChange: this.handleChange,
|
|
|
|
onChange: this.handleChange,
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
@ -591,36 +594,36 @@ class Selectsetting extends Component{
|
|
|
|
</Upload>
|
|
|
|
</Upload>
|
|
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<style>
|
|
|
|
{/*<style>*/}
|
|
|
|
{
|
|
|
|
{/*{*/}
|
|
|
|
`
|
|
|
|
{/*`*/}
|
|
|
|
.maxwidth400{
|
|
|
|
{/*.maxwidth400{*/}
|
|
|
|
max-width: 400px;
|
|
|
|
{/*max-width: 400px;*/}
|
|
|
|
overflow: hidden;
|
|
|
|
{/*overflow: hidden;*/}
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
{/*text-overflow: ellipsis;*/}
|
|
|
|
white-space: nowrap;
|
|
|
|
{/*white-space: nowrap;*/}
|
|
|
|
}
|
|
|
|
{/*}*/}
|
|
|
|
`
|
|
|
|
{/*`*/}
|
|
|
|
}
|
|
|
|
{/*}*/}
|
|
|
|
</style>
|
|
|
|
{/*</style>*/}
|
|
|
|
{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
|
|
|
|
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
|
|
|
|
return(
|
|
|
|
{/*return(*/}
|
|
|
|
<p className="color-grey mt10" key={key} >
|
|
|
|
{/*<p className="color-grey mt10" key={key} >*/}
|
|
|
|
<a className="color-grey fl">
|
|
|
|
{/*<a className="color-grey fl">*/}
|
|
|
|
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
|
|
|
|
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
|
|
|
|
</a>
|
|
|
|
{/*</a>*/}
|
|
|
|
<span className="mr12 color9B9B maxwidth400 fl" length="58">
|
|
|
|
{/*<span className="mr12 color9B9B maxwidth400 fl" length="58">*/}
|
|
|
|
{item.name}
|
|
|
|
{/*{item.name}*/}
|
|
|
|
</span>
|
|
|
|
{/*</span>*/}
|
|
|
|
<span className="color656565 mt2 color-grey-6 font-12 mr8">
|
|
|
|
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
|
|
|
|
{item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"123":this.props.bytesToSize(item.response.filesize)}
|
|
|
|
{/*{item.response===undefined?"":isNaN(bytesToSize(item.filesize))?"123":bytesToSize(item.filesize)}*/}
|
|
|
|
</span>
|
|
|
|
{/*</span>*/}
|
|
|
|
<i className="font-14 iconfont icon-guanbi "
|
|
|
|
{/*<i className="font-14 iconfont icon-guanbi "*/}
|
|
|
|
id={item.response===undefined?"":item.response.id}
|
|
|
|
{/*id={item.response===undefined?"":item.response.id}*/}
|
|
|
|
aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>
|
|
|
|
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
|
|
|
|
</p>
|
|
|
|
{/*</p>*/}
|
|
|
|
)
|
|
|
|
{/*)*/}
|
|
|
|
})}
|
|
|
|
{/*})}*/}
|
|
|
|
|
|
|
|
|
|
|
|
{this.state.newfileListtypes===true?<p className={"color-red"}>请先上传资源</p>:""}
|
|
|
|
{this.state.newfileListtypes===true?<p className={"color-red"}>请先上传资源</p>:""}
|
|
|
|
|
|
|
|
|
|
|
@ -632,12 +635,13 @@ class Selectsetting extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}</style>
|
|
|
|
`}</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className={this.state.fileListtype===true?"mt30":""}>
|
|
|
|
<Checkbox
|
|
|
|
<Checkbox
|
|
|
|
checked={is_public}
|
|
|
|
checked={is_public}
|
|
|
|
onChange={this.onChangepublics}>
|
|
|
|
onChange={this.onChangepublics}>
|
|
|
|
<span className={"font-14"}>勾选后所有用户可见,否则仅课堂成员可见</span>
|
|
|
|
<span className={"font-14"}>勾选后所有用户可见,否则仅课堂成员可见</span>
|
|
|
|
</Checkbox>
|
|
|
|
</Checkbox>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{/*{this.props.has_course_groups&&this.props.has_course_groups===true?:""}*/}
|
|
|
|
{/*{this.props.has_course_groups&&this.props.has_course_groups===true?:""}*/}
|
|
|
|
{/*{this.state.course_groupss&&this.state.course_groupss.length>0?<Checkbox*/}
|
|
|
|
{/*{this.state.course_groupss&&this.state.course_groupss.length>0?<Checkbox*/}
|
|
|
|
{/*checked={unified_setting}*/}
|
|
|
|
{/*checked={unified_setting}*/}
|
|
|
|