评阅调整

dev_cs
杨树明 6 years ago
parent 73fe37c9d3
commit c71e1a9964

@ -10,7 +10,6 @@ class AppraiseModal extends Component{
group_ids:[],
fileList:[],
Inputsval:undefined,
valuetype:0,
textareavaltype:false,
comment:undefined,
hidden_comment:undefined
@ -18,11 +17,23 @@ class AppraiseModal extends Component{
}
componentDidMount() {
this.setState({
valuetype:this.props.work_type===undefined?0:this.props.work_type,
textareaval:this.props.work_comment,
})
let{data,work_comment,work_comment_hidden}=this.props;
if(this.props.showAppraisetype==="child"){
data.stage_list.map((item,key)=>{
if(this.props.challenge_id===item.challenge_id){
this.setState({
comment:item.challenge_comment,
hidden_comment:item.challenge_comment_hidden,
})
}
})
}else{
this.setState({
comment:work_comment,
hidden_comment:work_comment_hidden,
})
}
}
@ -38,11 +49,10 @@ class AppraiseModal extends Component{
})
}
Saves=()=>{
let{textareaval,valuetype,comment,hidden_comment}=this.state;
let{comment,hidden_comment}=this.state;
let commenttype=comment===undefined||comment===null||comment==="";
let hidden_commenttype=hidden_comment===undefined||hidden_comment===null||hidden_comment==="";
if(commenttype===true&&hidden_commenttype===true){
this.setState({
textareavaltype:true
@ -50,20 +60,20 @@ class AppraiseModal extends Component{
return
}
//comment 是 text 可见的评阅内容
// hidden_comment 是 text 不可见的评阅内容
// challenge_id 否 int 关卡id关卡评阅才需传关卡id
let challenge_id=this.props.showAppraisetype==="child"?this.props.challenge_id:undefined
let url=`/student_works/${this.props.match.params.homeworkid}/shixun_work_comment.json`
axios.post(url, {
comment:textareaval,
hidden_comment:valuetype
comment:comment,
hidden_comment:hidden_comment,
challenge_id:challenge_id
}).then((response) => {
if(response.data.status===0){
this.props.showNotification(response.data.message)
this.props.showCancel(textareaval,valuetype)
this.props.showCancel(comment,hidden_comment,challenge_id)
}else{
this.props.showNotification(response.data.message)
}

@ -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,138 @@ class ShixunWorkReport extends Component {
})
}
showAppraiseModal=(type,id)=>{
showAppraiseModal=(type,id,show,hidden)=>{
let{data}=this.state;
debugger
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)=>{
let{data,showAppraisetype}=this.state;
debugger
if(showAppraisetype==="child"){
data.stage_list.forEach((item,key)=>{
if(item.challenge_id===id){
item.challenge_comment=show;
item.challenge_comment_hidden=hidden;
}
})
this.setState({
showAppraiseModaltype:false,
data:data
})
}else{
this.setState({
showAppraiseModaltype:false,
work_comment:show,
work_comment_hidden:hidden
})
}
this.setState({
showAppraiseModaltype:false,
work_comment_hidden:type===0?false:true,
work_comment:list,
work_type:type,
showAppraiseModals:true,
showAppraiseModalsshow:true,
})
}
isdeleteModal=()=>{
isdeleteModal=(comment_id,visible_comment)=>{
this.setState({
modalsType: true,
modalsTopval:"是否确认删除?",
modalSave: ()=>this.isdeleteModals(),
modalCancel:()=>this.hideisdeleteModal(),
modalSave: ()=>this.isdeleteModals(comment_id,visible_comment),
modalCancel:()=>this.hideisdeleteModals(),
})
}
hideisdeleteModal=()=>{
hideisdeleteModals=()=>{
this.setState({
modalsType: false,
modalsType:false,
modalsTopval:"是否确认删除?",
modalSave: ()=>this.isdeleteModals(),
modalCancel:()=>this.hideisdeleteModal(),
modalSave: "",
modalCancel:"",
})
}
isdeleteModals=()=>{
hideisdeleteModal=(comment_id,visible_comment)=>{
let{data,work_comment,work_comment_hidden,showAppraisetype}=this.state;
if(showAppraisetype==="child"){
data.stage_list.forEach((item,key)=>{
if(item.comment_id===comment_id){
if(visible_comment===true){
item.challenge_comment=null;
}else{
item.challenge_comment_hidden=null;
}
}
})
this.setState({
modalsType:false,
modalsTopval:"是否确认删除?",
modalSave: "",
modalCancel:"",
data:data
})
}else{
if(visible_comment===true){
this.setState({
modalsType:false,
modalsTopval:"是否确认删除?",
modalSave: "",
modalCancel:"",
work_comment:visible_comment===true?null:work_comment,
})
}else{
this.setState({
modalsType:false,
modalsTopval:"是否确认删除?",
modalSave: "",
modalCancel:"",
work_comment_hidden:visible_comment===false?null:work_comment_hidden
})
}
}
}
isdeleteModals=(comment_id,visible_comment)=>{
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,
visible_comment:visible_comment
}}).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(comment_id,visible_comment)
}else{
this.props.showNotification(response.data.message)
}
@ -234,7 +296,7 @@ class ShixunWorkReport extends Component {
});
}
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 +305,9 @@ 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)
console.log(data)
console.log(work_comment_hidden)
console.log(work_comment)
return (
data===undefined?"":<Spin indicator={antIcon} spinning={this.state.spinning}>
@ -262,10 +326,12 @@ class ShixunWorkReport extends Component {
{...this.state}
visible={showAppraiseModaltype}
Cancel={()=>this.hideAppraiseModal()}
showCancel={(list,type)=>this.showAppraiseModals(list,type)}
showCancel={(show,hidden,id)=>this.showAppraiseModals(show,hidden,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 +369,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>:""}
</div>
{/*{work_comment===null||work_comment===undefined?"评阅":"编辑评阅"}*/}
<style>{
`
@ -425,7 +493,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)}
/>
</div>
@ -477,33 +545,12 @@ class ShixunWorkReport extends Component {
</div>
{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?"(仅对课堂老师可见)":""}</span>
{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>:""}
</div>
<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, "▁▁▁")}}></div>
</div>
</div>
</div>
</div>
</div>:""}
<ShowAppraiseList
{...this.props}
{...this.state}
isdeleteModal={(comment_id,visible_comment)=>this.isdeleteModal(comment_id,visible_comment)}
showAppraiseModal={(type,id,show,hidden)=>this.showAppraiseModal(type,id,show,hidden)}
/>
<div className="stud-class-set bor-bottom-greyE mt17">

@ -0,0 +1,172 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
import { WordNumberTextarea,markdownToHTML } from 'educoder';
import axios from 'axios';
class ShowAppraiseList extends Component{
constructor(props){
super(props);
this.state={
}
}
componentDidMount() {
}
render(){
let {data,work_comment,work_comment_hidden}=this.props;
console.log(data)
return(
<div>
<style>
{
`
.appraisebox{
width: 65px;
height: 22px;
background: rgba(76,172,255,1);
border-radius: 2px;
display: inline-block;
margin-right: 20px;
color: #fff;
font-size: 14px;
text-align: center;
line-height: 22px;
}
`
}
</style>
{data===undefined?"":work_comment===undefined||work_comment===null||work_comment===""?"":
<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 className={"appraisebox"}>总体评阅</span>
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr ml20"
onClick={()=>this.props.isdeleteModal(data.comment_id,true)}
>删除</a>:""}
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr"
onClick={()=>this.props.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)}
>编辑</a>:""}
</div>
<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, "▁▁▁")}}></div>
</div>
</div>
</div>
</div>
</div>}
{data===undefined?"":work_comment_hidden===undefined||work_comment_hidden===null||work_comment_hidden===""?"":this.props&&this.props.isAdminOrTeacher()===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 className={"appraisebox"}>总体评阅</span><span></span>
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr ml20"
onClick={()=>this.props.isdeleteModal(data.comment_id,false)}
>删除</a>:""}
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr"
onClick={()=>this.props.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)}
>编辑</a>:""}
</div>
<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_hidden).replace(/▁/g, "▁▁▁")}}></div>
</div>
</div>
</div>
</div>
</div>:""}
{data===undefined?"":data.stage_list.map((item,key)=>{
let challenge_comment_hidden=item.challenge_comment_hidden===undefined||item.challenge_comment_hidden===null||item.challenge_comment_hidden==="";
let challenge_comment=item.challenge_comment===undefined||item.challenge_comment===null||item.challenge_comment==="";
return(
<div>
{challenge_comment===false?<div className="stud-class-set mt17" key={key}>
<div className="clearfix edu-back-white poll_list">
<div className="font-16 color-dark-21 shixunreporttitleboxtop pd20 color333">
<span className={"appraisebox"}>{key+1}</span>
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr ml20"
onClick={()=>this.props.isdeleteModal(item.comment_id,true)}
>删除</a>:""}
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr"
onClick={()=>this.props.showAppraiseModal("child",item.challenge_id,item.challenge_comment,item.challenge_comment_hidden)}
>编辑</a>:""}
</div>
<div className="font-16 color-dark-21 shixunreporttitleboxbom pd30">
<div style={{minHeight:'50px'}}>
<div className={"personalsummary"}>
<div className={"markdown-body"}
dangerouslySetInnerHTML={{__html: markdownToHTML(item.challenge_comment).replace(/▁/g, "▁▁▁")}}></div>
</div>
</div>
</div>
</div>
</div>:""}
{challenge_comment_hidden===false&&this.props&&this.props.isAdminOrTeacher()===true?<div className="stud-class-set mt17" key={key}>
<div className="clearfix edu-back-white poll_list">
<div className="font-16 color-dark-21 shixunreporttitleboxtop pd20 color333">
<span className={"appraisebox"}>{key+1}</span><span></span>
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr ml20"
onClick={()=>this.props.isdeleteModal(item.comment_id,false)}
>删除</a>:""}
{this.props&&this.props.isAdminOrTeacher()===true?<a className="color-blue font-14 fr"
onClick={()=>this.props.showAppraiseModal("child",item.challenge_id,item.challenge_comment,item.challenge_comment_hidden)}
>编辑</a>:""}
</div>
<div className="font-16 color-dark-21 shixunreporttitleboxbom pd30">
<div style={{minHeight:'50px'}}>
<div className={"personalsummary"}>
<div className={"markdown-body"}
dangerouslySetInnerHTML={{__html: markdownToHTML(item.challenge_comment_hidden).replace(/▁/g, "▁▁▁")}}></div>
</div>
</div>
</div>
</div>
</div>:""}
</div>)
})
}
</div>
)
}
}
export default ShowAppraiseList;

@ -207,7 +207,7 @@ class OfficialAcademicTranscript extends Component {
render: (text, record) => (
<span>
{console.log(record)}
<a
className=" color-blue font-14 fr mr22"
onClick={()=>this.props.showAppraiseModal("child",record.challenge_id.id,record.challenge_comment,record.challenge_comment_hidden)}

Loading…
Cancel
Save