Merge branches 'dev_aliyun' and 'dev_ysm' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_cs
杨树明 5 years ago
commit 3d90ffeed1

@ -35,10 +35,15 @@ class ShixunWorkDetails extends Component {
} }
}).then((result) => { }).then((result) => {
if (result.status === 200) { if (result.status === 200) {
this.setState({ 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) {
data:result.data,
spinning:false }else{
}) this.setState({
data:result.data,
spinning:false
})
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -50,7 +55,33 @@ class ShixunWorkDetails extends Component {
shixuntypes:type[3] 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)=>{ goback=(sum)=>{
// let{data}=this.state // let{data}=this.state
// if(sum===1){ // if(sum===1){
@ -110,6 +141,9 @@ class ShixunWorkDetails extends Component {
<div className="stud-class-set bor-bottom-greyE"> <div className="stud-class-set bor-bottom-greyE">
<div className="clearfix edu-back-white poll_list"> <div className="clearfix edu-back-white poll_list">
<ShixunCustomsPass <ShixunCustomsPass
{...this.props}
{...this.state}
updatas={()=>this.updatas()}
data={data} data={data}
/> />
</div> </div>

@ -1,10 +1,10 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {WordsBtn} from 'educoder'; import {WordsBtn} from 'educoder';
import {Table} from "antd"; import {Table,InputNumber} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom'; import {Link,Switch,Route,Redirect} from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { MonacoDiffEditor } from 'react-monaco-editor'; import { MonacoDiffEditor } from 'react-monaco-editor';
import axios from 'axios';
class ShixunCustomsPass extends Component { class ShixunCustomsPass extends Component {
constructor(props) { constructor(props) {
@ -18,10 +18,51 @@ class ShixunCustomsPass extends Component {
componentDidMount() { 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() { render() {
let {data}=this.props; let {data}=this.props;
console.log(data) let {customsids}=this.state;
// console.log(data)
let datas=[]; let datas=[];
data&&data.challenge_list.forEach((item,key)=>{ data&&data.challenge_list.forEach((item,key)=>{
@ -33,6 +74,8 @@ class ShixunCustomsPass extends Component {
finishtime:item.copy_username, 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'), 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, empvalue:item.code_rate,
challenge_id:{id:item.id},
copy_user_id:item.copy_user_id
// adjustmentminute:asdasd // adjustmentminute:asdasd
}) })
}) })
@ -112,6 +155,20 @@ class ShixunCustomsPass extends Component {
render: (text, record) => ( render: (text, record) => (
<span className={"color-grey-9"}> <span className={"color-grey-9"}>
{record.elapsedtime} {record.elapsedtime}
</span>
),
},{
title: '调分',
key: 'adjustmentminute',
dataIndex: 'adjustmentminute',
render: (text, record) => (
<span>
<a><InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.evaluating.final_score}
onBlur={(e) => 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}
/></a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span> </span>
), ),
}, { }, {
@ -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 ( return (
<div> <div>
@ -177,6 +242,9 @@ class ShixunCustomsPass extends Component {
.customsPass{ .customsPass{
text-align: left !important; text-align: left !important;
} }
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 16px 12px;
}
`} `}
</style> </style>
{datas===undefined?"":<Table {datas===undefined?"":<Table

Loading…
Cancel
Save