dev_aliyun
caishi 5 years ago
commit 47e9ff574c

@ -23,9 +23,9 @@
</div>
<li class="inline">
<a href="<%= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"
class="ex_submit">报名参赛</a>
class="ex_submit"><%= first_section.competition_entries[2].name %></a>
<a href="javascript:void(0)" onclick="toEnrollDetail();" class="ex_submit">查看报名详情</a>
<a href="javascript:void(0)" class="ex_submit team-btn"><%= first_section.competition_entries[3].name %></a>
</li>
</div>
</div>
@ -34,11 +34,31 @@
<p class="second_course_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".team-btn").on("click", function(){
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
toEnrollDetail();
return;
}
var teamId = "<%= @competition.team_members.find_by_user_id(@user.id).try(:competition_team_id) %>";
location.href = "<%= competition_teams_path %>/" + teamId;
})
})
function toEnrollDetail(){
var htmlvalue = '<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">完成报名后即可查看</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="javascript:void(0)" class="task-btn task-btn-orange fr">立即报名</a></div></div>';
'<a href="<%= enroll_competition_path(id: params[:id]) %>" class="task-btn task-btn-orange fr">立即报名</a></div></div>';
pop_box_new(htmlvalue, 500, 205);
}
</script>

Loading…
Cancel
Save