|
|
|
@ -160,7 +160,54 @@ class YslDetailCards extends Component{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//章节下移
|
|
|
|
|
chapterdown=(id)=>{
|
|
|
|
|
let url=`/course_stages/${id}/down_position.json`;
|
|
|
|
|
axios.post(url).then((response) => {
|
|
|
|
|
if(response){
|
|
|
|
|
if(response.data){
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.props.showNotification(`下移成功`);
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`下移失败`);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`下移失败`);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`下移失败`);
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//章节上移
|
|
|
|
|
chapterup=(id)=>{
|
|
|
|
|
let url=`/course_stages/${id}/up_position.json`;
|
|
|
|
|
axios.post(url).then((response) => {
|
|
|
|
|
if(response){
|
|
|
|
|
if(response.data){
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.props.showNotification(`上移成功`);
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//取消的
|
|
|
|
|
updatapathCardsedit=()=>{
|
|
|
|
|
this.setState({
|
|
|
|
@ -183,16 +230,18 @@ class YslDetailCards extends Component{
|
|
|
|
|
//编辑用
|
|
|
|
|
pathCardsedit=(key,pathid)=>{
|
|
|
|
|
|
|
|
|
|
let url=`/stages/`+pathid+`/edit.json`;
|
|
|
|
|
let url=`/course_stages/${pathid}/edit.json`;
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result.status===200){
|
|
|
|
|
this.setState({
|
|
|
|
|
idsum:key,
|
|
|
|
|
pathCardsedittype:true,
|
|
|
|
|
pathlistedit:result.data,
|
|
|
|
|
editbuttomtype:true,
|
|
|
|
|
editbuttomtypeadd:true
|
|
|
|
|
})
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.status===200){
|
|
|
|
|
this.setState({
|
|
|
|
|
idsum:key,
|
|
|
|
|
pathCardsedittype:true,
|
|
|
|
|
pathlistedit:result.data,
|
|
|
|
|
editbuttomtype:true,
|
|
|
|
|
editbuttomtypeadd:true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
@ -232,23 +281,33 @@ class YslDetailCards extends Component{
|
|
|
|
|
let {delecttype,editdelectid}=this.state;
|
|
|
|
|
let id=editdelectid;
|
|
|
|
|
if(delecttype===true){
|
|
|
|
|
let url ='/stages/'+id+'.json'
|
|
|
|
|
let url =`/course_stages/${id}.json`
|
|
|
|
|
axios.delete(url).then((response) => {
|
|
|
|
|
if(response.data.status===1){
|
|
|
|
|
// window.location.href = "/paths/" + response.data.subject_id
|
|
|
|
|
this.setState({
|
|
|
|
|
idsum:undefined,
|
|
|
|
|
pathCardsedittype:false,
|
|
|
|
|
Modalstype:false,
|
|
|
|
|
Modalstopval:'',
|
|
|
|
|
Modalsbottomval:'',
|
|
|
|
|
delecttype:false,
|
|
|
|
|
editdelectid:undefined
|
|
|
|
|
})
|
|
|
|
|
// this.getPathCardsList();
|
|
|
|
|
|
|
|
|
|
this.updatapathCardsedit()
|
|
|
|
|
if(response){
|
|
|
|
|
if(response.data){
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.setState({
|
|
|
|
|
idsum:undefined,
|
|
|
|
|
pathCardsedittype:false,
|
|
|
|
|
Modalstype:false,
|
|
|
|
|
Modalstopval:'',
|
|
|
|
|
Modalsbottomval:'',
|
|
|
|
|
delecttype:false,
|
|
|
|
|
editdelectid:undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.updatapathCardsedit()
|
|
|
|
|
this.props.showNotification(`删除成功`);
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`删除失败`);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`删除失败`);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`删除失败`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
@ -265,7 +324,7 @@ class YslDetailCards extends Component{
|
|
|
|
|
// console.log(editbuttomtype);
|
|
|
|
|
// console.log("this.props.isAdmin");
|
|
|
|
|
// console.log(this.props.isAdmin());
|
|
|
|
|
console.log(this.state.delecttype);
|
|
|
|
|
// console.log(this.state.delecttype);
|
|
|
|
|
return(
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
@ -354,7 +413,7 @@ class YslDetailCards extends Component{
|
|
|
|
|
}
|
|
|
|
|
</a>
|
|
|
|
|
{
|
|
|
|
|
stages.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.down_path)}>
|
|
|
|
|
stages.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.chapterdown(item.stage_id)}>
|
|
|
|
|
<Tooltip placement="bottom" title="向下移动">
|
|
|
|
|
<img src={getImageUrl("images/educoder/icon/movedown.svg")} className="fl mt2 ml4"/>
|
|
|
|
|
</Tooltip>
|
|
|
|
@ -363,7 +422,7 @@ class YslDetailCards extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{key===0?"":
|
|
|
|
|
<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.up_path)}>
|
|
|
|
|
<a className="fr ring-op-green mr20" onClick={()=>this.chapterup(item.stage_id)}>
|
|
|
|
|
<Tooltip placement="bottom" title="向上移动">
|
|
|
|
|
<img src={getImageUrl("images/educoder/icon/moveup.svg")} className="fl mt2 ml4"/>
|
|
|
|
|
</Tooltip>
|
|
|
|
@ -438,6 +497,7 @@ class YslDetailCards extends Component{
|
|
|
|
|
updatapathCardsedits={this.updatapathCardsedit}
|
|
|
|
|
pathlisteditlist={pathlistedit}
|
|
|
|
|
stageid={item.stage_id}
|
|
|
|
|
ysldetailcards={"ysldetailcards"}
|
|
|
|
|
pathid={pathid}
|
|
|
|
|
></DetailCardsEditAndEdit>
|
|
|
|
|
</div>
|
|
|
|
@ -446,7 +506,7 @@ class YslDetailCards extends Component{
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{ editbuttomtypeadd===true?'':
|
|
|
|
|
{ editbuttomtypeadd===true?'':this.props.isAdmin()===true?
|
|
|
|
|
<DetailCardsEditAndAdd
|
|
|
|
|
{...this.props}
|
|
|
|
|
sum={stages && stages.length+1}
|
|
|
|
@ -454,7 +514,9 @@ class YslDetailCards extends Component{
|
|
|
|
|
detailInfoList={this.props.detailInfoList}
|
|
|
|
|
getPathCardsLists={this.updatapathCardsedit}
|
|
|
|
|
editeditbuttomtypes={this.editeditbuttomtypecanle}
|
|
|
|
|
ysldetailcards={"ysldetailcards"}
|
|
|
|
|
></DetailCardsEditAndAdd>
|
|
|
|
|
:""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|