Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_auth
杨树林 5 years ago
commit 867b21f1ce

@ -144,7 +144,8 @@ $(document).on('turbolinks:load', function(){
var html='<div class="row mt-2 align-items-center linkFormItem">\n' + var html='<div class="row mt-2 align-items-center linkFormItem">\n' +
' <div class="col-1 text-right">\n' + ' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' + ' <label class="checkbox checkbox-primary mt-1">\n' +
' <input type="checkbox" name="navbar[][hidden]" value="0" class="font-16" checked="checked">\n' + ' <input type="checkbox" name="navbar[][hidden]" value="0" hidden class="font-16" checked="checked">\n' +
' <input type="checkbox" value="0" class="font-16 module_hidden" checked="checked">\n' +
' </label>\n' + ' </label>\n' +
' </div>\n' + ' </div>\n' +
' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' + ' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' +
@ -203,6 +204,15 @@ $(document).on('turbolinks:load', function(){
$(this).parents(".requireForm_item").remove(); $(this).parents(".requireForm_item").remove();
}); });
$('.nav-setting-form').on('click', '.module_hidden', function(){
var checkEle = $(this);
if (checkEle.is(':checked')) {
checkEle.prev().val(0);
} else {
checkEle.prev().val(1);
}
});
$('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){
var radio = $(this); var radio = $(this);
if (radio.is(':checked')) { if (radio.is(':checked')) {

@ -38,8 +38,10 @@ module CompetitionsHelper
def chart_stages competition def chart_stages competition
stages = [] stages = []
statistic_stages = competition.competition_stages.where("score_rate > 0") statistic_stages = competition.competition_stages.where("score_rate > 0")
if competition.max_stage_end_time && competition.max_stage_end_time < Time.now && statistic_stages.size > 1
stages << {id: nil, name: "总排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time} end_time = competition.max_stage_end_time || competition.end_time
if end_time && end_time < Time.now
stages << {id: nil, name: statistic_stages.size > 1 ? "总排行榜" : "排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time}
end end
statistic_stages.each do |stage| statistic_stages.each do |stage|

@ -21,7 +21,7 @@ class Admins::CompetitionNavSettingService < ApplicationService
else else
com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md') com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md')
end end
com_module.update_attributes!(hidden: nav["hidden"] ? 0 : 1, position: nav["position"] ? nav["position"] : com_module.position, name: nav["name"], url: nav["url"]) com_module.update_attributes!(hidden: nav["hidden"] && nav["hidden"].to_i == 0 ? 0 : 1, position: nav["position"] ? nav["position"] : params[:navbar].length, name: nav["name"], url: nav["url"])
end end
delete_module_ids = old_module_ids - module_ids delete_module_ids = old_module_ids - module_ids

@ -11,6 +11,8 @@ class Competitions::SaveTeamService < ApplicationService
end end
def call def call
raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(creator)
Competitions::SaveTeamForm.new(form_params).validate! Competitions::SaveTeamForm.new(form_params).validate!
new_record = team.new_record? new_record = team.new_record?

@ -189,7 +189,8 @@
<div class="row mt-2"> <div class="row mt-2">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-8 color-blue mt-1"> <div class="col-md-8 color-blue mt-1">
@ -259,7 +260,8 @@
<div class="row mt-2 new_module_div linkFormItem"> <div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-label mt-2"> <div class="col-md-label mt-2">
@ -282,7 +284,8 @@
<div class="row mt-2 align-items-center linkFormItem"> <div class="row mt-2 align-items-center linkFormItem">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-label mt-1"> <div class="col-md-label mt-1">
@ -325,7 +328,7 @@
</div> </div>
<% if @competition.mode == 1 %> <%# if @competition.mode == 1 %>
<div class="card mb-5 competition-chart-stages"> <div class="card mb-5 competition-chart-stages">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<span>排行榜设置</span> <span>排行榜设置</span>
@ -493,4 +496,4 @@
</div> </div>
</div> </div>
<div style="margin-bottom: 8.5rem;"></div> <div style="margin-bottom: 8.5rem;"></div>
<% end %> <%# end %>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -486,7 +486,7 @@ class App extends Component {
{/*/!*众包创新*!/*/} {/*/!*众包创新*!/*/}
{/*<Route path={"/crowdsourcing"} component={ProjectPackages}/>*/} {/*<Route path={"/crowdsourcing"} component={ProjectPackages}/>*/}
{/*竞赛*/} {/*竞赛*/}
<Route path={"/newcompetitions"} <Route path={"/competitions"}
render={ render={
(props) => { (props) => {

@ -814,9 +814,9 @@ class Registration extends React.Component {
<div style={{marginBottom: '12px'}}> <div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link <Breadcrumb.Item><Link
to={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item> to={`/competitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/} {/*<Breadcrumb.Item*/}
{/* href={`/competitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/} {/* href={`/competitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item> <Breadcrumb.Item>报名</Breadcrumb.Item>

@ -304,7 +304,7 @@ class PersonalCompetititem extends React.Component {
> >
<div className="regitemimgs555"> <div className="regitemimgs555">
<a <a
href={`/newcompetitions/${this.props.match.params.identifier}/competition_teams/${item.id}`} href={`/competitions/${this.props.match.params.identifier}/competition_teams/${item.id}`}
style={{ style={{
color: "#459be5", color: "#459be5",
width: "100%", width: "100%",
@ -364,7 +364,7 @@ class PersonalCompetititem extends React.Component {
> >
<div className="regitemimgs555"> <div className="regitemimgs555">
<a <a
href={`/newcompetitions/${this.props.match.params.identifier}/competition_teams/${item.id}`} href={`/competitions/${this.props.match.params.identifier}/competition_teams/${item.id}`}
style={{ style={{
color: "#459be5", color: "#459be5",
width: "100%", width: "100%",

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large" size="large"
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<a href={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} <a href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"} this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
> >
@ -182,7 +182,7 @@ class CompetitionsIndex extends Component{
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a className={"competitionstitles"} <a className={"competitionstitles"}
href={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} href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a> >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/} {/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/} {/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}

@ -241,8 +241,8 @@ class Competitionteams extends Component{
<div className={"educontent clearfix mt20 "}> <div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>{data&&data.name}</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>{data&&data.name}</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={`/competitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item>
<Breadcrumb.Item>战队详情</Breadcrumb.Item> <Breadcrumb.Item>战队详情</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>

@ -240,7 +240,7 @@ class CompetitionCommon extends Component{
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item> <Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
@ -284,7 +284,7 @@ class CompetitionCommon extends Component{
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col> </Col>
<Col className="gutter-row rankbeicenter" span={6}> <Col className="gutter-row rankbeicenter" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
</Col> </Col>
</Row> </Row>
</Col> </Col>
@ -317,7 +317,7 @@ class CompetitionCommon extends Component{
报名截止 报名截止
</Button>: </Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}> data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}></a>} {data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}
</Button>:""} </Button>:""}
</Col> </Col>
<Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col> <Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col>

@ -68,7 +68,7 @@ class CompetitionContents extends Component{
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
<a onClick={()=>this.derivefun(`/newcompetitions/${this.props.match.params.identifier}/charts.xlsx`)}>导出</a> <a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx`)}>导出</a>
</Button> </Button>
</div> </div>
const columns = [ const columns = [
@ -317,25 +317,26 @@ class CompetitionContents extends Component{
{ {
` `
.ant-table-tbody > tr > td:nth-last-child(4){ .ant-table-tbody > tr > td:nth-last-child(4){
line-height: 63px; // line-height: 63px;
width: 300px; // width: 300px;
height: 96px; // height: 96px;
display: inline-flex; // // display: inline-flex;
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
white-space: nowrap; // white-space: nowrap;
width: 150px;
} }
.ant-table-tbody > tr > td:nth-last-child(3){ .ant-table-tbody > tr > td:nth-last-child(3){
line-height: 63px; // line-height: 63px;
width: 313px; // width: 290px;
height: 96px; // height: 96px;
display: inline-block; // display: inline-block;
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
white-space: nowrap; // white-space: nowrap;
} }
.ant-table-tbody>tr>td, .ant-table-thead>tr>th { .ant-table-tbody>tr>td, .ant-table-thead>tr>th {
padding: 15px; padding: 5px;
} }
` `
} }

@ -53,7 +53,7 @@ class Competitions extends Component {
<Switch> <Switch>
{/*新版竞赛战队详情*/} {/*新版竞赛战队详情*/}
<Route path="/newcompetitions/:identifier/competition_teams/:competition_team_id" <Route path="/competitions/:identifier/competition_teams/:competition_team_id"
render={ render={
(props) => (<CompetitionTeams {...this.props} {...props} {...this.state} />) (props) => (<CompetitionTeams {...this.props} {...props} {...this.state} />)
} }
@ -62,21 +62,21 @@ class Competitions extends Component {
{/*新版竞赛报名*/} {/*新版竞赛报名*/}
<Route <Route
path="/newcompetitions/:identifier/enroll" path="/competitions/:identifier/enroll"
render={ render={
(props) => (<Registration {...this.props} {...props} {...this.state}/>) (props) => (<Registration {...this.props} {...props} {...this.state}/>)
} }
/> />
{/*新版竞赛详情页面*/} {/*新版竞赛详情页面*/}
<Route path="/newcompetitions/:identifier/common_header" <Route path="/competitions/:identifier/common_header"
render={ render={
(props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />) (props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/*新版竞赛首页*/} {/*新版竞赛首页*/}
<Route path="/newcompetitions" <Route path="/competitions"
render={ render={
(props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />) (props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />)
} }

Loading…
Cancel
Save