diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js index 967a6ca61..a5a3b5408 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js @@ -35,10 +35,15 @@ class ShixunWorkDetails extends Component { } }).then((result) => { if (result.status === 200) { - this.setState({ - data:result.data, - spinning:false - }) + 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({ + data:result.data, + spinning:false + }) + } + } }).catch((error) => { console.log(error) @@ -50,7 +55,33 @@ class ShixunWorkDetails extends Component { shixuntypes:type[3] }) } + updatas=()=>{ + this.setState({ + spinning:true + }) + let homeworkid=this.props.match.params.homeworkid; + let userid=this.props.match.params.userid; + let url = "/homework_commons/"+homeworkid+"/code_review_detail.json"; + axios.get(url,{ + params: { + user_id:userid, + } + }).then((result) => { + if (result.status === 200) { + 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({ + data:result.data, + spinning:false + }) + } + + } + }).catch((error) => { + console.log(error) + }) + } goback=(sum)=>{ // let{data}=this.state // if(sum===1){ @@ -110,6 +141,9 @@ class ShixunWorkDetails extends Component {
this.updatas()} data={data} />
diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js index 8ffa8a1dd..d03453c40 100644 --- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js +++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js @@ -1,10 +1,10 @@ import React, {Component} from "react"; import {WordsBtn} from 'educoder'; -import {Table} from "antd"; +import {Table,InputNumber} from "antd"; import {Link,Switch,Route,Redirect} from 'react-router-dom'; import moment from 'moment'; import { MonacoDiffEditor } from 'react-monaco-editor'; - +import axios from 'axios'; class ShixunCustomsPass extends Component { constructor(props) { @@ -18,10 +18,51 @@ class ShixunCustomsPass extends Component { componentDidMount() { } + editgame_scores=(e,id,maxsum,code_rate,copy_user_id)=>{ + + let{datas}=this.state; + let newdatas=datas; + let score=e.target.value; + + if(score!=null&&score!=undefined&&score!=""){ + if(score<0){ + this.props.showNotification("不能小于0"); + this.setState({ + customsids:id + }) + }else if(score>maxsum){ + this.props.showNotification(`不能大于关卡分值${maxsum}`); + this.setState({ + customsids:id + }) + }else{ + let work_id=this.props.data.work_id; + let url=`/student_works/${work_id}/adjust_review_score.json` + axios.post(url,{ + type:"review", + score:score, + challenge_id:id, + code_rate:code_rate, + copy_user_id:copy_user_id + }).then((result)=>{ + if(result.data.status===0){ + this.props.updatas(); + this.props.showNotification(result.data.message); + }else{ + this.props.showNotification(result.data.message); + } + }).catch((error)=>{ + }) + } + }else{ + this.props.showNotification("调分为空将不会修改之前的分数"); + } + } render() { let {data}=this.props; - console.log(data) + let {customsids}=this.state; + // console.log(data) let datas=[]; data&&data.challenge_list.forEach((item,key)=>{ @@ -33,6 +74,8 @@ class ShixunCustomsPass extends Component { finishtime:item.copy_username, elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'), empvalue:item.code_rate, + challenge_id:{id:item.id}, + copy_user_id:item.copy_user_id // adjustmentminute:asdasd }) }) @@ -112,6 +155,20 @@ class ShixunCustomsPass extends Component { render: (text, record) => ( {record.elapsedtime} + + ), + },{ + title: '调分', + key: 'adjustmentminute', + dataIndex: 'adjustmentminute', + + render: (text, record) => ( + + this.editgame_scores(e,record.challenge_id.id,record.evaluating.all_score,record.empvalue,record.copy_user_id)} + // min={0} max={record.game_scores.game_score_full} + /> + {/*查看*/} ), }, { @@ -138,7 +195,15 @@ class ShixunCustomsPass extends Component { // }, - + if(this.props.isAdmin()===false){ + columns.some((item,key)=> { + if (item.title === "调分") { + columns.splice(key, 1) + return true + } + } + ) + } return (
@@ -177,6 +242,9 @@ class ShixunCustomsPass extends Component { .customsPass{ text-align: left !important; } + .ant-table-thead > tr > th, .ant-table-tbody > tr > td { + padding: 16px 12px; + } `} {datas===undefined?"":