From 9152a08b87efbba63fa5903e467533a66d89680a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 8 Jul 2019 14:10:56 +0800 Subject: [PATCH 1/2] function comp react 16.8 --- public/react/package.json | 4 +- .../courses/busyWork/CommonWorkAppraise.js | 42 ++------------- .../CommonWorkAppraiseReviseAttachments.js | 52 +++++++++++++++++++ .../src/modules/courses/busyWork/TestHooks.js | 26 ++++++++++ 4 files changed, 85 insertions(+), 39 deletions(-) create mode 100644 public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js create mode 100644 public/react/src/modules/courses/busyWork/TestHooks.js diff --git a/public/react/package.json b/public/react/package.json index 21f37b76e..5cb94e404 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -63,13 +63,13 @@ "rc-select": "^8.0.12", "rc-tree": "^1.7.11", "rc-upload": "^2.5.1", - "react": "^16.3.0", + "react": "^16.8.0", "react-beautiful-dnd": "^10.0.4", "react-codemirror": "^1.0.0", "react-codemirror2": "^6.0.0", "react-content-loader": "^3.1.1", "react-dev-utils": "^5.0.0", - "react-dom": "^16.3.0-alpha.2", + "react-dom": "^16.8.0", "react-hot-loader": "^4.0.0", "react-infinite-scroller": "^1.2.4", "react-loadable": "^5.3.1", diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 4e7d72a30..3a7e25fcd 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -13,6 +13,9 @@ import CheckCodeModal from '../coursesPublic/modal/CheckCodeModal' import '../css/Courses.css' import WorkDetailPageHeader from './common/WorkDetailPageHeader' import CommonWorkAppraiseReply from './reply/CommonWorkAppraiseReply' +import Example from './TestHooks' +import CommonWorkAppraiseReviseAttachments from './CommonWorkAppraiseReviseAttachments' + const { Option} = Select; const CheckboxGroup = Checkbox.Group; const confirm = Modal.confirm; @@ -174,12 +177,12 @@ class CommonWorkAppraise extends Component{ modalSave={ModalSave} loadtype={loadtype} /> - {/* 内容区 */} {/*
*/}
+ -
- 补交附件 -
- -
- {revise_reason} -
- {revise_attachments.map((item,key)=>{ - return( -
- - - - - {item.title} - - {item.filesize} - {item.delete===true?:""} -
- ) - })} -
- 更新 - {atta_update_user} - - {moment(atta_update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(atta_update_time).format('YYYY-MM-DD HH:mm')} - -
-
} + {is_evaluation != true && project_info && project_info.name &&
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js new file mode 100644 index 000000000..d12099d38 --- /dev/null +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js @@ -0,0 +1,52 @@ +import React, { useState } from 'react' +import moment from 'moment' +// import Example from './TestHooks' +function CommonWorkAppraiseReviseAttachments(props) { + const { revise_attachments, revise_reason, atta_update_time, atta_update_user} = props + if (!revise_attachments) return '' + return ( + + {/* {Example()} */} + {revise_attachments.length===0?"":
+ +
+ 补交附件 +
+ + {/* {age} */} + +
+ {revise_reason} +
+ {revise_attachments.map((item,key)=>{ + return( +
+ + + + + {item.title} + + {item.filesize} + {item.delete===true?:""} +
+ ) + })} +
+ 更新 + {atta_update_user} + + {moment(atta_update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(atta_update_time).format('YYYY-MM-DD HH:mm')} + +
+
} +
+ ) + +} +export default CommonWorkAppraiseReviseAttachments; \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/TestHooks.js b/public/react/src/modules/courses/busyWork/TestHooks.js new file mode 100644 index 000000000..53a03bd49 --- /dev/null +++ b/public/react/src/modules/courses/busyWork/TestHooks.js @@ -0,0 +1,26 @@ +// import React, { useState, useEffect } from 'react' + + +// function Example() { +// const [state, setState] = useState({counter: 0}) +// useEffect(() => { +// console.log(' cdm') + +// return () => { +// console.log(' cwum') +// }; +// }) +// const add1ToCounter = () => { +// const newCounterValue = state.counter + 1 +// setState({ counter: newCounterValue }) +// } +// return ( +//
+//

{state.counter}

