@ -11,6 +11,7 @@ import Coursesshixundetails from './shixunreport/Coursesshixundetails';
import Shixunechart from './shixunreport/Shixunechart' ;
import DownloadMessageysl from "../../modals/DownloadMessageysl"
import AppraiseModal from "../coursesPublic/AppraiseModal" ;
import ShowAppraiseList from './ShowAppraiseList' ;
import { UnControlled as CodeMirror } from 'react-codemirror2' ;
import 'codemirror/mode/cmake/cmake' ;
import 'codemirror/mode/xml/xml' ;
@ -34,9 +35,8 @@ class ShixunWorkReport extends Component {
DownloadMessageval : undefined ,
isspinning : false ,
showAppraiseModaltype : false ,
work _comment _hidden : false ,
showAppraiseModalsshow : true ,
work _comment : null
work _comment _hidden : undefined ,
work _comment : undefined ,
}
}
@ -102,7 +102,7 @@ class ShixunWorkReport extends Component {
let homeworkid = this . props . match . params . homeworkid ;
let url = ` /student_works/ ${ homeworkid } /shixun_work_report.json `
axios . get ( url ) . then ( ( result ) => {
if ( result . data . status === 403 || result . data . status === 401 || result . data . status === 407 || result . data . status === 408 || result . data . status === 409 ) {
if ( result . data . status === 403 || result . data . status === 401 || result . data . status === 407 || result . data . status === 408 || result . data . status === 409 || result . data . status === 500 ) {
} else {
this . setState ( {
@ -155,76 +155,141 @@ class ShixunWorkReport extends Component {
} )
}
showAppraiseModal = ( type , id ) => {
showAppraiseModal = ( type , id , show , hidden ) => {
let { data } = this . state ;
if ( type === "child" ) {
data . stage _list . forEach ( ( item , key ) => {
if ( item . challenge _id === id ) {
item . challenge _comment = show ;
item . challenge _comment _hidden = hidden ;
}
} )
this . setState ( {
showAppraiseModaltype : true ,
showAppraisetype : type ,
challenge _id : id
challenge _id : id ,
data : data
} )
} else {
this . setState ( {
showAppraiseModaltype : true ,
showAppraisetype : type ,
challenge _id : undefined
challenge _id : undefined ,
work _comment : show ,
work _comment _hidden : hidden
} )
}
let { work _comment , work _comment _hidden } = this . state ;
this . setState ( {
showAppraiseModaltype : true ,
work _comment _hidden : work _comment === null || work _comment === undefined ? this . state . work _type ? true : false : work _comment _hidden ,
} )
}
hideAppraiseModal = ( ) => {
let { work _comment , work _comment _hidden } = this . state ;
this . setState ( {
showAppraiseModaltype : false ,
work _comment _hidden : work _comment === null || work _comment === undefined ? this . state . work _type === 1 ? true : false : work _comment _hidden ,
} )
}
showAppraiseModals = ( list , type ) => {
showAppraiseModals = ( show , hidden , id , comment _id ) => {
let { data , showAppraisetype } = this . state ;
if ( showAppraisetype === "child" ) {
data . stage _list . forEach ( ( item , key ) => {
if ( item . challenge _id === id ) {
item . challenge _comment = show ;
item . challenge _comment _hidden = hidden ;
item . comment _id = comment _id
}
} )
this . setState ( {
showAppraiseModaltype : false ,
data : data
} )
} else {
data . comment _id = comment _id ;
this . setState ( {
showAppraiseModaltype : false ,
work _comment _hidden : type === 0 ? false : true ,
work _comment : list ,
work _type : type ,
showAppraiseModals : true ,
showAppraiseModalsshow : true ,
work _comment : show ,
work _comment _hidden : hidden ,
data : data
} )
}
isdeleteModal = ( ) => {
}
isdeleteModal = ( comment _id , visible _comment , type ) => {
let newcomment _id = comment _id ;
let newvisible _comment = visible _comment ;
let newtype = type ;
this . setState ( {
modalsType : true ,
modalsTopval : "是否确认删除?" ,
modalSave : ( ) => this . isdeleteModals ( ) ,
modalCancel : ( ) => this . hideisdeleteModal ( ) ,
modalSave : ( ) => this . isdeleteModals ( newcomment _id , newvisible _comment , newtype ) ,
modalCancel : ( ) => this . hideisdeleteModal s ( ) ,
} )
}
hideisdeleteModal = ( ) => {
hideisdeleteModal s = ( ) => {
this . setState ( {
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalSave : ( ) => this . isdeleteModals ( ) ,
modalCancel : ( ) => this . hideisdeleteModal ( ) ,
modalSave : "" ,
modalCancel : "" ,
} )
}
isdeleteModals = ( ) => {
hideisdeleteModal = ( comment _id , visible _comment , type ) => {
let { data , work _comment , work _comment _hidden } = this . state ;
if ( type === "child" ) {
data . stage _list . map ( ( item , key ) => {
console . log ( item )
if ( item . comment _id != null ) {
if ( item . comment _id === comment _id ) {
item . challenge _comment = null ;
item . challenge _comment _hidden = null ;
}
}
} )
this . setState ( {
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalSave : "" ,
modalCancel : "" ,
data : data
} )
} else {
this . setState ( {
modalsType : false ,
modalsTopval : "是否确认删除?" ,
modalSave : "" ,
modalCancel : "" ,
work _comment : null ,
work _comment _hidden : null
} )
}
}
isdeleteModals = ( comment _id , visible _comment , type ) => {
let newcomment _id = comment _id ;
let newvisible _comment = visible _comment ;
let newtype = type ;
if ( comment _id != null ) {
let url = ` /student_works/ ${ this . props . match . params . homeworkid } /destroy_work_comment.json `
axios . delete ( url ) . then ( ( response ) => {
axios . delete ( url , { data : {
comment _id : comment _id ,
} } ) . then ( ( response ) => {
// const { status } = response.data;
if ( response . data . status === 0 ) {
this . props . showNotification ( response . data . message )
this . setState ( {
showAppraiseModalsshow : false ,
work _comment _hidden : false ,
work _comment : undefined ,
work _type : 0 ,
} )
this . hideisdeleteModal ( )
this . hideisdeleteModal ( newcomment _id , newvisible _comment , newtype )
} else {
this . props . showNotification ( response . data . message )
}
@ -233,8 +298,10 @@ class ShixunWorkReport extends Component {
console . log ( error ) ;
} ) ;
}
}
render ( ) {
let { data , showAppraiseModaltype , work _comment _hidden , showAppraiseModalsshow , work _comment } = this . state ;
let { data , showAppraiseModaltype , work _comment _hidden , work_comment } = this . state ;
let category _id = data === undefined ? "" : data . category === null ? "" : data . category . category _id ;
let homework _common _id = data === undefined ? "" : data . homework _common _id ;
@ -243,7 +310,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 = work _comment === null || work _comment === undefined ? false : true ;
console . log ( showAppraiseModals )
return (
data === undefined ? "" : < Spin indicator = { antIcon } spinning = { this . state . spinning } >
@ -262,10 +329,12 @@ class ShixunWorkReport extends Component {
{ ... this . state }
visible = { showAppraiseModaltype }
Cancel = { ( ) => this . hideAppraiseModal ( ) }
showCancel = { ( list, type ) => this . showAppraiseModals ( list , type ) }
showCancel = { ( show, hidden , id , comment _id ) => this . showAppraiseModals ( show , hidden , id , comment _id ) }
work _comment = { this . state . work _comment }
work _type = { work _comment === null || work _comment === undefined ? this . state . work _type : work _comment _hidden === true ? 1 : 0 }
/ > : " " }
< div className = "newMain clearfix " >
< div className = { "educontent mb20" } >
< div className = "educontent" >
@ -303,9 +372,11 @@ class ShixunWorkReport extends Component {
{ /*>评阅</a> : ""}*/ }
{ this . props . isAdmin ( ) ? < a
className = " color-blue font-14 fr ml20 mt15"
onClick = { ( ) => this . showAppraiseModal ( "main" )}
onClick = { ( ) => this . showAppraiseModal ( "main" ,undefined , work _comment , work _comment _hidden )}
> 评阅 < / a > : " " }
< / d i v >
{ /*{work_comment===null||work_comment===undefined?"评阅":"编辑评阅"}*/ }
< style > {
`
@ -425,7 +496,7 @@ class ShixunWorkReport extends Component {
jumptopic = { this . jumptopic }
getdatalist = { ( ) => this . getdatalist ( ) }
setupdalist = { ( challenge _score , overall _appraisal , work _score ) => this . setupdalist ( challenge _score , overall _appraisal , work _score ) }
showAppraiseModal = { ( type , id )=> this . showAppraiseModal ( type , id ) }
showAppraiseModal = { ( type , id ,show , hidden )=> this . showAppraiseModal ( type , id , show , hidden ) }
/ >
< / d i v >
@ -477,33 +548,12 @@ class ShixunWorkReport extends Component {
< / d i v >
{ showAppraiseModals === true && showAppraiseModalsshow === true ? < div className = "stud-class-set mt17" >
< div className = "clearfix edu-back-white poll_list" >
< div className = "font-16 color-dark-21 shixunreporttitleboxtop pd20 color333" >
老师评阅 < span > { work _comment _hidden === true || this . state . work _type === 1 ? "(仅对课堂老师可见)" : "" } < / s p a n >
{ this . props && this . props . isAdminOrTeacher ( ) === true ? < a className = "color-blue font-14 fr ml20"
onClick = { ( ) => this . isdeleteModal ( ) }
> 删除 < / a > : " " }
{ this . props && this . props . isAdminOrTeacher ( ) === true ? < a className = "color-blue font-14 fr"
onClick = { ( ) => this . showAppraiseModal ( "main" ) }
> 编辑 < / a > : " " }
< / d i v >
< div className = "font-16 color-dark-21 shixunreporttitleboxbom pd30" >
< div style = { { minHeight : '50px' } } >
< div className = { "personalsummary" } >
< div className = { "markdown-body" }
dangerouslySetInnerHTML = { { _ _html : markdownToHTML ( work _comment ) . replace ( /▁/g , "▁▁▁" ) } } > < / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v > : " " }
< ShowAppraiseList
{ ... this . props }
{ ... this . state }
isdeleteModal = { ( comment _id , visible _comment , type ) => this . isdeleteModal ( comment _id , visible _comment , type ) }
showAppraiseModal = { ( type , id , show , hidden ) => this . showAppraiseModal ( type , id , show , hidden ) }
/ >
< div className = "stud-class-set bor-bottom-greyE mt17" >