调整章节选择

dev_cs
杨树林 5 years ago
parent f65fc1e36e
commit db861b8b12

@ -77,9 +77,21 @@ class ListPageIndex extends Component{
super(props);
this.state={
yslGuideone:undefined,
yslElearning:false,
}
}
comyslElearning(bool){
if(bool===true){
this.setState({
yslElearning:true,
})
}else {
this.setState({
yslElearning:false,
})
}
}
componentDidMount(){
console.log("77");
var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -175,7 +187,7 @@ class ListPageIndex extends Component{
{/*left_nav*/}
<div className={"with22 fl setleft"} style={{width:'264px',minHeight:'500px'}}>
<Coursesleftnav {...this.props} {...this.state}/>
<Coursesleftnav {...this.props} {...this.state} comyslElearning={(i)=>this.comyslElearning(i)}/>
</div>
{/*right_concent*/}
@ -258,7 +270,7 @@ class ListPageIndex extends Component{
<Route
path="/courses/:coursesId/online_learning"
render={
(props) => (<Elearning {...this.props} {...props} {...this.state} />)
(props) => (<Elearning {...this.props} {...props} {...this.state} comyslElearning={(i)=>this.comyslElearning(i)} />)
}
>
</Route>

@ -57,7 +57,7 @@ class Coursesleftnav extends Component{
toopvisible:false,
toopvisibleindex:undefined,
sandiantypes:undefined,
antIcon:false
antIcon:false,
}
}
@ -755,7 +755,15 @@ class Coursesleftnav extends Component{
{/*分班*/}
{/*{item.type==="course_group"? :""}*/}
<div onClick={e=>this.Navmodalnames(e,3,"editname",item.id,item.name)}>重命名</div>
{/*online_learning*/}
{
this.props.isClassManagement()===true?
(
item.type==="online_learning"?
<div onClick={e=>this.Chapterediting(e,item.id,item.url)}>章节编辑</div>
:""
)
:""}
<div onClick={e=>this.edithidden(e,item.id)}>隐藏</div>
<div onClick={e=>this.editSetup(e,item.id)}>置顶</div>
</div>)
@ -773,10 +781,17 @@ class Coursesleftnav extends Component{
{item.type==="board"?<div onClick={e=>this.Navmodalnames(e,7,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
{item.type==="board"?<div onClick={e=>this.deleteSecondary(e,3,iem.category_id,item.category_url)}>删除</div>:""}
</div>)
}
};
//章节编辑
Chapterediting=(e,id,url)=> {
e.stopPropagation();//阻止冒泡
console.log(url);
console.log(id);
//页面刷新
this.props.history.replace( url );
this.props.comyslElearning(true);
};
render(){
let {
twosandiantype,

@ -33,24 +33,29 @@ class Elearning extends Component{
componentDidMount() {
// 记得删除退出课堂
console.log("获取到数据");
console.log(this.props);
// console.log("获取到数据");
// console.log(this.props);
this.getdata();
}
getdata=()=>{
console.log("更新了数据了");
let url = `/courses/${this.props.match.params.coursesId}/online_learning.json`;
// //
axios.get(url).then((response) => {
if(response){
if(response.data){
console.log("获取到到数据");
console.log(response);
this.setState({
description: response.data.description,
start_learning:response.data.start_learning,
learned:response.data.learned,
last_shixun:response.data.last_shixun,
stages:response.data.stages,
});
}
// console.log("获取到到数据");
// console.log(response);
this.setState({
description: response.data.description,
start_learning:response.data.start_learning,
learned:response.data.learned,
last_shixun:response.data.last_shixun,
stages:response.data.stages,
});
}
}
this.setState({
isSpin:false,
@ -71,13 +76,11 @@ class Elearning extends Component{
console.log("12312312312")
console.log(e);
}
}
componentDidUpdate = (prevProps) => {
console.log("componentDidUpdate");
console.log(prevProps);
console.log(this.props);
console.log("componentDidUpdate");
// console.log(prevProps);
// console.log(this.props);
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user!==undefined){
// console.log(this.props.current_user.login);
@ -87,6 +90,17 @@ class Elearning extends Component{
})
}
}
if(prevProps.yslElearning===this.props.yslElearning) {
if(prevProps.yslElearning===true && this.props.yslElearning===true){
console.log("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
console.log(prevProps.yslElearning);
console.log(this.props.yslElearning);
this.getdata();
this.props.comyslElearning(false);
}
}
}
@ -274,6 +288,8 @@ class Elearning extends Component{
};
render(){
console.log("Elearning++++++++");
// console.log(this.props.Chapterupdate);
let{description,whethertoedit,isSpin,start_learning,hidestartshixunsreplacevalues,learned,last_shixun,stages,isRender} =this.state;
const isNotMembers=this.props.isNotMember();//非课堂成员
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;

Loading…
Cancel
Save