调整评阅页

competitions
杨树林 5 years ago
parent 11d1c4fa67
commit 5d881d8090

@ -1,95 +1,97 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {WordsBtn} from 'educoder'; import {WordsBtn} from 'educoder';
import {Table,InputNumber,Tooltip} from "antd"; import {Table, InputNumber, Tooltip} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom'; import {Link, Switch, Route, Redirect} from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
class OfficialAcademicTranscript extends Component { class OfficialAcademicTranscript extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
loadingstate:true, loadingstate: true,
datas:undefined, datas: undefined,
customsids:undefined customsids: undefined
} }
} }
componentDidMount() { componentDidMount() {
} }
myjumptopic=(e)=>{
myjumptopic = (e) => {
console.log("获取到值"); console.log("获取到值");
console.log(e); console.log(e);
this.props.jumptopic(e); this.props.jumptopic(e);
} }
editgame_scores=(e,id,maxsum)=>{ editgame_scores = (e, id, maxsum) => {
let{datas}=this.state; let {datas} = this.state;
let newdatas=datas; let newdatas = datas;
let score=e.target.value; let score = e.target.value;
if(score!=null&&score!=undefined&&score!=""){ if (score != null && score != undefined && score != "") {
if(score<0){ if (score < 0) {
this.props.showNotification("不能小于0"); this.props.showNotification("不能小于0");
this.setState({ this.setState({
customsids:id customsids: id
}) })
}else if(score>maxsum){ } else if (score > maxsum) {
this.props.showNotification(`不能大于关卡分值${maxsum}`); this.props.showNotification(`不能大于关卡分值${maxsum}`);
this.setState({ this.setState({
customsids:id customsids: id
}) })
}else{ } else {
let work_id=this.props.data.work_id; let work_id = this.props.data.work_id;
let url=`/student_works/${work_id}/adjust_review_score.json` let url = `/student_works/${work_id}/adjust_review_score.json`
axios.post(url,{ axios.post(url, {
type:"report", type: "report",
score:score, score: score,
challenge_id:id challenge_id: id
}).then((result)=>{ }).then((result) => {
if(result.data.status===0){ if (result.data.status === 0) {
// this.props.getdatalist() // this.props.getdatalist()
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.props.setupdalist(result.data.challenge_score,result.data.overall_appraisal,result.data.work_score) this.props.setupdalist(result.data.challenge_score, result.data.overall_appraisal, result.data.work_score)
newdatas.map((item,key)=>{ newdatas.map((item, key) => {
if(item.challenge_id.id===id){ if (item.challenge_id.id === id) {
item.game_scores.game_score=score item.game_scores.game_score = score
} }
}) })
this.setState({ this.setState({
datas:newdatas, datas: newdatas,
customsids:undefined customsids: undefined
}) })
}else{ } else {
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
} }
}).catch((error)=>{ }).catch((error) => {
}) })
} }
}else{ } else {
this.props.showNotification("调分为空将不会修改之前的分数"); this.props.showNotification("调分为空将不会修改之前的分数");
} }
} }
render() { render() {
let {customsids}=this.state; let {customsids} = this.state;
let {data}=this.props; let {data} = this.props;
let datas=[]; let datas = [];
if(data!=undefined){ if (data != undefined) {
data.stage_list===undefined?"":data.stage_list.forEach((item,key)=>{ data.stage_list === undefined ? "" : data.stage_list.forEach((item, key) => {
datas.push({ datas.push({
customs: key+1, customs: key + 1,
taskname:{name:item.name,complete_status:item.complete_status}, taskname: {name: item.name, complete_status: item.complete_status},
openingtime:item.open_time, openingtime: item.open_time,
evaluating: item.evaluate_count, evaluating: item.evaluate_count,
finishtime:item.finished_time, finishtime: item.finished_time,
elapsedtime:item.time_consuming, elapsedtime: item.time_consuming,
empvalue:{myself:item.myself_experience,experience:item.experience}, empvalue: {myself: item.myself_experience, experience: item.experience},
game_scores:{game_score:item.game_score,game_score_full:item.game_score_full}, game_scores: {game_score: item.game_score, game_score_full: item.game_score_full},
challenge_id:{id:item.challenge_id}, challenge_id: {id: item.challenge_id},
challenge_comment: item.challenge_comment, challenge_comment: item.challenge_comment,
challenge_comment_hidden: item.challenge_comment_hidden, challenge_comment_hidden: item.challenge_comment_hidden,
// adjustmentminute:asdasd // adjustmentminute:asdasd
@ -97,7 +99,7 @@ class OfficialAcademicTranscript extends Component {
}) })
} }
let columns=[{ let columns = [{
title: '关卡', title: '关卡',
dataIndex: 'customs', dataIndex: 'customs',
key: 'customs', key: 'customs',
@ -110,13 +112,17 @@ class OfficialAcademicTranscript extends Component {
title: '任务名称', title: '任务名称',
dataIndex: 'taskname', dataIndex: 'taskname',
key: 'taskname', key: 'taskname',
className:"TaskForms", className: "TaskForms",
render: (text, record) => ( render: (text, record) => (
<span> <span>
<span className={"task-hide linhe15"} style={{color:"#676767"}}><a className="tasknameName font-14" onClick={()=>this.myjumptopic("id"+record.customs)} title={record.taskname.name.length>15?record.taskname.name:""} > <span className={"task-hide linhe15"} style={{color: "#676767"}}><a className="tasknameName font-14"
onClick={() => this.myjumptopic("id" + record.customs)}
title={record.taskname.name.length > 15 ? record.taskname.name : ""}>
{record.taskname.name} {record.taskname.name}
</a> </a>
{record.taskname.complete_status===2?<span className={"tasknamebox ml10"}>延时</span>:record.taskname.complete_status===3?<span className={"tasknameboxs ml10"}></span>:""} {record.taskname.complete_status === 2 ?
<span className={"tasknamebox ml10"}>延时</span> : record.taskname.complete_status === 3 ?
<span className={"tasknameboxs ml10"}>延时</span> : ""}
</span> </span>
</span> </span>
), ),
@ -158,79 +164,101 @@ class OfficialAcademicTranscript extends Component {
{record.elapsedtime} {record.elapsedtime}
</span> </span>
), ),
}, { },
title: '经验值', {
key: 'empvalue', title: '查看答案',
dataIndex: 'empvalue', dataIndex: 'view_answer',
key: 'view_answer',
className: "edu-txt-center",
render: (text, record) => {
return (
<span style={{cursor: "default"}}>{record.view_answer === true ? <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>已查看</span> </Tooltip> : <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>未查看</span> </Tooltip>}</span>
)
}
},
{
title: '经验值',
key: 'empvalue',
dataIndex: 'empvalue',
render: (text, record) => ( render: (text, record) => (
<span> <span>
<span style={{color:'#29BD8B'}}>{record.empvalue.myself}</span><span className={"color-grey-9"}>/{record.empvalue.experience}</span> <span style={{color: '#29BD8B'}}>{record.empvalue.myself}</span><span
className={"color-grey-9"}>/{record.empvalue.experience}</span>
</span> </span>
), ),
},{ }, {
title: '关卡得分', title: '关卡得分',
key: 'game_scores', key: 'game_scores',
dataIndex: 'game_scores', dataIndex: 'game_scores',
render: (text, record) => ( render: (text, record) => (
<span> <span>
<Tooltip placement="bottom" title={ <Tooltip placement="bottom" title={
<pre> <pre>
关卡得分{record.game_scores.game_score}/关卡满分{record.game_scores.game_score_full} 关卡得分{record.game_scores.game_score}/关卡满分{record.game_scores.game_score_full}
</pre> </pre>
}> }>
<span style={{color:'#29BD8B'}}>{record.game_scores.game_score}</span><span className={"color-grey-9"}>/{record.game_scores.game_score_full}</span> <span style={{color: '#29BD8B'}}>{record.game_scores.game_score}</span><span
className={"color-grey-9"}>/{record.game_scores.game_score_full}</span>
</Tooltip> </Tooltip>
</span> </span>
), ),
},{ }, {
title: '调分', title: '调分',
key: 'adjustmentminute', key: 'adjustmentminute',
dataIndex: 'adjustmentminute', dataIndex: 'adjustmentminute',
render: (text, record) => ( render: (text, record) => (
<span> <span>
<a><InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.game_scores.game_score} <a><InputNumber size="small" className={customsids === record.challenge_id.id ? "bor-red" : ""}
onBlur={(e) => this.editgame_scores(e,record.challenge_id.id,record.game_scores.game_score_full)} defaultValue={record.game_scores.game_score}
// min={0} max={record.game_scores.game_score_full} onBlur={(e) => this.editgame_scores(e, record.challenge_id.id, record.game_scores.game_score_full)}
// min={0} max={record.game_scores.game_score_full}
/></a> /></a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/} {/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span> </span>
), ),
},{ }, {
title: '操作', title: '操作',
key: 'operation', key: 'operation',
dataIndex: 'operation', dataIndex: 'operation',
render: (text, record) => ( render: (text, record) => (
<span> <span>
<a <a
className=" color-blue font-14 fr mr22" className=" color-blue font-14 fr mr22"
onClick={()=>this.props.showAppraiseModal("child",record.challenge_id.id,record.challenge_comment,record.challenge_comment_hidden)} onClick={() => this.props.showAppraiseModal("child", record.challenge_id.id, record.challenge_comment, record.challenge_comment_hidden)}
>评阅</a> >评阅</a>
</span> </span>
), ),
}]; }];
if(this.props.isAdmin()===false){ if (this.props.isAdmin() === false) {
columns.some((item,key)=> { columns.some((item, key) => {
if (item.title === "调分") { if (item.title === "调分") {
columns.splice(key, 1) columns.splice(key, 1)
return true return true
} }
} }
) )
columns.some((item,key)=> { columns.some((item, key) => {
if (item.title === "操作") { if (item.title === "操作") {
columns.splice(key, 1) columns.splice(key, 1)
return true return true
} }
} }
) )
} }
return ( return (
<div> <div>
{/*{data===undefined?"":""}*/} {/*{data===undefined?"":""}*/}
@ -301,10 +329,10 @@ class OfficialAcademicTranscript extends Component {
} }
`} `}
</style> </style>
{datas===undefined?"":<Table {datas === undefined ? "" : <Table
dataSource={datas} dataSource={datas}
columns={columns} columns={columns}
pagination={false} pagination={false}
// loading={loadingstate} // loading={loadingstate}
// onChange={this.TablePagination} // onChange={this.TablePagination}
/>} />}

Loading…
Cancel
Save