import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; import HomeworkModal from "../coursesPublic/HomeworkModal"; import {getRandomNumber, getRandomcode, handleDateString, getImageUrl} from 'educoder'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import { Button, Checkbox, message, InputNumber, DatePicker, Radio, Tooltip, notification, } from "antd"; import {Link} from 'react-router-dom'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import axios from 'axios'; import moment from 'moment'; import 'moment/locale/zh-cn'; import Modals from "../../modals/Modals"; import DownloadMessageysl from "../../modals/DownloadMessageysl"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import '../css/members.css'; import "../common/formCommon.css"; import '../css/Courses.css'; import './style.css'; import '../css/busyWork.css' import '../poll/pollStyle.css' import Startshixuntask from "../coursesPublic/Startshixuntask"; const RadioGroup = Radio.Group; //GraduationTaskssetting.js //课堂作业设置 function range(start, end) { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; } function disabledDateTime() { return { disabledMinutes: () => range(1, 30).concat(range(31, 60)), // disabledSeconds: () => range(0,60) } } function disabledDate(current) { return current && current < moment().endOf('day').subtract(1, 'days'); } class Trainingjobsetting extends Component { //unifiedsetting 统一设置 //allowreplenishment 允许补交 //completionefficiencyscore 完成效率评分占比 //level级别 //proportion 比例 //releasetime 发布时间 //deadline 截至时间 constructor(props) { super(props); // this.props.form.setFieldsValue({ // radiogroup:1, // // }); this.state = { flagPageEdit: true, flagPageEdits: false, flagPageEditstwo: false, flagPageEditsthrees: false, flagPageEditsfor: false, props: props, flagPageEditsbox: false, handclass: undefined, rulest: undefined, rules: undefined, starttimetype: false, endtimetype: false, latetimetype: false, allowlate: 1, unit_p_tip: "", unit_e_tip: "", latepenaltytype: false, unifiedsetting: true, allowreplenishment: undefined, completionefficiencyscore: false, whethertopay: false, proportion: undefined, level: undefined, ealuation: false, latededuction: undefined, latedeductiontwo: "0", database: false, datasheet: false, databasetwo: undefined, datasheettwo: undefined, publicwork: undefined, publish_time: undefined, publish_timebool: false, end_time: undefined, late_time: undefined, endOpen: false, borreds: undefined, borredss: undefined, releasetime: undefined, deadline: undefined, late_times: undefined, mystyle: {"display": "block"}, mystyles: {"display": "none"}, challenge_settings: undefined, boolUnite: true, boolUnitetwo: true, boolUnitetwoname: undefined, score_open: false, group_settings: undefined, rulesdata: [], showmodel: false, code_review: false, testscripttiptype: false, starttimesend: undefined, end_timebool: false, late_timesbool: false, work_efficiencys: false, task_pass: false, //是否允许跳关 CalculateMax: 100,//总分值 borredszf:"ml10 color-grey-9", borredszfl:true, borredszfls:'', total_scoretwo:0, total_score:0, } // console.log("获取到的值") // console.log("Trainingjobsetting") // // console.log("设置页面调用的老师学生权限") // console.log(JSON.stringify(props)) // console.log(this.props.isAdmin()) //判断是否是老师 // console.log(this.props.isStudent()) //判断是否是学生 // console.log(this.props.isNotMember()) //判断是否有登入权限 } componentDidMount() { //console.log("Trainingjobsetting"); //console.log("componentDidMount"); this.getTrainingjobsetting(true); let query = this.props.location.pathname; const type = query.split('/'); this.setState({ shixuntypes: type[3] }) this.props.triggerRef(this); if (this.props.isAdmin() === false) { this.cancelEdit() } } // componentWillReceiveProps(nextProps) { // // console.log("+++++++++916"); // // console.log(nextProps); // // console.log(this.props) // // console.log(this.props.isAdmin()); // if (nextProps.code_review != this.props.code_review) { // if (nextProps.code_review !== undefined) { // console.log("diaoyonglwangluo4"); // this.getTrainingjobsetting() // // } // } // // } // 获取数据地方 getTrainingjobsetting = (bool) => { // console.log("getTrainingjobsetting") var homeworkid = this.props.match.params.homeworkid; // console.log(homeworkid) let url = `/homework_commons/${homeworkid}/settings.json`; axios.get(url).then((result) => { // console.log(url); // console.log(result); if (result != undefined) { // console.log(result.data.code_review) // console.log("设置页") // console.log(JSON.stringify(result)) let array = []; let arrays = []; var rulesdatas = []; if (result.data.group_settings !== undefined) { if (result.data.group_settings.length === 0) { array.push({ course_group_id: [], course_group_name: [], publish_time: undefined, end_time: undefined, publish_flag: "", end_flag: "", class_flag: "", course_search: "", open: false }) } else { for (var i = 0; i < result.data.group_settings.length; i++) { if (result.data.group_settings[i].publish_time === null && result.data.group_settings[i].end_time === null) { } else { array.push({ course_group_id: result.data.group_settings[i].group_id, course_group_name: result.data.group_settings[i].group_name, publish_time: moment(result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(result.data.group_settings[i].end_time).format('YYYY-MM-DD HH:mm'), publish_flag: "", end_flag: "", class_flag: "", course_search: "", open: false }) } } } } if (result.data.group_settings !== undefined) { for (var i = 0; i < result.data.group_settings.length; i++) { arrays.push({ course_group_id: result.data.group_settings[i].group_id, course_group_name: result.data.group_settings[i].group_name, publish_time: moment(result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(result.data.group_settings[i].end_time).format('YYYY-MM-DD HH:mm'), course_choosed: 0, }) if (result.data.group_settings[i].group_id instanceof Array) { rulesdatas.push({ group_id: result.data.group_settings[i].group_id, publish_time: moment(result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(result.data.group_settings[i].end_time).format('YYYY-MM-DD HH:mm'), }) } else { rulesdatas.push({ group_id: [result.data.group_settings[i].group_id], publish_time: moment(result.data.group_settings[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(result.data.group_settings[i].end_time).format('YYYY-MM-DD HH:mm'), }) } } } // console.log("220"); var publish_timebools = false; if (result.data.publish_time) { publish_timebools = moment(result.data.publish_time, "YYYY-MM-DD HH:mm") <= moment(); } // console.log("228"); // console.log(publish_timebools); var end_timebools = false; if (result.data.end_time) { end_timebools == moment(result.data.end_time, "YYYY-MM-DD HH:mm") <= moment(); } // console.log("233"); // console.log(end_timebools); var late_timess = false; if (result.data.late_time) { late_timess == moment(result.data.end_time, "YYYY-MM-DD HH:mm") <= moment(); } // console.log("240"); // console.log(late_timess); this.setState({ publish_timebool: publish_timebools, end_timebool: end_timebools, late_timesbool: late_timess, task_pass: result.data.task_pass, rules: array, rulest: arrays, rulesdata: rulesdatas, jobsettingsdata: result, shixun_exp: result.data.shixun_exp, group_settings: result.data.group_settings, score_open: result.data.score_open, unifiedsetting: result.data.unified_setting, boolUnite: result.data.unified_setting === true ? false : result.data.unified_setting === false ? true : true, publish_time: result.data.publish_time === undefined ? undefined : result.data.publish_time === null ? undefined : result.data.publish_time, releasetime: result.data.publish_time === undefined ? undefined : result.data.publish_time === null ? undefined : result.data.publish_time, end_time: result.data.end_time === undefined ? undefined : result.data.end_time === null ? undefined : result.data.end_time, deadline: result.data.end_time === undefined ? undefined : result.data.end_time === null ? undefined : result.data.end_time, late_time: result.data.late_time === undefined ? undefined : result.data.late_time === null ? undefined : result.data.late_time, late_times: result.data.late_time === undefined ? undefined : result.data.late_time === null ? undefined : result.data.late_time, allowreplenishment: result.data.allow_late, latededuction: result.data.late_penalty, level: result.data.answer_open_evaluation === true ? "满分" : "扣分", work_efficiencys: result.data.work_efficiency, latedeductiontwo: result.data.eff_score, proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "", publicwork: result.data.score_open, challenge_settings: result.data.challenge_settings, code_review: result.data.code_review, total_scoretwo:result.data.total_score, total_score:result.data.total_score, }) this.props.Getdataback(result, result.data); if (bool === true) { if (this.props.isAdmin() !== undefined) { if (this.props.isAdmin() === true) { this.editSettings(result); this.Calculatethetotalscore(result.data.eff_score, result.data.challenge_settings); } } } } }) } //跳转道描点的地方 scrollToAnchor = (anchorName) => { if (anchorName) { // 找到锚点 let anchorElement = document.getElementById(anchorName); // 如果对应id的锚点存在,就跳转到锚点 if (anchorElement) { anchorElement.scrollIntoView(); } } } //计算总分值 Calculatethetotalscore = (latedeductiontwos, challenge_settings) => { //latedeductiontwos 效率分 //challenge_settings 总分 var datas = challenge_settings; var challenge_scoredata = []; let datasinde=0; for (var i = 0; i < datas.length; i++) { if (datas[i].checked === true) { // var object = { // challenge_id: datas[i].challenge_id, // challenge_score: datas[i].challenge_score, // }; challenge_scoredata.push(datas[i].challenge_score); // array.push(object) }else{ datasinde=datasinde+1; } } // //console.log("datasinde Calculatethetotalscore"); // //console.log(datasinde); // //console.log(datas.length); // if(array === "[]" || array.length === 0){ // this.props.showNotification(`没有关卡不能更新设置`); // return; // } // var latedeductiontwos = 0; // //效率分是否勾选 勾选获取效分 // if (this.state.completionefficiencyscore === true) { // latedeductiontwos = this.state.latedeductiontwo; // } // if(challenge_scoredata.length>0){ if(datasinde!==datas.length){ let len = 0; //console.log(challenge_scoredata); for (var k = 0; k < challenge_scoredata.length; k++) { len = len + parseFloat(challenge_scoredata[k]); } let max = latedeductiontwos + len; let maxs = max.toFixed(1); // console.log(1) // console.log(maxs) this.setState({ CalculateMax: maxs, }) } } //提交数据 pustdate = () => { var thiss = this; // //console.log("pustdate"); var homeworkid = this.props.match.params.homeworkid var array = []; var datas = this.state.challenge_settings; var challenge_scoredata = []; for (var i = 0; i < datas.length; i++) { if (datas[i].checked === true) { var object = { challenge_id: datas[i].challenge_id, challenge_score: datas[i].challenge_score, }; challenge_scoredata.push(datas[i].challenge_score); array.push(object) // //console.log("datas[i].challenge_score"); // //console.log(i); // //console.log(datas[i].challenge_score); } } // console.log("提交的数据"+"pustdate"); // console.log("提交的数据"+"pustdate"); if (this.state.jobsettingsdata.data.unified_setting === true) { if (this.state.unifiedsetting === true) { //统一设置 if (this.state.releasetime === undefined || this.state.releasetime === null || this.state.releasetime === "") { // this.props.showNotification(`请选择发布时间`); //立即发布 // this.homeworkstart(); this.scrollToAnchor("publishtimeid"); this.setState({ unit_p_tip: "请选择发布时间", p_flag: true, borreds: "bor-reds", }) return; } else { if (this.state.publish_time === undefined || this.state.publish_time === null || this.state.publish_time === "") { if (moment(this.state.publish_time, 'YYYY-MM-DD HH:mm') <= moment()) { //发布时间小于 当前时间 this.scrollToAnchor("publishtimeid"); this.setState({ unit_p_tip: "发布时间不能早于当前时间", p_flag: true, borreds: "bor-reds", }) return; } } } if (this.state.deadline === undefined || this.state.deadline === null || this.state.deadline === "") { // this.props.showNotification(`请选择截止时间`); this.scrollToAnchor("publishtimeid"); this.setState({ unit_e_tip: "请选择截止时间", p_flag: true, borredss: "bor-reds", }) return } else { if (!this.state.flagPageEditsthrees === false) { if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment()) { //截止时间小于当前时间 this.scrollToAnchor("publishtimeid"); this.setState({ unit_e_tip: "截止时间不能早于当前时间", p_flag: true, borredss: "bor-reds", }) return; } if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) { //截止时间小于发布时间 this.scrollToAnchor("publishtimeid"); this.setState({ unit_e_tip: "截止时间不能早于发布时间", p_flag: true, borredss: "bor-reds", }) return } } } if (this.state.allowreplenishment === true) { if (this.state.late_times === undefined || this.state.late_times === null || this.state.late_times === "") { // this.props.showNotification(`请选择结束时间`); this.scrollToAnchor("end_timeid") this.setState({ hand__e_tip: "请选择结束时间", hand_flags: true, handclass: "bor-reds", }) return; } else { // 补交结束时间不能早于截止时间 if (!this.state.flagPageEditsfor === false) { if (moment(this.state.late_time, "YYYY-MM-DD HH:mm") <= moment()) { //结束时间小于当前时间 this.scrollToAnchor("end_timeid"); this.setState({ hand__e_tip: "结束时间不能早于当前时间", hand_flags: true, handclass: "bor-reds", }) return; } if (moment(this.state.late_time, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) { //结束时间小于发布时间 this.scrollToAnchor("end_timeid"); this.setState({ hand__e_tip: "结束时间不能早于发布时间", hand_flags: true, handclass: "bor-reds", }) return; } if (moment(this.state.late_time, "YYYY-MM-DD HH:mm") <= moment(this.state.end_time, "YYYY-MM-DD HH:mm")) { //结束时间小于发布时间 this.scrollToAnchor("end_timeid"); this.setState({ hand__e_tip: "补交结束时间不能早于截止时间", hand_flags: true, handclass: "bor-reds", }) return; } } } } } else { //分班设置 // console.log("分班设置"); // console.log(this.$pollDetailTabForthRules); const result=this.$pollDetailTabForthRules.notUnifiedSettingCheck(this.state.rules); this.setState({ rules: result.rules }) if(result.validate==false){ this.scrollToAnchor("publishtimeid"); return false; } let rulesdata = this.state.rulesdata; if (rulesdata.length === 0) { this.props.showNotification(`分班发布设置不能为空`); return; } } } if (this.state.allowreplenishment === true) { if (this.state.latededuction === undefined) { this.props.showNotification(`请输入迟交扣分数`); return; } if (this.state.latededuction === null) { this.props.showNotification(`请输入迟交扣分数`); return; } if (this.state.latededuction === "") { this.props.showNotification(`请输入迟交扣分数`); return; } if (this.state.latededuction < 0) { this.props.showNotification(`迟交扣分数不能小于零`); return; } if (this.state.level === undefined || this.state.level === "") { this.props.showNotification(`请选择扣分项`); return; } } if (this.state.completionefficiencyscore === true) { if (this.state.latedeductiontwo === undefined) { this.props.showNotification(`请输入效率分数`); return; } if (this.state.latedeductiontwo === null) { this.props.showNotification(`请输入效率分数`); return; } if (this.state.latedeductiontwo === "") { this.props.showNotification(`请输入效率分数`); return; } if (this.state.latedeductiontwo <= 0) { this.props.showNotification(`效率分数不能小于等于零`); return; } // if(this.state.latedeductiontwo >100){ // message.error("效率分不能大于100",1); // return; // } if (this.state.proportion === undefined) { this.props.showNotification(`请选择比列`); return; } if (this.state.proportion !== undefined) { if (this.state.proportion === "均分比例") { //关卡分值平分 } if (this.state.proportion === "经验值比例") { this.setState({ boolUnitetwo: false, }) } if (this.state.proportion === "自定义分值") { this.setState({ boolUnitetwo: false, }) } } } if(this.state.borredszfl===false){ this.setState({ borredszf:this.state.borredszf, borredszfls:this.state.borredszfls, borredszfl:this.state.borredszfl, }) this.scrollToAnchor("zongfentimeid"); return; } var latedeductiontwos = 0; if (this.state.completionefficiencyscore === true) { latedeductiontwos = this.state.latedeductiontwo; } //从这里开始记得等于0的时候还要做判断 if (challenge_scoredata.length > 0) { var len = 0; for (var k = 0; k < challenge_scoredata.length; k++) { len = len + parseFloat(challenge_scoredata[k]); // console.log(len); // console.log(challenge_scoredata[k]); // console.log(len); } let max = latedeductiontwos + len; // if (max > 100) { // console.log("max>100"); // this.props.showNotification(`总分值+效率效率分之和要等于100,现在分值为` + max); // return; // } // if(max<100){ // console.log("max<100"); // this.props.showNotification(`总分值+效率效率分之和要等于100,现在分值为` + max); // return; // } if (this.state.proportion === "自定义分值") { try { if(parseFloat(this.state.CalculateMax)!==parseFloat(max)){ this.props.showNotification(`分值之和必须等于总分值:${this.state.CalculateMax}分`); this.scrollToAnchor("zongfentimeid"); return; } }catch (e) { } } }else{ try { if(parseFloat(this.state.CalculateMax)!==parseFloat(0)){ this.props.showNotification(`分值之和必须等于总分值:${this.state.CalculateMax}分`); this.scrollToAnchor("zongfentimeid"); return; } }catch (e) { } } var url = `/homework_commons/${homeworkid}/update_settings.json`; var data = undefined; // console.log("this.state.unified_setting") // console.log(this.state.unifiedsetting) if (array === "[]" || array.length === 0) { this.props.showNotification(`没有关卡不能更新设置`); return; } if (this.state.unifiedsetting === true) { //console.log("统一设置"); data = { unified_setting: this.state.unifiedsetting, //统一配置 publish_time: moment(this.state.publish_time).format('YYYY-MM-DD HH:mm'), //发布时间 end_time: moment(this.state.end_time).format('YYYY-MM-DD HH:mm'), //截止时间 allow_late: this.state.allowreplenishment, //补交 late_penalty: parseInt(this.state.latededuction), //迟交扣分 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 work_efficiency: this.state.work_efficiencys, //完成效率评分占比 eff_score: this.state.work_efficiencys === true ? this.state.latedeductiontwo : undefined,//效率分 shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, total_score:this.state.CalculateMax, total_scoretwo:this.state.CalculateMax,//记录总分值点击取消的时候还原总分值 } } else { // //非统一配置 // console.log("非统一设置"); let rulesdata = this.state.rulesdata; let newlist = [] rulesdata.map((item, key) => { if (item.publish_time === "Invalid date" || item.end_time === "Invalid date" || item.publiend_timesh_time === "Invalid date") { } else { newlist.push(item) } }) data = { unified_setting: this.state.unifiedsetting, //非统一配置 group_settings: newlist, allow_late: this.state.allowreplenishment, //补交 late_penalty: parseInt(this.state.latededuction), //迟交扣分 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 work_efficiency: this.state.work_efficiencys, //完成效率评分占比 eff_score: this.state.work_efficiencys=== true ? this.state.latedeductiontwo : undefined,//效率分 shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, total_score:this.state.CalculateMax, total_scoretwo:this.state.CalculateMax } } // console.log("pustdate"); // console.log(data); // console.log(JSON.stringify(data)); axios.post(url, data) .then((result) => { if (result.data.status == 0) { // console.log(JSON.stringify(result)); this.props.showNotification(`更新成功`); this.setState({ flagPageEditsbox: false, flagPageEdit: false, flagPageEditstwo: false, flagPageEditsthrees: false, flagPageEditsfor: false, whethertopay: false, completionefficiencyscore: false, }) this.refs.targetElementTrainingjobsetting.scrollIntoView() } }).catch((error) => { console.log(error); }) } //数据库 onChangedatabase = (e) => { this.setState({ database: e.target.checked, }) // console.log(e.target.checked); } //公开设置 onChangepublicwork = (e) => { this.setState({ publicwork: e.target.checked, }) // console.log(e.target.checked); } //是否跳关设置 onChangedatasheet = (e, index) => { var challenge_settings = this.state.challenge_settings; let {task_pass} = this.state; if (task_pass === true) { // 可以跳关 for (var i = 0; i < challenge_settings.length; i++) { if (i === index) { if (challenge_settings[i].checked === true) { challenge_settings[i].checked = false } else { challenge_settings[i].checked = true } } } } else { //不能跳关 var bool = false; //先判断如果是点击的关口 checked 根据点击进行切换 for (var i = 0; i < challenge_settings.length; i++) { if (i === index) { if (challenge_settings[i].checked === true) { challenge_settings[i].checked = false bool = false; } else { challenge_settings[i].checked = true bool = true; } } } //小于被选中的checked 都被选中 如果是大于被选中的checked 就全部隐藏掉 for (var i = 0; i < challenge_settings.length; i++) { if (bool === true) { if (i < index) { challenge_settings[i].checked = true } } else { if (i > index) { challenge_settings[i].checked = false } } } } // console.log(e.target.checked) // console.log(index) this.setState({ datasheet: e.target.checked, challenge_settings: challenge_settings }) this.onChangeslevelproportiontwo(this.state.proportion); } //统一设置 onChange = (e) => { if ((moment(this.state.publish_time, "YYYY-MM-DD HH:mm") <= moment())) { this.props.showNotification(`已发布,不能再修改统一设置`); return } this.setState({ unifiedsetting: e.target.checked, }) // console.log(e.target.checked); } //允许补交 onChanges = (e) => { // console.log(this.state.end_time); if (e.target.checked === true) { if (this.state.end_time !== null && this.state.end_time !== undefined) { // console.log(this.state.end_time); // var times = this.state.deadline.format('YYYY-MM-DD HH:mm'); this.setState({ late_time: moment(handleDateString(this.state.deadline)).add(1, 'months'), late_times: moment(handleDateString(this.state.deadline)).add(1, 'months').format('YYYY-MM-DD HH:mm'), }) } this.setState({ allowreplenishment: e.target.checked, latededuction: 5, whethertopay: true, }) } else { this.setState({ allowreplenishment: e.target.checked, latededuction: 0, whethertopay: false, hand__e_tip: "", hand_flags: false, handclass: "", }) } // console.log('radio checked', e.target.value); } //级别 onChangeslevel = (e) => { this.setState({ level: e.target.value }) // console.log('radio checked', e.target.value); } //比例 onChangeslevelproportion = (e) => { this.state.proportion = e.target.value if (e.target.value === "均分比例") { this.Equalproportion(this.state.latedeductiontwo, this.state.CalculateMax, true); } if (e.target.value === "经验值比例") { this.Empiricalvalueratio(this.state.latedeductiontwo, this.state.CalculateMax, true); } if (e.target.value === "自定义分值") { this.state.boolUnitetwoname = "自定义分值"; this.setState({ boolUnitetwoname: "自定义分值", boolUnitetwo: false, flagPageEdits: true, }) } this.setState({ proportion: e.target.value }) // console.log('radio checked', e.target.value); } onChangeslevelproportiontwo = (value) => { if (value === "均分比例") { this.Equalproportion(this.state.latedeductiontwo, this.state.CalculateMax, true); } if (value === "经验值比例") { this.Empiricalvalueratio(this.state.latedeductiontwo, this.state.CalculateMax, true); } if (value === "自定义分值") { this.state.boolUnitetwoname = "自定义分值"; this.setState({ boolUnitetwoname: "自定义分值", boolUnitetwo: false, flagPageEdits: true, }) } this.setState({ proportion: value }) } //均分比例 Equalproportion = (latedeductiontwo, Proportions, mybool) => { var challenge_settingsdata = this.state.challenge_settings; var latedeductiontwos = latedeductiontwo; if (latedeductiontwos === undefined || latedeductiontwos === null || latedeductiontwos === "") { latedeductiontwos = 0; } //效率分 if (challenge_settingsdata.length > 0) { var Proportion = Proportions; var oushution = 0; //获取占用分后的值 Proportion = Proportion - latedeductiontwos; oushution = Proportion; var srorelength = 0; //计算选中用户 for (var k = 0; k < challenge_settingsdata.length; k++) { if (challenge_settingsdata[k].checked === true) { srorelength++ } } //算下面值是否是奇数 var srbool = false; if (srorelength % 2 == 0) { // 偶数 srbool = false; } else { // 奇数 srbool = true; } //计算平均值 Proportion = Proportion / srorelength; var intkk = 0; var intkks = 0; if (srbool == true) { // 奇数 var exams = parseFloat(Proportion.toFixed(1)); var intk = srorelength * exams; intkk = oushution - intk; // console.log("奇数"); // console.log(srorelength);//3 // console.log(oushution);//79 // console.log(exams);//26.3 // console.log(intk);//78.9 // console.log(intkk); } else { // 偶数 var examsy = parseFloat(Proportion.toFixed(1)); intkks = oushution - (examsy * srorelength); // console.log("偶数"); // console.log(oushution); // console.log((examsy*srorelength)); } var mact = 0; //给每到题目赋平均值 for (var i = 0; i < challenge_settingsdata.length; i++) { if (challenge_settingsdata[i].checked === true) { if (srbool === false) { //console.log(intkks); mact = mact + 1; if (mact === srorelength) { challenge_settingsdata[i].challenge_score = (parseFloat(Proportion.toFixed(1)) + parseFloat(intkks.toFixed(1))).toFixed(1); //console.log(challenge_settingsdata[i].challenge_score); } else { challenge_settingsdata[i].challenge_score = Proportion.toFixed(1); } } else { //console.log(intkk); mact = mact + 1; if (mact === srorelength) { challenge_settingsdata[i].challenge_score = (parseFloat(Proportion.toFixed(1)) + parseFloat(intkk.toFixed(1))).toFixed(1); //console.log(challenge_settingsdata[i].challenge_score); } else { challenge_settingsdata[i].challenge_score = Proportion.toFixed(1); } } } else { challenge_settingsdata[i].challenge_score = 0; } } } //关卡分值平分 this.setState({ boolUnitetwo: true, flagPageEdits: false, challenge_settings: challenge_settingsdata, }) if (mybool === true) { this.Calculatethetotalscore(latedeductiontwo, challenge_settingsdata); } } //经验值比例 Empiricalvalueratio = (latedeductiontwo, ionsps, mybool) => { var shixun_exp = this.state.shixun_exp; var challenge_settingsdata = this.state.challenge_settings; var latedeductiontwos = latedeductiontwo; if (latedeductiontwos === undefined || latedeductiontwos === null || latedeductiontwos === "") { latedeductiontwos = 0; } // //效率分 if (shixun_exp !== undefined) { if (shixun_exp > 0) { if (challenge_settingsdata.length > 0) { var ionsp = ionsps; //获取效率分之后的值 ionsp = ionsp - latedeductiontwos; //获取道总分值 var Proportion = shixun_exp; //获取改变后的总分值 for (var k = 0; k < challenge_settingsdata.length; k++) { if (challenge_settingsdata[k].checked === false) { Proportion = Proportion - challenge_settingsdata[k].challenge_exp; } } //开始循环赋值 var expzs = 0; var mact = 0; for (var i = 0; i < challenge_settingsdata.length; i++) { if (challenge_settingsdata[i].checked === true) { mact = mact + 1; var myint = (challenge_settingsdata[i].challenge_exp / Proportion) * ionsp; challenge_settingsdata[i].challenge_score = myint.toFixed(1); expzs = parseFloat(myint.toFixed(1)) + parseFloat(expzs); } else { challenge_settingsdata[i].challenge_score = 0; } } var expzsy = 0; var bool = true; if (ionsp - expzs > 0) { expzsy = parseFloat(ionsp.toFixed(1)) - parseFloat(expzs.toFixed(1)); expzsy = Math.abs(expzsy); bool = true; } else { expzsy = parseFloat(ionsp.toFixed(1)) - parseFloat(expzs.toFixed(1)); expzsy = Math.abs(expzsy); bool = false; } var macts = 0; for (var i = 0; i < challenge_settingsdata.length; i++) { if (challenge_settingsdata[i].checked === true) { macts = macts + 1; if (mact === macts) { if (bool === true) { challenge_settingsdata[i].challenge_score = (parseFloat(challenge_settingsdata[i].challenge_score) + parseFloat(expzsy.toFixed(1))).toFixed(1); //console.log(parseFloat(challenge_settingsdata[i].challenge_score) + parseFloat(expzsy.toFixed(1))); //console.log(parseFloat(expzsy.toFixed(1))); } else { challenge_settingsdata[i].challenge_score = (parseFloat(challenge_settingsdata[i].challenge_score) - parseFloat(expzsy.toFixed(1))).toFixed(1); //console.log(parseFloat(challenge_settingsdata[i].challenge_score) - parseFloat(expzsy.toFixed(1))); //console.log(parseFloat(expzsy.toFixed(1))); } } } else { challenge_settingsdata[i].challenge_score = 0; } } } } } this.setState({ boolUnitetwo: false, flagPageEdits: false, challenge_settings: challenge_settingsdata, }) if (mybool === true) { this.Calculatethetotalscore(latedeductiontwo, challenge_settingsdata); } } //完成效率评分占比 onChangeeffectiveness = (e) => { if (e.target.checked === true) { this.setState({ completionefficiencyscore: e.target.checked, work_efficiencys: e.target.checked, latedeductiontwo: 20, }) //均分比例 if (this.state.proportion === "均分比例") { this.Equalproportion(20, this.state.CalculateMax, true); } else if (this.state.proportion === "经验值比例") { this.Empiricalvalueratio(20, this.state.CalculateMax, true); } } else { this.state.latedeductiontwo = 0; this.setState({ completionefficiencyscore: e.target.checked, work_efficiencys: e.target.checked, latedeductiontwo: 0, }) //均分比例 if (this.state.proportion === "均分比例") { this.Equalproportion(0, this.state.CalculateMax, true); } else if (this.state.proportion === "经验值比例") { this.Empiricalvalueratio(0, this.state.CalculateMax, true); } } // console.log(e.target.checked); } //迟交扣分 changeTopicName = (value) => { // console.log("1e.target.value", value) if (value === "" || value === undefined) { return } var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ var nubmer = value; if (!re.test(nubmer)) { this.props.showNotification(`请输入正确的数字`); this.setState({ latededuction: 0 }) return false; } // if (nubmer > 100) { // this.props.showNotification(`请输入小于100的数`); // // this.setState({ // latededuction: 0 // }) // return // } this.setState({ latededuction: value, }) } //总比分 Totalscorecalculation = (value) => { // console.log(2) // console.log(value) this.setState({ CalculateMax: value, }) if ( value === undefined || value === null || value === "" ) { this.setState({ borredszf:"ml10 color-grey-9 bor-reds ", borredszfls:"不能为空", borredszfl:false, }) return } var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ var nubmer = value; if (!re.test(nubmer)) { this.setState({ borredszf:"ml10 color-grey-9 bor-reds ", borredszfls:"请输入数字", borredszfl:false, }) return; } this.setState({ borredszf:"ml10 color-grey-9 ", borredszfls:"", borredszfl:true, }) // if (nubmer > 100) { // this.props.showNotification(`请输入小于100的数`); // // this.setState({ // CalculateMax: 0 // }) // return // } //获取效率分 let myvalues = this.state.latedeductiontwo; //均分比例 if (this.state.proportion === "均分比例") { this.Equalproportion(myvalues, value, true); } else if (this.state.proportion === "经验值比例") { this.Empiricalvalueratio(myvalues, value, true); } } // //效率分 changeTopicNametwo = (value) => { // console.log("TrainingjobsettingTrainingjobsetting", value) if (value === "" || value === undefined) { return } var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ var nubmer = value; if (!re.test(nubmer)) { this.props.showNotification(`请输入正确的数字`); this.setState({ latedeductiontwo: 0 }) return false; } // if (nubmer > 100) { // this.props.showNotification(`请输入小于100的数`); // // this.setState({ // latedeductiontwo: 0 // }) // return // } this.setState({ latedeductiontwo: value, }) //均分比例 if (this.state.proportion === "均分比例") { this.Equalproportion(value, this.state.CalculateMax, true); } else if (this.state.proportion === "经验值比例") { this.Empiricalvalueratio(value, this.state.CalculateMax, true); } else if (this.state.proportion === "自定义分值") { // this.Calculatethetotalscore(value, this.state.challenge_settings); } } hangeTopicNametwodatasheet = (value, index) => { // console.log("2e.target.value", value) if (value === "" || value === undefined) { return } var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ var nubmer = value; if (!re.test(nubmer)) { this.props.showNotification(`请输入正确的数字`); // this.setState({ // datasheet: 0 // }) var challenge_settings = this.state.challenge_settings; for (var i = 0; i < challenge_settings.length; i++) { if (i === index) { challenge_settings[i].challenge_score = ""; } } this.setState({ challenge_settings: challenge_settings }) return false; } var challenge_settings = this.state.challenge_settings; for (var i = 0; i < challenge_settings.length; i++) { if (i === index) { challenge_settings[i].challenge_score = value; } } this.setState({ challenge_settings: challenge_settings }) var latedeductiontwos = 0; //效率分是否勾选 勾选获取效分 if (this.state.completionefficiencyscore === true) { latedeductiontwos = this.state.latedeductiontwo; } if (this.state.proportion === "均分比例") { this.Calculatethetotalscore(latedeductiontwos, challenge_settings); } else if (this.state.proportion === "经验值比例") { this.Calculatethetotalscore(latedeductiontwos, challenge_settings); } // if (nubmer > 100) { // message.error("请输入小于100的数"); // this.setState({ // datasheet: 0 // }) // return // } // this.setState({ // datasheet: value, // }) } // disabledEndDate = (end_time) => { // const publish_time = this.state.publish_time; // if (!end_time || !publish_time) { // return false; // } // return end_time.valueOf() <= publish_time.valueOf(); // // } // disabledEndDates = (end_time) => { // const publish_time = this.state.end_time // if (!end_time || !publish_time) { // return false; // } // console.log("end_time.valueOf()") // // console.log(end_time.valueOf()); // // console.log(publish_time.valueOf()); // return end_time.valueOf() <= publish_time.valueOf(); // // // } disabledStartDatestart = (startValue) => { const endValue = this.state.end_time if (!startValue || !endValue) { return false; } var endValues = moment(endValue).subtract(1, 'days'); return startValue.valueOf() > endValues.valueOf(); }; disabledEndDateend = (endValue) => { const startValue = this.state.publish_time; if (!endValue || !startValue) { return false; } var endValuesys = moment(startValue).subtract(1, 'days'); return endValue.valueOf() <= endValuesys.valueOf(); }; disabledEndDateendd = (endsValue) => { const endValues = this.state.end_time if (!endsValue || !endValues) { return false; } var endValuesyss = moment(endValues).subtract(1, 'days'); return endsValue.valueOf() <= endValuesyss.valueOf(); }; onChangedata = (field, value, dateString) => { this.setState({ [field]: handleDateString(dateString), }); } ontimeonok = (value) => { //console.log("ontimeonok点击了2"); if (value === undefined) { return; } if (moment(value, "YYYY-MM-DD HH:mm") <= moment()) { } else { try { this.setState({ unit_p_tip: "", p_flag: false, borreds: undefined, releasetime: value.format('YYYY-MM-DD HH:mm'), }) } catch (e) { } } } ontimeonoktwo = (value) => { if (value === undefined) { return; } if (moment(value, "YYYY-MM-DD HH:mm") <= moment()) { } else { if (moment(value, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) { return } try { this.setState({ unit_e_tip: "", p_flag: false, deadline: value.format('YYYY-MM-DD HH:mm'), borredss: undefined, }) } catch (e) { } } } ontimeonokthree = (value) => { if (value === undefined) { return; } let {publish_time, unifiedsetting, rulesdata} = this.state; if (unifiedsetting === true) { if (moment(value, "YYYY-MM-DD HH:mm") <= moment(publish_time)) { } else { } } else { rulesdata.map((item, key) => { if (item.publish_time != "Invalid date") { if (moment(value, "YYYY-MM-DD HH:mm") <= moment(item.publish_time, "YYYY-MM-DD HH:mm")) { } else { this.setState({ late_times: value.format('YYYY-MM-DD HH:mm'), hand__e_tip: "", hand_flags: false, handclass: "", }) } } }) } } onStartChange = (value, dateString) => { //console.log("onStartChange点击了1"); if (value == null) { this.setState({ releasetime: undefined, publish_time: undefined, }) return; } // if (moment(value, "YYYY-MM-DD HH:mm") <= moment()) { // this.setState({ // unit_p_tip: "发布时间不能早于当前时间", // p_flag: true, // borreds:"bor-reds", // releasetime:undefined, // publish_time:undefined, // }) // } else { try { this.setState({ unit_p_tip: "", p_flag: false, borreds: undefined, releasetime: value.format('YYYY-MM-DD HH:mm'), }) } catch (e) { } // //console.log(value); //console.log(dateString); // console.log(handleDateString(dateString)); // this.onChangedata('publish_time', value, dateString); this.setState({ publish_time: moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), }); if (this.state.allowreplenishment === true) { if (this.state.end_time === undefined || this.state.end_time === "") { this.setState({ end_time: moment(handleDateString(dateString)).add(1, 'months'), deadline: moment(handleDateString(dateString)).add(1, 'months').format('YYYY-MM-DD HH:mm'), }) } else { } if (this.state.late_time === undefined || this.state.late_time === "") { this.setState({ late_time: moment(handleDateString(dateString)).add(2, 'months'), late_times: moment(handleDateString(dateString)).add(2, 'months').format('YYYY-MM-DD HH:mm'), }); } else { } try { this.setState({ unit_e_tip: "", p_flag: false, borredss: undefined, }) } catch (e) { } } else { if (this.state.end_time === undefined || this.state.end_time === "") { this.setState({ end_time: moment(handleDateString(dateString)).add(1, 'months'), deadline: moment(handleDateString(dateString)).add(1, 'months').format('YYYY-MM-DD HH:mm'), }) } else { } } // } } onEndChange = (value, dateString) => { // console.log("onEndChange") // console.log(value) // console.log(dateString) if (value == null) { this.setState({ end_time: undefined, deadline: undefined, }) return; } // if (moment(value, "YYYY-MM-DD HH:mm") <= moment()) { // this.setState({ // unit_e_tip: "截止时间不能早于当前时间", // p_flag: true, // borredss:"bor-reds", // end_time:undefined, // deadline:undefined, // }) // } else { // console.log(moment(value, "YYYY-MM-DD HH:mm")); // console.log(moment(this.state.publish_time, "YYYY-MM-DD HH:mm")); if (moment(value, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) { this.setState({ unit_e_tip: "截止时间不能早于发布时间", p_flag: true, borredss: "bor-reds", end_time: value.format('YYYY-MM-DD HH:mm'), deadline: value.format('YYYY-MM-DD HH:mm'), }) return } try { this.setState({ unit_e_tip: "", p_flag: false, borredss: undefined, deadline: value.format('YYYY-MM-DD HH:mm'), }) } catch (e) { } this.setState({ end_time: moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), }) // this.onChangedata('end_time', value, dateString); if (this.state.allowreplenishment === true) { this.setState({ deadline: moment(handleDateString(dateString)).format('YYYY-MM-DD HH:mm'), late_time: moment(handleDateString(dateString)).add(2, 'months'), late_times: moment(handleDateString(dateString)).add(2, 'months').format('YYYY-MM-DD HH:mm'), }) } // } } onEndChangeys = (value, dateString) => { if (value == null) { this.setState({ late_times: undefined, late_time: undefined, }) return; } let {publish_time, end_time, unifiedsetting, rulesdata} = this.state; if (unifiedsetting === true) { if (moment(value, "YYYY-MM-DD HH:mm") <= moment(publish_time)) { this.setState({ hand__e_tip: "补交结束时间不能早于发布时间", hand_flags: true, handclass: "bor-reds", late_times: value.format('YYYY-MM-DD HH:mm'), late_time: value.format('YYYY-MM-DD HH:mm'), }) } else if (moment(value, "YYYY-MM-DD HH:mm") <= moment(end_time)) { this.setState({ hand__e_tip: "补交结束时间不能早于截止时间", hand_flags: true, handclass: "bor-reds", late_times: value.format('YYYY-MM-DD HH:mm'), late_time: value.format('YYYY-MM-DD HH:mm'), }) } else { try { this.setState({ late_times: value.format('YYYY-MM-DD HH:mm'), late_time: value.format('YYYY-MM-DD HH:mm'), hand__e_tip: "", hand_flags: false, handclass: "", }) } catch (e) { } } } else { rulesdata.map((item, key) => { if (item.publish_time != "Invalid date") { if (moment(value, "YYYY-MM-DD HH:mm") <= moment(item.publish_time)) { //console.log(moment(item.publish_time, "YYYY-MM-DD HH:mm") <= moment(publish_time)) let kes = key + 1; this.setState({ hand__e_tip: "补交时间不能早于发布规则" + kes + "的发布时间", hand_flags: true, handclass: "bor-reds", }) return } else { this.setState({ late_times: value.format('YYYY-MM-DD HH:mm'), late_time: value.format('YYYY-MM-DD HH:mm'), hand__e_tip: "", hand_flags: false, handclass: undefined, }) } } }) } } //立即发布 homeworkstart = () => { let homeworkid = this.props.match.params.homeworkid; let url = "/homework_commons/" + homeworkid + "/publish_groups.json"; axios.get(url).then((response) => { if (response.status === 200) { const dataformat = 'YYYY-MM-DD HH:mm'; let starttime = this.props.getNowFormatDates(1); let endtime = this.props.getNowFormatDates(2); this.setState({ modalname: "立即发布", modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, OneSelftype: true, Topval: "学生将立即收到作业", // Botvalleft:"暂不发布", Botval: `本操作只对"未发布"的作业有效`, starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes: starttime, starttimesend: response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time, typs: "start", endtime: "截止时间:" + endtime, Cancelname: "暂不发布", Savesname: "立即发布", Cancel: this.homeworkhide, Saves: this.homeworkstartend, course_groups: response.data.course_groups, }) } }).catch((error) => { console.log(error) }); } //立即截止 homeworkends = () => { let homeworkid = this.props.match.params.homeworkid; let url = "/homework_commons/" + homeworkid + "/end_groups.json"; axios.get(url).then((response) => { if (response.status === 200) { this.setState({}) this.setState({ modalname: "立即截止", modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, visible: true, Topval: "学生将不能再提交作业", // Botvalleft:"暂不截止", Botval: `本操作只对"提交中"的作业有效`, Cancelname: "暂不截止", Savesname: "立即截止", Cancel: this.homeworkhide, Saves: this.coursetaskend, starttime: undefined, endtime: undefined, typs: "end", course_groups: response.data.course_groups, }) } }).catch((error) => { console.log(error) }); } // 立即发布 homeworkstartend = (ds, endtime) => { var homeworkid = this.props.match.params.homeworkid; let data = {} if (ds.length === 0) { if (this.props.teacherdatapage.category.main === 1) { data = { homework_ids: [homeworkid], end_time: endtime, } } else { data = { homework_ids: [homeworkid], end_time: endtime, category_id: this.props.teacherdatapage.category.category_id, } } } else { if (this.props.teacherdatapage.category.main === 1) { data = { homework_ids: [homeworkid], group_ids: ds, group_end_times: endtime, detail: true } } else { data = { homework_ids: [homeworkid], group_ids: ds, group_end_times: endtime, category_id: this.props.teacherdatapage.category.category_id, detail: true } } } let coursesId = this.props.match.params.coursesId; let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json"; axios.post(url, data).then((result) => { if (result.status === 200) { if (result.data.status === 0) { notification.open({ message: "提示", description: result.data.message }); this.homeworkhide(); this.getTrainingjobsetting(false); } } }).catch((error) => { console.log(error); }) } //立即截止确定按钮 coursetaskend = () => { var homeworkid = this.props.match.params.homeworkid; let {course_groupslist} = this.state; const cid = this.props.match.params.coursesId; let url = "/courses/" + cid + "/homework_commons/end_homework.json"; axios.post(url, { group_ids: course_groupslist, homework_ids: [homeworkid], }) .then((response) => { if (response.data.status == 0) { notification.open({ message: "提示", description: response.data.message }); // notification['success']({ // message:"提示", // description:response.data.message // }); this.getTrainingjobsetting(false); this.homeworkhide() } }) .catch(function (error) { console.log(error); }); } getcourse_groupslist = (id) => { this.setState({ course_groupslist: id }) } homeworkhide = () => { this.setState({ modalname: undefined, modaltype: undefined, visible: false, OneSelftype: false, Topval: undefined, Topvalright: undefined, Botvalleft: undefined, Botval: undefined, starttime: undefined, endtime: undefined, Cancelname: undefined, Savesname: undefined, Cancel: undefined, Saves: undefined, StudentList_value: undefined, addname: undefined, addnametype: false, addnametab: undefined, typs: undefined, starttimes: undefined, starttimesend: undefined, }) } cancelBox = () => { this.setState({ modalsType: false, modalsTopval: "", loadtype: false, }) } //编辑 editSetting = () => { try { if (this.state.jobsettingsdata.data.is_end === true) { this.setState({ modalsType: true, modalsTopval: "课堂已结束不能再修改!", loadtype: true, modalSave: this.cancelBox }) } else { var releasetime = true; var deadline = true; var endtime = true; var whethertopays = true; //发布时间 if (moment(this.state.publish_time, "YYYY-MM-DD HH:mm") <= moment()) { releasetime = false; } //截止时间 if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment()) { deadline = false; } //结束时间 if (moment(this.state.late_time, "YYYY-MM-DD HH:mm") <= moment()) { endtime = false; } if (this.state.allowreplenishment === false) { whethertopays = false; } if (this.state.jobsettingsdata !== undefined) { } try { if (this.state.jobsettingsdata && this.state.jobsettingsdata.data.homework_status[0] === "未发布") { this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, completionefficiencyscore: false, work_efficiencys: this.state.work_efficiencys, unifiedsetting: this.state.unifiedsetting, latedeductiontwo: this.state.latedeductiontwo, }); //均分比例 try { if (this.state.proportion === "均分比例") { this.Equalproportion(this.state.latedeductiontwo, this.state.CalculateMax, true); } else if (this.state.proportion === "经验值比例") { this.Empiricalvalueratio(this.state.latedeductiontwo, this.state.CalculateMax, true); } } catch (e) { } } else { this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, unifiedsetting: this.state.unifiedsetting, }); if (this.state.work_efficiencys === true) { this.setState({ completionefficiencyscore: true, }) } else { this.setState({ completionefficiencyscore: false, }) } } } catch (e) { this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, unifiedsetting: this.state.unifiedsetting, }); if (this.state.work_efficiencys === true) { this.setState({ completionefficiencyscore: true, }) } else { this.setState({ completionefficiencyscore: false, }) } } if (this.state.proportion === "自定义分值") { this.setState({ boolUnitetwoname: "自定义分值", boolUnitetwo: false, flagPageEdits: true, }) } } } catch (e) { } }; //一进来就是老师要用的编辑页面 editSettings = (datas) => { // console.log("编辑页面"); // console.log(datas); try { if (datas.data.is_end === true) { this.setState({ modalsType: true, modalsTopval: "课堂已结束不能再修改!", loadtype: true, modalSave: this.cancelBox }) } else { // var releasetime = true; var deadline = true; var endtime = true; var whethertopays = true; //发布时间 if (moment(datas.data.publish_time, "YYYY-MM-DD HH:mm") <= moment()) { releasetime = false; } //截止时间 if (moment(datas.data.end_time, "YYYY-MM-DD HH:mm") <= moment()) { deadline = false; } //结束时间 if (moment(datas.data.late_time, "YYYY-MM-DD HH:mm") <= moment()) { endtime = false; } if (datas.data.allow_late === false) { whethertopays = false; } try { if (datas.data && datas.data.homework_status[0] === "未发布") { this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, completionefficiencyscore: datas.data.work_efficiency === true ? true : false, work_efficiencys: datas.data.work_efficiency, unifiedsetting: datas.data.unified_setting, latedeductiontwo: datas.data.eff_score, }); //均分比例 // result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? try { if (datas.data.shixun_evaluation === 0) { this.Equalproportion(datas.data.eff_score, this.state.CalculateMax, false); } else if (datas.data.shixun_evaluation === 1) { this.Empiricalvalueratio(datas.data.eff_score, this.state.CalculateMax, false); } } catch (e) { //console.log("报错editSettings"); //console.log(1); //console.log(e); } } else { this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, unifiedsetting: datas.data.unified_setting, }); if (datas.data.work_efficiency === true) { this.setState({ completionefficiencyscore: true, }) } else { this.setState({ completionefficiencyscore: false, }) } } } catch (e) { //console.log(2); //console.log(e); this.setState({ flagPageEditsbox: true, flagPageEdit: true, whethertopay: whethertopays, flagPageEditstwo: releasetime, flagPageEditsthrees: deadline, flagPageEditsfor: endtime, unifiedsetting: datas.data.unified_setting, }); if (datas.data.work_efficiency === true) { this.setState({ completionefficiencyscore: true, }) } else { this.setState({ completionefficiencyscore: false, }) } } if (datas.data.shixun_evaluation === 2) { this.setState({ boolUnitetwoname: "自定义分值", boolUnitetwo: false, flagPageEdits: true, }) } } } catch (e) { //console.log(3); //console.log(e); } }; //取消编辑 cancelEdit = () => { this.setState({ flagPageEditsbox: false, flagPageEdit: false, flagPageEditstwo: false, flagPageEditsthrees: false, flagPageEditsfor: false, whethertopay: false, unit_p_tip: "", p_flag: false, borreds: undefined, borredss: undefined, hand__e_tip: "", hand_flags: false, handclass: undefined, completionefficiencyscore: false, latedeductiontwo: 0, unit_e_tip: "", }) this.refs.targetElementTrainingjobsetting.scrollIntoView(); this.getTrainingjobsetting(false); // console.log(3) // console.log(this.state.total_scoretwo) this.setState({ CalculateMax:this.state.total_scoretwo, }) } rulesCheckInfo = (rules) => { var datas = []; for (var i = 0; i < rules.length; i++) { if (rules[i].course_group_id instanceof Array) { datas.push({ group_id: rules[i].course_group_id, publish_time: moment(rules[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(rules[i].end_time).format('YYYY-MM-DD HH:mm'), }); } else { datas.push({ group_id: [rules[i].course_group_id], publish_time: moment(rules[i].publish_time).format('YYYY-MM-DD HH:mm'), end_time: moment(rules[i].end_time).format('YYYY-MM-DD HH:mm'), }); } } //console.log(rules); //console.log(datas); this.setState({ rules, rulesdata: datas, }) } workshowmodel = () => { this.setState({ showmodel: true }) } hideshowmodel = () => { this.setState({ showmodel: false }) } testscripttip = (e) => { if (e === 0) { this.setState({ testscripttiptype: true, }) } else { this.setState({ testscripttiptype: false, }) } } ChangeTab = (e) => { this.props.ChangeTab(e); } daochushixunbaogao = () => { let url = `/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`; this.confirmysl(url, url + `&export=true${getRandomNumber(true)}`); } daochuzuoye = () => { let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`; this.confirmysl(url, url + `?export=true&${getRandomNumber(true)}`); } confirmysl(url, urlWithExport) { axios.get(urlWithExport).then((response) => { if (response === undefined) { return } if (response.data.status && response.data.status === -1) { } else if (response.data.status && response.data.status === -2) { if (response.data.message === "100") { // 已超出文件导出的上限数量(100 ),建议: this.setState({ DownloadType: true, DownloadMessageval: 100 }) } else { //因附件资料超过500M this.setState({ DownloadType: true, DownloadMessageval: 500 }) } } else { this.props.showNotification(`正在下载中`); window.open(getRandomcode("/api" + url), '_blank'); } }).catch((error) => { console.log(error) }); } Downloadcal = () => { this.setState({ DownloadType: false, DownloadMessageval: undefined }) } render() { const dataformat = 'YYYY-MM-DD HH:mm'; let {flagPageEdit, testscripttiptype, publish_timebool, end_timebool,borredszf,borredszfl,borredszfls, late_timesbool, work_efficiencys, flagPageEdits, flagPageEditstwo, flagPageEditsbox, whethertopay, handclass, flagPageEditsthrees, flagPageEditsfor, rules, rulest, unifiedsetting, group_settings, course_group, unit_e_tip, borreds, borredss, unit_p_tip, end_time, late_time, score_open, publish_time, starttimetype, modalsType, modalsTopval, loadtype, modalSave, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata, endOpen, mystyle, mystyles, task_pass} = this.state; // console.log(publish_timebool); // console.log(!flagPageEditstwo); const radioStyle = { display: 'block', height: '30px', lineHeight: '30px', color: "#666666" }; const radioStyles = { display: 'block', height: '30px', lineHeight: '30px', color: "#666666", marginLeft: '38px', }; // const startDate=moment(this.state.publish_time).format('YYYY-MM-DD HH:mm'); // const endDate =moment(this.state.publish_time).add('months',1).format('YYYY-MM-DD HH:mm'); // console.log("Trainingjobsetting"); // console.log(startDate); // console.log(endDate); // if( this.props.isAdmin() === true){ // this.editSetting(); // } // console.log(this.props.isAdmin()) // console.log(this.state.code_review===false) // console.log("引入的分值"); // console.log(this.state.CalculateMax); return (
发布设置
{
!flagPageEdit && this.props.isAdmin() === true ?
编辑设置
{/*
{ unit_p_tip && unit_p_tip != "" ? {unit_p_tip} : "" }
{ unit_e_tip && unit_e_tip != "" ? {unit_e_tip} : "" }
{ this.state.hand__e_tip && this.state.hand__e_tip != "" ? {this.state.hand__e_tip} : "" }
(学生工作效率= log(实训总得分/实训总耗时)
(学生效率分 = 学生工作效率 / 课堂学生最高工作效率 * 分值)
若完成效率分值 = 10分, 则
均分比例: 根据任务数平均分配
例: 实训任务3关, 每关分值: 1/3*(100-10)=30分
难易度: 根据关卡经验值的高低确定关卡分值
例: 实训总经验值1200, 某关经验值200,
则其分值:200/1200*(100-10)=15分
自定义分值: 手动设置关卡分值
关卡名称{task_pass === false ? "(请选中需要学生完成的关卡,该实训不支持跳关学习)" : "(请选中需要学生完成的关卡,该实训支持跳关学习)"}
查看参考答案才通过评测的关卡扣分规则(学生通过评测后再查看参考答案,不对成绩产生影响)