@ -157,7 +157,7 @@ class ShixunWorkReport extends Component {
showAppraiseModal = ( type , id , show , hidden ) => {
showAppraiseModal = ( type , id , show , hidden ) => {
let { data } = this . state ;
let { data } = this . state ;
debugger
if ( type === "child" ) {
if ( type === "child" ) {
data . stage _list . forEach ( ( item , key ) => {
data . stage _list . forEach ( ( item , key ) => {
if ( item . challenge _id === id ) {
if ( item . challenge _id === id ) {
@ -188,17 +188,17 @@ class ShixunWorkReport extends Component {
showAppraiseModaltype : false ,
showAppraiseModaltype : false ,
} )
} )
}
}
showAppraiseModals = ( show , hidden , id )=> {
showAppraiseModals = ( show , hidden , id ,comment _id )=> {
let { data , showAppraisetype } = this . state ;
let { data , showAppraisetype } = this . state ;
debugger
if ( showAppraisetype === "child" ) {
if ( showAppraisetype === "child" ) {
data . stage _list . forEach ( ( item , key ) => {
data . stage _list . forEach ( ( item , key ) => {
if ( item . challenge _id === id ) {
if ( item . challenge _id === id ) {
item . challenge _comment = show ;
item . challenge _comment = show ;
item . challenge _comment _hidden = hidden ;
item . challenge _comment _hidden = hidden ;
item . c hallenge_id = id ;
item . c omment_id = comment _id
}
}
} )
} )
this . setState ( {
this . setState ( {
@ -206,7 +206,7 @@ class ShixunWorkReport extends Component {
data : data
data : data
} )
} )
} else {
} else {
data . comment _id = id
data . comment _id = comment_ id;
this . setState ( {
this . setState ( {
showAppraiseModaltype : false ,
showAppraiseModaltype : false ,
work _comment : show ,
work _comment : show ,
@ -216,11 +216,11 @@ class ShixunWorkReport extends Component {
}
}
}
}
isdeleteModal = ( comment _id , visible _comment )=> {
isdeleteModal = ( comment _id , visible _comment ,type )=> {
this . setState ( {
this . setState ( {
modalsType : true ,
modalsType : true ,
modalsTopval : "是否确认删除?" ,
modalsTopval : "是否确认删除?" ,
modalSave : ( ) => this . isdeleteModals ( comment _id , visible _comment ),
modalSave : ( ) => this . isdeleteModals ( comment _id , visible _comment ,type ),
modalCancel : ( ) => this . hideisdeleteModals ( ) ,
modalCancel : ( ) => this . hideisdeleteModals ( ) ,
} )
} )
}
}
@ -235,12 +235,15 @@ class ShixunWorkReport extends Component {
}
}
hideisdeleteModal = ( comment _id , visible _comment )=> {
hideisdeleteModal = ( comment _id , visible _comment ,type )=> {
let { data , work _comment , work _comment _hidden , showAppraisetype } = this . state ;
let { data , work _comment , work _comment _hidden } = this . state ;
if ( showAppraisetype === "child" ) {
data . stage _list . forEach ( ( item , key ) => {
if ( type === "child" ) {
data . stage _list . map ( ( item , key ) => {
console . log ( item )
if ( item . comment _id != null ) {
if ( item . comment _id === comment _id ) {
if ( item . comment _id === comment _id ) {
if ( visible _comment === true ) {
if ( visible _comment === true ) {
item . challenge _comment = null ;
item . challenge _comment = null ;
@ -248,7 +251,9 @@ class ShixunWorkReport extends Component {
item . challenge _comment _hidden = null ;
item . challenge _comment _hidden = null ;
}
}
}
}
}
} )
} )
this . setState ( {
this . setState ( {
modalsType : false ,
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalsTopval : "是否确认删除?" ,
@ -256,40 +261,36 @@ class ShixunWorkReport extends Component {
modalCancel : "" ,
modalCancel : "" ,
data : data
data : data
} )
} )
} else {
} else {
if ( visible _comment === true ) {
this . setState ( {
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalSave : "" ,
modalCancel : "" ,
work _comment : visible _comment === true ? null : work _comment ,
} )
} else {
this . setState ( {
this . setState ( {
modalsType : false ,
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalsTopval : "是否确认删除?" ,
modalSave : "" ,
modalSave : "" ,
modalCancel : "" ,
modalCancel : "" ,
work _comment _hidden : visible _comment === false ? null : work _comment _hidden
work _comment : null ,
work _comment _hidden : null
} )
} )
}
}
}
}
}
isdeleteModals = ( comment _id , visible _comment ) => {
isdeleteModals = ( comment _id , visible _comment , type ) => {
let newcomment _id = comment _id ;
let newvisible _comment = visible _comment ;
let newtype = type ;
let url = ` /student_works/ ${ this . props . match . params . homeworkid } /destroy_work_comment.json `
let url = ` /student_works/ ${ this . props . match . params . homeworkid } /destroy_work_comment.json `
axios . delete ( url , { data : {
axios . delete ( url , { data : {
comment _id : comment _id ,
comment _id : comment _id ,
visible _comment : visible _comment
} } ) . then ( ( response ) => {
} } ) . then ( ( response ) => {
// const { status } = response.data;
// const { status } = response.data;
if ( response . data . status === 0 ) {
if ( response . data . status === 0 ) {
this . props . showNotification ( response . data . message )
this . props . showNotification ( response . data . message )
this . hideisdeleteModal ( newcomment _id , newvisible _comment , newtype )
this . hideisdeleteModal ( comment _id , visible _comment )
} else {
} else {
this . props . showNotification ( response . data . message )
this . props . showNotification ( response . data . message )
}
}
@ -308,9 +309,7 @@ class ShixunWorkReport extends Component {
// let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true;
// let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true;
let showAppraiseModals = work _comment === null || work _comment === undefined ? false : true ;
let showAppraiseModals = work _comment === null || work _comment === undefined ? false : true ;
console . log ( data )
console . log ( work _comment _hidden )
console . log ( work _comment )
return (
return (
data === undefined ? "" : < Spin indicator = { antIcon } spinning = { this . state . spinning } >
data === undefined ? "" : < Spin indicator = { antIcon } spinning = { this . state . spinning } >
@ -329,7 +328,7 @@ class ShixunWorkReport extends Component {
{ ... this . state }
{ ... this . state }
visible = { showAppraiseModaltype }
visible = { showAppraiseModaltype }
Cancel = { ( ) => this . hideAppraiseModal ( ) }
Cancel = { ( ) => this . hideAppraiseModal ( ) }
showCancel = { ( show , hidden , id )=> this . showAppraiseModals ( show , hidden , id) }
showCancel = { ( show , hidden , id ,comment _id )=> this . showAppraiseModals ( show , hidden , id, comment _ id) }
work _comment = { this . state . work _comment }
work _comment = { this . state . work _comment }
work _type = { work _comment === null || work _comment === undefined ? this . state . work _type : work _comment _hidden === true ? 1 : 0 }
work _type = { work _comment === null || work _comment === undefined ? this . state . work _type : work _comment _hidden === true ? 1 : 0 }
/ > : " " }
/ > : " " }
@ -551,7 +550,7 @@ class ShixunWorkReport extends Component {
< ShowAppraiseList
< ShowAppraiseList
{ ... this . props }
{ ... this . props }
{ ... this . state }
{ ... this . state }
isdeleteModal = { ( comment _id , visible _comment )=> this . isdeleteModal ( comment _id , visible _comment ) }
isdeleteModal = { ( comment _id , visible _comment ,type )=> this . isdeleteModal ( comment _id , visible _comment , type ) }
showAppraiseModal = { ( type , id , show , hidden ) => this . showAppraiseModal ( type , id , show , hidden ) }
showAppraiseModal = { ( type , id , show , hidden ) => this . showAppraiseModal ( type , id , show , hidden ) }
/ >
/ >