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' +
' <div class="col-1 text-right">\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' +
' </div>\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();
});
$('.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(){
var radio = $(this);
if (radio.is(':checked')) {

@ -38,8 +38,10 @@ module CompetitionsHelper
def chart_stages competition
stages = []
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
statistic_stages.each do |stage|

@ -21,7 +21,7 @@ class Admins::CompetitionNavSettingService < ApplicationService
else
com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md')
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
delete_module_ids = old_module_ids - module_ids

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

@ -189,7 +189,8 @@
<div class="row mt-2">
<div class="col-1 text-right">
<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>
</div>
<div class="col-md-8 color-blue mt-1">
@ -259,7 +260,8 @@
<div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right">
<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>
</div>
<div class="col-md-label mt-2">
@ -282,7 +284,8 @@
<div class="row mt-2 align-items-center linkFormItem">
<div class="col-1 text-right">
<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>
</div>
<div class="col-md-label mt-1">
@ -325,7 +328,7 @@
</div>
<% if @competition.mode == 1 %>
<%# if @competition.mode == 1 %>
<div class="card mb-5 competition-chart-stages">
<div class="card-header d-flex justify-content-between align-items-center">
<span>排行榜设置</span>
@ -493,4 +496,4 @@
</div>
</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={"/newcompetitions"}
<Route path={"/competitions"}
render={
(props) => {

@ -814,9 +814,9 @@ class Registration extends React.Component {
<div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<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*/}
{/* href={`/competitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item>

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

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
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"?
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"?
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"}
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>
{/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}

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

@ -240,7 +240,7 @@ class CompetitionCommon extends Component{
data===undefined?"":<div className={"educontent clearfix mt20 "}>
<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>
@ -284,7 +284,7 @@ class CompetitionCommon extends Component{
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col>
<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>
</Row>
</Col>
@ -317,7 +317,7 @@ class CompetitionCommon extends Component{
报名截止
</Button>:
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>:""}
</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>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<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>
</div>
const columns = [
@ -317,25 +317,26 @@ class CompetitionContents extends Component{
{
`
.ant-table-tbody > tr > td:nth-last-child(4){
line-height: 63px;
width: 300px;
height: 96px;
display: inline-flex;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
// line-height: 63px;
// width: 300px;
// height: 96px;
// // display: inline-flex;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
width: 150px;
}
.ant-table-tbody > tr > td:nth-last-child(3){
line-height: 63px;
width: 313px;
height: 96px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
// line-height: 63px;
// width: 290px;
// height: 96px;
// display: inline-block;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
}
.ant-table-tbody>tr>td, .ant-table-thead>tr>th {
padding: 15px;
padding: 5px;
}
`
}

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

Loading…
Cancel
Save