Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

issues25489
杨树明 6 years ago
commit e88d7d96d1

@ -78,7 +78,7 @@ class AccountsController < ApplicationController
return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked? return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked?
login_control = LimitForbidControl::UserLogin.new(@user) login_control = LimitForbidControl::UserLogin.new(@user)
return normal_status(-2, "登录密码出错已达上限,将锁定密码1小时") if login_control.forbid? return normal_status(-2, "登录密码出错已达上限,将锁定密码#{login_control.forbid_expires/60}分钟") if login_control.forbid?
password_ok = @user.check_password?(params[:password].to_s) password_ok = @user.check_password?(params[:password].to_s)
unless password_ok unless password_ok

@ -8,8 +8,13 @@ class TrustieHacksController < ApplicationController
## 分页参数 ## 分页参数
page = params[:page] || 1 page = params[:page] || 1
limit = params[:limit] || 16 limit = params[:limit] || 16
search = params[:search]
hacks = @hackathon.trustie_hacks hacks = @hackathon.trustie_hacks
if search
hacks = hacks.where("name like ?", "%#{search}%")
end
@hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count) @hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count)
@hacks = hacks.page(page).per(limit) @hacks = hacks.page(page).per(limit)
@ -28,6 +33,11 @@ class TrustieHacksController < ApplicationController
render_ok render_ok
end end
def destroy
@hack.destroy
render_ok
end
def edit_hackathon def edit_hackathon
end end
@ -36,6 +46,16 @@ class TrustieHacksController < ApplicationController
render_ok render_ok
end end
# 报名入口
def entry
if @hack.hack_users.exists?(user_id: current_user)
render_error('已经报名,请勿重复操作')
else
@hack.hack_users.create(user_id: current_user)
render_ok
end
end
private private

@ -12,7 +12,7 @@ class LimitForbidControl::UserLogin < LimitForbidControl::Base
def forbid_expires def forbid_expires
num = EduSetting.get('daily_error_password_forbid_time').presence.to_i num = EduSetting.get('daily_error_password_forbid_time').presence.to_i
num.zero? ? 1.hours : num.to_i.hours num.zero? ? 1.hours : num.to_i.minutes
end end
def cumulative_expires def cumulative_expires

@ -1,4 +1,9 @@
class TrustieHack < ApplicationRecord class TrustieHack < ApplicationRecord
has_many :hack_users, :dependent => :destroy has_many :hack_users, :dependent => :destroy
belongs_to :trustie_hackathon, counter_cache: true belongs_to :trustie_hackathon, counter_cache: true
def entry_info(user_id)
hack_users.exists?(user_id: user_id)
end
end end

@ -20,7 +20,7 @@
<td><%= myshixun.identifier %></td> <td><%= myshixun.identifier %></td>
<td class="text-left"> <td class="text-left">
<% current_task = myshixun.last_executable_task || myshixun.last_task %> <% current_task = myshixun.last_executable_task || myshixun.last_task %>
<%= link_to "/myshixuns/#{myshixun.identifier}/stages/#{current_task.identifier}", target: '_blank' do %> <%= link_to "/tasks/#{current_task.identifier}", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %> <%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% end %> <% end %>
</td> </td>

@ -5,5 +5,6 @@ end
json.hacks @hacks do |hack| json.hacks @hacks do |hack|
json.(hack, :id, :name, :description, :hack_users_count) json.(hack, :id, :name, :description, :hack_users_count)
json.entry_info hack.entry_info(current_user.id)
end end

@ -880,7 +880,9 @@ Rails.application.routes.draw do
get :edit_hackathon get :edit_hackathon
post :update_hackathon post :update_hackathon
end end
member do
post :entry
end
end end
end end

@ -0,0 +1,5 @@
class AddUniqIndexForHackUsers < ActiveRecord::Migration[5.2]
def change
add_index :hack_users, [:user_id, :trustie_hack_id], unique: true
end
end

@ -106,8 +106,9 @@ const buildColumns = (that,isParent) => {
} }
} }
]; ];
if (course_groups && course_groups.length) { if (course_groups && course_groups.length) {
this.isStudentPage && columns.push({ that.isStudentPage && columns.push({
title: '分班', title: '分班',
dataIndex: 'course_group_name', dataIndex: 'course_group_name',
key: 'course_group_name', key: 'course_group_name',

@ -2,7 +2,7 @@ import React, { Component } from "react";
import { message, Icon, Input, Form, Upload,Radio ,Tooltip} from "antd"; import { message, Icon, Input, Form, Upload,Radio ,Tooltip} from "antd";
import axios from 'axios' import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper" import ModalWrapper from "../../courses/common/ModalWrapper"
import { City, getUploadActionUrl, getImageUrl, ImageLayer2, getUploadActionUrlOfAuth ,ConditionToolTip } from 'educoder' import { getUploadActionUrl, ImageLayer2 ,ConditionToolTip } from 'educoder'
import '../account/common.css' import '../account/common.css'
import AccountBasicEditItem from '../account/AccountBasicEditItem' import AccountBasicEditItem from '../account/AccountBasicEditItem'
import ApplyForAddOrgModal from './ApplyForAddOrgModal' import ApplyForAddOrgModal from './ApplyForAddOrgModal'
@ -469,12 +469,12 @@ class RealNameCertificationModal extends Component{
showApplyForAddChildOrgModal:this.showApplyForAddChildOrgModal showApplyForAddChildOrgModal:this.showApplyForAddChildOrgModal
} }
const uploadProps2 = { const uploadProps2 = {
name: 'image', // name: 'image',
data: {type: certification == 1 ? "real_name" : "professional"}, data: {type: certification == 1 ? "real_name" : "professional"},
multiple: true, multiple: true,
showUploadList: false, showUploadList: false,
// https://newweb.educoder.net // https://newweb.educoder.net
action: this.props.current_user ? `${getUploadActionUrlOfAuth(this.props.current_user.login)}` : '', action: this.props.current_user ? `${getUploadActionUrl()}` : '',
className: 'idPic-uploader', className: 'idPic-uploader',
onChange: this.handleChange2, onChange: this.handleChange2,
}; };

Loading…
Cancel
Save