dev_forum
杨树明 5 years ago
parent f103d07731
commit 39c3291965

@ -341,7 +341,7 @@ class Selectresource extends Component{
>
{
Resourcelist === undefined ?Resourcelist.files.length===0?<NoneData/>:
Resourcelist === undefined ?"":Resourcelist.files.length===0?<NoneData/>:
<Checkbox.Group style={{ width: '100%' }} value={patheditarry} onChange={this.shixunhomeworkedit}>
{
@ -365,7 +365,7 @@ class Selectresource extends Component{
)
})
}
</Checkbox.Group>:""
</Checkbox.Group>
}
</div>

@ -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}*/}

@ -2,7 +2,7 @@ import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message,DatePicker,Select,Tooltip} from "antd";
import axios from 'axios';
import Modals from '../../modals/Modals';
import {getUrl,handleDateString} from 'educoder';
import {getUrl,handleDateString,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
const CheckboxGroup = Checkbox.Group;
@ -85,12 +85,12 @@ class Sendresource 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),
});
}
}
@ -126,9 +126,9 @@ class Sendresource extends Component{
// }
onAttachmentRemove = (id) => {
onAttachmentRemove = (file) => {
const url = `/attachments/${id}.json`
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
@ -146,6 +146,9 @@ class Sendresource extends Component{
.catch(function (error) {
console.log(error);
});
this.setState({
fileListtype:false,
})
}
ModalCancelModalCancel=()=>{
@ -322,7 +325,7 @@ class Sendresource extends Component{
const uploadProps = {
width: 600,
showUploadList:false,
// showUploadList:false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
@ -427,36 +430,37 @@ class Sendresource 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))?"":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)=>{*/}
{/*debugger*/}
{/*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))?"":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>*/}
{/*)*/}
{/*})}*/}
{newfileListtype===true?<p className={"color-red"}>请先上传资源</p>:""}
@ -468,7 +472,7 @@ class Sendresource extends Component{
}
`}</style>
<Checkbox checked={is_public} onChange={this.onChangepublic}>
<div className={this.state.fileListtype===true?"mt30":""}></div><Checkbox checked={is_public} onChange={this.onChangepublic}>
<span className={"font-14"}>勾选后所有用户可见否则仅课堂成员可见</span>
</Checkbox>

Loading…
Cancel
Save