diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 37c524f63..2d1b39590 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -78,12 +78,17 @@ class AccountsController < ApplicationController
return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked?
login_control = LimitForbidControl::UserLogin.new(@user)
- return normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回登录密码,") 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)
unless password_ok
+ if login_control.remain_times-1 == 0
+ normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码")
+ else
+ normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会")
+ end
login_control.increment!
- return normal_status(-2, "你已经输错密码#{login_control.error_times}次,还剩余#{login_control.remain_times}次机会")
+ return
end
successful_authentication(@user)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 258ab9d83..da6e99418 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -191,6 +191,7 @@ class AttachmentsController < ApplicationController
candown = current_user.member_of_course?(course)
end
tip_exception(403, "您没有权限进入") if course.present? && !candown
+ tip_exception(403, "您没有权限进入") if @file.container.is_a?(ApplyUserAuthentication)
end
end
end
diff --git a/app/controllers/competitions/competitions_controller.rb b/app/controllers/competitions/competitions_controller.rb
index 1eaa0dc22..6ab7e83a0 100644
--- a/app/controllers/competitions/competitions_controller.rb
+++ b/app/controllers/competitions/competitions_controller.rb
@@ -46,7 +46,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
@competition_modules = @competition.unhidden_competition_modules
# 未登录、未获奖用户,不展示获奖证书栏目
- if !current_user.logged? || !current_competition.finished? || !current_competition.competition_prize_users.exists?(user: current_user)
+ if !current_user.logged? || !current_competition.finished? || (!current_competition.competition_prize_users.exists?(user: current_user) && !current_user.admin_or_business?)
@competition_modules = @competition_modules.select { |mod| mod.name != '获奖证书' }
end
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index cc7cacb44..488289815 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -18,7 +18,7 @@ class CoursesController < ApplicationController
:left_banner, :top_banner, :apply_to_join_course, :exit_course, :course_groups]
before_action :set_course, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,
:set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers,
- :top_banner, :left_banner, :add_teacher_popup, :add_teacher,
+ :top_banner, :left_banner, :add_teacher_popup, :add_teacher, :inform_up, :inform_down,
:graduation_group_list, :create_graduation_group, :join_graduation_group,
:course_group_list, :set_course_group, :change_course_admin, :change_course_teacher,
:delete_course_teacher, :teacher_application_review, :students, :all_course_groups,
@@ -41,7 +41,7 @@ class CoursesController < ApplicationController
:set_course_group, :create_group_by_importing_file,
:update_task_position, :tasks_list]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
- :change_course_teacher, :course_group_list, :change_member_role,
+ :change_course_teacher, :course_group_list, :change_member_role,:inform_up, :inform_down,
:teacher_application_review, :apply_teachers, :delete_course_teacher]
before_action :validate_course_name, only: [:create, :update]
before_action :find_board, only: :board_list
@@ -281,13 +281,43 @@ class CoursesController < ApplicationController
end
def informs
- @informs = @course.informs
+ @informs = @course.informs.order("position desc")
+ end
+
+ def inform_up
+ inform = @course.informs.find_by(id: params[:inform_id])
+ next_inform = inform.next_inform
+ ActiveRecord::Base.transaction do
+ if next_inform
+ render_error('已经到达最顶部')
+ else
+ inform.update_attribute(:position, (position + 1))
+ next_inform.update_attribute(:position, last_inform.position - 1)
+ render_ok
+ end
+ end
+ end
+
+ def inform_down
+ inform = @course.informs.find_by(id: params[:inform_id])
+ last_inform = inform.last_inform
+ ActiveRecord::Base.transaction do
+ if last_inform
+ render_error('已经到达最底部')
+ else
+ inform.update_attribute(:position, (position - 1))
+ last_inform.update_attribute(:position, last_inform.position + 1)
+ render_ok
+ end
+ end
+
end
def new_informs
inform = Inform.new(container: @course)
inform.name = params[:name]
inform.description = params[:description]
+ inform.position = @course.informs.maximum(:position) + 1
inform.save!
normal_status("创建成功")
end
@@ -300,6 +330,7 @@ class CoursesController < ApplicationController
def delete_informs
inform = @course.informs.find_by(id: params[:inform_id])
+ @course.informs.where("position > ?", inform.position).update_all("position = position - 1")
inform.destroy!
normal_status("删除成功")
end
diff --git a/app/controllers/trustie_hacks_controller.rb b/app/controllers/trustie_hacks_controller.rb
index 8265c364e..803809124 100644
--- a/app/controllers/trustie_hacks_controller.rb
+++ b/app/controllers/trustie_hacks_controller.rb
@@ -16,6 +16,7 @@ class TrustieHacksController < ApplicationController
end
@hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count)
+ @hacks_count = hacks.count
@hacks = hacks.page(page).per(limit)
diff --git a/app/controllers/users/authentication_applies_controller.rb b/app/controllers/users/authentication_applies_controller.rb
index 6a2c20893..183df2f65 100644
--- a/app/controllers/users/authentication_applies_controller.rb
+++ b/app/controllers/users/authentication_applies_controller.rb
@@ -17,6 +17,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController
private
def create_params
- params.permit(:name, :gender, :id_number, :upload_image)
+ params.permit(:name, :gender, :id_number, :upload_image, attachment_ids: [])
end
end
\ No newline at end of file
diff --git a/app/controllers/users/professional_auth_applies_controller.rb b/app/controllers/users/professional_auth_applies_controller.rb
index 5a9d305ff..d1ee70953 100644
--- a/app/controllers/users/professional_auth_applies_controller.rb
+++ b/app/controllers/users/professional_auth_applies_controller.rb
@@ -17,6 +17,6 @@ class Users::ProfessionalAuthAppliesController < Users::BaseAccountController
private
def create_params
- params.permit(:school_id, :department_id, :identity, :extra, :upload_image)
+ params.permit(:school_id, :department_id, :identity, :extra, :upload_image, attachment_ids: [])
end
end
\ No newline at end of file
diff --git a/app/forms/users/apply_authentication_form.rb b/app/forms/users/apply_authentication_form.rb
index e9bd1b793..a9cb60eec 100644
--- a/app/forms/users/apply_authentication_form.rb
+++ b/app/forms/users/apply_authentication_form.rb
@@ -1,10 +1,11 @@
class Users::ApplyAuthenticationForm
include ActiveModel::Model
- attr_accessor :name, :id_number, :gender, :upload_image
+ attr_accessor :name, :id_number, :gender, :upload_image, :attachment_ids
validates :name, presence: true
validate :validate_ID_number
+ validate :validate_attachment_ids
def validate_ID_number
@@ -12,4 +13,10 @@ class Users::ApplyAuthenticationForm
raise("身份证格式不对")
end
end
+
+ def validate_attachment_ids
+ unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
+ raise("图片参数不对")
+ end
+ end
end
\ No newline at end of file
diff --git a/app/forms/users/apply_professional_auth_form.rb b/app/forms/users/apply_professional_auth_form.rb
index c5de9700c..40caf1c0e 100644
--- a/app/forms/users/apply_professional_auth_form.rb
+++ b/app/forms/users/apply_professional_auth_form.rb
@@ -1,10 +1,17 @@
class Users::ApplyProfessionalAuthForm
include ActiveModel::Model
- attr_accessor :school_id, :department_id, :identity, :extra, :upload_image
+ attr_accessor :school_id, :department_id, :identity, :extra, :upload_image, :attachment_ids
validates :school_id, presence: true, numericality: { only_integer: true, greater_than: 0 }
validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true
validates :identity, presence: true, inclusion: { in: %w(student teacher professional) }
validates :extra, presence: true
+ validate :validate_attachment_ids
+
+ def validate_attachment_ids
+ unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
+ raise("图片参数不对")
+ end
+ end
end
\ No newline at end of file
diff --git a/app/models/apply_user_authentication.rb b/app/models/apply_user_authentication.rb
index 4f94202f6..ad74b0261 100644
--- a/app/models/apply_user_authentication.rb
+++ b/app/models/apply_user_authentication.rb
@@ -4,6 +4,7 @@ class ApplyUserAuthentication < ApplicationRecord
belongs_to :user
has_many :tidings, :as => :container, :dependent => :destroy
+ has_one :attachment, as: :container, dependent: :destroy
scope :real_name_auth, -> { where(auth_type: 1) }
scope :professional_auth, -> { where(auth_type: 2) }
diff --git a/app/models/inform.rb b/app/models/inform.rb
index d486b6f11..a6f40fe6d 100644
--- a/app/models/inform.rb
+++ b/app/models/inform.rb
@@ -5,4 +5,13 @@ class Inform < ApplicationRecord
validates :description, length: { maximum: 5000 }
has_many :attachments, as: :container, dependent: :destroy
+
+ def next_inform
+ Inform.where(position: self.position+1, container_id: self.course_id, container_type: 'Course')
+ end
+
+ def last_inform
+ Inform.where(position: self.position-1, container_id: self.course_id, container_type: 'Course')
+ end
+
end
diff --git a/app/services/admins/identity_auths/agree_apply_service.rb b/app/services/admins/identity_auths/agree_apply_service.rb
index 65a3b2376..d75a6d7db 100644
--- a/app/services/admins/identity_auths/agree_apply_service.rb
+++ b/app/services/admins/identity_auths/agree_apply_service.rb
@@ -14,7 +14,8 @@ class Admins::IdentityAuths::AgreeApplyService < ApplicationService
RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500)
deal_tiding!
- delete_auth_file!
+ apply.attachment&.destroy
+ # delete_auth_file!
end
end
diff --git a/app/services/admins/identity_auths/refuse_apply_service.rb b/app/services/admins/identity_auths/refuse_apply_service.rb
index 57581dd40..7ac2e6c38 100644
--- a/app/services/admins/identity_auths/refuse_apply_service.rb
+++ b/app/services/admins/identity_auths/refuse_apply_service.rb
@@ -12,7 +12,8 @@ class Admins::IdentityAuths::RefuseApplyService < ApplicationService
apply.update!(status: 2, remarks: reason)
deal_tiding!
- delete_auth_file!
+ apply.attachment&.destroy
+ # delete_auth_file!
end
end
diff --git a/app/services/admins/professional_auths/agree_apply_service.rb b/app/services/admins/professional_auths/agree_apply_service.rb
index 81654f0d3..1ca2da2fc 100644
--- a/app/services/admins/professional_auths/agree_apply_service.rb
+++ b/app/services/admins/professional_auths/agree_apply_service.rb
@@ -14,7 +14,8 @@ class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService
RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500)
deal_tiding!
- delete_auth_file!
+ apply.attachment&.destroy
+ # delete_auth_file!
end
end
diff --git a/app/services/admins/professional_auths/refuse_apply_service.rb b/app/services/admins/professional_auths/refuse_apply_service.rb
index b5332c999..a055488c3 100644
--- a/app/services/admins/professional_auths/refuse_apply_service.rb
+++ b/app/services/admins/professional_auths/refuse_apply_service.rb
@@ -12,7 +12,8 @@ class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService
apply.update!(status: 2, remarks: reason)
deal_tiding!
- delete_auth_file!
+ apply.attachment&.destroy
+ # delete_auth_file!
end
end
diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb
index c68260dcb..cab76b45c 100644
--- a/app/services/users/apply_authentication_service.rb
+++ b/app/services/users/apply_authentication_service.rb
@@ -22,9 +22,11 @@ class Users::ApplyAuthenticationService < ApplicationService
user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present?
- user.apply_user_authentication.create!(auth_type: 1, status: 0)
+ apply = user.apply_user_authentication.create!(auth_type: 1, status: 0)
- move_image_file! unless params[:upload_image].to_s == 'false'
+ Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids]
+
+ # move_image_file! unless params[:upload_image].to_s == 'false'
end
# sms_notify_admin
diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb
index 46a4658aa..81cd11a4c 100644
--- a/app/services/users/apply_professional_auth_service.rb
+++ b/app/services/users/apply_professional_auth_service.rb
@@ -34,9 +34,11 @@ class Users::ApplyProfessionalAuthService < ApplicationService
user.save!
extension.save!
- user.apply_user_authentication.create!(auth_type: 2, status: 0)
+ apply = user.apply_user_authentication.create!(auth_type: 2, status: 0)
- move_image_file! unless params[:upload_image].to_s == 'false'
+ Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids]
+
+ # move_image_file! unless params[:upload_image].to_s == 'false'
end
# sms_notify_admin
diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb
index c40d681ec..e1c603215 100644
--- a/app/views/admins/identity_authentications/shared/_list.html.erb
+++ b/app/views/admins/identity_authentications/shared/_list.html.erb
@@ -51,8 +51,8 @@
<% unless is_processed %>
- <% if File.exists?(disk_real_name_auth_filename(user.id)) %>
- <%= image_tag(real_name_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
+ <% if apply.attachment %>
+ <%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<% else %>
<%= content_tag(:span, '图片已删除', class: 'text-secondary') %>
<% end %>
diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb
index 79cf31aad..0bf8ea4a3 100644
--- a/app/views/admins/professional_authentications/shared/_list.html.erb
+++ b/app/views/admins/professional_authentications/shared/_list.html.erb
@@ -48,8 +48,8 @@
<% unless is_processed %>
- <% if File.exists?(disk_professional_auth_filename(user.id)) %>
- <%= image_tag(professional_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
+ <% if apply.attachment %>
+ <%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<% else %>
<%= content_tag(:span, '图片已删除', class: 'text-secondary') %>
<% end %>
diff --git a/app/views/courses/students.json.jbuilder b/app/views/courses/students.json.jbuilder
index 2790a81fc..93d05b623 100644
--- a/app/views/courses/students.json.jbuilder
+++ b/app/views/courses/students.json.jbuilder
@@ -5,7 +5,7 @@ json.students do
json.name student.user.try(:real_name)
json.name_link user_path(student.user)
json.student_id student.user.try(:student_id)
- json.course_group_name student.course_group.try(:name)
+ json.course_group_name student.course_group_name
json.course_member_id student.id
if @user_course_identity < Course::ASSISTANT_PROFESSOR && !params[:course_group_id].present?
json.member_roles student.user.course_role(@course)
diff --git a/app/views/trustie_hacks/index.json.jbuilder b/app/views/trustie_hacks/index.json.jbuilder
index 0f4d4f060..c309ebe21 100644
--- a/app/views/trustie_hacks/index.json.jbuilder
+++ b/app/views/trustie_hacks/index.json.jbuilder
@@ -2,7 +2,7 @@ json.hackathon do
json.(@hackathon, :id, :name, :description)
json.hackathon_users_count @hackathon_users_count
end
-
+json.hacks_count @hacks_count
json.hacks @hacks do |hack|
json.(hack, :id, :name, :description, :hack_users_count)
json.entry_info hack.entry_info(current_user.id)
diff --git a/config/routes.rb b/config/routes.rb
index b2a7b1de6..e13092c08 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -381,6 +381,8 @@ Rails.application.routes.draw do
get 'work_score'
get 'act_score'
get 'statistics'
+ post :inform_up
+ post :inform_down
end
collection do
diff --git a/db/migrate/20191106055638_migrate_2808_exercise_score.rb b/db/migrate/20191106055638_migrate_2808_exercise_score.rb
new file mode 100644
index 000000000..ebf09e148
--- /dev/null
+++ b/db/migrate/20191106055638_migrate_2808_exercise_score.rb
@@ -0,0 +1,111 @@
+class Migrate2808ExerciseScore < ActiveRecord::Migration[5.2]
+ def challenge_path(path)
+ cha_path = path.present? ? path.split(";") : []
+ cha_path.reject(&:blank?)[0].try(:strip)
+ end
+
+ # 版本库文件内容,带转码
+ def git_fle_content(repo_path, path)
+ begin
+ Rails.logger.info("git file content: repo_path is #{repo_path}, path is #{path}")
+
+ content = GitService.file_content(repo_path: repo_path, path: path)
+
+ Rails.logger.info("git file content: content is #{content}")
+ decode_content = nil
+ if content.present?
+ content = content["content"] #6.24 -hs 这个为新增,因为当实训题里含有选择题时,这里会报错,undefined method `[]' for nil:NilClass
+
+ content = Base64.decode64(content)
+ cd = CharDet.detect(content)
+ Rails.logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}"
+ # 字符编码问题,GB18030编码识别率不行
+ decode_content =
+ if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8
+ content.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '})
+ else
+ content.force_encoding('UTF-8')
+ end
+ end
+
+ decode_content
+
+ rescue Exception => e
+ Rails.logger.error(e.message)
+ raise Educoder::TipException.new("文档内容获取异常")
+ end
+ end
+
+ def calculate_student_score(exercise,user)
+ score5 = 0.0 #实训题
+ exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges)
+ exercise_questions.each do |q|
+ if q.question_type == 5
+ q.exercise_shixun_challenges.each do |exercise_cha|
+ game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
+ if game.present?
+ exercise_cha_score = 0.0
+ answer_status = 0
+ # if game.status == 2 && game.final_score >= 0
+ if game.final_score > 0 && game.end_time < exercise.end_time
+ exercise_cha_score = game.real_score(exercise_cha.question_score)
+ # exercise_cha_score = exercise_cha.question_score #每一关卡的得分
+ answer_status = 1
+ end
+ ex_shixun_answer_content = exercise_cha.exercise_shixun_answers.where(user_id:user.id,exercise_question_id:q.id)
+ code = nil
+ if exercise_cha.challenge&.path.present?
+ cha_path = challenge_path(exercise_cha.challenge&.path)
+ game_challenge = game.game_codes.search_challenge_path(cha_path)&.first
+ if game_challenge.present?
+ game_code = game_challenge
+ code = game_code.try(:new_code)
+ else
+ begin
+ code = git_fle_content(game.myshixun.repo_path,cha_path)
+ rescue
+ code = ""
+ end
+ end
+ end
+ if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
+ ### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了?涉及到code的多个版本库的修改
+ sx_option = {
+ :exercise_question_id => q.id,
+ :exercise_shixun_challenge_id => exercise_cha.id,
+ :user_id => user.id,
+ :score => exercise_cha_score.round(1),
+ :answer_text => code,
+ :status => answer_status
+ }
+ ExerciseShixunAnswer.create!(sx_option)
+ else
+ ex_shixun_answer_content.first.update_attributes!(score:exercise_cha_score.round(1),answer_text:code,status:answer_status)
+ end
+ score5 += exercise_cha_score
+ else
+ score5 += 0.0
+ end
+ end
+ end
+ end
+ score5
+ end
+
+ def change
+ exercise = Exercise.find_by(id: 2808)
+ if exercise
+ exercise_users = exercise.exercise_users.where("start_at is not null and commit_status = 0")
+ exercise_users.each do |exercise_user|
+ calculate_score = calculate_student_score(exercise, exercise_user.user)
+ subjective_score = exercise_user.subjective_score
+ total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
+ total_score = calculate_score + total_score_subjective_score
+ if exercise_user.end_at.nil?
+ exercise_user.update_attributes!(score:total_score,objective_score:calculate_score,end_at:exercise.end_time,commit_status:1,status:1,commit_method:3)
+ end
+ puts exercise_user.id
+ end
+ end
+ end
+end
diff --git a/db/migrate/20191106094429_add_position_for_informs.rb b/db/migrate/20191106094429_add_position_for_informs.rb
new file mode 100644
index 000000000..3065081f2
--- /dev/null
+++ b/db/migrate/20191106094429_add_position_for_informs.rb
@@ -0,0 +1,17 @@
+class AddPositionForInforms < ActiveRecord::Migration[5.2]
+ def change
+ add_column :informs, :position, :integer, :default => 1
+
+ course_ids = Inform.where(container_type: 'Course').pluck(:container_id).uniq
+ courses = Course.where(id: course_ids)
+
+ courses.find_each do |course|
+ next if course.informs.count == 1
+ informs = course.informs.order("created_at asc")
+ informs.each_with_index do |inform, index|
+ inform.update_attribute(:position, index+1)
+ end
+ end
+
+ end
+end
diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js
index 9a23f66c1..1f582ce79 100644
--- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js
+++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js
@@ -144,7 +144,8 @@ class CompetitionsIndex extends Component{
报名截止时间:{item.enroll_end_time} ,
]}
extra={
-
+
+
奖金
diff --git a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css
index aa2c347f3..6aa2fd641 100644
--- a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css
+++ b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css
@@ -88,7 +88,8 @@
}
.CompetitionsIndex .gutter-row{
- margin-right:20px;
+ /*margin-right:20px;*/
+ width: 33%;
}
.pt50{
diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css
index f55c9a336..7603137e0 100644
--- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css
+++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.css
@@ -399,4 +399,8 @@
.color000{
color: #000;
+}
+
+.cursorpointer{
+ cursor: pointer;
}
\ 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 ed129d8bd..4ccd8fb6f 100755
--- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js
+++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js
@@ -72,16 +72,19 @@ class CompetitionCommon extends Component{
}
//获取头部信息
getbannerdata=()=>{
- let menuid=this.props.location.search.replace('?menu=', '');
+ // let menuid=this.props.location.search.replace('?menu=', '');
+ let query=this.props.location&&this.props.location.search;
+ const types = query.split('&')
+ const menuid = types[0].split('?menu=')
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
data: response.data,
- thiskeys: menuid === undefined || menuid === "" ? response.data.competition_modules[0].id : menuid,
+ thiskeys: menuid[1] === undefined || menuid[1] === "" ? response.data.competition_modules[0].id : menuid[1],
mode: response.data.mode
})
- if(menuid===undefined||menuid===""){
+ if(menuid[1]===undefined||menuid[1]===""){
this.getrightdata(
response.data.competition_modules[0].id,
response.data.competition_modules[0].module_type,
@@ -91,7 +94,7 @@ class CompetitionCommon extends Component{
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
- if(`${item.id}`===`${menuid}`){
+ if(`${item.id}`===`${menuid[1]}`){
this.getrightdata(
item.id,
item.module_type,
@@ -224,6 +227,18 @@ class CompetitionCommon extends Component{
Competitionedittype:false
})
+ }
+ newgotocourse=(url)=>{
+ if(this.props.checkIfLogin()===false){
+ this.props.showLoginDialog()
+ return
+ }
+ if(this.props.checkIfProfileCompleted()===false){
+ this.props.showProfileCompleteDialog()
+ return
+ }
+ window.open(url);
+
}
gotocourse=(url)=>{
@@ -255,7 +270,9 @@ class CompetitionCommon extends Component{
).then((response) => {
if (response.data.status === 0) {
// this.props.history.replace();
- this.Personalregistration(`/courses/${data.course_id}`)
+ this.getbannerdata()
+ window.open(`/courses/${data.course_id}`);
+
}
})
@@ -267,7 +284,7 @@ class CompetitionCommon extends Component{
let urls = `/competitions/${this.props.match.params.identifier}/enroll`;
this.Personalregistration(urls)
} else {
- this.props.history.replace(url);
+ window.open(url);
}
}
@@ -293,6 +310,7 @@ class CompetitionCommon extends Component{
if (response.data) {
this.props.showNotification(`报名成功,预祝您夺得桂冠!`);
// this.props.history.replace(urls);
+ this.getbannerdata()
window.open(urls)
}
}
@@ -355,7 +373,15 @@ class CompetitionCommon extends Component{
className={"color000"}>{data && data.start_time}~{data && data.end_time}
{/* */}
-
+
@@ -379,8 +405,24 @@ class CompetitionCommon extends Component{
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status === "nearly_published" ? "--" : data && data.visits_count}
-
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status === "nearly_published" ? "--" : data && data.member_count}
+
+ {data.competition_status === "ended" ?
+
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
+ onClick={ data.mode === 2 ?data.member_of_course==true?() => this.newgotocourse(`/courses/${data.course_id}`):"":() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
+ >{data && data.member_count}
+ :data.competition_status === "nearly_published" ?
+
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
+ >{"--"}
:
+ data.competition_status === "progressing" ?
+ data.mode === 2 ?
+
this.gotocourse()}>{data && data.member_count}
: signupdata && signupdata.personal === true ?
+
this.gotocourse("personal")}>{data && data.member_count}
:
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data && data.member_count}
+ :""}
+
diff --git a/public/react/src/modules/courses/busyWork/UseBank.js b/public/react/src/modules/courses/busyWork/UseBank.js
index 1729f7fa5..1c6db302e 100644
--- a/public/react/src/modules/courses/busyWork/UseBank.js
+++ b/public/react/src/modules/courses/busyWork/UseBank.js
@@ -213,6 +213,13 @@ class UseBank extends Component{
text-overflow:ellipsis;
white-space:nowrap
}
+ .bankwidth76{
+ width:76px !important;
+ overflow:hidden;
+ text-overflow:ellipsis;
+ white-space:nowrap;
+ text-align: center;
+ }
.bankwidth2{
width:24% !important;
overflow:hidden;
@@ -224,7 +231,7 @@ class UseBank extends Component{
Margin-left:15px
}
.with63{
- width: 63% !important;
+ width: 60% !important;
box-sizing: border-box;
margin-left: 15px;
}
@@ -306,15 +313,21 @@ class UseBank extends Component{
- 30 ? item.name:""} style={{"maxWidth":"100%"}}>{item.name}
+ 30 ? item.name : ""}
+ style={{"maxWidth": "100%"}}>
+ {item.name}
+
10 && item.course_list_name}
className={nav_my === 'myself' ? "fl with30 color-grey-6 task-hide pl5 bankwidth" : "fl with30 color-grey-6 task-hide pl5 bankwidth2"}
- >{item.course_list_name}
+ >{item.course_list_name}
{
nav_my === 'public' &&
- {item.username}
+ {item.username}
}
{nav_my === "myself" ?
(this.props.object_type && this.props.object_type === "normal" ?
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 91427534f..ac0f81356 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -107,7 +107,7 @@ const buildColumns = (that,isParent) => {
}
];
- if (course_groups && course_groups.length) {
+ if (that.hasGroupModule()) {
that.isStudentPage && columns.push({
title: '分班',
dataIndex: 'course_group_name',
@@ -249,6 +249,13 @@ class studentsList extends Component{
console.log(error)
});
}
+ hasGroupModule = () => {
+ const { course_modules } = this.props;
+ const result = course_modules && course_modules.filter( item => {
+ return item.type == 'course_group'
+ })
+ return result && result.length > 0
+ }
Downloadcal=()=>{
this.setState({
diff --git a/public/react/src/modules/osshackathon/Osshackathon.css b/public/react/src/modules/osshackathon/Osshackathon.css
index 54287ccae..8966ed800 100644
--- a/public/react/src/modules/osshackathon/Osshackathon.css
+++ b/public/react/src/modules/osshackathon/Osshackathon.css
@@ -37,4 +37,33 @@
font-weight:400;
color:rgba(5,16,26,1);
line-height:24px;
+}
+
+.ant-input::-webkit-input-placeholder{
+ color: #999;
+ font-size: 14px;
+}
+
+.ant-input:-moz-placeholder {
+ color: #999;
+ font-size: 14px;
+}
+
+.ant-input::-moz-placeholder{
+ color: #999;
+ font-size: 14px;
+}
+
+.ant-input:-ms-input-placeholder{
+ color: #999;
+ font-size: 14px;
+}
+
+.Searchant-btn-primary .ant-btn-primary{
+ background: #4CACFF;
+ border-color: #4CACFF;
+}
+
+.Searchant-btn-primary .ant-input-group .ant-input{
+ height:42px;
}
\ No newline at end of file
diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js
index f2bf71e32..6b8cb3bf3 100644
--- a/public/react/src/modules/osshackathon/Osshackathon.js
+++ b/public/react/src/modules/osshackathon/Osshackathon.js
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import axios from 'axios';
-import {SnackbarHOC, WordsBtn,getImageUrl} from 'educoder';
+import {SnackbarHOC, WordsBtn,getImageUrl,markdownToHTML} from 'educoder';
import {Row, Col,Input,Divider,Card,Button} from 'antd';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../courses/common/CNotificationHOC';
@@ -11,13 +11,35 @@ class Osshackathon extends Component {
constructor(props) {
super(props)
this.state = {
-
+ page:1,
+ limit:10,
+ search:undefined,
+ data:undefined
}
}
componentDidMount() {
+ this.getosshackathon();
}
+ getosshackathon=()=>{
+ let {page,limit,search}=this.state;
+ let url=`/osshackathon.json`;
+ axios.get(url,{params:{
+ page:page,
+ limit:limit,
+ search:search,
+ }}).then((result)=>{
+ if(result.status==200){
+ console.log(result)
+ this.setState({
+ data:result.data
+ })
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
componentDidUpdate = (prevProps) => {
@@ -25,10 +47,21 @@ class Osshackathon extends Component {
}
render() {
- // let {} = this.state;
+ let{data}=this.state;
+ console.log(this.state.data)
return (
+
@@ -37,24 +70,28 @@ class Osshackathon extends Component {
>
+
console.log(value)}
/>
+
- 报名整数:280 个
+ 报名整数:{data&&data.hackathon.hackathon_users_count} 个
+
- 大赛介绍
+ {data&&data.hackathon.name}
编辑
@@ -73,12 +110,18 @@ class Osshackathon extends Component {
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
- probare, quae sunt a te dicta? Refert tamen, quo modo.
+ {data&&data.hackathon.description===null?"":
}
-
+ {
+ data&&data.hacks.length==0?"":data&&data.hacks.map((item,key)=>{
+ return(
+
+ )
+ })
+ }
{/*学生身份*/}
-
+
diff --git a/public/react/src/modules/page/readme.txt b/public/react/src/modules/page/readme.txt
index f5e5646e9..dc22a971b 100644
--- a/public/react/src/modules/page/readme.txt
+++ b/public/react/src/modules/page/readme.txt
@@ -221,4 +221,8 @@ TPI SSH
VNCDisplay
- 使用的github上的代码 https://github.com/novnc/noVNC/
\ No newline at end of file
+ 使用的github上的代码 https://github.com/novnc/noVNC/
+
+
+tpi拖拽改变视图大小代码:
+js_min_all.js中搜索 doc.live('mousemove touchmove',function(e){
\ No newline at end of file
diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js
index cc5bfc2c6..8309cc5ca 100644
--- a/public/react/src/modules/user/modal/RealNameCertificationModal.js
+++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js
@@ -44,6 +44,7 @@ class RealNameCertificationModal extends Component{
this.state={
identity:"teacher",
departmentsName:undefined,
+ fileID:undefined,
filterSchoolList:undefined,
filterDepartments :undefined,
school:undefined,
@@ -269,7 +270,8 @@ class RealNameCertificationModal extends Component{
axios.post((url),{
name:values.name || basicInfo.name,
gender:parseInt(values.sex),
- id_number:values.credentials
+ id_number:values.credentials,
+ attachment_ids:[this.state.fileID]
}).then((result)=>{
if(result){
this.props.showNotification("申请已提交,请等待审核!");
@@ -295,7 +297,8 @@ class RealNameCertificationModal extends Component{
school_id:this.state.school_id,
department_id:this.state.department_id,
identity:this.state.identity,
- extra: values.job == "student" ? values.student_No : values.job == "teacher" ? values.job1 : values.job2
+ extra: values.job == "student" ? values.student_No : values.job == "teacher" ? values.job1 : values.job2,
+ attachment_ids:[this.state.fileID]
}).then((result)=>{
if(result){
this.props.showNotification("申请已提交,请等待审核!");
@@ -327,20 +330,7 @@ class RealNameCertificationModal extends Component{
const { course_lists, checkBoxValues } = this.state
this.onSendOk()
}
-
- handleChange = (info) => {
- if (info.file.status === 'uploading') {
- this.setState({ loading: true });
- return;
- }
- if (info.file.status === 'done') {
- // Get this url from response in real world.
- getBase64(info.file.originFileObj, imageUrl => this.setState({
- imageUrl,
- loading: false,
- }));
- }
- }
+
handleChange2 = (info) => {
if (info.file.status === 'uploading') {
this.setState({ loading: true });
@@ -348,9 +338,11 @@ class RealNameCertificationModal extends Component{
}
if (info.file.status === 'done') {
// Get this url from response in real world.
+ console.log(info.file.response);
getBase64(info.file.originFileObj, imageUrl2 => this.setState({
imageUrl2,
loading: false,
+ fileID:info.file.response && info.file.response.id
}));
}
}