From 8ad2bb0da75552da636dd56944058784509861be 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, 15 Oct 2019 17:49:45 +0800 Subject: [PATCH 01/17] =?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/AppConfig.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index cddea79a6..39d12e605 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -93,14 +93,16 @@ export function initAxiosInterceptors(props) { config.url = url; } } - // - // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息 - // console.log(config); - // console.log(JSON.parse(config)); - // console.log(config.url); - // console.log("被阻止了是重复请求================================="); - // return false; - // } + + if (config.method === "post") { + if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息 + console.log(config); + console.log(JSON.parse(config)); + console.log(config.url); + console.log("被阻止了是重复请求================================="); + return false; + } + } // 非file_update请求 if (config.url.indexOf('update_file') === -1) { requestMap[config.url] = true; From e0c1b4e7b5a41ac0ca4962efc7b02094f9caf674 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, 15 Oct 2019 17:50:44 +0800 Subject: [PATCH 02/17] =?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/AppConfig.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 39d12e605..34dcbc0c4 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -93,13 +93,13 @@ export function initAxiosInterceptors(props) { config.url = url; } } - + console.log(config); if (config.method === "post") { if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息 - console.log(config); - console.log(JSON.parse(config)); - console.log(config.url); - console.log("被阻止了是重复请求================================="); + // console.log(config); + // console.log(JSON.parse(config)); + // console.log(config.url); + // console.log("被阻止了是重复请求================================="); return false; } } From 874e157dcbae4bfd86b632a544c83ee1ba9e6ceb Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 26 Oct 2019 15:34:44 +0800 Subject: [PATCH 03/17] competition error message --- app/forms/competitions/save_team_form.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/forms/competitions/save_team_form.rb b/app/forms/competitions/save_team_form.rb index 1b2b6c4a8..be07a6365 100644 --- a/app/forms/competitions/save_team_form.rb +++ b/app/forms/competitions/save_team_form.rb @@ -39,9 +39,9 @@ class Competitions::SaveTeamForm # 存在已报名老师 enrolled_teacher_members = competition.team_members.where(user_id: all_teachers) - .where.not(competition_team_id: team.id).includes(:user) + .where.not(competition_team_id: team.id).pluck(:user_id) if enrolled_teacher_members.present? - errors.add(:teacher_ids, :enrolled, names: enrolled_teacher_members.map { |m| m.user.real_name }.join(',')) + errors.add(:teacher_ids, :enrolled, names: User.where(id: enrolled_teacher_members).map(&:real_name).join(',')) return end end @@ -72,9 +72,9 @@ class Competitions::SaveTeamForm # 存在已报名成员 enrolled_members = competition.team_members.where(user_id: all_members) - .where.not(competition_team_id: team.id).includes(:user) + .where.not(competition_team_id: team.id).pluck(:user_id) if enrolled_members.present? - errors.add(:member_ids, :enrolled, names: enrolled_members.map { |m| m.user.real_name }.join(',')) + errors.add(:member_ids, :enrolled, names: User.where(id: enrolled_members).map(&:real_name).join(',')) return end end From 61868d1a77451b2b7a4bf1904a6272c52b99d15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 26 Oct 2019 15:41:10 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitimain/CompetitionsIndex.js | 14 ++++----- .../Competitimain/Competitionsindex.css | 7 ++++- .../Competitioncommon/CompetitionCommon.js | 14 +++++---- .../Competitioncommon/CompetitionContents.js | 4 +-- .../CompetitionContentsChart.js | 29 ++++++++++++++----- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index eb4cb431f..e140b2c16 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -123,10 +123,10 @@ class CompetitionsIndex extends Component{ size="large" dataSource={datas&&datas} renderItem={(item,key) => ( -
this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)}> + >
{item.competition_status==="nearly_published"? @@ -180,18 +180,18 @@ class CompetitionsIndex extends Component{ - this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} - >{item.name}{item.sub_title===null?"":`——${item.sub_title}`} + {item.name}{item.sub_title===null?"":`——${item.sub_title}`} {/*{item.sub_title===null?"":*/} {/*{item.sub_title}}*/} {/**/} } /> - {item.description} + {item.description}
-
+ ) diff --git a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css index dda7fcf40..aa4bd8d03 100644 --- a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css +++ b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css @@ -130,13 +130,14 @@ text-align: center; color: #fff; font-size: 22px; - display: flex; + align-items: center; justify-content: space-around; flex-direction: column; } .CompetitionsList:hover .CompetitionsListzhezhao{ display: block; + display: flex; } .competitionstitlesshou:hover a{ cursor: pointer; @@ -154,4 +155,8 @@ background-position: center !important; background-position: 50% !important; background-repeat: no-repeat !important; +} + +.span666{ + color:#666666 !important; } \ 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 9c80366f3..0f935605e 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -22,7 +22,8 @@ class CompetitionCommon extends Component{ mdContentdata:undefined, chart_rules:undefined, Competitionedittype:false, - chartdata:undefined + chartdata:undefined, + has_url:false } } @@ -148,16 +149,19 @@ class CompetitionCommon extends Component{ }) }else{ if(module_url.substring(0,7)=='http://'||module_url.substring(0,8)=='https://') { - window.location.href= module_url + // window.location.href= module_url + window.open(module_url) }else{ - window.location.href="https://"+module_url; + window.open(`https://${module_url}`) + // window.location.href=; } return } this.setState({ module_id:id, - module_type:typeid + module_type:typeid, + has_url:has_url }) } @@ -217,7 +221,7 @@ class CompetitionCommon extends Component{ } render() { - let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state; + let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state; return ( data===undefined?"":
diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js index a49384f71..ca99fde8e 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js @@ -26,9 +26,9 @@ class CompetitionContents extends Component{ return (
- {this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?:"":""} + :"":"":""}
diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index 8432613e3..93eaec5b0 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; import {markdownToHTML,getImageUrl} from 'educoder'; +import axios from 'axios'; import NoneData from "../../courses/shixunHomework/shixunHomework"; const { Content } = Layout; @@ -11,17 +12,28 @@ class CompetitionContents extends Component{ constructor(props) { super(props) this.state={ - + personal:undefined } } componentDidMount(){ window.document.title = '竞赛'; + let url=`/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get(url) + .then((response) => { + if(response.status===200){ + console.log(response) + this.setState({ + personal:response.data.personal + }) + } + }).catch((error) => { + console.log(error) + }) } render() { - const operations = -
+ const operations =
const columns = [ From f7ce428752d246bfb95f50c381f509bcb3b721cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 26 Oct 2019 16:38:29 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionContentsChart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index 55a3108c5..fcd0657ee 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -33,7 +33,7 @@ class CompetitionContents extends Component{ } derivefun=(url)=>{ - axios.get(url + '&export=true').then((response) => { + axios.get(url).then((response) => { if(response === undefined){ return } From bbc909d137687e1a59ad53b3aae593e7df8112f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 26 Oct 2019 16:39:52 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionContentsChart.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index fcd0657ee..9cfc0ae69 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -33,12 +33,12 @@ class CompetitionContents extends Component{ } derivefun=(url)=>{ - axios.get(url).then((response) => { + axios.get(url).then((response)=>{ if(response === undefined){ return } if(response.data.status&&response.data.status===-1){ - + this.props.showNotification(response.data.message); }else if(response.data.status&&response.data.status===-2){ // if(response.data.message === "100"){ // // 已超出文件导出的上限数量(100 ),建议: @@ -54,6 +54,7 @@ class CompetitionContents extends Component{ // DownloadMessageval:500 // }) // } + this.props.showNotification(response.data.message); }else { // this.props.showNotification(`正在下载中`); // window.open("/api"+url, '_blank'); From 0fc1bc3763a3619b62f7d9428007413bebba5d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 26 Oct 2019 16:43:36 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionContentsChart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index 9cfc0ae69..d2d628333 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -312,7 +312,7 @@ class CompetitionContents extends Component{ ) })}
} - + {chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":} From 7536a0775c93fc2f146652f488cf7e8c0cd647d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 26 Oct 2019 16:54:02 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/Competitioncommon/CompetitionCommon.css | 5 +++-- .../Competitioncommon/CompetitionContentsChart.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css index ff20efb97..264642b7d 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css @@ -394,6 +394,7 @@ .userranksclass{ text-align: left; - width: 15%; - padding-left: 31px; + width: 18%; + padding-left: 12px; + margin-right: 28px; } \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index d2d628333..2d4ee2812 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -167,7 +167,7 @@ class CompetitionContents extends Component{ {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ - if(key===3){ + if(key===2){ return( { - if(key===1){ + if(key===0){ return( { - if(key===2){ + if(key===1){ return( Date: Sat, 26 Oct 2019 17:04:41 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionContentsChart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index 2d4ee2812..f287b66a5 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -134,7 +134,7 @@ class CompetitionContents extends Component{ // - // console.log(this.props.chartdata&&this.props.chartdata.user_ranks) + //console.log(chartdata&&chartdata.teams) return (
{chart_rules===undefined?"":this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?this.props.has_url===false?operations:"":"":""}> @@ -313,7 +313,7 @@ class CompetitionContents extends Component{ })}
} - {chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":
} + {chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<4?"":
}