|
|
import React, {Component} from "react";
|
|
|
import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form} from "antd";
|
|
|
import {WordNumberTextarea} from 'educoder';
|
|
|
import './Newshixunmodel.css'
|
|
|
|
|
|
//调分
|
|
|
class ModulationModal_exercise extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
score: 0,
|
|
|
subjective_questions: 0,
|
|
|
objective_questions: 0,
|
|
|
subjective_score: 0,
|
|
|
objective_score: 0,
|
|
|
subool: false,
|
|
|
Inputsval: '',
|
|
|
Inputsvals: '',
|
|
|
Inputsvaltype: false,
|
|
|
Inputsvaltypes: false,
|
|
|
Inputsvaltest: "",
|
|
|
Inputsvaltests: "",
|
|
|
|
|
|
}
|
|
|
//因为主观题加客观题的和是总分
|
|
|
}
|
|
|
|
|
|
componentDidMount = () => {
|
|
|
console.log("ModulationModal_exercise");
|
|
|
console.log(this.props);
|
|
|
this.setState({
|
|
|
subjective_score: this.props.subjective_score,
|
|
|
objective_score: this.props.objective_score,
|
|
|
})
|
|
|
if (this.props.subjective_score > 0 && this.props.objective_score > 0) {
|
|
|
this.setState({
|
|
|
subool: false,
|
|
|
})
|
|
|
} else {
|
|
|
this.setState({
|
|
|
subool: true
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Saves = () => {
|
|
|
let {
|
|
|
textareaval,
|
|
|
subjective_questions,
|
|
|
objective_questions,
|
|
|
score,
|
|
|
subool,
|
|
|
Inputsval,
|
|
|
subjective_score,
|
|
|
objective_score,
|
|
|
Inputsvals
|
|
|
} = this.state;
|
|
|
let re = /^[0-9]+.?[0-9]*$/;//判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
|
|
|
|
|
|
if (subool === false) {
|
|
|
//不是总分模式
|
|
|
if (Inputsval === undefined || Inputsval === null || Inputsval === "") {
|
|
|
this.setState({
|
|
|
Inputsval: "",
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "请填写分数",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//判断主观题
|
|
|
|
|
|
var nubmer = Inputsval;
|
|
|
if (!re.test(nubmer)) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (0 > parseFloat(Inputsval)) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "成绩不能小于零",
|
|
|
})
|
|
|
return;
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: `成绩不能大于${this.props.subjective_score}`,
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
//判断客观题
|
|
|
if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") {
|
|
|
this.setState({
|
|
|
Inputsvals: "",
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请填写分数",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
var nubmers = Inputsvals;
|
|
|
if (!re.test(nubmers)) {
|
|
|
this.setState({
|
|
|
Inputsvals: "",
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (0 > parseFloat(Inputsvals)) {
|
|
|
this.setState({
|
|
|
Inputsvals: Inputsvals,
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
} else if (parseFloat(Inputsval) > 100) {
|
|
|
this.setState({
|
|
|
Inputsvals: Inputsvals,
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: `成绩不能大于${this.props.objective_score}`,
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
//总分模式
|
|
|
if (subjective_score > 0) {
|
|
|
//主观题
|
|
|
if (Inputsval === undefined || Inputsval === null || Inputsval === "") {
|
|
|
this.setState({
|
|
|
Inputsval: "",
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "请填写分数",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//判断主观题
|
|
|
var nubmer = Inputsval;
|
|
|
if (!re.test(nubmer)) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (0 > parseFloat(Inputsval)) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: "成绩不能小于零",
|
|
|
})
|
|
|
return;
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
this.setState({
|
|
|
Inputsval: Inputsval,
|
|
|
Inputsvaltype: true,
|
|
|
Inputsvaltest: `成绩不能大于${this.props.subjective_score}`,
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
} else if (objective_score > 0) {
|
|
|
//客观题
|
|
|
if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") {
|
|
|
this.setState({
|
|
|
Inputsvals: "",
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请填写分数",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
var nubmers = Inputsvals;
|
|
|
if (!re.test(nubmers)) {
|
|
|
this.setState({
|
|
|
Inputsvals: "",
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (0 > parseFloat(Inputsvals)) {
|
|
|
this.setState({
|
|
|
Inputsvals: Inputsvals,
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
})
|
|
|
return;
|
|
|
} else if (parseFloat(Inputsvals) > 100) {
|
|
|
this.setState({
|
|
|
Inputsvals: Inputsvals,
|
|
|
Inputsvaltypes: true,
|
|
|
Inputsvaltests: `成绩不能大于${this.props.objective_score}`,
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
this.props.Saves(Inputsval, Inputsvals);
|
|
|
|
|
|
}
|
|
|
|
|
|
settextarea = (e) => {
|
|
|
this.setState({
|
|
|
textareaval: e.target.value
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//主观题
|
|
|
setInputs = (e) => {
|
|
|
console.log("主");
|
|
|
console.log(e.target.value);
|
|
|
this.setState({
|
|
|
Inputsval: e.target.value,
|
|
|
Inputsvaltype: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//客观题
|
|
|
setInputss = (e) => {
|
|
|
console.log("客");
|
|
|
console.log(e.target.value);
|
|
|
this.setState({
|
|
|
Inputsvals: e.target.value,
|
|
|
Inputsvaltypes: false,
|
|
|
|
|
|
})
|
|
|
}
|
|
|
//最终成绩主观题
|
|
|
setInputsss = (e) => {
|
|
|
console.log("终主");
|
|
|
console.log(e.target.value);
|
|
|
this.setState({
|
|
|
Inputsval: e.target.value,
|
|
|
Inputsvaltype: false,
|
|
|
})
|
|
|
}
|
|
|
//最终成绩客观题
|
|
|
setInputssss = (e) => {
|
|
|
console.log("终客");
|
|
|
console.log(e.target.value);
|
|
|
this.setState({
|
|
|
Inputsvals: e.target.value,
|
|
|
Inputsvaltypes: false,
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
let {
|
|
|
Inputsvaltype,
|
|
|
Inputsvaltypes,
|
|
|
Inputsvaltest,
|
|
|
Inputsvaltests,
|
|
|
subjective_score,
|
|
|
objective_score,
|
|
|
Inputsval,
|
|
|
Inputsvals,
|
|
|
} = this.state;
|
|
|
return (
|
|
|
<div>
|
|
|
<Modal
|
|
|
keyboard={false}
|
|
|
className={"HomeworkModal"}
|
|
|
title={this.props.modalname || '评阅'}
|
|
|
visible={this.props.visible}
|
|
|
closable={false}
|
|
|
footer={null}
|
|
|
destroyOnClose={true}
|
|
|
>
|
|
|
<div className="clearfix" style={{
|
|
|
display: "-webkit-flex",
|
|
|
flexDirection: "column",
|
|
|
alignItems: "center",
|
|
|
}}>
|
|
|
{
|
|
|
subjective_score > 0 && objective_score > 0 ?
|
|
|
<div>
|
|
|
{Inputsvaltype === true ?
|
|
|
<style>
|
|
|
{
|
|
|
`
|
|
|
.ant-input:hover {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
.ant-input:focus {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
}
|
|
|
`
|
|
|
}
|
|
|
</style>
|
|
|
:
|
|
|
""
|
|
|
|
|
|
}
|
|
|
<div className="mexertwo">
|
|
|
<p className="mexeheigth2">主观题成绩:</p>
|
|
|
<Input
|
|
|
className={Inputsvaltype === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
style={{
|
|
|
width: "150px",
|
|
|
height: "40px",
|
|
|
}}
|
|
|
placeholder="请填写主观题成绩"
|
|
|
onInput={this.setInputs}
|
|
|
value={Inputsval === undefined || Inputsval === null ? "" : Inputsval}/>
|
|
|
<p className="mexeheigth ml10">分 ,</p>
|
|
|
<p className="mexeheigth"><span>总分:</span><span>{subjective_score}</span><span
|
|
|
className="ml10">分</span></p>
|
|
|
</div>
|
|
|
{
|
|
|
Inputsvaltype === true ?
|
|
|
<p style={{
|
|
|
color: "#DD1717",
|
|
|
width: "77%",
|
|
|
marginLeft: "75px",
|
|
|
marginTop: "10px",
|
|
|
}}>{Inputsvaltest}</p>
|
|
|
: ""
|
|
|
}
|
|
|
{Inputsvaltypes === true ?
|
|
|
<style>
|
|
|
{
|
|
|
`
|
|
|
.ant-input:hover {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
.ant-input:focus {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
}
|
|
|
`
|
|
|
}
|
|
|
</style>
|
|
|
:
|
|
|
""
|
|
|
|
|
|
}
|
|
|
<div className="mexertwo">
|
|
|
|
|
|
<p className="mexeheigth2">客观题成绩:</p>
|
|
|
<Input
|
|
|
className={Inputsvaltypes === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
style={{
|
|
|
width: "150px",
|
|
|
height: "40px",
|
|
|
}}
|
|
|
placeholder="请填写客观题成绩"
|
|
|
onInput={this.setInputss}
|
|
|
value={Inputsvals === undefined || Inputsvals === null ? "" : Inputsvals}/>
|
|
|
<p className="mexeheigth ml10">分 ,</p>
|
|
|
<p className="mexeheigth"><span>总分:</span><span>{objective_score} </span><span
|
|
|
className="ml10">分</span></p>
|
|
|
|
|
|
</div>
|
|
|
{
|
|
|
Inputsvaltypes === true ?
|
|
|
<p style={{
|
|
|
color: "#DD1717",
|
|
|
width: "77%",
|
|
|
marginLeft: "75px",
|
|
|
marginTop: "10px",
|
|
|
}}>{Inputsvaltests}</p>
|
|
|
: ""
|
|
|
}
|
|
|
</div>
|
|
|
:
|
|
|
<div className="mt20">
|
|
|
{
|
|
|
subjective_score > 0 && objective_score === 0 ?
|
|
|
<div>
|
|
|
{Inputsvaltype === true ?
|
|
|
<style>
|
|
|
{
|
|
|
`
|
|
|
.ant-input:hover {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
.ant-input:focus {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
}
|
|
|
`
|
|
|
}
|
|
|
</style>
|
|
|
:
|
|
|
""
|
|
|
|
|
|
}
|
|
|
<div className="mexertwo">
|
|
|
<p className="mexeheigth2">最终成绩:</p>
|
|
|
<Input
|
|
|
className={Inputsvaltype === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
style={{
|
|
|
width: "150px",
|
|
|
height: "40px",
|
|
|
}}
|
|
|
placeholder="请填写最终成绩"
|
|
|
onInput={this.setInputsss}
|
|
|
value={Inputsval === undefined || Inputsval === null ? "" : Inputsval}/>
|
|
|
<p className="mexeheigth ml10"> 分 ,</p>
|
|
|
<p className="mexeheigth">
|
|
|
<span>总分:</span><span>{subjective_score > 0 && objective_score === 0 ? subjective_score : ""} {objective_score > 0 && subjective_score === 0 ? objective_score : ""}</span><span
|
|
|
className="ml10">分</span></p>
|
|
|
|
|
|
</div>
|
|
|
{
|
|
|
Inputsvaltype === true ?
|
|
|
<p style={{
|
|
|
color: "#DD1717",
|
|
|
width: "77%",
|
|
|
marginLeft: "75px",
|
|
|
marginTop: "10px",
|
|
|
}}>{Inputsvaltest}</p>
|
|
|
: ""
|
|
|
}
|
|
|
</div>
|
|
|
:
|
|
|
""
|
|
|
}
|
|
|
{
|
|
|
objective_score > 0 && subjective_score === 0 ?
|
|
|
<div>
|
|
|
{Inputsvaltypes === true ?
|
|
|
<style>
|
|
|
{
|
|
|
`
|
|
|
.ant-input:hover {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
.ant-input:focus {
|
|
|
border: 1px solid #DD1717!important;
|
|
|
}
|
|
|
}
|
|
|
`
|
|
|
}
|
|
|
</style>
|
|
|
:
|
|
|
""
|
|
|
|
|
|
}
|
|
|
<div className="mexertwo">
|
|
|
<p className="mexeheigth2">最终成绩:</p>
|
|
|
<Input
|
|
|
className={Inputsvaltypes === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
style={{
|
|
|
width: "150px",
|
|
|
height: "40px",
|
|
|
}}
|
|
|
placeholder="请填写最终成绩"
|
|
|
onInput={this.setInputssss}
|
|
|
value={Inputsvals === undefined || Inputsvals === null ? "" : Inputsvals}/>
|
|
|
<p className="mexeheigth ml10"> 分 ,</p>
|
|
|
<p className="mexeheigth">
|
|
|
<span>总分:</span><span>{subjective_score > 0 && objective_score === 0 ? subjective_score : ""} {objective_score > 0 && subjective_score === 0 ? objective_score : ""}</span><span
|
|
|
className="ml10">分</span></p>
|
|
|
|
|
|
</div>
|
|
|
{
|
|
|
Inputsvaltypes === true ?
|
|
|
<p style={{
|
|
|
color: "#DD1717",
|
|
|
width: "77%",
|
|
|
marginLeft: "75px",
|
|
|
marginTop: "10px",
|
|
|
}}>{Inputsvaltests}</p>
|
|
|
: ""
|
|
|
}
|
|
|
</div>
|
|
|
:
|
|
|
""
|
|
|
}
|
|
|
|
|
|
|
|
|
<div className="minbuttionte">
|
|
|
<a className="task-btn color-white mr30" style={{width: "72px",}}
|
|
|
onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
|
|
|
<a className="task-btn task-btn-orange" style={{width: "72px",}}
|
|
|
onClick={this.Saves}>{this.props.Savesname || '保存'}</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
</div>
|
|
|
</Modal>
|
|
|
</div>
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default ModulationModal_exercise;
|
|
|
// <div className="task-popup-content">
|
|
|
// <p className="task-popup-text-center font-16 mb20">
|
|
|
//
|
|
|
// <span className={"color-dark-21"}>该学生的最终成绩将不会按照评分规则进行计算</span>
|
|
|
//
|
|
|
// </p>
|
|
|
//
|
|
|
//
|
|
|
// <div className="clearfix">
|
|
|
// {/*<textarea*/}
|
|
|
// {/*className="winput-100-150"*/}
|
|
|
// {/*placeholder="请填写您对作品调分的原因"*/}
|
|
|
// {/*value={textareaval}*/}
|
|
|
// {/*onInput={this.settextarea}*/}
|
|
|
// {/*></textarea>*/}
|
|
|
//
|
|
|
// <WordNumberTextarea
|
|
|
// placeholder={"请填写您对作品调分的原因"}
|
|
|
// onInput={(e)=>this.settextarea(e)}
|
|
|
// value={textareaval}
|
|
|
// maxlength={100}
|
|
|
// />
|
|
|
//
|
|
|
// {/*<li style={{height:"20px",lineHeight:"20px"}}><span className={textareavaltype===true?"color-red":"none"}>原因不能为空</span></li>*/}
|
|
|
// <div style={{height:"20px",lineHeight:"20px"}}></div>
|
|
|
// </div>
|
|
|
//
|
|
|
// <style>
|
|
|
// {
|
|
|
//
|
|
|
// `
|
|
|
// .pdl10{
|
|
|
// padding-left:10px;
|
|
|
// }
|
|
|
// `
|
|
|
// }
|
|
|
// </style>
|
|
|
//
|
|
|
// <li className={"pdl10"}>
|
|
|
//
|
|
|
// </li>
|
|
|
// <li style={{height:"20px",lineHeight:"20px"}}><span className={Inputsvaltype===true?"color-red":"none"}>分数不能为空</span></li>
|
|
|
// <div className="clearfix edu-txt-center">
|
|
|
// <a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
|
|
|
// <a className="task-btn task-btn-orange" onClick={this.Saves}>{this.props.Savesname || '保存'}</a>
|
|
|
{/* </div>*/
|
|
|
}
|
|
|
{/*</div>*/
|
|
|
}
|