diff --git a/app/controllers/competitions/prize_leader_accounts_controller.rb b/app/controllers/competitions/prize_leader_accounts_controller.rb index 0c01e2738..490c5fb6d 100644 --- a/app/controllers/competitions/prize_leader_accounts_controller.rb +++ b/app/controllers/competitions/prize_leader_accounts_controller.rb @@ -2,7 +2,7 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController before_action :require_prize_team_leader! def update - Competitions::SavePrizeTeamAccountService.call(current_competition, current_user, update_params) + Competitions::SavePrizeTeamAccountService.call(current_competition, current_prize_user, update_params) render_ok rescue ApplicationService::Error => ex render_error(ex.message) @@ -13,8 +13,8 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController def require_prize_team_leader! prize_user = current_competition.competition_prize_users.joins(:competition_prize) .where(competition_prizes: { category: :bonus }) - .find_by(leader: true, user_id: current_user.id) - return if prize_user.present? + .find_by(leader: true, user_id: current_prize_user.id) + return if prize_user.present? && (current_user.admin_or_business? || current_user.id == current_prize_user.id) render_forbidden end @@ -22,4 +22,8 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController def update_params params.permit(:bank, :second_bank, :card_no) end + + def current_prize_user + @_current_prize_user ||= User.find(params[:user_id]) + end end \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css index 5693fcc2e..5ec38aff5 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css @@ -245,6 +245,7 @@ height: 60px; border-radius: 50% !important; box-shadow: 0px 0px 12px rgba(0,0,0,0.2); + border: 2px solid #459BE5; } .Competitioncenter{ @@ -308,6 +309,7 @@ width: 64px; height: 63px; border-radius: 50%; + border: 2px solid #459BE5; } .CompetitionsListzhezhao{ @@ -418,4 +420,13 @@ cursor: default; max-width: 100px; display: inherit; +} + +.competimgabsolute{ + position: absolute; + left: 100px; + bottom: -10px; +} +.competimgabsolute .ant-badge-count{ + box-shadow: none !important; } \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js index 45b7fd3d2..f2b2cd451 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; +import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd'; import {markdownToHTML,getImageUrl} from 'educoder'; import axios from 'axios'; @@ -200,8 +200,11 @@ class CompetitionContents extends Component{
  • - - + +
    + +
    +

    {personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}

    @@ -234,10 +237,13 @@ class CompetitionContents extends Component{ cover={
  • - +
    +
    +
    +

    {personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}

    @@ -270,10 +276,13 @@ class CompetitionContents extends Component{ cover={
  • - +
    - +
    + +
    +

    {personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}

    diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 0f75154cf..d376cefa2 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -40,12 +40,48 @@ class Bankcardnumberverification extends Component { } } + componentDidUpdate = (prevProps) => { + if (prevProps.bank_account != this.props.bank_account) { + console.log("componentDidUpdate"); + console.log(this.props); + console.log(prevProps); + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + try { + if(this.props.bank_account){ + this.props.form.setFieldsValue({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + } + }catch (e) { + + } + try { + if(prevProps.bank_account){ + this.props.form.setFieldsValue({ + openingbank:prevProps.bank_account.bank, + subbranch: prevProps.bank_account.second_bank, + subbranchs: prevProps.bank_account.card_no, + }) + } + }catch (e) { + + } + + + } + + } yhBankstrue = () => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`; axios.patch(url, { + user_id:this.props.userdata.id, bank: values.openingbank, second_bank: values.subbranchs, card_no: values.subbranch @@ -152,7 +188,7 @@ class Bankcardnumberverification extends Component { > {getFieldDecorator('openingbank', { rules: [{ - // initialValue: this.state.cityDefaultValue, + initialValue: this.state.openingbank&&this.state.openingbank, required: true, message: '请输入开户行', }], @@ -167,7 +203,7 @@ class Bankcardnumberverification extends Component { > {getFieldDecorator('subbranch', { rules: [{ - // initialValue: this.state.cityDefaultValue, + initialValue: this.props.subbranch&&this.props.subbranch, required: true, message: '请输入支行', }], @@ -182,7 +218,7 @@ class Bankcardnumberverification extends Component { > {getFieldDecorator('subbranchs', { rules: [{ - // initialValue: this.state.cityDefaultValue, + initialValue: this.props.subbranchs&&this.props.subbranchs, required: true, message: '请输入账号', }], diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index e4c149fa3..3f015a3bc 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -288,6 +288,7 @@ class CompetitionContentspdfpeopledata extends Component { if (!err) { let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`; axios.patch(url, { + user_id:this.state.userdata.id, bank: values.openingbank, second_bank: values.subbranchs, card_no: values.subbranch @@ -296,7 +297,7 @@ class CompetitionContentspdfpeopledata extends Component { try { if (result.data.status == 0) { // console.log(JSON.stringify(result)); - this.props.showNotification(`提交成功成功`); + this.props.showNotification(`提交成功`); this.getdata(this.state.userdata.id); this.GetawardinformationAPI(); } @@ -321,11 +322,19 @@ class CompetitionContentspdfpeopledata extends Component { //撤销认证 Cancellationofapplication = (index) => { + let userid; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; + } let url = "" if (index === 1) { - url = `/users/accounts/${this.props.user.user_id}/authentication_apply.json`; + url = `/users/accounts/${userid}/authentication_apply.json`; } else if (index === 2) { - url = `/users/accounts/${this.props.user.user_id}/professional_auth_apply.json`; + url = `/users/accounts/${userid}/professional_auth_apply.json`; } axios.delete(url) .then((response) => { @@ -336,7 +345,11 @@ class CompetitionContentspdfpeopledata extends Component { } else if (index === 2) { this.props.showNotification('撤销职业认证成功') } - this.getdata(this.state.userdata.id); + try { + this.getdata(this.state.userdata.id); + }catch (e) { + + } } } catch (e) { @@ -515,6 +528,7 @@ class CompetitionContentspdfpeopledata extends Component {
    { bank_account_editable === true ? + this.hideUpdating(i)} getdata={(id) => this.getdata(id)} diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js index 4a9718032..fa0b20b7a 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js @@ -47,7 +47,7 @@ class Phonenumberverification extends Component { }).then((result) => { if (result) { this.props.showNotification("手机号码绑定成功!"); - this.props.hideUpdating() + this.props.hideUpdating(1) this.props.getdata(id); } }).catch((error) => { diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 1e3ced6d3..9e4b9f4b8 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -46,6 +46,7 @@ function disabledDateFunc(current) { return current && current < moment().endOf('day').subtract(1, 'days'); } // 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting +//普通作业分组作业设置 class CommonWorkSetting extends Component{ constructor(props){ @@ -411,10 +412,11 @@ class CommonWorkSetting extends Component{ } // 补交设置 允许补交 allow_late_change=(e)=>{ + // console.log(e.target.checked ); this.setState({ - allow_late: e.target.value + allow_late: e.target.checked }) - if (e.target.value) { + if (e.target.checked) { this.setState({ late_penalty: 5 }) @@ -1155,12 +1157,16 @@ class CommonWorkSetting extends Component{
    补交设置 - (选中,则允许学生延时提交作品) +
    - - 允许补交 + + + 开启补交 (选中,则允许学生延时提交作品)
    迟交扣分: @@ -1205,9 +1211,7 @@ class CommonWorkSetting extends Component{
    - 禁止补交 -
    @@ -1539,3 +1543,10 @@ class CommonWorkSetting extends Component{ const CommonWorkSettingForm = Form.create({ name: 'commonworkSettingForm' })(CommonWorkSetting); export default CommonWorkSettingForm; + +// {/**/} +// +// {/* 允许补交*/} +// {/* 禁止补交*/} +// +// {/**/} diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js index 538b32773..a9e54a62c 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js @@ -11,21 +11,209 @@ class ModulationModal_exercise extends Component { score: 0, subjective_questions: 0, objective_questions: 0, - + subjective_score: 0, + objective_score: 0, + subool: false, + Inputsval: '', + Inputsvals: '', + Inputsvaltype: false, + Inputsvaltypes: false, + Inputsvaltest: "", + Inputsvaltests: "", } //因为主观题加客观题的和是总分 } componentDidMount = () => { - + console.log("ModulationModal_exercise"); + console.log(this.props); + this.setState({ + subjective_score: this.props.subjective_score, + objective_score: this.props.objective_score, + }) + if (this.props.subjective_score > 0 && this.props.objective_score > 0) { + this.setState({ + subool: false, + }) + } else { + this.setState({ + subool: true + }) + } } Saves = () => { - let {textareaval, subjective_questions, objective_questions, score} = this.state; + let { + textareaval, + subjective_questions, + objective_questions, + score, + subool, + Inputsval, + subjective_score, + objective_score, + Inputsvals + } = this.state; + let re = /^[0-9]+.?[0-9]*$/;//判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ + + if (subool === false) { + //不是总分模式 + if (Inputsval === undefined || Inputsval === null || Inputsval === "") { + this.setState({ + Inputsval: "", + Inputsvaltype: true, + Inputsvaltest: "请填写分数", + }) + return + } + + //判断主观题 + + var nubmer = Inputsval; + if (!re.test(nubmer)) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: "请输入0-100的分数", + }) + return; + } + + + if (0 > parseFloat(Inputsval)) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: "成绩不能小于零", + }) + return; + } else if (parseFloat(Inputsval) > this.props.subjective_score) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: `成绩不能大于${this.props.subjective_score}`, + }) + return; + } + //判断客观题 + if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") { + this.setState({ + Inputsvals: "", + Inputsvaltypes: true, + Inputsvaltests: "请填写分数", + }) + return + } + var nubmers = Inputsvals; + if (!re.test(nubmers)) { + this.setState({ + Inputsvals: "", + Inputsvaltypes: true, + Inputsvaltests: "请输入0-100的分数", + }) + return; + } + + if (0 > parseFloat(Inputsvals)) { + this.setState({ + Inputsvals: Inputsvals, + Inputsvaltypes: true, + Inputsvaltests: "请输入0-100的分数", + }) + return; + } else if (parseFloat(Inputsval) > 100) { + this.setState({ + Inputsvals: Inputsvals, + Inputsvaltypes: true, + Inputsvaltests: `成绩不能大于${this.props.objective_score}`, + }) + return; + } - // this.props.Saves(textareaval, Inputsval) + + } else { + //总分模式 + if (subjective_score > 0) { + //主观题 + if (Inputsval === undefined || Inputsval === null || Inputsval === "") { + this.setState({ + Inputsval: "", + Inputsvaltype: true, + Inputsvaltest: "请填写分数", + }) + return + } + + //判断主观题 + var nubmer = Inputsval; + if (!re.test(nubmer)) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: "请输入0-100的分数", + }) + return; + } + + + if (0 > parseFloat(Inputsval)) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: "成绩不能小于零", + }) + return; + } else if (parseFloat(Inputsval) > this.props.subjective_score) { + this.setState({ + Inputsval: Inputsval, + Inputsvaltype: true, + Inputsvaltest: `成绩不能大于${this.props.subjective_score}`, + }) + return; + } + } else if (objective_score > 0) { + //客观题 + if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") { + this.setState({ + Inputsvals: "", + Inputsvaltypes: true, + Inputsvaltests: "请填写分数", + }) + return + } + var nubmers = Inputsvals; + if (!re.test(nubmers)) { + this.setState({ + Inputsvals: "", + Inputsvaltypes: true, + Inputsvaltests: "请输入0-100的分数", + }) + return; + } + + if (0 > parseFloat(Inputsvals)) { + this.setState({ + Inputsvals: Inputsvals, + Inputsvaltypes: true, + Inputsvaltests: "请输入0-100的分数", + }) + return; + } else if (parseFloat(Inputsvals) > 100) { + this.setState({ + Inputsvals: Inputsvals, + Inputsvaltypes: true, + Inputsvaltests: `成绩不能大于${this.props.objective_score}`, + }) + return; + } + + } + } + + + this.props.Saves(Inputsval, Inputsvals); } @@ -35,13 +223,57 @@ class ModulationModal_exercise extends Component { }) } + //主观题 setInputs = (e) => { + console.log("主"); + console.log(e.target.value); + this.setState({ + Inputsval: e.target.value, + Inputsvaltype: false, + }) + } + //客观题 + setInputss = (e) => { + console.log("客"); + console.log(e.target.value); + this.setState({ + Inputsvals: e.target.value, + Inputsvaltypes: false, + + }) + } + //最终成绩主观题 + setInputsss = (e) => { + console.log("终主"); + console.log(e.target.value); + this.setState({ + Inputsval: e.target.value, + Inputsvaltype: false, + }) + } + //最终成绩客观题 + setInputssss = (e) => { + console.log("终客"); + console.log(e.target.value); + this.setState({ + Inputsvals: e.target.value, + Inputsvaltypes: false, + }) } render() { - let {Inputsvaltype, subjective_questions, objective_questions, score} = this.state; + let { + Inputsvaltype, + Inputsvaltypes, + Inputsvaltest, + Inputsvaltests, + subjective_score, + objective_score, + Inputsval, + Inputsvals, + } = this.state; return (
    + { + subjective_score > 0 && objective_score > 0 ? +
    + {Inputsvaltype === true ? + + : + "" -
    -

    主观题成绩:

    - this.setInputs(e)} - value={subjective_questions === undefined || subjective_questions === null ? "" : subjective_questions}/> -

    分 ,

    -

    总分:45.0

    -
    - -
    - -

    客观题成绩:

    - this.setInputs(e)} - value={objective_questions === undefined || objective_questions === null ? "" : objective_questions}/> -

    分 ,

    -

    总分:45.0

    - -
    - -
    -

    最终成绩:

    - this.setInputs(e)} - value={score === undefined || score === null ? "" : score}/> -

    分 ,

    -

    总分:45.0

    - -
    - - - + } +
    +

    主观题成绩:

    + +

    分 ,

    +

    总分:{subjective_score}

    +
    + { + Inputsvaltype === true ? +

    {Inputsvaltest}

    + : "" + } + {Inputsvaltypes === true ? + + : + "" -
    + } +
    + +

    客观题成绩:

    + +

    分 ,

    +

    总分:{objective_score}

    + +
    + { + Inputsvaltypes === true ? +

    {Inputsvaltests}

    + : "" + } +
    + : +
    + { + subjective_score > 0 && objective_score === 0 ? +
    + {Inputsvaltype === true ? + + : + "" + + } +
    +

    最终成绩:

    + +

    分 ,

    +

    + 总分:{subjective_score > 0 && objective_score === 0 ? subjective_score : ""} {objective_score > 0 && subjective_score === 0 ? objective_score : ""}

    +
    + { + Inputsvaltype === true ? +

    {Inputsvaltest}

    + : "" + } +
    + : + "" + } + { + objective_score > 0 && subjective_score === 0 ? +
    + {Inputsvaltypes === true ? + + : + "" + } +
    +

    最终成绩:

    + +

    分 ,

    +

    + 总分:{subjective_score > 0 && objective_score === 0 ? subjective_score : ""} {objective_score > 0 && subjective_score === 0 ? objective_score : ""}

    + +
    + { + Inputsvaltypes === true ? +

    {Inputsvaltests}

    + : "" + } +
    + : + "" + } + + +
    + {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 34721fa21..30cb300c8 100644 --- a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css +++ b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css @@ -361,7 +361,7 @@ .minbuttionte { /* display: flex; */ - margin-top: 27px; + margin-top: 20px; width: 100%; /* align-items: center; */ margin-bottom: 17px; diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 96b0790e4..2fb31ad40 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1031,10 +1031,8 @@ class Studentshavecompletedthelist extends Component { render: (text, record) => ( {record.finalscore==="--"? - - - -- + this.Adjustment(record.user_id)}>评阅 : ( {record.finalscore==="--"? - -- + this.Adjustment(record.user_id)}>评阅 : { + console.log("Adjustment"); + console.log(e); this.setState({ testpapergradingboll: true, - exeuserid: e.user_id, + exeuserid: e, }) } @@ -2625,12 +2625,13 @@ class Studentshavecompletedthelist extends Component { //试卷调分 Testpapergrading = (v, n) => { + // debugger var exercise_id = this.props.match.params.Id; let url = `/exercises/${exercise_id}/adjust_score.json`; axios.post(url, { user_id: this.state.exeuserid, - subjective_score: n, - objective_score: v, + subjective_score: v, + objective_score: n, }) .then((response) => { if (response.data.status == '0') { @@ -2639,7 +2640,7 @@ class Studentshavecompletedthelist extends Component { this.Teacherliststudentlist(); } }) - .catch(function (error) { + .catch((error) => { console.log(error); this.setState({testpapergradingboll: false}) }); @@ -2676,18 +2677,20 @@ class Studentshavecompletedthelist extends Component { :
    - {testpapergradingboll === true ? this.Adjustments()} - Saves={(value, num) => this.Testpapergrading(value, num)} - /> : ""} - {/*{*/} - {/* testpapergradingboll === true ? this.Adjustments()}*/} - {/* Saves={(value, num) => this.Testpapergrading(value, num)}*/} - {/* /> : ""*/} - {/*}*/} + {/*{testpapergradingboll === true ? this.Adjustments()}*/} + {/* Saves={(value, num) => this.Testpapergrading(value, num)}*/} + {/*/> : ""}*/} + { + testpapergradingboll === true ? this.Adjustments()} + Saves={(value, num) => this.Testpapergrading(value, num)} + /> : "" + }