From 975bd891b01a5fda6092fb115a3af6d6c00240b0 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, 4 Nov 2019 14:43:50 +0800 Subject: [PATCH 01/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 649aeab7a..d6e46fc5e 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1172,7 +1172,8 @@ class Listofworksstudentone extends Component { align: 'center', className: 'font-14', render: (text, record) => ( - record.submitstate === "未提交" ? -- : + record.submitstate === "未提交" ? + this.Viewstudenttraininginformations()}>调分 : this.Viewstudenttraininginformationt(record)}>查看 @@ -1502,7 +1503,8 @@ class Listofworksstudentone extends Component { align: 'center', className: 'font-14', render: (text, record) => ( - record.submitstate === "未提交" ? -- : + record.submitstate === "未提交" ? + this.Viewstudenttraininginformations()}>调分 : this.Viewstudenttraininginformationt(record)}>{record.operating} From 497802afb6ff97a93e2a6fa0224cf091f4c138be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 15:05:19 +0800 Subject: [PATCH 02/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/ModulationModal.js | 160 ++++++++++++------ .../courses/coursesPublic/Newshixunmodel.css | 52 +++++- .../shixunHomework/Listofworksstudentone.js | 14 +- 3 files changed, 170 insertions(+), 56 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index 1857f6814..0dd0b2ec7 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -1,7 +1,9 @@ import React,{ Component } from "react"; -import { Modal,Checkbox,Upload,Button,Icon,message,Input} from "antd"; +import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form} from "antd"; import { WordNumberTextarea } from 'educoder'; +import './Newshixunmodel.css' +//调分 class ModulationModal extends Component{ constructor(props){ super(props); @@ -16,12 +18,12 @@ class ModulationModal extends Component{ Saves=()=>{ let {textareaval,Inputsval}=this.state; - if(textareaval===""||textareaval===undefined){ - this.setState({ - textareavaltype:true - }) - return - } + // if(textareaval===""||textareaval===undefined){ + // this.setState({ + // textareavaltype:true + // }) + // return + // } this.setState({ textareavaltype: false }) @@ -69,60 +71,120 @@ class ModulationModal extends Component{ footer={null} destroyOnClose={true} > -
-

- - 该学生的最终成绩将不会按照评分规则进行计算 - -

- - -
- {/**/} - +
+
+ *调分: + + +
+
+ +

调分后该学生的最终成绩将不会按照评分规则进行计算

+
+ +
+ 调分原因: this.settextarea(e)} + onInput={(e) => this.settextarea(e)} value={textareaval} maxlength={100} /> +
-
  • 原因不能为空
  • -
    - - - -
  • - -
  • -
  • 分数不能为空
  • +
    - + + +
    ) } } -export default ModulationModal; \ No newline at end of file +export default ModulationModal; +//
    +//

    +// +// 该学生的最终成绩将不会按照评分规则进行计算 +// +//

    +// +// +//
    +// {/**/} +// +// this.settextarea(e)} +// value={textareaval} +// maxlength={100} +// /> +// +// {/*
  • 原因不能为空
  • */} +//
    +//
    +// +// +// +//
  • +// +//
  • +//
  • 分数不能为空
  • +//
    +// {this.props.Cancelname || '取消'} +// {this.props.Savesname || '保存'} +{/*
    */ +} +{/*
    */ +} diff --git a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css index f0f45a468..bbd2e56da 100644 --- a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css +++ b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css @@ -266,4 +266,54 @@ .padding13-30 { padding: 13px 30px; box-sizing: border-box; -} \ No newline at end of file +} + +.displaymodulat { + display: flex; + display: -webkit-flex; + flex-direction: column; + align-items: center; +} + +.WordNumberTextarea { + outline: none; /* 去掉输入字符时的默认样式 */ + appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + background-color: white; + text-shadow: none; + -webkit-writing-mode: horizontal-tb !important; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + resize: none; /*禁止拉伸*/ + border: none; /*去掉默认边框*/ + width: 100%; + height: 130px; + border: none; + display: block; +} + +.WordNumbernote { + padding: 0; + margin: 0; + list-style: none; + text-decoration: none; + box-sizing: border-box; + overflow: hidden; + height: auto; + border: 1px solid rgba(234, 234, 234, 1); + border-radius: 0.125rem; + margin: 10px 10px 0px 10px; + padding: 10px 10px 5px 10px; + backgroud: rgba(234, 234, 234, 1); + width: 335px; + +} + +.WordNumberTextarea-count { + display: inline-block; + float: right; + font-size: 16px; + color: #adadad; + padding-right: 0.25rem; +} + diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index d6e46fc5e..465f3d590 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1173,7 +1173,8 @@ class Listofworksstudentone extends Component { className: 'font-14', render: (text, record) => ( record.submitstate === "未提交" ? - this.Viewstudenttraininginformations()}>调分 : + this.Adjustment(record)}>调分 : this.Viewstudenttraininginformationt(record)}>查看 @@ -1504,7 +1505,8 @@ class Listofworksstudentone extends Component { className: 'font-14', render: (text, record) => ( record.submitstate === "未提交" ? - this.Viewstudenttraininginformations()}>调分 : + this.Adjustment(record)}>调分 : this.Viewstudenttraininginformationt(record)}>{record.operating} @@ -2801,14 +2803,14 @@ class Listofworksstudentone extends Component { this.setState({visible: false}) } // 调分 - Viewstudenttraininginformations = (e) => { - // console.log("Viewstudenttraininginformations2"); + Adjustment = (e) => { + // console.log("Adjustment"); // console.log(e.myid); this.setState({ visible: true, userid: e.myid, - // Tune: }) + } //确定 saveModulationModal = (value, num) => { @@ -3232,7 +3234,7 @@ class Listofworksstudentone extends Component {
    {visible === true ? this.cancelModulationModel()} Saves={(value, num) => this.saveModulationModal(value, num)} /> : ""} From eb815ef86309a6a703c269255165c6beaaecaa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 16:16:15 +0800 Subject: [PATCH 03/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/ModulationModal.js | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index 0dd0b2ec7..959ee9bbf 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -92,14 +92,16 @@ class ModulationModal extends Component{ }} placeholder="请填写分数" value={Inputsval} - onInput={this.setInputs}/> - + onInput={this.setInputs} + suffix={ + + } + />
    -

    调分后该学生的最终成绩将不会按照评分规则进行计算

    +

    调分后该学生的最终成绩将不会按照评分规则进行计算

    - 调分原因: + 调分原因: this.settextarea(e)} value={textareaval} maxlength={100} />
    -
    + From 2ff464202feadfc875eca10263ba7825ef497118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 16:26:24 +0800 Subject: [PATCH 04/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesPublic/ModulationModal.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index 959ee9bbf..b11aa4df7 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -130,11 +130,12 @@ class ModulationModal extends Component{
    From da9ba684301c7bdb362d53b3fe2e8954773a5616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 17:13:02 +0800 Subject: [PATCH 05/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 193 +++++++++++------- 1 file changed, 120 insertions(+), 73 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index f842a685b..08c95af6a 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -23,6 +23,7 @@ import './yslexercisetable.css'; import {getImageUrl, toPath, sortDirections} from 'educoder'; import CheckBoxGroup from "../../page/component/CheckBoxGroup"; import NoneData from '../../../modules/courses/coursesPublic/NoneData' +import ModulationModal from "../coursesPublic/ModulationModal"; const Search = Input.Search; const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; @@ -38,6 +39,7 @@ class Studentshavecompletedthelist extends Component { datas: [], page: 1, limit: 20, + testpapergradingboll: false, styletable: { "display": "block" }, @@ -1028,11 +1030,9 @@ class Studentshavecompletedthelist extends Component { render: (text, record) => ( {record.finalscore==="--"? - -- - :record.submitstate === "未提交"? - -- + this.Adjustment(record)} + >调分 : ( {record.finalscore==="--"? - -- - :record.submitstate === "未提交"? - -- + this.Adjustment(record)} + >调分 : { - // console.log('Page: '); + // //console.log('Page: '); if (this.state.loadingstate === false) { this.setState({ page: pageNumber, @@ -1271,7 +1269,7 @@ class Studentshavecompletedthelist extends Component { } paginationonChanges = (pageNumber) => { - // console.log('Page: '); + // //console.log('Page: '); if (this.state.loadingstate === false) { this.setState({ page: pageNumber, @@ -1292,12 +1290,12 @@ class Studentshavecompletedthelist extends Component { componentDidMount() { // if(this.props.isAdmin() === true){ // this.Teacherliststudentlistsy(); - // console.log("1111111111111111"); - // console.log(this.props.isAdmin()); + // //console.log("1111111111111111"); + // //console.log(this.props.isAdmin()); // }else { this.Teacherliststudentlist(); - // console.log("2222222222222"); - // console.log(this.props.isAdmin()); + // //console.log("2222222222222"); + // //console.log(this.props.isAdmin()); // } try { this.props.triggerRef(this); @@ -1313,10 +1311,10 @@ class Studentshavecompletedthelist extends Component { //试卷列表 Teacherliststudentlist = () => { - // console.log("Teacherliststudentlist"); // 764 + // //console.log("Teacherliststudentlist"); // 764 var thiss = this; var exercise_id = this.props.match.params.Id; - // console.log(731); // 764 935 + // //console.log(731); // 764 935 var url = `/exercises/${exercise_id}/exercise_lists.json`; axios.get((url), { params: { @@ -1342,7 +1340,7 @@ class Studentshavecompletedthelist extends Component { }) if (response.data.current_answer_user === undefined || response.data.current_answer_user === null) { // 学生未截止 - // console.log("试卷学生未截止"); + // //console.log("试卷学生未截止"); this.Generatenewdatas(response.data.exercise_users); if (response.data.exercise_types.subjective === 0) { if (this.state.noclassroom === undefined || this.state.noclassroom === "" || this.state.noclassroom === null) { @@ -1389,7 +1387,7 @@ class Studentshavecompletedthelist extends Component { } } else { //学生已截止 - // console.log("试卷学生已截止"); + // //console.log("试卷学生已截止"); if (response.data.exercise_types.subjective === 0) { if (this.state.loadingstate === false) { var arr =[]; @@ -1469,22 +1467,22 @@ class Studentshavecompletedthelist extends Component { } //老师 else if (response.data.exercise_types.user_permission === 0) { - // console.log(response.data.exercise_users) - // console.log(response) - // console.log("试卷老师加载中"); + // //console.log(response.data.exercise_users) + // //console.log(response) + // //console.log("试卷老师加载中"); if (thiss.state.loadingstate === false) { thiss.setState({ loadingstate: true, }) } - console.log(response); - console.log(1393); + //console.log(response); + //console.log(1393); thiss.Generatenewdatasy(response.data.exercise_users, response); } }).catch((error) => { - // console.log(error); - // console.log("其实数据加载失败了"); - // console.log("1111"); + // //console.log(error); + // //console.log("其实数据加载失败了"); + // //console.log("1111"); }); @@ -1495,9 +1493,9 @@ class Studentshavecompletedthelist extends Component { let datalist = []; let datalisttwo = []; var teacherlist = undefined; - // console.log("开始数据了"); + // //console.log("开始数据了"); if (exercise_users !== undefined) { - // console.log("开始打印数据了"); + // //console.log("开始打印数据了"); for (var i = 0; i < exercise_users.length; i++) { if (exercise_users[i].commit_status === 1) { datalist.push({ @@ -1574,9 +1572,9 @@ class Studentshavecompletedthelist extends Component { let datalist = []; var teacherlist = undefined; var noclassroom = undefined; - // console.log("开始数据了"); + // //console.log("开始数据了"); if (exercise_users !== undefined) { - // console.log("开始打印数据了"); + // //console.log("开始打印数据了"); for (var i = 0; i < exercise_users.length; i++) { datalist.push({ myid: exercise_users[i].login, @@ -1610,7 +1608,7 @@ class Studentshavecompletedthelist extends Component { } TablePagination = (e) => { - // console.log(e.current); + // //console.log(e.current); var teacherlist = { //分页 total: this.state.exercise_users.length, //数据总数量 pageSize: 20, //一页显示几条 @@ -1623,7 +1621,7 @@ class Studentshavecompletedthelist extends Component { } TablePaginations = (e) => { - // console.log(e.current); + // //console.log(e.current); var teacherlists = { //分页 total: this.state.exercise_users, //数据总数量 pageSize: 10, //一页显示几条 @@ -1639,7 +1637,7 @@ class Studentshavecompletedthelist extends Component { Searchdata = (order, commit_status, review, exercise_group_id, search, page, limit, order_type) => { var exercise_id = this.props.match.params.Id; - // console.log(731); // 764 935 + // //console.log(731); // 764 935 var url = `/exercises/${exercise_id}/exercise_lists.json`; var params = { order: order, @@ -1654,7 +1652,7 @@ class Studentshavecompletedthelist extends Component { axios.get(url, { params: params }).then((response) => { - // console.log(JSON.stringify(response)); + // //console.log(JSON.stringify(response)); this.setState({ Teacherliststudentlist: response.data, review: response.data.review, @@ -1702,7 +1700,7 @@ class Studentshavecompletedthelist extends Component { } this.Generatenewdata(response.data.exercise_users, response.data.current_answer_user); }).catch((error) => { - console.log(error) + //console.log(error) this.setState({ loadingstate: false, }) @@ -1717,9 +1715,9 @@ class Studentshavecompletedthelist extends Component { let datalist = []; var indexi = 0; var teacherlist = undefined; - // console.log("开始数据了"); + // //console.log("开始数据了"); if (exercise_users !== undefined) { - // console.log("开始打印数据了"); + // //console.log("开始打印数据了"); for (var i = 0; i < exercise_users.length; i++) { if (exercise_users[i].commit_status === 1) { datalist.push({ @@ -1767,7 +1765,7 @@ class Studentshavecompletedthelist extends Component { if (indexi === exercise_users.length) { //都没评论 不显示评论 if (response.data.exercise_types.groups_count > 0) { - // console.log("77771111111"); + // //console.log("77771111111"); //分班大于0显示分班 //7ge // this.state.columnsys.map((item,key)=>{ @@ -1854,8 +1852,8 @@ class Studentshavecompletedthelist extends Component { arr.push(item); } } - // console.log(thiss.state.columnsys); - // console.log(arr); + // //console.log(thiss.state.columnsys); + // //console.log(arr); this.setState({ data: datalist, @@ -1908,7 +1906,7 @@ class Studentshavecompletedthelist extends Component { } else { //包括主观题 if (indexi === exercise_users.length) { - console.log("2548包含主观题不包含分班"); + //console.log("2548包含主观题不包含分班"); if (response.data.exercise_types.groups_count > 0) { var arr =[]; @@ -1959,7 +1957,7 @@ class Studentshavecompletedthelist extends Component { }) } } else { - // console.log("2699包含主观题包含分班"); + // //console.log("2699包含主观题包含分班"); if (response.data.exercise_types.groups_count > 0) { this.setState({ data: datalist, @@ -2010,7 +2008,7 @@ class Studentshavecompletedthelist extends Component { TablePaginationsy = (e) => { - // console.log(e.current); + // //console.log(e.current); var teacherlist = { //分页 total: this.state.exercise_users.length, //数据总数量 pageSize: 20, //一页显示几条 @@ -2037,19 +2035,19 @@ class Studentshavecompletedthelist extends Component { order_type: order_type } }).then((response) => { - // console.log("528"); - // console.log(JSON.stringify(response)); + // //console.log("528"); + // //console.log(JSON.stringify(response)); if(response===undefined){ return } this.setState({ loadingstate: false, }) - // console.log(response); - // console.log(1997); + // //console.log(response); + // //console.log(1997); this.Generatenewdatasy(response.data.exercise_users, response); }).catch((error) => { - // console.log(error) + // //console.log(error) this.setState({ loadingstate: false, }) @@ -2101,9 +2099,9 @@ class Studentshavecompletedthelist extends Component { this.Searchdatasys(this.state.order, undefined, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } checkeboxstwo = (checkedValues, data) => { - // console.log(checkedValues) + // //console.log(checkedValues) if (JSON.stringify(checkedValues) === "[]") { - // console.log(checkedValues); + // //console.log(checkedValues); if (this.state.loadingstate === false) { this.setState({ loadingstate: true, @@ -2138,7 +2136,7 @@ class Studentshavecompletedthelist extends Component { this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } else { - // console.log(checkedValues); + // //console.log(checkedValues); this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); if (this.state.loadingstate === false) { this.setState({ @@ -2160,7 +2158,7 @@ class Studentshavecompletedthelist extends Component { } notlimitedst = () => { - // console.log(); + // //console.log(); // var datas=this.state.course_groups; // for(var ik=0;ik { - // console.log(checkedValues); + // //console.log(checkedValues); if (JSON.stringify(checkedValues) === "[]") { - // console.log(checkedValues); + // //console.log(checkedValues); if (this.state.loadingstate === false) { this.setState({ course_groupysls: undefined, @@ -2297,7 +2295,7 @@ class Studentshavecompletedthelist extends Component { this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type) } else { - // console.log(checkedValues); + // //console.log(checkedValues); if (this.state.loadingstate === false) { this.setState({ checkedValuesineinfo: checkedValues, @@ -2325,7 +2323,7 @@ class Studentshavecompletedthelist extends Component { onSearchKeywordKeyUp = (e) => { if (e.keyCode === 13) { // this.onSearch(); - // console.log("使用了回车键"); + // //console.log("使用了回车键"); // if(this.state.searchtext === ""){ // message.error("请输入姓名或学号搜索"); // return @@ -2356,7 +2354,7 @@ class Studentshavecompletedthelist extends Component { this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, value, 1, this.state.limit, this.state.order_type); // this.Startsorting(this.state.order,this.state.checkedValuesine,this.state.checkedValuesineinfo,value); - // console.log(value) + // //console.log(value) }; @@ -2375,7 +2373,7 @@ class Studentshavecompletedthelist extends Component { //搜索学生 文字输入 inputSearchValues = (e) => { - // console.log(e.target.value) + // //console.log(e.target.value) if (e.target.value === "") { this.setState({ searchtext: undefined, @@ -2563,19 +2561,63 @@ class Studentshavecompletedthelist extends Component { setExerciseReviewAndAnswer = () => { } + // 调分 + Adjustment = (e) => { + // console.log("Adjustment"); + // console.log(e.myid); + this.setState({ + testpapergradingboll: true, + exeuserid: e.user_id, + }) + + } + //调分窗 + Adjustments = () => { + //弹出弹框 + this.setState({ + testpapergradingboll: false + }) + + } + + //试卷调分 + Testpapergrading = (v, n) => { + var exercise_id = this.props.match.params.Id; + let url = `/exercise_questions/${exercise_id}/adjust_score.json`; + axios.post(url, { + score: n, + user_id: this.state.exeuserid, + comment: v, + }) + .then((response) => { + if (response.data.status == '0') { + this.setState({testpapergradingboll: false}); + this.props.showNotification('调分成功'); + this.Teacherliststudentlist(); + } + }) + .catch(function (error) { + console.log(error); + this.setState({testpapergradingboll: false}) + }); + + + } + + render() { const isAdmin = this.props.isAdmin(); - let {data, datas, page, columns, course_groupyslsthree, columnstwo, styletable,exercise_status, course_groupyslstwodatas, limit, course_groupysls, course_groupyslstwodata, course_groupyslstwo, teacherlists, Teacherliststudentlist, order, columnss, course_groupsdatas, course_groups, Evaluationarray, unlimited, unlimiteds, unlimitedtwo, teacherlist, searchtext, loadingstate, review, nocomment, commented, unsubmitted, submitted, columnsys, exercise_users,mylistansum} = this.state; - // console.log("Studentshavecompletedthelist"); - // console.log(this.props.current_status); - // console.log("获取到的数据"); - // console.log(datas); - // console.log(data); - // console.log("this.props.Commonheadofthetestpaper.exercise_status"); - // console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status); - // console.log(exercise_status); + let {data, datas, page, columns, course_groupyslsthree, columnstwo, styletable, exercise_status, course_groupyslstwodatas, limit, course_groupysls, course_groupyslstwodata, course_groupyslstwo, teacherlists, Teacherliststudentlist, order, columnss, course_groupsdatas, course_groups, Evaluationarray, unlimited, unlimiteds, unlimitedtwo, teacherlist, searchtext, loadingstate, review, nocomment, commented, unsubmitted, submitted, columnsys, exercise_users, mylistansum, testpapergradingboll} = this.state; + // //console.log("Studentshavecompletedthelist"); + // //console.log(this.props.current_status); + // //console.log("获取到的数据"); + // //console.log(datas); + // //console.log(data); + // //console.log("this.props.Commonheadofthetestpaper.exercise_status"); + // //console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status); + // //console.log(exercise_status); return ( isAdmin === true ? ( @@ -2591,6 +2633,11 @@ class Studentshavecompletedthelist extends Component { :
    + {testpapergradingboll === true ? this.Adjustments()} + Saves={(value, num) => this.Testpapergrading(value, num)} + /> : ""}
      From 5d9e4966f97b639f2d14c48153d9ab073e098dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 17:54:44 +0800 Subject: [PATCH 06/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- .../modules/courses/coursesPublic/ModulationModal.js | 10 ++++++++-- .../courses/exercise/Studentshavecompletedthelist.js | 9 +++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index c0dbc6687..bd25f6977 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -243,4 +243,4 @@ function initOnlineOfflineListener() { '网络异常,请检测网络后重试。', }) }); -} \ No newline at end of file +} diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index b11aa4df7..d203470c0 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -81,11 +81,16 @@ class ModulationModal extends Component{ display: "flex", flexDirection: "initial", }}> + *调分: + }}>*调分: {this.props.Cancelname || '取消'} diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 08c95af6a..e997b834a 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1242,6 +1242,7 @@ class Studentshavecompletedthelist extends Component { ],//columnsystwo 也会被columnsys当作参数接收 exercise_status:0, order_type: "desc", + exeuserid: 0, } // //console.log("Studentshavecompletedthelist"); // //console.log(props.current_status); @@ -1732,7 +1733,8 @@ class Studentshavecompletedthelist extends Component { completion: exercise_users[i].objective_score === undefined ? "--" : exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, - finalscore: "评阅" + finalscore: "评阅", + user_id: exercise_users[i].user_id }) } else { datalist.push({ @@ -1747,7 +1749,8 @@ class Studentshavecompletedthelist extends Component { completion: exercise_users[i].objective_score === undefined ? "--" : exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, - finalscore: "--" + finalscore: "--", + user_id: exercise_users[i].user_id }) indexi++; } @@ -2563,8 +2566,6 @@ class Studentshavecompletedthelist extends Component { } // 调分 Adjustment = (e) => { - // console.log("Adjustment"); - // console.log(e.myid); this.setState({ testpapergradingboll: true, exeuserid: e.user_id, From 212fdbd900fef273c6446c0d83d23ae158ce3735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 6 Nov 2019 10:02:52 +0800 Subject: [PATCH 07/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E8=B0=83=E5=88=86=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/ModulationModal.js | 49 ++++++++++++++++--- .../courses/coursesPublic/Newshixunmodel.css | 8 +++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index d203470c0..a1d354e78 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -29,11 +29,21 @@ class ModulationModal extends Component{ }) if(Inputsval===undefined||Inputsval===""){ - this.setState({ - Inputsvaltype:true - }) + this.setState({ + Inputsval: "", + Inputsvaltype: true, + Inputsvaltest: "请输入分数", + }) return } + + if (this.state.Inputsvaltype === true) { + return; + } + this.setState({ + Inputsvaltype: false, + Inputsvaltest: "", + }) this.props.Saves(textareaval,Inputsval) } @@ -45,21 +55,34 @@ class ModulationModal extends Component{ } setInputs=(e)=>{ + debugger var value=parseInt(e.target.value) if(isNaN(value)){ - value=0 + value = 0; + this.setState({ + Inputsval: value, + Inputsvaltype: true, + Inputsvaltest: "请输入分数", + }) }else{ if(value<0||value>100){ - value=0 + value = 0; + this.setState({ + Inputsval: value, + Inputsvaltype: true, + Inputsvaltest: "请输入0-100的分数", + }) + } } this.setState({ - Inputsval:value + Inputsval: value, + Inputsvaltype: false, }) } render(){ - let {textareaval,Inputsval,textareavaltype,Inputsvaltype}=this.state; + let {textareaval, Inputsval, textareavaltype, Inputsvaltype, Inputsvaltest} = this.state; return(
      + + *调分: -
      + { + Inputsvaltype === true ? +

      {Inputsvaltest}

      + : "" + } +
      Date: Wed, 6 Nov 2019 11:14:40 +0800 Subject: [PATCH 08/45] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/exercise/Studentshavecompletedthelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index e997b834a..90c76ee68 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -2584,7 +2584,7 @@ class Studentshavecompletedthelist extends Component { //试卷调分 Testpapergrading = (v, n) => { var exercise_id = this.props.match.params.Id; - let url = `/exercise_questions/${exercise_id}/adjust_score.json`; + let url = `/exercises/${exercise_id}/adjust_score.json`; axios.post(url, { score: n, user_id: this.state.exeuserid, From dbe0b46660c2186e979e85147f1e9af059b61ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 6 Nov 2019 11:23:54 +0800 Subject: [PATCH 09/45] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/coursesPublic/ModulationModal.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index a1d354e78..4a679b515 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -117,15 +117,15 @@ class ModulationModal extends Component{ color: " #f5222d", }}>*调分: Date: Wed, 6 Nov 2019 11:28:58 +0800 Subject: [PATCH 10/45] =?UTF-8?q?=E8=AF=95=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkList.js | 20 ++++++++++++------- .../tasks/GraduationTaskssettinglist.js | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index e5046a9d5..40102866c 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -363,8 +363,8 @@ function buildColumns(that, student_works, studentData) { {/**/} {/**/} { isAdmin && 调整学生最终成绩
      其它历史评分将全部失效}> - that.showModulationModal(record)} + that.showModulationModal(record)} >调分
      } {/* toWorkDetailPage */} @@ -748,11 +748,17 @@ class CommonWorkList extends Component{ isPublish={true} doWhenSuccess={this.doWhenSuccess}> - this.saveModulationModal(value,num)} - /> + + { + modulationModalVisible === true ? + this.saveModulationModal(value, num)} + /> + : "" + } + {/* 内容区 */} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 43bb9ba0b..2d2b88a0a 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -900,8 +900,8 @@ class GraduationTaskssettinglist extends Component{ {tag.name} : - this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}> + this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}> {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name} } From 50870e01b347db0f530c156287d7a87e03e615ce Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 14:13:18 +0800 Subject: [PATCH 11/45] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=88=90=E7=BB=A9?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...91106055638_migrate_2808_exercise_score.rb | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 db/migrate/20191106055638_migrate_2808_exercise_score.rb diff --git a/db/migrate/20191106055638_migrate_2808_exercise_score.rb b/db/migrate/20191106055638_migrate_2808_exercise_score.rb new file mode 100644 index 000000000..ebf09e148 --- /dev/null +++ b/db/migrate/20191106055638_migrate_2808_exercise_score.rb @@ -0,0 +1,111 @@ +class Migrate2808ExerciseScore < ActiveRecord::Migration[5.2] + def challenge_path(path) + cha_path = path.present? ? path.split(";") : [] + cha_path.reject(&:blank?)[0].try(:strip) + end + + # 版本库文件内容,带转码 + def git_fle_content(repo_path, path) + begin + Rails.logger.info("git file content: repo_path is #{repo_path}, path is #{path}") + + content = GitService.file_content(repo_path: repo_path, path: path) + + Rails.logger.info("git file content: content is #{content}") + decode_content = nil + if content.present? + content = content["content"] #6.24 -hs 这个为新增,因为当实训题里含有选择题时,这里会报错,undefined method `[]' for nil:NilClass + + content = Base64.decode64(content) + cd = CharDet.detect(content) + Rails.logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}" + # 字符编码问题,GB18030编码识别率不行 + decode_content = + if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 + content.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '}) + else + content.force_encoding('UTF-8') + end + end + + decode_content + + rescue Exception => e + Rails.logger.error(e.message) + raise Educoder::TipException.new("文档内容获取异常") + end + end + + def calculate_student_score(exercise,user) + score5 = 0.0 #实训题 + exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges) + exercise_questions.each do |q| + if q.question_type == 5 + q.exercise_shixun_challenges.each do |exercise_cha| + game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡 + if game.present? + exercise_cha_score = 0.0 + answer_status = 0 + # if game.status == 2 && game.final_score >= 0 + if game.final_score > 0 && game.end_time < exercise.end_time + exercise_cha_score = game.real_score(exercise_cha.question_score) + # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 + answer_status = 1 + end + ex_shixun_answer_content = exercise_cha.exercise_shixun_answers.where(user_id:user.id,exercise_question_id:q.id) + code = nil + if exercise_cha.challenge&.path.present? + cha_path = challenge_path(exercise_cha.challenge&.path) + game_challenge = game.game_codes.search_challenge_path(cha_path)&.first + if game_challenge.present? + game_code = game_challenge + code = game_code.try(:new_code) + else + begin + code = git_fle_content(game.myshixun.repo_path,cha_path) + rescue + code = "" + end + end + end + if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 + ### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了?涉及到code的多个版本库的修改 + sx_option = { + :exercise_question_id => q.id, + :exercise_shixun_challenge_id => exercise_cha.id, + :user_id => user.id, + :score => exercise_cha_score.round(1), + :answer_text => code, + :status => answer_status + } + ExerciseShixunAnswer.create!(sx_option) + else + ex_shixun_answer_content.first.update_attributes!(score:exercise_cha_score.round(1),answer_text:code,status:answer_status) + end + score5 += exercise_cha_score + else + score5 += 0.0 + end + end + end + end + score5 + end + + def change + exercise = Exercise.find_by(id: 2808) + if exercise + exercise_users = exercise.exercise_users.where("start_at is not null and commit_status = 0") + exercise_users.each do |exercise_user| + calculate_score = calculate_student_score(exercise, exercise_user.user) + subjective_score = exercise_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + if exercise_user.end_at.nil? + exercise_user.update_attributes!(score:total_score,objective_score:calculate_score,end_at:exercise.end_time,commit_status:1,status:1,commit_method:3) + end + puts exercise_user.id + end + end + end +end From 5aeac0a802f31e87b0245bafd8e0beeace08a55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 15:44:20 +0800 Subject: [PATCH 12/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9Bbanne?= =?UTF-8?q?r=E6=8A=A5=E5=90=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionCommon.css | 4 +++ .../Competitioncommon/CompetitionCommon.js | 34 +++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css index f55c9a336..7603137e0 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css @@ -399,4 +399,8 @@ .color000{ color: #000; +} + +.cursorpointer{ + cursor: pointer; } \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index ed129d8bd..86f22bcda 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -224,6 +224,18 @@ class CompetitionCommon extends Component{ Competitionedittype:false }) + } + newgotocourse=(url)=>{ + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + if(this.props.checkIfProfileCompleted()===false){ + this.props.showProfileCompleteDialog() + return + } + window.open(url); + } gotocourse=(url)=>{ @@ -267,7 +279,7 @@ class CompetitionCommon extends Component{ let urls = `/competitions/${this.props.match.params.identifier}/enroll`; this.Personalregistration(urls) } else { - this.props.history.replace(url); + window.open(url); } } @@ -379,8 +391,24 @@ class CompetitionCommon extends Component{ className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status === "nearly_published" ? "--" : data && data.visits_count}
      -
      this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status === "nearly_published" ? "--" : data && data.member_count}
      + + {data.competition_status === "ended" ? +
      this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + onClick={ data.mode === 2 ?() => this.newgotocourse(`/courses/${data.course_id}`):() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + >{data && data.member_count}
      + :data.competition_status === "nearly_published" ? +
      this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + >{"--"}
      : + data.competition_status === "progressing" ? + data.mode === 2 ? +
      this.gotocourse()}>{data && data.member_count}
      : signupdata && signupdata.personal === true ? +
      this.gotocourse("personal")}>{data && data.member_count}
      :
      this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data && data.member_count}
      + :""} + From f296827ec0065b43908da210878ece7ed7744045 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 15:44:31 +0800 Subject: [PATCH 13/45] =?UTF-8?q?=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 37c524f63..71d54be8b 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -82,8 +82,9 @@ class AccountsController < ApplicationController password_ok = @user.check_password?(params[:password].to_s) unless password_ok + normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会") login_control.increment! - return normal_status(-2, "你已经输错密码#{login_control.error_times}次,还剩余#{login_control.remain_times}次机会") + return end successful_authentication(@user) From 4130200b397b6a46e5b6e65a9ac85149bd003872 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 15:49:13 +0800 Subject: [PATCH 14/45] =?UTF-8?q?=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E6=8F=90=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 71d54be8b..d93327d78 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -82,7 +82,11 @@ class AccountsController < ApplicationController password_ok = @user.check_password?(params[:password].to_s) unless password_ok - normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会") + if login_control.remain_times-1 == 0 + normal_status(-2, "连续输错密码达到#{login_control.error_times+1}次,账号将被锁定") + else + normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会") + end login_control.increment! return end From 23edade8f1974f93098bf0641ec30be3135a0854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 16:04:30 +0800 Subject: [PATCH 15/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9Bbanne?= =?UTF-8?q?r=E6=8A=A5=E5=90=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionCommon.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index 86f22bcda..301fc8c1c 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -267,7 +267,7 @@ class CompetitionCommon extends Component{ ).then((response) => { if (response.data.status === 0) { // this.props.history.replace(); - this.Personalregistration(`/courses/${data.course_id}`) + window.open(`/courses/${data.course_id}`); } }) @@ -393,9 +393,9 @@ class CompetitionCommon extends Component{ {data.competition_status === "ended" ? -
      this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} - onClick={ data.mode === 2 ?() => this.newgotocourse(`/courses/${data.course_id}`):() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + onClick={ data.mode === 2 ?data.member_of_course==true?() => this.newgotocourse(`/courses/${data.course_id}`):"":() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} >{data && data.member_count}
      :data.competition_status === "nearly_published" ?
      Date: Wed, 6 Nov 2019 16:09:31 +0800 Subject: [PATCH 16/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionCommon.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index 301fc8c1c..24792e137 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -267,7 +267,9 @@ class CompetitionCommon extends Component{ ).then((response) => { if (response.data.status === 0) { // this.props.history.replace(); + this.getbannerdata() window.open(`/courses/${data.course_id}`); + } }) @@ -305,6 +307,7 @@ class CompetitionCommon extends Component{ if (response.data) { this.props.showNotification(`报名成功,预祝您夺得桂冠!`); // this.props.history.replace(urls); + this.getbannerdata() window.open(urls) } } From f56d0734150d7543d1fe31d684d709e9296d9cad Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 6 Nov 2019 16:16:50 +0800 Subject: [PATCH 17/45] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/modal/RealNameCertificationModal.js | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index cc5bfc2c6..8309cc5ca 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -44,6 +44,7 @@ class RealNameCertificationModal extends Component{ this.state={ identity:"teacher", departmentsName:undefined, + fileID:undefined, filterSchoolList:undefined, filterDepartments :undefined, school:undefined, @@ -269,7 +270,8 @@ class RealNameCertificationModal extends Component{ axios.post((url),{ name:values.name || basicInfo.name, gender:parseInt(values.sex), - id_number:values.credentials + id_number:values.credentials, + attachment_ids:[this.state.fileID] }).then((result)=>{ if(result){ this.props.showNotification("申请已提交,请等待审核!"); @@ -295,7 +297,8 @@ class RealNameCertificationModal extends Component{ school_id:this.state.school_id, department_id:this.state.department_id, identity:this.state.identity, - extra: values.job == "student" ? values.student_No : values.job == "teacher" ? values.job1 : values.job2 + extra: values.job == "student" ? values.student_No : values.job == "teacher" ? values.job1 : values.job2, + attachment_ids:[this.state.fileID] }).then((result)=>{ if(result){ this.props.showNotification("申请已提交,请等待审核!"); @@ -327,20 +330,7 @@ class RealNameCertificationModal extends Component{ const { course_lists, checkBoxValues } = this.state this.onSendOk() } - - handleChange = (info) => { - if (info.file.status === 'uploading') { - this.setState({ loading: true }); - return; - } - if (info.file.status === 'done') { - // Get this url from response in real world. - getBase64(info.file.originFileObj, imageUrl => this.setState({ - imageUrl, - loading: false, - })); - } - } + handleChange2 = (info) => { if (info.file.status === 'uploading') { this.setState({ loading: true }); @@ -348,9 +338,11 @@ class RealNameCertificationModal extends Component{ } if (info.file.status === 'done') { // Get this url from response in real world. + console.log(info.file.response); getBase64(info.file.originFileObj, imageUrl2 => this.setState({ imageUrl2, loading: false, + fileID:info.file.response && info.file.response.id })); } } From 913db26a8cef9fb022fbfee8127117fa69db3855 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 6 Nov 2019 16:23:18 +0800 Subject: [PATCH 18/45] competition certificate entry --- app/controllers/competitions/competitions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/competitions/competitions_controller.rb b/app/controllers/competitions/competitions_controller.rb index 1eaa0dc22..6ab7e83a0 100644 --- a/app/controllers/competitions/competitions_controller.rb +++ b/app/controllers/competitions/competitions_controller.rb @@ -46,7 +46,7 @@ class Competitions::CompetitionsController < Competitions::BaseController @competition_modules = @competition.unhidden_competition_modules # 未登录、未获奖用户,不展示获奖证书栏目 - if !current_user.logged? || !current_competition.finished? || !current_competition.competition_prize_users.exists?(user: current_user) + if !current_user.logged? || !current_competition.finished? || (!current_competition.competition_prize_users.exists?(user: current_user) && !current_user.admin_or_business?) @competition_modules = @competition_modules.select { |mod| mod.name != '获奖证书' } end From d2eeb28e4235edb830699e4170705f1a30027250 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:26:17 +0800 Subject: [PATCH 19/45] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=92=8C=E8=81=8C=E4=B8=9A=E8=AE=A4=E8=AF=81=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 1 + app/models/apply_user_authentication.rb | 1 + .../admins/identity_auths/agree_apply_service.rb | 3 ++- .../admins/identity_auths/refuse_apply_service.rb | 3 ++- .../admins/professional_auths/agree_apply_service.rb | 3 ++- .../admins/professional_auths/refuse_apply_service.rb | 3 ++- app/services/users/apply_authentication_service.rb | 6 ++++-- app/services/users/apply_professional_auth_service.rb | 6 ++++-- .../identity_authentications/shared/_list.html.erb | 4 ++-- .../professional_authentications/shared/_list.html.erb | 10 +++++----- 10 files changed, 25 insertions(+), 15 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 258ab9d83..da6e99418 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -191,6 +191,7 @@ class AttachmentsController < ApplicationController candown = current_user.member_of_course?(course) end tip_exception(403, "您没有权限进入") if course.present? && !candown + tip_exception(403, "您没有权限进入") if @file.container.is_a?(ApplyUserAuthentication) end end end diff --git a/app/models/apply_user_authentication.rb b/app/models/apply_user_authentication.rb index 4f94202f6..ad74b0261 100644 --- a/app/models/apply_user_authentication.rb +++ b/app/models/apply_user_authentication.rb @@ -4,6 +4,7 @@ class ApplyUserAuthentication < ApplicationRecord belongs_to :user has_many :tidings, :as => :container, :dependent => :destroy + has_one :attachment, as: :container, dependent: :destroy scope :real_name_auth, -> { where(auth_type: 1) } scope :professional_auth, -> { where(auth_type: 2) } diff --git a/app/services/admins/identity_auths/agree_apply_service.rb b/app/services/admins/identity_auths/agree_apply_service.rb index 65a3b2376..d75a6d7db 100644 --- a/app/services/admins/identity_auths/agree_apply_service.rb +++ b/app/services/admins/identity_auths/agree_apply_service.rb @@ -14,7 +14,8 @@ class Admins::IdentityAuths::AgreeApplyService < ApplicationService RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500) deal_tiding! - delete_auth_file! + apply.attachment&.destroy + # delete_auth_file! end end diff --git a/app/services/admins/identity_auths/refuse_apply_service.rb b/app/services/admins/identity_auths/refuse_apply_service.rb index 57581dd40..7ac2e6c38 100644 --- a/app/services/admins/identity_auths/refuse_apply_service.rb +++ b/app/services/admins/identity_auths/refuse_apply_service.rb @@ -12,7 +12,8 @@ class Admins::IdentityAuths::RefuseApplyService < ApplicationService apply.update!(status: 2, remarks: reason) deal_tiding! - delete_auth_file! + apply.attachment&.destroy + # delete_auth_file! end end diff --git a/app/services/admins/professional_auths/agree_apply_service.rb b/app/services/admins/professional_auths/agree_apply_service.rb index 81654f0d3..1ca2da2fc 100644 --- a/app/services/admins/professional_auths/agree_apply_service.rb +++ b/app/services/admins/professional_auths/agree_apply_service.rb @@ -14,7 +14,8 @@ class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500) deal_tiding! - delete_auth_file! + apply.attachment&.destroy + # delete_auth_file! end end diff --git a/app/services/admins/professional_auths/refuse_apply_service.rb b/app/services/admins/professional_auths/refuse_apply_service.rb index b5332c999..a055488c3 100644 --- a/app/services/admins/professional_auths/refuse_apply_service.rb +++ b/app/services/admins/professional_auths/refuse_apply_service.rb @@ -12,7 +12,8 @@ class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService apply.update!(status: 2, remarks: reason) deal_tiding! - delete_auth_file! + apply.attachment&.destroy + # delete_auth_file! end end diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index c68260dcb..cab76b45c 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -22,9 +22,11 @@ class Users::ApplyAuthenticationService < ApplicationService user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present? - user.apply_user_authentication.create!(auth_type: 1, status: 0) + apply = user.apply_user_authentication.create!(auth_type: 1, status: 0) - move_image_file! unless params[:upload_image].to_s == 'false' + Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids] + + # move_image_file! unless params[:upload_image].to_s == 'false' end # sms_notify_admin diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index 46a4658aa..81cd11a4c 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -34,9 +34,11 @@ class Users::ApplyProfessionalAuthService < ApplicationService user.save! extension.save! - user.apply_user_authentication.create!(auth_type: 2, status: 0) + apply = user.apply_user_authentication.create!(auth_type: 2, status: 0) - move_image_file! unless params[:upload_image].to_s == 'false' + Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids] + + # move_image_file! unless params[:upload_image].to_s == 'false' end # sms_notify_admin diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb index c40d681ec..e1c603215 100644 --- a/app/views/admins/identity_authentications/shared/_list.html.erb +++ b/app/views/admins/identity_authentications/shared/_list.html.erb @@ -51,8 +51,8 @@ <% unless is_processed %> - <% if File.exists?(disk_real_name_auth_filename(user.id)) %> - <%= image_tag(real_name_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <% if apply.attachment %> + <%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> <% else %> <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> <% end %> diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb index 79cf31aad..b80d0422f 100644 --- a/app/views/admins/professional_authentications/shared/_list.html.erb +++ b/app/views/admins/professional_authentications/shared/_list.html.erb @@ -48,11 +48,11 @@ <% unless is_processed %> - <% if File.exists?(disk_professional_auth_filename(user.id)) %> - <%= image_tag(professional_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> - <% else %> - <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> - <% end %> + <%# if apply.attachment %> + <%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <%# else %> + <%#= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <%# end %> <% end %> From 1130395f94e8b7ac162f171983f3807f41e83afd Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 6 Nov 2019 16:26:37 +0800 Subject: [PATCH 20/45] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/readme.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/page/readme.txt b/public/react/src/modules/page/readme.txt index f5e5646e9..dc22a971b 100644 --- a/public/react/src/modules/page/readme.txt +++ b/public/react/src/modules/page/readme.txt @@ -221,4 +221,8 @@ TPI SSH VNCDisplay - 使用的github上的代码 https://github.com/novnc/noVNC/ \ No newline at end of file + 使用的github上的代码 https://github.com/novnc/noVNC/ + + +tpi拖拽改变视图大小代码: +js_min_all.js中搜索 doc.live('mousemove touchmove',function(e){ \ No newline at end of file From 983ae533f6c407b873fca62762b42c6becb3aa3c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 6 Nov 2019 16:26:44 +0800 Subject: [PATCH 21/45] hasGroupModule = () => { --- public/react/src/modules/courses/members/studentsList.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 91427534f..ac0f81356 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -107,7 +107,7 @@ const buildColumns = (that,isParent) => { } ]; - if (course_groups && course_groups.length) { + if (that.hasGroupModule()) { that.isStudentPage && columns.push({ title: '分班', dataIndex: 'course_group_name', @@ -249,6 +249,13 @@ class studentsList extends Component{ console.log(error) }); } + hasGroupModule = () => { + const { course_modules } = this.props; + const result = course_modules && course_modules.filter( item => { + return item.type == 'course_group' + }) + return result && result.length > 0 + } Downloadcal=()=>{ this.setState({ From d716950127ba22bf7dca94c88ce5183789dda08c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:27:26 +0800 Subject: [PATCH 22/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../professional_authentications/shared/_list.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb index b80d0422f..0bf8ea4a3 100644 --- a/app/views/admins/professional_authentications/shared/_list.html.erb +++ b/app/views/admins/professional_authentications/shared/_list.html.erb @@ -48,11 +48,11 @@ <% unless is_processed %> - <%# if apply.attachment %> + <% if apply.attachment %> <%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> - <%# else %> - <%#= content_tag(:span, '图片已删除', class: 'text-secondary') %> - <%# end %> + <% else %> + <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <% end %> <% end %> From 792dc9a6ac70dc075239043efe107dbf72db369f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:29:11 +0800 Subject: [PATCH 23/45] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/students.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/students.json.jbuilder b/app/views/courses/students.json.jbuilder index 2790a81fc..93d05b623 100644 --- a/app/views/courses/students.json.jbuilder +++ b/app/views/courses/students.json.jbuilder @@ -5,7 +5,7 @@ json.students do json.name student.user.try(:real_name) json.name_link user_path(student.user) json.student_id student.user.try(:student_id) - json.course_group_name student.course_group.try(:name) + json.course_group_name student.course_group_name json.course_member_id student.id if @user_course_identity < Course::ASSISTANT_PROFESSOR && !params[:course_group_id].present? json.member_roles student.user.course_role(@course) From dd9887348031db93d221665d7ef8fa9ff71913e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 16:30:55 +0800 Subject: [PATCH 24/45] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionCommon.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index 24792e137..eb8e661a4 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -72,16 +72,19 @@ class CompetitionCommon extends Component{ } //获取头部信息 getbannerdata=()=>{ - let menuid=this.props.location.search.replace('?menu=', ''); + // let menuid=this.props.location.search.replace('?menu=', ''); + let query=this.props.location&&this.props.location.search; + const types = query.split('&') + const menuid = types[0].split('?menu=') let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; axios.get(url).then((response) => { if(response.status===200){ this.setState({ data: response.data, - thiskeys: menuid === undefined || menuid === "" ? response.data.competition_modules[0].id : menuid, + thiskeys: menuid[1] === undefined || menuid[1] === "" ? response.data.competition_modules[0].id : menuid[1], mode: response.data.mode }) - if(menuid===undefined||menuid===""){ + if(menuid[1]===undefined||menuid[1]===""){ this.getrightdata( response.data.competition_modules[0].id, response.data.competition_modules[0].module_type, @@ -91,7 +94,7 @@ class CompetitionCommon extends Component{ }else{ let newlist=response.data.competition_modules; newlist.map((item,key)=>{ - if(`${item.id}`===`${menuid}`){ + if(`${item.id}`===`${menuid[1]}`){ this.getrightdata( item.id, item.module_type, From 3ac2f1501224f99cb9ca476eba1001361ccd9224 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:33:35 +0800 Subject: [PATCH 25/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/authentication_applies_controller.rb | 2 +- app/controllers/users/professional_auth_applies_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/authentication_applies_controller.rb b/app/controllers/users/authentication_applies_controller.rb index 6a2c20893..8ded7be8b 100644 --- a/app/controllers/users/authentication_applies_controller.rb +++ b/app/controllers/users/authentication_applies_controller.rb @@ -17,6 +17,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController private def create_params - params.permit(:name, :gender, :id_number, :upload_image) + params.permit(:name, :gender, :id_number, :upload_image, :attachment_ids) end end \ No newline at end of file diff --git a/app/controllers/users/professional_auth_applies_controller.rb b/app/controllers/users/professional_auth_applies_controller.rb index 5a9d305ff..ea546f047 100644 --- a/app/controllers/users/professional_auth_applies_controller.rb +++ b/app/controllers/users/professional_auth_applies_controller.rb @@ -17,6 +17,6 @@ class Users::ProfessionalAuthAppliesController < Users::BaseAccountController private def create_params - params.permit(:school_id, :department_id, :identity, :extra, :upload_image) + params.permit(:school_id, :department_id, :identity, :extra, :upload_image, :attachment_ids) end end \ No newline at end of file From 7b4686d80894e0e180f08b74ff0a5ba6ed5fac36 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 16:37:30 +0800 Subject: [PATCH 26/45] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index d93327d78..2d1b39590 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -78,12 +78,12 @@ class AccountsController < ApplicationController return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked? login_control = LimitForbidControl::UserLogin.new(@user) - return normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回登录密码,") if login_control.forbid? + return normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码") if login_control.forbid? password_ok = @user.check_password?(params[:password].to_s) unless password_ok if login_control.remain_times-1 == 0 - normal_status(-2, "连续输错密码达到#{login_control.error_times+1}次,账号将被锁定") + normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码") else normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会") end From 9c722933baf360aca29b7764b0c93f361b2f8803 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:39:59 +0800 Subject: [PATCH 27/45] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/users/apply_authentication_form.rb | 3 ++- app/forms/users/apply_professional_auth_form.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/forms/users/apply_authentication_form.rb b/app/forms/users/apply_authentication_form.rb index e9bd1b793..a16a884c8 100644 --- a/app/forms/users/apply_authentication_form.rb +++ b/app/forms/users/apply_authentication_form.rb @@ -1,10 +1,11 @@ class Users::ApplyAuthenticationForm include ActiveModel::Model - attr_accessor :name, :id_number, :gender, :upload_image + attr_accessor :name, :id_number, :gender, :upload_image, :attachment_ids validates :name, presence: true validate :validate_ID_number + validates :attachment_ids, presence: true def validate_ID_number diff --git a/app/forms/users/apply_professional_auth_form.rb b/app/forms/users/apply_professional_auth_form.rb index c5de9700c..a8910482d 100644 --- a/app/forms/users/apply_professional_auth_form.rb +++ b/app/forms/users/apply_professional_auth_form.rb @@ -1,10 +1,11 @@ class Users::ApplyProfessionalAuthForm include ActiveModel::Model - attr_accessor :school_id, :department_id, :identity, :extra, :upload_image + attr_accessor :school_id, :department_id, :identity, :extra, :upload_image, :attachment_ids validates :school_id, presence: true, numericality: { only_integer: true, greater_than: 0 } validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true validates :identity, presence: true, inclusion: { in: %w(student teacher professional) } validates :extra, presence: true + validates :attachment_ids, presence: true end \ No newline at end of file From d1b449b8af1338223f3829bab8b5bb18af2a8ced Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:45:05 +0800 Subject: [PATCH 28/45] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/users/apply_authentication_form.rb | 8 +++++++- app/forms/users/apply_professional_auth_form.rb | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/forms/users/apply_authentication_form.rb b/app/forms/users/apply_authentication_form.rb index a16a884c8..39a9a9e9d 100644 --- a/app/forms/users/apply_authentication_form.rb +++ b/app/forms/users/apply_authentication_form.rb @@ -5,7 +5,7 @@ class Users::ApplyAuthenticationForm validates :name, presence: true validate :validate_ID_number - validates :attachment_ids, presence: true + validates :validate_attachment_ids def validate_ID_number @@ -13,4 +13,10 @@ class Users::ApplyAuthenticationForm raise("身份证格式不对") end end + + def validate_attachment_ids + unless attachment_ids.is_a?(Array) || attachment_ids.length != 1 + raise("图片参数不对") + end + end end \ No newline at end of file diff --git a/app/forms/users/apply_professional_auth_form.rb b/app/forms/users/apply_professional_auth_form.rb index a8910482d..1481b12cf 100644 --- a/app/forms/users/apply_professional_auth_form.rb +++ b/app/forms/users/apply_professional_auth_form.rb @@ -7,5 +7,11 @@ class Users::ApplyProfessionalAuthForm validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true validates :identity, presence: true, inclusion: { in: %w(student teacher professional) } validates :extra, presence: true - validates :attachment_ids, presence: true + validates :validate_attachment_ids + + def validate_attachment_ids + unless attachment_ids.is_a?(Array) || attachment_ids.length != 1 + raise("图片参数不对") + end + end end \ No newline at end of file From 8dd3687bc8fd46af816ee424131d4ba494505a57 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:46:10 +0800 Subject: [PATCH 29/45] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/users/apply_authentication_form.rb | 2 +- app/forms/users/apply_professional_auth_form.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/forms/users/apply_authentication_form.rb b/app/forms/users/apply_authentication_form.rb index 39a9a9e9d..a9cb60eec 100644 --- a/app/forms/users/apply_authentication_form.rb +++ b/app/forms/users/apply_authentication_form.rb @@ -5,7 +5,7 @@ class Users::ApplyAuthenticationForm validates :name, presence: true validate :validate_ID_number - validates :validate_attachment_ids + validate :validate_attachment_ids def validate_ID_number diff --git a/app/forms/users/apply_professional_auth_form.rb b/app/forms/users/apply_professional_auth_form.rb index 1481b12cf..40caf1c0e 100644 --- a/app/forms/users/apply_professional_auth_form.rb +++ b/app/forms/users/apply_professional_auth_form.rb @@ -7,7 +7,7 @@ class Users::ApplyProfessionalAuthForm validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true validates :identity, presence: true, inclusion: { in: %w(student teacher professional) } validates :extra, presence: true - validates :validate_attachment_ids + validate :validate_attachment_ids def validate_attachment_ids unless attachment_ids.is_a?(Array) || attachment_ids.length != 1 From b39374f8fd8571e6f8898d3b9f88ab37cf78ff77 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 16:48:41 +0800 Subject: [PATCH 30/45] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/trustie_hacks_controller.rb | 1 + app/views/trustie_hacks/index.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/trustie_hacks_controller.rb b/app/controllers/trustie_hacks_controller.rb index 8265c364e..803809124 100644 --- a/app/controllers/trustie_hacks_controller.rb +++ b/app/controllers/trustie_hacks_controller.rb @@ -16,6 +16,7 @@ class TrustieHacksController < ApplicationController end @hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count) + @hacks_count = hacks.count @hacks = hacks.page(page).per(limit) diff --git a/app/views/trustie_hacks/index.json.jbuilder b/app/views/trustie_hacks/index.json.jbuilder index 0f4d4f060..c309ebe21 100644 --- a/app/views/trustie_hacks/index.json.jbuilder +++ b/app/views/trustie_hacks/index.json.jbuilder @@ -2,7 +2,7 @@ json.hackathon do json.(@hackathon, :id, :name, :description) json.hackathon_users_count @hackathon_users_count end - +json.hacks_count @hacks_count json.hacks @hacks do |hack| json.(hack, :id, :name, :description, :hack_users_count) json.entry_info hack.entry_info(current_user.id) From f14ab33e80b364a9ee837e8893a2ec76d678ada4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 16:54:52 +0800 Subject: [PATCH 31/45] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/authentication_applies_controller.rb | 2 +- app/controllers/users/professional_auth_applies_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/authentication_applies_controller.rb b/app/controllers/users/authentication_applies_controller.rb index 8ded7be8b..183df2f65 100644 --- a/app/controllers/users/authentication_applies_controller.rb +++ b/app/controllers/users/authentication_applies_controller.rb @@ -17,6 +17,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController private def create_params - params.permit(:name, :gender, :id_number, :upload_image, :attachment_ids) + params.permit(:name, :gender, :id_number, :upload_image, attachment_ids: []) end end \ No newline at end of file diff --git a/app/controllers/users/professional_auth_applies_controller.rb b/app/controllers/users/professional_auth_applies_controller.rb index ea546f047..d1ee70953 100644 --- a/app/controllers/users/professional_auth_applies_controller.rb +++ b/app/controllers/users/professional_auth_applies_controller.rb @@ -17,6 +17,6 @@ class Users::ProfessionalAuthAppliesController < Users::BaseAccountController private def create_params - params.permit(:school_id, :department_id, :identity, :extra, :upload_image, :attachment_ids) + params.permit(:school_id, :department_id, :identity, :extra, :upload_image, attachment_ids: []) end end \ No newline at end of file From e0a6d69cfb6082bbce45c42300bac5acbe533a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 16:58:26 +0800 Subject: [PATCH 32/45] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/osshackathon/Osshackathon.css | 29 +++++++++++++++++++ .../src/modules/osshackathon/Osshackathon.js | 1 + 2 files changed, 30 insertions(+) diff --git a/public/react/src/modules/osshackathon/Osshackathon.css b/public/react/src/modules/osshackathon/Osshackathon.css index 54287ccae..8966ed800 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.css +++ b/public/react/src/modules/osshackathon/Osshackathon.css @@ -37,4 +37,33 @@ font-weight:400; color:rgba(5,16,26,1); line-height:24px; +} + +.ant-input::-webkit-input-placeholder{ + color: #999; + font-size: 14px; +} + +.ant-input:-moz-placeholder { + color: #999; + font-size: 14px; +} + +.ant-input::-moz-placeholder{ + color: #999; + font-size: 14px; +} + +.ant-input:-ms-input-placeholder{ + color: #999; + font-size: 14px; +} + +.Searchant-btn-primary .ant-btn-primary{ + background: #4CACFF; + border-color: #4CACFF; +} + +.Searchant-btn-primary .ant-input-group .ant-input{ + height:42px; } \ No newline at end of file diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index f2bf71e32..5e56b12aa 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -39,6 +39,7 @@ class Osshackathon extends Component { Date: Wed, 6 Nov 2019 17:12:23 +0800 Subject: [PATCH 33/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/osshackathon/Osshackathon.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index 5e56b12aa..3b2d16178 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -37,6 +37,7 @@ class Osshackathon extends Component { >
      + console.log(value)} /> +
      报名整数:280
      +
      From 94a59821c23aabb18a3b5b9f206023888897aa9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 17:35:57 +0800 Subject: [PATCH 34/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitimain/CompetitionsIndex.js | 3 ++- .../Competitimain/Competitionsindex.css | 3 ++- .../Competitioncommon/CompetitionCommon.js | 10 +++++++- .../src/modules/osshackathon/Osshackathon.js | 23 ++++++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index 9a23f66c1..1f582ce79 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -144,7 +144,8 @@ class CompetitionsIndex extends Component{ 报名截止时间:{item.enroll_end_time}, ]} extra={ -
      +
      +
      奖金
      diff --git a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css index aa2c347f3..6aa2fd641 100644 --- a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css +++ b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css @@ -88,7 +88,8 @@ } .CompetitionsIndex .gutter-row{ - margin-right:20px; + /*margin-right:20px;*/ + width: 33%; } .pt50{ diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index eb8e661a4..4ccd8fb6f 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -373,7 +373,15 @@ class CompetitionCommon extends Component{ className={"color000"}>{data && data.start_time}~{data && data.end_time} {/**/} - + diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index 3b2d16178..eeaff6a2f 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -11,13 +11,34 @@ class Osshackathon extends Component { constructor(props) { super(props) this.state = { - + page:1, + limit:10, + search:undefined } } componentDidMount() { + this.getosshackathon(); } + getosshackathon=()=>{ + let {page,limit,search}=this.state; + let url=`/osshackathon.json`; + axios.get(url,{params:{ + page:page, + limit:limit, + search:search, + }}).then((result)=>{ + if(result.status==200){ + console.log(result) + this.setState({ + + }) + } + }).catch((error)=>{ + console.log(error); + }) + } componentDidUpdate = (prevProps) => { From bc6b43c8876fdb01094edcce032213518769d511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 18:02:31 +0800 Subject: [PATCH 35/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/osshackathon/Osshackathon.js | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index eeaff6a2f..6b8cb3bf3 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; import axios from 'axios'; -import {SnackbarHOC, WordsBtn,getImageUrl} from 'educoder'; +import {SnackbarHOC, WordsBtn,getImageUrl,markdownToHTML} from 'educoder'; import {Row, Col,Input,Divider,Card,Button} from 'antd'; import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; import { CNotificationHOC } from '../courses/common/CNotificationHOC'; @@ -13,7 +13,8 @@ class Osshackathon extends Component { this.state = { page:1, limit:10, - search:undefined + search:undefined, + data:undefined } } @@ -32,7 +33,7 @@ class Osshackathon extends Component { if(result.status==200){ console.log(result) this.setState({ - + data:result.data }) } }).catch((error)=>{ @@ -46,10 +47,21 @@ class Osshackathon extends Component { } render() { - // let {} = this.state; + let{data}=this.state; + console.log(this.state.data) return (
      +
      @@ -71,7 +83,7 @@ class Osshackathon extends Component {
      - 报名整数:280个 + 报名整数:{data&&data.hackathon.hackathon_users_count}
      @@ -79,7 +91,7 @@ class Osshackathon extends Component { - 大赛介绍 + {data&&data.hackathon.name} @@ -98,12 +110,18 @@ class Osshackathon extends Component {

      - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista - probare, quae sunt a te dicta? Refert tamen, quo modo. + {data&&data.hackathon.description===null?"":

      }

      - + { + data&&data.hacks.length==0?"":data&&data.hacks.map((item,key)=>{ + return( + + ) + }) + } {/*学生身份*/} - + From 5bf62228112f56de0b63de1b4677d0a6171f73f2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 18:38:21 +0800 Subject: [PATCH 36/45] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 37 +++++++++++++++++-- app/models/inform.rb | 9 +++++ config/routes.rb | 2 + ...20191106094429_add_position_for_informs.rb | 17 +++++++++ 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20191106094429_add_position_for_informs.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cc7cacb44..53a85572d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -18,7 +18,7 @@ class CoursesController < ApplicationController :left_banner, :top_banner, :apply_to_join_course, :exit_course, :course_groups] before_action :set_course, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, :set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers, - :top_banner, :left_banner, :add_teacher_popup, :add_teacher, + :top_banner, :left_banner, :add_teacher_popup, :add_teacher, :inform_up, :inform_down, :graduation_group_list, :create_graduation_group, :join_graduation_group, :course_group_list, :set_course_group, :change_course_admin, :change_course_teacher, :delete_course_teacher, :teacher_application_review, :students, :all_course_groups, @@ -41,7 +41,7 @@ class CoursesController < ApplicationController :set_course_group, :create_group_by_importing_file, :update_task_position, :tasks_list] before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, - :change_course_teacher, :course_group_list, :change_member_role, + :change_course_teacher, :course_group_list, :change_member_role,:inform_up, :inform_down, :teacher_application_review, :apply_teachers, :delete_course_teacher] before_action :validate_course_name, only: [:create, :update] before_action :find_board, only: :board_list @@ -281,13 +281,43 @@ class CoursesController < ApplicationController end def informs - @informs = @course.informs + @informs = @course.informs.order("position desc") + end + + def inform_up + inform = @course.informs.find_by(id: params[:inform_id]) + next_inform = inform.next_inform + ActiveRecord::Base.transaction do + if next_inform + render_error('已经到达最底部') + else + inform.update_attribute(:position, (position + 1)) + next_inform.update_attribute(:position, last_inform.position - 1) + render_ok + end + end + end + + def inform_down + inform = @course.informs.find_by(id: params[:inform_id]) + last_inform = inform.last_inform + ActiveRecord::Base.transaction do + if last_inform + render_error('已经到达最顶部') + else + inform.update_attribute(:position, (position - 1)) + last_inform.update_attribute(:position, last_inform.position + 1) + render_ok + end + end + end def new_informs inform = Inform.new(container: @course) inform.name = params[:name] inform.description = params[:description] + inform.position = @course.informs.max(:position).to_i + 1 inform.save! normal_status("创建成功") end @@ -300,6 +330,7 @@ class CoursesController < ApplicationController def delete_informs inform = @course.informs.find_by(id: params[:inform_id]) + @course.informs.where("position > ?", inform.position).update_all("position = position - 1") inform.destroy! normal_status("删除成功") end diff --git a/app/models/inform.rb b/app/models/inform.rb index d486b6f11..a6f40fe6d 100644 --- a/app/models/inform.rb +++ b/app/models/inform.rb @@ -5,4 +5,13 @@ class Inform < ApplicationRecord validates :description, length: { maximum: 5000 } has_many :attachments, as: :container, dependent: :destroy + + def next_inform + Inform.where(position: self.position+1, container_id: self.course_id, container_type: 'Course') + end + + def last_inform + Inform.where(position: self.position-1, container_id: self.course_id, container_type: 'Course') + end + end diff --git a/config/routes.rb b/config/routes.rb index b2a7b1de6..e13092c08 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -381,6 +381,8 @@ Rails.application.routes.draw do get 'work_score' get 'act_score' get 'statistics' + post :inform_up + post :inform_down end collection do diff --git a/db/migrate/20191106094429_add_position_for_informs.rb b/db/migrate/20191106094429_add_position_for_informs.rb new file mode 100644 index 000000000..3065081f2 --- /dev/null +++ b/db/migrate/20191106094429_add_position_for_informs.rb @@ -0,0 +1,17 @@ +class AddPositionForInforms < ActiveRecord::Migration[5.2] + def change + add_column :informs, :position, :integer, :default => 1 + + course_ids = Inform.where(container_type: 'Course').pluck(:container_id).uniq + courses = Course.where(id: course_ids) + + courses.find_each do |course| + next if course.informs.count == 1 + informs = course.informs.order("created_at asc") + informs.each_with_index do |inform, index| + inform.update_attribute(:position, index+1) + end + end + + end +end From d9371d730a523ad4d9699bd9766796049cc4cf2f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 7 Nov 2019 09:02:01 +0800 Subject: [PATCH 37/45] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E5=85=B3=E5=8D=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 53a85572d..d61634f4d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -317,7 +317,7 @@ class CoursesController < ApplicationController inform = Inform.new(container: @course) inform.name = params[:name] inform.description = params[:description] - inform.position = @course.informs.max(:position).to_i + 1 + inform.position = @course.informs.maximum(:position) + 1 inform.save! normal_status("创建成功") end From ebd0797b3712a3e9c68662376806fffc109f0428 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 7 Nov 2019 09:08:30 +0800 Subject: [PATCH 38/45] =?UTF-8?q?=E6=96=87=E5=AD=97=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d61634f4d..488289815 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -289,7 +289,7 @@ class CoursesController < ApplicationController next_inform = inform.next_inform ActiveRecord::Base.transaction do if next_inform - render_error('已经到达最底部') + render_error('已经到达最顶部') else inform.update_attribute(:position, (position + 1)) next_inform.update_attribute(:position, last_inform.position - 1) @@ -303,7 +303,7 @@ class CoursesController < ApplicationController last_inform = inform.last_inform ActiveRecord::Base.transaction do if last_inform - render_error('已经到达最顶部') + render_error('已经到达最底部') else inform.update_attribute(:position, (position - 1)) last_inform.update_attribute(:position, last_inform.position + 1) From 2e964b5713f16779261f33f63d680f3721901524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 7 Nov 2019 09:26:56 +0800 Subject: [PATCH 39/45] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/PathDetail/Modifytext.js | 7 ++++--- .../react/src/modules/paths/PathDetail/PathDetailIndex.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/Modifytext.js b/public/react/src/modules/paths/PathDetail/Modifytext.js index c7d95cd1a..c2ec7809c 100644 --- a/public/react/src/modules/paths/PathDetail/Modifytext.js +++ b/public/react/src/modules/paths/PathDetail/Modifytext.js @@ -159,9 +159,10 @@ class Modifytext extends Component { marginTop: "24px", }}> + border: "0.5px solid #C9C9C9", + background: "#C9C9C9", + color: "#fff", + }} type="primary " onClick={() => this.hideUpdating()}>取消 diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index d23cf5634..7e59b72eb 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -685,7 +685,7 @@ class PathDetailIndex extends Component{
      From 606116f32c9276496e836669cddf9f89ae2d1f08 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 7 Nov 2019 09:46:55 +0800 Subject: [PATCH 40/45] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=8E=BB=E6=8E=89=E6=A0=87=E7=AD=BE=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/graduation_topics/_graduation_comments.json.jbuilder | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/graduation_topics/_graduation_comments.json.jbuilder b/app/views/graduation_topics/_graduation_comments.json.jbuilder index b9314aa25..03002e82e 100644 --- a/app/views/graduation_topics/_graduation_comments.json.jbuilder +++ b/app/views/graduation_topics/_graduation_comments.json.jbuilder @@ -3,7 +3,8 @@ json.author do end json.id message.id -json.content content_safe(message.contents_show(identity)) +# json.content content_safe(message.contents_show(identity)) +json.content message.contents_show(identity) json.time time_from_now(message.created_at) json.hidden message.hidden # 主贴与子贴不一致 From 4a3c4773e4477a46165f1de528dac7edcd9abd8d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 7 Nov 2019 09:51:48 +0800 Subject: [PATCH 41/45] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/editormd/lib/readme-marked.txt | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 public/editormd/lib/readme-marked.txt diff --git a/public/editormd/lib/readme-marked.txt b/public/editormd/lib/readme-marked.txt new file mode 100644 index 000000000..6641515b8 --- /dev/null +++ b/public/editormd/lib/readme-marked.txt @@ -0,0 +1,35 @@ + +项目里有许多其他地方也有marked.js,除了js_min_all.js里的,其他地方的marked.js都没被使用到。 + +// 说明:左边 --> 右边 左边被替换成了右边的内容 +// 这里的替换是直接在marked.min.js中完成的。 +1、 // b(i[1].replace(/^ *| *\| *$/g,"")) --> i[1].replace(/^ *| *\| *$/g, "").split(/ *\| */) table没识别的问题 +2、 // header.length===a.align.length --> header.length table没识别的问题 +3、 // 2个table: b(a.cells[p],a.header.length) --> a.cells[p].replace(/^ *\| *| *\| *$/g, "").split(/ *\| */) +4、 // .replace(/(?: *\| *)?\n$/,"") --> .replace(/\n$/, "") +5、 // /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ --> /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ + +如果要继续升级marked.min.js,还是要注意上面所列的问题 +issue列表中搜索md,可以查看到部分的相关问题,下面列举若干关键问题: + +table相关 1、2、3、4、5 +https://www.trustie.net/issues/24398 +https://www.trustie.net/issues/24448 +https://www.trustie.net/issues/24336 + + +/educoder/public/react/public/js/editormd/editormd.min.js +md编辑器公式相关修改,修改上述文件,并压缩,然后替换到js_min_all.js的这个位置的: +/* + * Editor.md + * + * @file editormd.js + * @version v1.5.0 + * @description Open source online markdown editor. + * @license MIT License + * @author Pandao + * {@link https://github.com/pandao/editor.md} + * @updateTime 2015-06-09 + */ +公式相关 修改在 /public/js/editormd/editormd.min.js +https://www.trustie.net/issues/23895 \ No newline at end of file From 0de39be598755ead66073be94e7f3018e3d68bae Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 7 Nov 2019 09:54:46 +0800 Subject: [PATCH 42/45] =?UTF-8?q?safari=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/busyWork/CommonWorkSetting.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 20c1dc1b5..1bc806190 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -728,18 +728,18 @@ class CommonWorkSetting extends Component{ course_id , unified_setting: unified_setting, // 统一设置 group_settings: group_settings_param, - publish_time: temp_end_time ? new Date(temp_publish_time) : temp_end_time, // 发布 - end_time: temp_end_time ? new Date(temp_end_time) : temp_end_time, // 截止 + publish_time: temp_end_time ? new Date(temp_publish_time.replace(/-/g, '/')) : temp_end_time, // 发布 + end_time: temp_end_time ? new Date(temp_end_time.replace(/-/g, '/')) : temp_end_time, // 截止 late_penalty: late_penalty, // 迟交扣分 allow_late: allow_late, // 是否允许补交 - late_time: late_time ? new Date(late_time) : late_time, // 补交截止时间 + late_time: late_time ? new Date(late_time.replace(/-/g, '/')) : late_time, // 补交截止时间 anonymous_comment: anonymous_comment, // true: 启用匿评 false:未启用匿评 - evaluation_start: evaluation_start ? new Date(evaluation_start) : evaluation_start, //匿评开始时间 - evaluation_end: evaluation_end ? new Date(evaluation_end) : evaluation_end, + evaluation_start: evaluation_start ? new Date(evaluation_start.replace(/-/g, '/')) : evaluation_start, //匿评开始时间 + evaluation_end: evaluation_end ? new Date(evaluation_end.replace(/-/g, '/')) : evaluation_end, evaluation_num: evaluation_num, // 匿评数 absence_penalty: absence_penalty, // 匿评扣分 anonymous_appeal: anonymous_appeal, // true: 启用匿评申诉, false:未启用 - appeal_time: appeal_time ? new Date(appeal_time) : appeal_time, // 申诉结束时间 + appeal_time: appeal_time ? new Date(appeal_time.replace(/-/g, '/')) : appeal_time, // 申诉结束时间 appeal_penalty: appeal_penalty, // 违规匿评扣分 ta_mode: ta_mode, // 1:普通模式 0:复审模式 final_mode: final_mode, // true: 单项评分优先, false: 多项评分配比 From 90d5b61a650d1a519c6d9dd06dd4f04069c555e7 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 7 Nov 2019 10:13:55 +0800 Subject: [PATCH 43/45] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/readme.txt b/public/react/readme.txt index 0f085af23..e813d22a8 100644 --- a/public/react/readme.txt +++ b/public/react/readme.txt @@ -2,6 +2,7 @@ /educoder/public/react/public/js/readme.txt 关于js_min_all /educoder/educoder/public/react/scripts/readme-cdn.txt 关于CDN /educoder/public/react/src/modules/page/readme.txt 关于TPI +/educoder/public/editormd/lib/readme-marked.txt 关于md编辑器 marked.js 1、 安装node v6.9.x;此安装包含了node和npm。 From 99746df22a87374602c571b2d7567245c7db3ff6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 7 Nov 2019 10:14:35 +0800 Subject: [PATCH 44/45] =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/graduation/tasks/GraduationTaskssetting.js | 6 ++++-- .../courses/graduation/tasks/GraduationTaskssettinglist.js | 6 ++++-- .../graduation/tasks/GraduationTaskssettingquestions.js | 6 ++++-- public/react/src/modules/courses/poll/PollDetailIndex.js | 6 ++++-- .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 00d617030..967303e5e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -895,8 +895,10 @@ debugger }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + this.props.slowDownload(url) + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 23c603b72..db1e34075 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -718,8 +718,10 @@ class GraduationTaskssettinglist extends Component{ }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + this.props.slowDownload(url) + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js index 05e8d497b..9370138c0 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js @@ -239,8 +239,10 @@ class GraduationTasksquestions extends Component{ }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + this.props.slowDownload(url) + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index e0c46a039..184e95333 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -114,8 +114,10 @@ class PollDetailIndex extends Component{ }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + this.props.slowDownload(url) + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 88682c5a6..2a2ed9a9e 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -72,8 +72,10 @@ class ShixunWorkReport extends Component { }) } }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url+'?export=true', '_blank'); + this.props.slowDownload(url) + + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url+'?export=true', '_blank'); this.setState({ isspinning: false }) } }).catch((error) => { From de3eeb539f5404863d55e6ed3e5798d31337a62c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 7 Nov 2019 10:43:50 +0800 Subject: [PATCH 45/45] if (params[key].constructor === Array) { --- public/react/src/common/UrlTool2.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/react/src/common/UrlTool2.js b/public/react/src/common/UrlTool2.js index f4827266b..ae2e3e8e6 100644 --- a/public/react/src/common/UrlTool2.js +++ b/public/react/src/common/UrlTool2.js @@ -4,7 +4,13 @@ const queryString = { for (let key in params) { // https://stackoverflow.com/questions/6566456/how-to-serialize-an-object-into-a-list-of-url-query-parameters if (params[key] != undefined) { - paramsUrl += `${key}=${encodeURIComponent(params[key])}&` + if (params[key].constructor === Array) { + for (let singleArrIndex of params[key]) { + paramsUrl = paramsUrl + key + '[]=' + singleArrIndex + '&' + } + } else { + paramsUrl += `${key}=${encodeURIComponent(params[key])}&` + } } } if (paramsUrl == '') {