资源描述方面

newyslclassrooms
杨树林 5 years ago
parent c7dad0d3ef
commit f87becc496

@ -13,20 +13,35 @@ import Modals from '../../modals/Modals';
class Fileslistitem extends Component { class Fileslistitem extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {}
}
} }
settingList=()=>{ settingList = (bools) => {
let {discussMessage} = this.props let {discussMessage} = this.props
this.setState({ this.setState({
discussMessageid: discussMessage.id discussMessageid: discussMessage.id
}) })
if (bools === true) {
this.props.Settingtypes(discussMessage.id) this.props.Settingtypes(discussMessage.id)
} else {
this.props.Settingtypess(discussMessage.id)
} }
}
//外链
showfiless = (url,id) => {
window.open(url)
let urls=`/files/${id}/update_visits.json`;
axios.post(urls,{
}).then((result)=>{
if(result.data.status===0){
this.props.Updateresourcepage()
}else{
this.props.showNotification(result.data.message);
}
})
}
showfiles = (list) => { showfiles = (list) => {
if (this.props.checkIfLogin() === false) { if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog() this.props.showLoginDialog()
@ -120,10 +135,12 @@ class Fileslistitem extends Component{
const cid = this.props.match.params.coursesId const cid = this.props.match.params.coursesId
const url = `/files/bulk_delete.json`; const url = `/files/bulk_delete.json`;
axios.delete(url, { data: { axios.delete(url, {
data: {
course_id: cid, course_id: cid,
ids: [id], ids: [id],
}}) }
})
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
//Modalstopval:response.data.message, //Modalstopval:response.data.message,
@ -153,10 +170,12 @@ class Fileslistitem extends Component{
render() { render() {
const { checkBox, const {
checkBox,
discussMessage, index discussMessage, index
} = this.props; } = this.props;
let bools = discussMessage.link && discussMessage.link ? false : true;
return ( return (
<div className="graduateTopicList boardsList"> <div className="graduateTopicList boardsList">
@ -213,33 +232,72 @@ class Fileslistitem extends Component{
margin-top:2px; margin-top:2px;
} }
`}</style> `}</style>
<div className="clearfix ds pr contentSection" style={{cursor : this.props.isAdmin ? "pointer" : "default"}} onClick={() => window.$(`.sourceitem${index} input`).click() }> <div className="clearfix ds pr contentSection" style={{cursor: this.props.isAdmin ? "pointer" : "default"}}
onClick={() => window.$(`.sourceitem${index} input`).click()}>
<h6 onClick={(event) => this.eventStop(event)}> <h6 onClick={(event) => this.eventStop(event)}>
<span className={`sourceitem${index} fl mr12 mt3`}> <span className={`sourceitem${index} fl mr12 mt3`}>
{checkBox} {checkBox}
</span> </span>
{ {
this.props.isAdmin ? <a this.props.isAdmin ?
(bools === true ?
<a
// href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"} // href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"}
onClick={() => this.showfiles(discussMessage)} onClick={() => this.showfiles(discussMessage)}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : "" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>
:
<a
// href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"}
onClick={() => this.showfiless(discussMessage.link,discussMessage.id)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>
)
: ""
} }
{ {
this.props.isStudent? <a this.props.isStudent ?
(bools === true ?
<a
onClick={() => this.showfiles(discussMessage)} onClick={() => this.showfiles(discussMessage)}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> :"" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>
:
<a
onClick={() => this.showfiless(discussMessage.link,discussMessage.id)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>
)
: ""
} }
{ {
this.props.isNotMember === true ? this.props.isNotMember === true ?
discussMessage.is_lock === true ? discussMessage.is_lock === true ?
<span className="fl mt3 font-16 font-bd color-dark maxwidth580 pointer" title={"私有属性,非课堂成员不能访问"}>{discussMessage.title}</span> <span className="fl mt3 font-16 font-bd color-dark maxwidth580 pointer"
:<a title={"私有属性,非课堂成员不能访问"}>{discussMessage.title}</span>
:
(bools === true ?
<a
onClick={() => this.showfiles(discussMessage)} onClick={() => this.showfiles(discussMessage)}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>:"" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> :
<a
onClick={() =>this.showfiless(discussMessage.link,discussMessage.id)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>
)
: ""
} }
@ -250,13 +308,37 @@ class Fileslistitem extends Component{
</Tooltip> </Tooltip>
: "" : ""
} }
<style>
{
`
.fwlz{
width:40px;
height:20px;
border-radius:2px;
border:1px solid rgba(250,100,0,1);
font-size:12px;
font-family:MicrosoftYaHei;
color:rgba(250,100,0,1);
text-align: center;
margin-left: 15px;
}
`
}
</style>
{
discussMessage.link && discussMessage.link ?
<p className="fl mt3 fwlz pointer">外链</p>
:
""
}
{discussMessage.is_publish === false ? <CoursesListType typelist={["未发布"]} typesylename={""}/> : ""} {discussMessage.is_publish === false ? <CoursesListType typelist={["未发布"]} typesylename={""}/> : ""}
{this.props.isAdmin ? {this.props.isAdmin ?
<span className={"fr mt2"} onClick={(event) => this.eventStop(event)}> <span className={"fr mt2"} onClick={(event) => this.eventStop(event)}>
<WordsBtn style="blue" className="colorblue font-16 ml20 fr"> <WordsBtn style="blue" className="colorblue font-16 ml20 fr">
<a className="btn colorblue fontweight400" <a className="btn colorblue fontweight400"
onClick={()=>this.settingList()}>设置</a> onClick={() => this.settingList(bools)}>设置</a>
</WordsBtn> </WordsBtn>
</span> : ""} </span> : ""}
@ -265,7 +347,7 @@ class Fileslistitem extends Component{
<WordsBtn style="blue" className="colorblue font-16 ml20 fr"> <WordsBtn style="blue" className="colorblue font-16 ml20 fr">
<a className="btn colorblue fontweight400" <a className="btn colorblue fontweight400"
onClick={()=>this.settingList()}>设置</a> onClick={() => this.settingList(bools)}>设置</a>
</WordsBtn> </WordsBtn>
<WordsBtn style="blue" className="colorblue font-16 ml20 fr"> <WordsBtn style="blue" className="colorblue font-16 ml20 fr">
@ -288,7 +370,6 @@ class Fileslistitem extends Component{
</style> </style>
<style> <style>
{ {
` `
@ -315,11 +396,26 @@ class Fileslistitem extends Component{
{/*</p>}*/} {/*</p>}*/}
<p className={this.props.isAdmin===true?"color-grey panel-lightgrey mt8 fl ml30":"color-grey panel-lightgrey mt8 fl ml13"} style={{width:'100%'}}> <p
className={this.props.isAdmin === true ? "color-grey panel-lightgrey mt8 fl ml30" : "color-grey panel-lightgrey mt8 fl ml13"}
style={{width: '100%'}}>
<span className="mr50"> <span className="mr50">
<span className="mr15 color-dark">{discussMessage.author.name}</span> <span className="mr15 color-dark">{discussMessage.author.name}</span>
{
bools ?
<span className="mr15 color-grey9">大小 {discussMessage.filesize}</span> <span className="mr15 color-grey9">大小 {discussMessage.filesize}</span>
:
""
}
{
bools ?
<span className="mr15 color-grey9">下载 {discussMessage.downloads_count}</span> <span className="mr15 color-grey9">下载 {discussMessage.downloads_count}</span>
:
<span className="mr15 color-grey9">点击次数{discussMessage.downloads_count}</span>
}
{/*<span className="mr15 color-grey9">引用 {discussMessage.quotes}</span>*/} {/*<span className="mr15 color-grey9">引用 {discussMessage.quotes}</span>*/}
<span className="mr15 color-grey-c"> <span className="mr15 color-grey-c">
{/*{moment(discussMessage.publish_time).format('YYYY-MM-DD HH:mm:ss')}*/} {/*{moment(discussMessage.publish_time).format('YYYY-MM-DD HH:mm:ss')}*/}
@ -329,14 +425,16 @@ class Fileslistitem extends Component{
{discussMessage.publish_time === null ? "" : discussMessage.is_publish === true ? moment(discussMessage.publish_time).fromNow() : moment(discussMessage.publish_time).format('YYYY-MM-DD HH:mm')} {discussMessage.publish_time === null ? "" : discussMessage.is_publish === true ? moment(discussMessage.publish_time).fromNow() : moment(discussMessage.publish_time).format('YYYY-MM-DD HH:mm')}
</span> </span>
</span> </span>
{discussMessage&&discussMessage.category_name===null?"":this.props.child===false?<div className="color-grey9 task-hide fr mr30" title={discussMessage&&discussMessage.category_name} {discussMessage && discussMessage.category_name === null ? "" : this.props.child === false ?
<div className="color-grey9 task-hide fr mr30" title={discussMessage && discussMessage.category_name}
style={{"max-width": "268px"}}>所属目录{discussMessage && discussMessage.category_name} style={{"max-width": "268px"}}>所属目录{discussMessage && discussMessage.category_name}
</div> : ""} </div> : ""}
</p> </p>
<p
<p className={this.props.isAdmin===true?"color-grey panel-lightgrey mt8 fl ml30":"color-grey panel-lightgrey mt8 fl ml13"} style={{width:'94%'}}> className={this.props.isAdmin === true ? "color-grey panel-lightgrey mt8 fl ml30" : "color-grey panel-lightgrey mt8 fl ml13"}
style={{width: '94%'}}>
<style> <style>
{ {
` `
@ -349,7 +447,8 @@ class Fileslistitem extends Component{
` `
} }
</style> </style>
<span className="color-dark isspans">资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description}</span> <span
className="color-dark isspans">资源描述 :{discussMessage.description === null ? "暂无描述" : discussMessage.description}</span>
{/*<span className="mr50">*/} {/*<span className="mr50">*/}
{/*/!*<span className="mr15 color-dark"></span>*!/*/} {/*/!*<span className="mr15 color-dark"></span>*!/*/}
{/*<span className="mr15 color-dark">*/} {/*<span className="mr15 color-dark">*/}
@ -365,4 +464,5 @@ class Fileslistitem extends Component{
) )
} }
} }
export default Fileslistitem; export default Fileslistitem;

@ -597,11 +597,19 @@ class Fileslists extends Component{
this.setState({ this.setState({
Addanexternallink:false, Addanexternallink:false,
}) })
if(ints===1){
this.Updateresourcepage();
}
} }
} }
Updateresourcepage=()=>{
let{pagesize,tagname,searchValue,page,sort,sorttype,coursesecondcategoryid}=this.state;
this.getfileslist(pagesize,page,tagname,searchValue,sort,sorttype,coursesecondcategoryid);
}
Cancelvisible=()=>{ Cancelvisible=()=>{
@ -620,6 +628,14 @@ class Fileslists extends Component{
}) })
} }
Settingtypess=(id)=>{
this.setState({
Addanexternallink:true,
Exterchainname:"资源设置",
discussMessageid:id,
})
}
moveTos=(id)=>{ moveTos=(id)=>{
let {checkBoxValues} = this.state; let {checkBoxValues} = this.state;
@ -863,9 +879,10 @@ class Fileslists extends Component{
{...this.state} {...this.state}
modalname={Exterchainname} modalname={Exterchainname}
visible={Addanexternallink} visible={Addanexternallink}
discussMessageid={discussMessageid}
Cancelname={"取消"} Cancelname={"取消"}
Savesname={"确认"} Savesname={"确认"}
Cancel={()=>this.sendResourcessls(1,false)} Cancel={()=>this.sendResourcessls(2,false)}
categoryid={category_id} categoryid={category_id}
setupdate={(ints,bool)=>this.sendResourcessls(ints,bool)} setupdate={(ints,bool)=>this.sendResourcessls(ints,bool)}
has_course_groups={this.state.has_course_groups} has_course_groups={this.state.has_course_groups}
@ -1049,11 +1066,13 @@ class Fileslists extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
discussMessage={item} discussMessage={item}
Updateresourcepage={()=>this.Updateresourcepage()}
isAdmin={this.props.isAdmin()} isAdmin={this.props.isAdmin()}
isStudent={this.props.isStudent()} isStudent={this.props.isStudent()}
isNotMember={this.props.isNotMember()} isNotMember={this.props.isNotMember()}
checkBox={this.props.isAdmin()?<Checkbox value={item.id} key={item.id}></Checkbox>:""} checkBox={this.props.isAdmin()?<Checkbox value={item.id} key={item.id}></Checkbox>:""}
Settingtypes={(id)=>this.Settingtypes(id)} Settingtypes={(id)=>this.Settingtypes(id)}
Settingtypess={(id)=>this.Settingtypess(id)}
coursesId={this.props.match.params.coursesId} coursesId={this.props.match.params.coursesId}
updatafiledfun={()=>this.updatafiled()} updatafiledfun={()=>this.updatafiled()}
index={index} index={index}

@ -133,7 +133,7 @@ class sendResources extends Component{
this.props.Cancel() this.props.Cancel()
} }
Saves=()=>{ Saves=()=>{
debugger
let {resourcesname,resourceurl,description,is_public,datatime,Radiovalue} =this.state; let {resourcesname,resourceurl,description,is_public,datatime,Radiovalue} =this.state;
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
@ -178,12 +178,41 @@ class sendResources extends Component{
return return
} }
if(this.props.Exterchainname==="资源设置"){
//设置
let coursesId=this.props.match.params.coursesId;
let attachmentId=this.props.attachmentId;
let url="/files/"+this.props.discussMessageid+".json";
axios.put(url,{
name:resourcesname,
link:resourceurl,
course_id:coursesId,
course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
is_public:is_public,
publish_time:Radiovalue===1?datatime===undefined? undefined:datatime:undefined,
description:description,
delay_publish:Radiovalue,
}).then((result)=>{
if(result.data.status===0){
this.ModalCancelModalCancel();
this.props.updataleftNavfun();
this.props.showNotification("设置资源成功");
this.props.setupdate(1,false)
}else{
this.props.showNotification(result.data.message);
}
})
}else{
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
let attachmentId=this.props.attachmentId; let attachmentId=this.props.attachmentId;
let url="/files/upload.json"; let url="/files/upload.json";
axios.post(url,{ axios.post(url,{
name:resourcesname,
link:resourceurl,
course_id:coursesId, course_id:coursesId,
course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
is_public:is_public, is_public:is_public,
@ -197,12 +226,14 @@ class sendResources extends Component{
this.ModalCancelModalCancel(); this.ModalCancelModalCancel();
this.props.updataleftNavfun(); this.props.updataleftNavfun();
this.props.showNotification("上传资源成功"); this.props.showNotification("上传资源成功");
this.props.setupdate(this.props.attachmentId) this.props.setupdate(1,false)
}else{ }else{
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
} }
}) })
}
} }

Loading…
Cancel
Save