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