资源部分

courseware
dinglink 5 years ago
parent cde6b16208
commit ff373ac2d7

@ -1,5 +1,5 @@
import React,{ Component } from "react";
import { Input, Checkbox, Table, Tooltip, Pagination,Spin } from "antd";
import { Input, Checkbox, Table, Tooltip, Pagination,Spin, Divider } from "antd";
import { WordsBtn,on, off, trigger ,getUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
@ -17,6 +17,7 @@ import _ from 'lodash'
import './style.css';
import '../css/members.css';
import moment from 'moment';
import { tuple } from "antd/lib/_util/type";
class Fileslists extends Component{
constructor(props){
super(props);
@ -45,7 +46,9 @@ class Fileslists extends Component{
isSpin:false,
course_second_categories:[],
title: "",
link: ""
link: "",
//是否展开
istowshowid:'',
}
}
@ -458,9 +461,11 @@ class Fileslists extends Component{
checkBoxValues:[]
})
if(parseInt(this.props.match.params.main_id)!=parseInt(this.props.coursesids)){
trigger('attachmentAddlog', parseInt( course_modules&&course_modules.course_modules[0].id))
console.log(1)
trigger('attachmentAddlog', {id: parseInt( course_modules&&course_modules.course_modules[0].id),name:'目录'})
}else{
trigger('attachmentAddlog', parseInt(filesId))
console.log(2)
trigger('attachmentAddlog', {id:parseInt(filesId),name:'资源'})
}
}
@ -658,6 +663,13 @@ class Fileslists extends Component{
})
}
//判断二级链接是否显示
istowshow(item){
this.setState({
istowshowid:item.id
})
}
moveTos=(id)=>{
let {checkBoxValues} = this.state;
@ -773,7 +785,9 @@ class Fileslists extends Component{
this.setState({
course_groupslist:id
})
}
}
render(){
let { searchValue,
checkBoxValues,
@ -808,7 +822,6 @@ class Fileslists extends Component{
} = this.state;
let category_id= this.props.match.params.category_id;
// console.log(this.state.course_groups)
return(
<React.Fragment >
@ -998,10 +1011,14 @@ class Fileslists extends Component{
.courseSecond{
margin-left: 10px;
padding: 10px;
}
}
.bordboom{
border-bottom: 1 solid red;
}
`}
</style>
<ul className="drop_down_menu" style={{"right":"0px","left":"unset","min-width":'150px'}}>
<ul className="drop_down_menu" style={{"right":"0px","left":"unset","min-width":'180px'}}>
{/* <p style={{marginLeft:15,color:"#000000",fontSize:20}}>资源</p> */}
{this.state.course_second_categories.length>10? <p className="drop_down_search">
<Input placeholder="搜索" value={this.state.dirSearchValue} onChange={(e) => {this.setState({dirSearchValue: e.target.value})}}/>
</p>:""}
@ -1018,7 +1035,21 @@ class Fileslists extends Component{
return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map((itm,k)=>{
return(
filesId&&filesId===itm.id?"":<li key={k} id={itm.id} onClick={() => this.moveTos(itm.id )} title={itm.name}>{itm.name}</li>
filesId&&filesId===itm.id?"":
<div>
<div className="bordboom" style={{display:'flex',marginTop:15,height:30}}>
<div onClick={() => this.moveTos(itm.id )} style={{marginLeft:15,color:'#000000'}}>{itm.name}</div>
<i style={{marginLeft:15}} onClick={() => this.istowshow(itm,filesId)} className="iconfont icon-xiajiantou font-12 ml2"></i>
</div>
{ this.state.istowshowid===itm.id?
itm.course_third_categories.map((tt,ti) => {
return(
filesId&&filesId===itm.id?"":
<div style={{marginLeft:30}} key={ti} id={tt.id} onClick={() => this.moveTos(tt.id )} title={tt.name}>{tt.name}</div>
)
})
:''}
</div>
)
})
})}
@ -1035,7 +1066,7 @@ class Fileslists extends Component{
{/*)*/}
{/*})}*/}
{this.props.isAdmin()?parseInt(this.props.match.params.main_id)===filesId&&filesId?
<p className="drop_down_btn">
<p style={{marginLeft:15}}>
<a className="color-grey-6" onClick={()=>this.addDir()}>新建目录</a>
</p>
:"":""}

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import { Link } from "react-router-dom";
import axios from 'axios';
import {Checkbox,Modal,Input,Tooltip,notification,Popover} from 'antd';
import {Checkbox,Modal,Input,Tooltip,notification,Popover,Dropdown,Menu} from 'antd';
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals';
import { on, off, trigger } from 'educoder';
@ -11,7 +11,7 @@ const CheckboxGroup = Checkbox.Group;
let navidtype=true;
const { SubMenu } = Menu;
//a little function to help us with reordering the result
const reorder = (list, startIndex, endIndex) => {
@ -62,9 +62,13 @@ class Coursesleftnav extends Component{
antIcon:false,
chapterupdate:false,
successFunc:undefined
successFunc:undefined,
//用来判断 是不是资源点击进入的
Navmodalziyname:''
}
}
// updataleftNav=()=>{
//
@ -181,8 +185,9 @@ class Coursesleftnav extends Component{
groupRenameListener = (e, data) => {
this.Navmodalnames(e,5,"editSecondname", data.id, data.name);
}
attachmentAddlog=(e,data)=>{
this.Navmodalnames(e,1,"attachment",data);
attachmentAddlog=(e,data,name)=>{
console.log(data.id,data.name)
this.Navmodalnames(e,1,"attachment",data.id,data.name);
}
flieseditDir=(e, data)=>{
this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
@ -208,7 +213,6 @@ class Coursesleftnav extends Component{
on('editcommon_homeworks',this.editcommon_homeworks)
let courstype=this.props.match.url;
courstype = courstype.split('/');
courstype=courstype[3];
@ -464,6 +468,8 @@ class Coursesleftnav extends Component{
})
}
edithidden=(e,id)=>{
e.stopPropagation();//阻止冒泡
let {course_modules}=this.props;
@ -490,6 +496,7 @@ class Coursesleftnav extends Component{
Navmodalnames=(e,id,type,setnavid,name)=>{
e.stopPropagation();//阻止冒泡
console.log(id)
navidtype=false
if(id===1||id===2||id===6){
this.setState({
@ -498,6 +505,7 @@ class Coursesleftnav extends Component{
Navplaceholder:"请输入名称最大限制60个字符",
Navmodalnametype:true,
Navmodaltypename:id,
Navmodalziyname:name,
setnavid:setnavid,
NavmodalValue:""
})
@ -510,6 +518,7 @@ class Coursesleftnav extends Component{
Navmodalnametype:true,
Navmodaltypename:id,
setnavid:setnavid,
Navmodalziyname:name,
NavmodalValue:name
})
@ -548,7 +557,9 @@ class Coursesleftnav extends Component{
saveNavmodapost=(url,value,positiontype,coursesId,type)=>{
console.log(positiontype)
axios.post(url,
{name:value}).then((result)=>{
{name:value,
parent_id:2342
}).then((result)=>{
if(result!=undefined){
if(result.data.status===0){
@ -587,7 +598,6 @@ class Coursesleftnav extends Component{
}
if(positiontype==="files"||positiontype==="file"){
if(type===true){
this.updasaveNavmoda()
trigger('files')
@ -871,6 +881,7 @@ class Coursesleftnav extends Component{
showsandians=(e,key,urls,num,id,type,index)=> {
let {url}=this.state;
if (key === this.props.indexs) {
this.props.unlocationNavfun(undefined)
} else {
this.props.updataleftNavfun();
@ -899,7 +910,7 @@ class Coursesleftnav extends Component{
{/*/!* 分组作业 *!/*/}
{item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,1,"group_homeworks",item.id)}>新建目录</div>:""}
{/*资源*/}
{item.type==="attachment"?<div onClick={e=>this.Navmodalnames(e,1,"attachment",item.id)}>新建目录</div>:""}
{item.type==="attachment"?<div onClick={e=>this.Navmodalnames(e,1,"attachment",item.id,"资源")}>新建目录</div>:""}
{/* 视频 */}
{item.type==="video"?<div onClick={e=>this.Navmodalnames(e,1,"video",item.id)}>新建目录</div>:""}
{/*毕业设计*/}
@ -928,6 +939,7 @@ class Coursesleftnav extends Component{
let {twosandiantypes,twosandiantypenum}=this.state;
return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} >
{/*作业/资源*/}
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>新建目录</div>:""}
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""}
{/*分班*/}
@ -955,7 +967,11 @@ class Coursesleftnav extends Component{
chapterupdate:false,
})
}
sunmenu=()=>{
alert(1231)
}
render(){
let {
twosandiantype,
Navmodalname,
@ -1035,7 +1051,13 @@ class Coursesleftnav extends Component{
destroyOnClose={true}
centered={true}
>
<div className="df">
<div>
{this.state.Navmodalziyname==="资源"?<div className="df" style={{marginBottom:50}}>
<div className={"fl mt5"}>上级目录</div>
</div>:''}
<div className="df" >
<div className={"fl mt5"}>{this.state.Navtitles}</div>
<Input placeholder={this.state.Navplaceholder}
className={"input-flex-35 greyInput fl"}
@ -1043,6 +1065,7 @@ class Coursesleftnav extends Component{
value={NavmodalValue}
onInput={this.setNavmodalValue}
/>
</div>
</div>
<style>
{
@ -1053,6 +1076,7 @@ class Coursesleftnav extends Component{
`
}
</style>
{this.state.NavmodalValuetype===true?<span className={"ml70 color-red"}>
{this.state.NavmodalValues}
</span>:""}

Loading…
Cancel
Save