+// +//
+// ) +// } +// export default Example \ No newline at end of file From a191fb425b97a0ff02d89c05d722235c3015f53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 8 Jul 2019 14:28:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 2 +- .../exercise/Testpapersettinghomepage.js | 6 +- .../courses/shixunHomework/Listofworks.js | 4 +- .../shixunHomework/ShixunStudentWork.js | 4 +- .../shixunHomework/ShixunWorkReport.js | 4 +- .../shixunHomework/Trainingjobsetting.js | 93 +++++++++++++------ .../shixunHomework/Workquestionandanswer.js | 4 +- 7 files changed, 80 insertions(+), 37 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index f35e17ab7..20a307ac6 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1907,7 +1907,7 @@ class Studentshavecompletedthelist extends Component { }) } } else { - console.log("2699包含主观题包含分班"); + // console.log("2699包含主观题包含分班"); if (response.data.exercise_types.groups_count > 0) { this.setState({ data: datalist, diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 62ec3ff2f..be5ab4e52 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -113,19 +113,21 @@ class Testpapersettinghomepage extends Component{ experiment=(url)=>{ axios.get(url).then((response) => { + console.log(response); + debugger if(response.data.status&&response.data.status===-1){ }else if(response.data.status&&response.data.status===-2){ if(response.data.messages === "100"){ // 已超出文件导出的上限数量(100 ),建议: this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:500 }) } diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 46fb859af..cc3e4f9a9 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1348,13 +1348,13 @@ class Listofworks extends Component { // 已超出文件导出的上限数量(100 ),建议: this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:500 }) } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 652170726..24c61c813 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -468,13 +468,13 @@ class ShixunStudentWork extends Component { // 已超出文件导出的上限数量(100 ),建议: this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:500 }) } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 646bd5f02..50cb0e81c 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -41,13 +41,13 @@ class ShixunWorkReport extends Component { // 已超出文件导出的上限数量(100 ),建议: this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ - DownloadType:false, + DownloadType:true, DownloadMessageval:500 }) } diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index e483484e7..6730d43d2 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -693,11 +693,11 @@ class Trainingjobsetting extends Component { this.state.proportion=e.target.value if (e.target.value === "均分比例") { - this.Equalproportion(); + this.Equalproportion(this.state.latedeductiontwo); } if (e.target.value === "经验值比例") { - this.Empiricalvalueratio(); + this.Empiricalvalueratio(this.state.latedeductiontwo); } if (e.target.value === "自定义分值") { @@ -717,11 +717,11 @@ class Trainingjobsetting extends Component { } onChangeslevelproportiontwo=(value)=>{ if (value === "均分比例") { - this.Equalproportion(); + this.Equalproportion(this.state.latedeductiontwo); } if (value === "经验值比例") { - this.Empiricalvalueratio(); + this.Empiricalvalueratio(this.state.latedeductiontwo); } if (value=== "自定义分值") { @@ -739,9 +739,9 @@ class Trainingjobsetting extends Component { }) } //均分比例 - Equalproportion = () => { + Equalproportion = (latedeductiontwo) => { var challenge_settingsdata=this.state.challenge_settings; - var latedeductiontwos=this.state.latedeductiontwo; + var latedeductiontwos=latedeductiontwo; if(latedeductiontwos === undefined || latedeductiontwos===null || latedeductiontwos===""){ latedeductiontwos=0; } @@ -774,15 +774,22 @@ class Trainingjobsetting extends Component { var intkks=0; if(srbool==true){ // 奇数 - var exams = Math.round(Proportion) + 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 = Math.round(Proportion) + var examsy =parseFloat(Proportion.toFixed(1)); intkks=oushution - (examsy*srorelength); - + console.log("偶数"); + console.log(oushution); + console.log((examsy*srorelength)); } var mact=0; @@ -790,20 +797,23 @@ class Trainingjobsetting extends Component { for (var i=0;i{ + Empiricalvalueratio=(latedeductiontwo)=>{ var shixun_exp = this.state.shixun_exp; var challenge_settingsdata=this.state.challenge_settings; - var latedeductiontwos=this.state.latedeductiontwo; + var latedeductiontwos=latedeductiontwo; if(latedeductiontwos === undefined || latedeductiontwos===null || latedeductiontwos===""){ latedeductiontwos=0; } @@ -845,14 +855,45 @@ class Trainingjobsetting extends Component { } } //开始循环赋值 + var expzs=0; + var mact=0; for (var i=0;i0){ + expzsy=ionsp - expzs; + bool=true; + }else{ + expzsy=ionsp - expzs; + bool=false; + + } + var macts=0; + for (var i=0;i