educoder/public/react/src/modules/courses/coursesPublic/AppraiseModal.js

137 lines
3.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
import { WordNumberTextarea } from 'educoder';
import axios from 'axios';
class AppraiseModal extends Component{
constructor(props){
super(props);
this.state={
group_ids:[],
fileList:[],
textareaval:undefined,
Inputsval:undefined,
valuetype:1,
textareavaltype:false
}
}
onChanges=(e)=>{
this.setState({
valuetype:e.target.value
})
}
settextarea=(e)=>{
this.setState({
textareaval:e.target.value
})
}
Saves=()=>{
let{textareaval,valuetype}=this.state;
let newvaluetype=valuetype===1?false:true;
if(textareaval===undefined||textareaval===null||textareaval===""){
this.setState({
textareavaltype:true
})
return
}
let url=`/student_works/${this.props.match.params.homeworkid}/shixun_work_comment.json`
axios.post(url, {
comment:textareaval,
is_hidden:newvaluetype
}).then((response) => {
if(response.data.status===0){
this.props.showNotification(response.data.message)
this.props.Cancel()
}else{
this.props.showNotification(response.data.message)
}
}).catch((error) => {
console.log(error)
});
}
render(){
let {textareaval,Inputsval,textareavaltype,Inputsvaltype}=this.state;
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
};
return(
<div>
<Modal
keyboard={false}
className={"HomeworkModal"}
title={"评阅"}
visible={this.props.visible}
closable={false}
footer={null}
destroyOnClose={true}
>
<div className={"pd015"}>
<style>
{
`
.pd015{
padding: 0px 15px 15px 15px;
}
.font{
width: 48px;
height: 16px;
font-size: 16px;
font-family: PingFangSC;
font-weight: 400;
color: rgba(5,16,26,1);
line-height: 16px;
}
.newfont{
height: 16px;
font-size: 16px;
font-family: PingFangSC;
font-weight: 400;
color: rgba(5,16,26,1);
line-height: 16px;
margin-bottom: 5px;
}
`
}
</style>
<div className="clearfix">
<p className={"font mt10 mb10"}>
权限
</p>
<Radio.Group onChange={this.onChanges} value={this.state.valuetype}>
<Radio value={1} style={radioStyle} className={"newfont"}>可见 (学生查看老师的评阅内容</Radio>
<Radio value={2} style={radioStyle} className={"newfont"}>不可见 (仅对课堂老师可见</Radio>
</Radio.Group>
<p className={"font mt10 mb20"}>
内容
</p>
<WordNumberTextarea
placeholder={"请填写评阅内容"}
onInput={(e)=>this.settextarea(e)}
value={textareaval}
maxlength={500}
/>
<li style={{height:"20px",lineHeight:"20px"}} className={textareavaltype===true?"color-red mt20 mb10":"none"}><span>评阅内容不能为空</span></li>
</div>
<div className={textareavaltype===false?"mt20 clearfix edu-txt-center":"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>
</Modal>
</div>
)
}
}
export default AppraiseModal;