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

dev_home
杨树林 5 years ago
commit 298224bc80

@ -85,8 +85,8 @@ $(document).on('turbolinks:load', function() {
$subjectSelect.select2({
theme: 'bootstrap4',
placeholder: '请输入课程名称/创建者检索',
multiple: true,
closeOnSelect: false,
multiple: false,
closeOnSelect: true,
ajax: {
delay: 500,
url: '/admins/laboratories/' + laboratoryId + '/subjects_for_select',
@ -132,7 +132,7 @@ $(document).on('turbolinks:load', function() {
method: 'POST',
dataType: 'json',
url: '/admins/laboratories/' + laboratoryId + '/laboratory_subjects',
data: { subject_ids: subjectIds },
data: { subject_id: subjectIds },
success: function(){
show_success_flash();
window.location.reload();

@ -16,7 +16,7 @@ $(document).on('turbolinks:load', function() {
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/cooperative/users',
url: '/cooperative/users/for_select',
dataType: 'json',
data: function(params){
return { name: params.term };

@ -9,15 +9,8 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
end
def create
subject_ids = Array.wrap(params[:subject_ids])
subject_ids = Subject.where(id: subject_ids).pluck(:id)
exist_subject_id = current_laboratory.laboratory_subjects.where(subject_id: subject_ids).pluck(:subject_id)
LaboratorySubject.bulk_insert(*%i[subject_id laboratory_id created_at updated_at]) do |worker|
(subject_ids - exist_subject_id).each do |subject_id|
worker.add(subject_id: subject_id, laboratory_id: current_laboratory.id)
end
end
subject = Subject.find(params[:subject_id])
Subjects::CopySubjectService.call(subject, current_user.id, current_laboratory)
render_ok
end

@ -18,6 +18,7 @@ module Base::ErrorRescueHandler
render_unprocessable_entity(ex.model.errors.full_messages.join(','))
end
rescue_from ActiveRecord::RecordInvalid do |ex|
ex.backtrace.each { |msg| Rails.logger.error(msg) }
render_unprocessable_entity(ex.record.errors.full_messages.join(','))
end
end

@ -1,7 +1,13 @@
class Cooperative::UsersController < Cooperative::BaseController
def index
params[:sort_by] = params[:sort_by].presence || 'created_on'
params[:sort_direction] = params[:sort_direction].presence || 'desc'
default_sort('created_on', 'desc')
users = Admins::UserQuery.call(search_params.merge(laboratory_id: current_laboratory.id))
@users = paginate users.includes(user_extension: :school)
end
def for_select
default_sort('created_on', 'desc')
users = Admins::UserQuery.call(search_params)
@users = paginate users.includes(user_extension: :school)
@ -10,6 +16,6 @@ class Cooperative::UsersController < Cooperative::BaseController
private
def search_params
params.permit(:name, :sort_by, :sort_direction)
params.permit(:identity, :name, :keyword, :school_name, :sort_by, :sort_direction)
end
end

@ -61,13 +61,13 @@ class CoursesController < ApplicationController
@user = current_user
# 根据分类查询课堂(全部,我的,最新,最热)
@order = params[:order].present? ? params[:order] : "all"
@courses = current_laboratory.courses
@courses = current_laboratory.courses.not_deleted
if @order == "visits"
order_str = "courses.id = 1309 DESC, courses.visits DESC"
@courses = @courses.where(is_delete: 0, is_hidden: 0)
@courses = @courses.where(is_hidden: 0)
else
order_str = "courses.id = 1309 DESC, courses.homepage_show DESC, courses.created_at desc"
@courses = @courses.where(is_delete: 0, is_hidden: 0, is_end: 0)
@courses = @courses.where(is_hidden: 0, is_end: 0)
end
# 金课未开课的不显示在首页
@ -468,6 +468,7 @@ class CoursesController < ApplicationController
# @users = User.where.not(id: user_ids_of_course_members)
@users = User.where(status: User::STATUS_ACTIVE)
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
# REDO:Extension
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?
@ -1084,6 +1085,7 @@ class CoursesController < ApplicationController
# REDO:Extension
@users = User.where(status: User::STATUS_ACTIVE)
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
# REDO:Extension
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?
@ -1103,12 +1105,12 @@ class CoursesController < ApplicationController
# 邀请码验证
return normal_status(-1, "邀请码不能为空") if params[:invite_code].blank?
invite_code = params[:invite_code]
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0)
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id)
course_group = CourseGroup.find_by(invite_code: invite_code)
if course.blank?
return normal_status(-1, "邀请码无效") if course_group.blank?
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0)
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id)
return normal_status(-1, "邀请码无效") if course.blank?
end

@ -532,7 +532,7 @@ class HomeworkCommonsController < ApplicationController
# 如果该发布规则 没有已发布的分班则需判断发布时间
tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time] <= strf_time(Time.now) && group_settings.group_published.count == 0
tip_exception("截止时间不能早于等于当前时间") if setting[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能早于等于当前时间") if setting[:end_time] <= strf_time(Time.now) && group_settings.none_end.count > 0
tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time]
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && setting[:end_time] > strf_time(@course.end_date.end_of_day)

@ -7,7 +7,7 @@ class LibrariesController < ApplicationController
helper_method :current_library, :library_manageable?
def index
libraries = Library.all
libraries = current_laboratory.libraries
libraries =
if User.current&.logged? && params[:type] == 'mine'

@ -1,6 +1,6 @@
class ShixunListsController < ApplicationController
def index
@results = ShixunSearchService.call(search_params, request.subdomain)
@results = ShixunSearchService.call(search_params, current_laboratory)
end
private

@ -38,6 +38,9 @@ class ShixunsController < ApplicationController
## 云上实验室过滤
unless current_laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id })
else
not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{current_laboratory.id}")
@shixuns = @shixuns.where.not(id: not_shixun_ids)
end
## 方向
@ -916,6 +919,7 @@ class ShixunsController < ApplicationController
else
@users = User.none
end
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
page = params[:page] || 1
limit = params[:limit] || 20
@user_count = @users.count

@ -1,6 +1,6 @@
class SubjectListsController < ApplicationController
def index
@results = SubjectSearchService.call(search_params, request.subdomain)
@results = SubjectSearchService.call(search_params, current_laboratory)
end
private

@ -6,6 +6,7 @@ class SubjectsController < ApplicationController
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position, :update_team_title]
before_action :require_admin, only: [:copy_subject]
include ApplicationHelper
include SubjectsHelper
@ -23,18 +24,27 @@ class SubjectsController < ApplicationController
# 最热排序
if reorder == "myshixun_count"
laboratory_join = current_laboratory.main_site? ? '' : " JOIN laboratory_subjects ls ON ls.subject_id = subjects.id AND ls.laboratory_id = #{current_laboratory.id} "
if current_laboratory.main_site?
not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}").pluck(:id)
not_subject_ids = not_subject_ids.length > 0 ? "(" + not_subject_ids.join(",") + ")" : "(-1)"
laboratory_join = " AND subjects.id not in #{not_subject_ids} "
else
subject_ids = Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id }).pluck(:id)
subject_ids = subject_ids.length > 0 ? "(" + subject_ids.join(",") + ")" : "(-1)"
laboratory_join = " AND subjects.id in #{subject_ids} "
end
if select
@subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status,
subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id #{laboratory_join} where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%'
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%' #{laboratory_join}
AND subjects.repertoire_id = #{select} GROUP BY subjects.id ORDER BY myshixun_member_count DESC")
else
@subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status,
subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id #{laboratory_join} where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%'
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%' #{laboratory_join}
GROUP BY subjects.id ORDER BY myshixun_member_count DESC")
end
else
@ -56,6 +66,9 @@ class SubjectsController < ApplicationController
# 云上实验室过滤
unless current_laboratory.main_site?
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
else
not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}")
@subjects = @subjects.where.not(id: not_subject_ids)
end
# 类型
@ -289,6 +302,7 @@ class SubjectsController < ApplicationController
member_ids = @subject.subject_members.map(&:user_id).join(',')
condition = "%#{params[:search].strip}%".gsub(" ","")
@users = User.where("id not in (?) and status = 1 and LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", member_ids, "#{condition}")
@users = @users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@users = @users.page(page).per(10)
@users = @users.includes(:user_extension)
@ -448,6 +462,13 @@ class SubjectsController < ApplicationController
end
end
# 复制实践课程
def copy
end
private
def subject_params
tip_exception("实训路径名称不能为空") if params[:name].blank?
@ -498,4 +519,6 @@ class SubjectsController < ApplicationController
end
end

@ -2,6 +2,8 @@ class Users::CoursesController < Users::BaseController
def index
courses = Users::CourseService.new(observed_user, query_params).call
courses = courses.where(laboratory_id: current_laboratory.id)
@count = courses.count
@courses = paginate(courses.includes(teacher: { user_extension: :school }), special: observed_user.is_teacher?)
end

@ -3,6 +3,7 @@ class Users::RecentContactsController < Users::BaseController
def index
contacts = observed_user.recent_contacts.distinct
contacts = contacts.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@contacts = contacts.order('private_messages.created_at DESC').limit(10).includes(:user_extension)
end
end

@ -2,6 +2,14 @@ class Users::ShixunsController < Users::BaseController
def index
shixuns = Users::ShixunService.new(observed_user, query_params).call
## 云上实验室过滤
if current_laboratory.main_site?
not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{current_laboratory.id}")
shixuns = shixuns.where.not(id: not_shixun_ids)
else
shixuns = shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id })
end
@count = shixuns.count
@shixuns = paginate(shixuns.includes(:first_tag_repertoire), special: observed_user.is_teacher?)

@ -2,6 +2,14 @@ class Users::SubjectsController < Users::BaseController
def index
subjects = Users::SubjectService.new(observed_user, query_params).call
## 云上实验室过滤
if current_laboratory.main_site?
not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}")
subjects = subjects.where.not(id: not_subject_ids)
else
subjects = subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
end
@count = subjects.count
@subjects = paginate(subjects.includes(:user, :repertoire), special: observed_user.is_teacher?)
end

@ -3,6 +3,7 @@ class UsersForPrivateMessagesController < ApplicationController
def index
users = User.active.where.not(id: current_user.id)
users = users.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
keyword = params[:keyword].to_s.strip
if keyword.blank?

@ -5,7 +5,7 @@ class CourseActivity < ApplicationRecord
belongs_to :exercise
belongs_to :poll
after_create :add_course_lead
# after_create :add_course_lead
# 发布新课导语
# 导语要放置在课程创建信息之后

@ -16,6 +16,7 @@ class Laboratory < ApplicationRecord
has_many :courses, dependent: :destroy
has_many :competitions, dependent: :destroy
has_many :libraries, dependent: :destroy
validates :identifier, uniqueness: { case_sensitive: false }, allow_nil: true

@ -3,6 +3,7 @@ class Library < ApplicationRecord
belongs_to :user
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id, optional: true
belongs_to :laboratory, optional: true
has_many :library_applies, dependent: :delete_all
has_many :library_library_tags, dependent: :delete_all
@ -34,6 +35,13 @@ class Library < ApplicationRecord
end
end
before_save :set_laboratory
private def set_laboratory
return unless new_record?
self.laboratory = Laboratory.current if laboratory_id.blank?
end
def increment_visited_count!(num = 1)
increment_column!(:visited_count, num)
end

@ -13,6 +13,7 @@ module Searchable::Course
def search_data
{
laboratory_id: laboratory_id,
name: name,
author_name: teacher&.real_name
}

@ -30,6 +30,8 @@ class User < ApplicationRecord
LOGIN_CHARS = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z).freeze
belongs_to :laboratory, optional: true
has_one :user_extension, dependent: :destroy
has_many :open_users, dependent: :destroy
has_one :wechat_open_user, class_name: 'OpenUsers::Wechat'
@ -155,7 +157,7 @@ class User < ApplicationRecord
delegate :gender, :department_id, :school_id, :location, :location_city, :technical_title, to: :user_extension, allow_nil: true
before_save :update_hashed_password
before_save :update_hashed_password, :set_laboratory
after_create do
SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie?
end
@ -693,6 +695,10 @@ class User < ApplicationRecord
LimitForbidControl::UserLogin.new(self).clear
end
def from_sub_site?
laboratory_id.present? && laboratory_id != 1
end
protected
def validate_password_length
# 管理员的初始密码是5位
@ -704,6 +710,12 @@ class User < ApplicationRecord
raise('密码长度不能超过16位')
end
end
def set_laboratory
return unless new_record?
self.laboratory = Laboratory.current if laboratory_id.blank?
end
end

@ -6,7 +6,17 @@ class UserExtension < ApplicationRecord
belongs_to :school, optional: true
belongs_to :department, optional: true
before_save :set_laboratory_school
def identity_text
I18n.t("user.identity.#{identity}")
end
private
def set_laboratory_school
return unless new_record?
self.school_id = Laboratory.current.school_id if school_id.blank? && !Laboratory.current.main_site?
end
end

@ -12,6 +12,9 @@ class Admins::UserQuery < ApplicationQuery
def call
users = User.where(type: 'User')
# 云上实验室
users = users.where(laboratory_id: params[:laboratory_id]) if params[:laboratory_id].present?
# 状态
status = params[:status]
users = users.where(status: status) if status.present?

@ -8,34 +8,47 @@ class SearchService < ApplicationService
end
def call
Searchkick.search(keyword, search_options)
# return [] if keyword.blank?
modal_name.search(keyword, search_options)
end
private
def modal_name
@_modal_name ||=
case params[:type].to_s.strip
when 'shixun' then Shixun
when 'course' then Course
when 'subject' then Subject
when 'memo' then Memo
else Shixun
end
end
def search_options
model_options = {
index_name: index_names,
model_includes: model_includes
includes: modal_name.searchable_includes
}
model_options.merge(where: { status: 2 }) if index_names == [Shixun]
model_options.merge(default_options)
end
model_options.deep_merge!(where: { status: 2 }) if modal_name == Shixun
model_options.deep_merge!(extra_options)
def index_names
@_index_names ||=
case params[:type].to_s.strip
when 'shixun' then [Shixun]
when 'course' then [Course]
when 'subject' then [Subject]
when 'memo' then [Memo]
else [Shixun, Course, Subject, Memo]
end
model_options.deep_merge!(default_options)
model_options
end
def model_includes
index_names.each_with_object({}) do |klass, obj|
obj[klass] = klass.searchable_includes
def extra_options
case params[:type].to_s.strip
when 'shixun' then
shixun_ids = Laboratory.current.shixuns.pluck(:id)
Laboratory.current.main_site? ? {} : { where: { id: shixun_ids } }
when 'subject' then
subject_ids = Laboratory.current.subjects.pluck(:id)
Laboratory.current.main_site? ? {} : { where: { id: subject_ids } }
when 'course' then
{ where: { laboratory_id: Laboratory.current.id } }
else
{}
end
end
end

@ -1,11 +1,11 @@
class ShixunSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params, :subdomain
attr_reader :params, :laboratory
def initialize(params, subdomain)
def initialize(params, laboratory)
@params = params
@subdomain = subdomain
@laboratory = laboratory
end
def call
@ -37,8 +37,8 @@ class ShixunSearchService < ApplicationService
end
## 云上实验室过滤
unless current_laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id })
unless laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: @laboratory.id })
end
# laboratory = Laboratory.find_by_subdomain(subdomain)

@ -1,11 +1,11 @@
class SubjectSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params, :subdomain
attr_reader :params, :laboratory
def initialize(params, subdomain)
def initialize(params, laboratory)
@params = params
@subdomain = subdomain
@laboratory = laboratory
end
def call
@ -22,8 +22,8 @@ class SubjectSearchService < ApplicationService
# @subjects = @subjects.where(id: laboratory.subjects) if laboratory
## 云上实验室过滤
unless current_laboratory.main_site?
subjects = subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
unless laboratory.main_site?
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: laboratory.id })
end
Subject.search(keyword, search_options)

@ -0,0 +1,206 @@
class Subjects::CopySubjectService < ApplicationService
attr_reader :subject, :to_subject, :user_id, :laboratory
def initialize(subject, user_id, laboratory=nil)
@subject = subject
@user_id = user_id
@laboratory = laboratory
subject_params = subject.attributes.dup.except('id', 'copy_subject_id', 'user_id', 'homepage_show')
@to_subject = Subject.new(subject_params)
end
def call
return if subject.blank?
ActiveRecord::Base.transaction do
copy_subject!
end
end
private
# 复制实践课程表
def copy_subject!
to_subject.copy_subject_id = subject.id
to_subject.user_id = user_id
to_subject.save!
copy_stages_data!(subject, to_subject)
copy_subject_members_data(to_subject)
laboratory.laboratory_subjects.create(subject: to_subject) if laboratory
end
# 复制章节需要的章节
def copy_stages_data!(subject, to_subject)
subject.stages.each do |stage|
to_stage = to_subject.stages.new
to_stage.attributes = stage.attributes.dup.except('id', 'subject_id', 'user_id')
to_stage.user_id = user_id
to_stage.save!
copy_stage_shixuns_data!(stage, to_stage)
end
end
# 创建实践课程关联实训表
def copy_stage_shixuns_data!(stage, to_stage)
stage.stage_shixuns.each do |stage_shixun|
to_shixun = copy_shixun_data!(stage_shixun)
to_stage_shixun = to_stage.stage_shixuns.new
to_stage_shixun.attributes = stage_shixun.attributes.dup.except('id', 'subject_id', 'stage_id', 'shixun_id')
to_stage_shixun.subject_id = to_stage.subject_id
to_stage_shixun.shixun_id = to_shixun.id
to_stage_shixun.save!
end
end
# 复制实训数据
def copy_shixun_data!(stage_shixun)
shixun = stage_shixun.shixun
to_shixun = Shixun.new
to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show',
'use_scope', 'averge_star', 'myshixuns_count')
to_shixun.user_id = user_id
to_shixun.save!
copy_shixun_info_data!(shixun, to_shixun)
copy_shixun_mirror_repositories_data!(shixun, to_shixun)
copy_shixun_tag_repertoires_data!(shixun, to_shixun)
copy_shixun_service_configs_data!(shixun, to_shixun)
copy_challenges_data!(shixun, to_shixun)
copy_shixun_members_data!(to_shixun)
# 云上实验室
laboratory.laboratory_shixuns.create(shixun: to_shixun) if laboratory
to_shixun
end
# 创建实训长字段内容
def copy_shixun_info_data!(shixun, to_shixun)
to_shixun_info = ShixunInfo.new
to_shixun_info.attributes = shixun.shixun_info.attributes.except('id', 'shixun_id')
to_shixun_info.shixun_id = to_shixun.id
to_shixun_info.save!
end
# 创建实训镜像标签
def copy_shixun_mirror_repositories_data!(shixun, to_shixun)
shixun.shixun_mirror_repositories.each do |shixun_mirror_repository|
to_shixun_mirror_repository = to_shixun.shixun_mirror_repositories.new
to_shixun_mirror_repository.attributes = shixun_mirror_repository.attributes.dup.except('id', 'shixun_id')
to_shixun_mirror_repository.shixun_id = to_shixun.id
to_shixun_mirror_repository.save!
end
end
# 创建实训tag标签
def copy_shixun_tag_repertoires_data!(shixun, to_shixun)
shixun.shixun_tag_repertoires.each do |shixun_tag_repertoire|
to_shixun_tag_repertoire = to_shixun.shixun_tag_repertoires.new
to_shixun_tag_repertoire.attributes = shixun_tag_repertoire.attributes.dup.except('id', 'shixun_id')
to_shixun_tag_repertoire.shixun_id = to_shixun.id
to_shixun_tag_repertoire.save!
end
end
# 复制实训服务配置
def copy_shixun_service_configs_data!(shixun, to_shixun)
shixun.shixun_service_configs.each do |shixun_service_config|
to_shixun_service_config = to_shixun.shixun_service_configs.new
to_shixun_service_config.attributes = shixun_service_config.attributes.dup.except('id', 'shixun_id')
to_shixun_service_config.shixun_id = to_shixun.id
to_shixun_service_config.save!
end
end
# 复制关卡信息
def copy_challenges_data!(shixun, to_shixun)
shixun.challenges.each do |challenge|
to_challenge = to_shixun.challenges.new
to_challenge.attributes = challenge.attributes.dup.except('id', 'shixun_id', 'praises_count', 'user_id', 'visits')
to_challenge.user_id = user_id
to_challenge.shixun_id = to_shixun.id
to_challenge.save!
copy_challenge_answers_data!(challenge, to_challenge)
copy_challenge_tags_data!(challenge, to_challenge)
copy_test_sets_data!(challenge, to_challenge)
copy_challenge_chooses_data!(challenge, to_challenge)
end
end
# 复制答案数据
def copy_challenge_answers_data!(challenge, to_challenge)
challenge.challenge_answers.each do |challenge_answer|
to_challenge_answer = to_challenge.challenge_answers.new
to_challenge_answer.attributes = challenge_answer.attributes.dup.except('id', 'challenge_id')
to_challenge_answer.challenge_id = to_challenge.id
to_challenge_answer.save!
end
end
# 复制关卡标签数据
def copy_challenge_tags_data!(challenge, to_challenge)
challenge.challenge_tags.each do |challenge_tag|
to_challenge_tag = to_challenge.challenge_tags.new
to_challenge_tag.attributes = challenge_tag.attributes.dup.except('id', 'challenge_id')
to_challenge_tag.challenge_id = to_challenge.id
to_challenge_tag.save!
end
end
# 复制测试集
def copy_test_sets_data!(challenge, to_challenge)
challenge.test_sets.each do |test_set|
to_test_set = to_challenge.test_sets.new
to_test_set.attributes = test_set.attributes.dup.except('id', 'challenge_id')
to_test_set.challenge_id = to_challenge.id
to_test_set.save!
end
end
# 复制选择题关卡
def copy_challenge_chooses_data!(challenge, to_challenge)
challenge.challenge_chooses.each do |challenge_choose|
to_challenge_choose = to_challenge.challenge_chooses.new
to_challenge_choose.attributes = challenge_choose.attributes.dup.except('id', 'challenge_id')
to_challenge_choose.challenge_id = to_challenge.id
to_challenge_choose.save!
copy_challenge_questions_data!(challenge_choose, to_challenge_choose)
copy_challenge_choose_tags_data!(challenge_choose, to_challenge_choose)
end
end
# 复制选择题问题
def copy_challenge_questions_data!(challenge_choose, to_challenge_choose)
challenge_choose.challenge_questions.each do |challenge_question|
to_challenge_question = to_challenge_choose.challenge_questions.new
to_challenge_question.attributes = challenge_question.attributes.dup.except('id', 'challenge_choose_id')
to_challenge_question.challenge_choose_id = to_challenge_choose.id
to_challenge_question.save!
end
end
# 复制选择题标签
def copy_challenge_choose_tags_data!(challenge_choose, to_challenge_choose)
challenge_choose.challenge_tags.each do |challenge_tag|
to_challenge_tag = to_challenge_choose.challenge_tags.new
to_challenge_tag.attributes = challenge_tag.attributes.dup.except('id', 'challenge_choose_id')
to_challenge_tag.challenge_choose_id = to_challenge_choose.id
to_challenge_tag.save!
end
end
# 创建实训成员
def copy_shixun_members_data!(to_shixun)
to_shixun.shixun_members.create!(user_id: user_id, role: 1)
end
# 创建课程成员
def copy_subject_members_data(to_subject)
to_subject.subject_members.create!(user_id: user_id, role: 1)
end
end

@ -43,6 +43,9 @@
<%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
<% if user.from_sub_site? %>
<span class="badge badge-pill badge-info">合作</span>
<% end %>
</td>
<td><%= user.real_name %></td>
<td><%= user.ID_number %></td>

@ -41,6 +41,9 @@
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
<% if user.from_sub_site? %>
<span class="badge badge-pill badge-info">合作</span>
<% end %>
</td>
<td><%= user.real_name %></td>
<td><%= raw [user.school_name.presence, user.department_name.presence].compact.join('<br/>') %></td>

@ -145,7 +145,7 @@
</thead>
<tbody>
<% (setting.navbar || setting.default_navbar).each do |nav| %>
<tr>
<tr style="<%= nav['name'] == '交流问答' ? 'display:none' : '' %>">
<td><%= text_field_tag('navbar[][name]', nav['name'], id: nil, class: 'form-control') %></td>
<td><%= text_field_tag('navbar[][link]', nav['link'], id: nil, class: 'form-control') %></td>
<td class="text-center">

@ -17,6 +17,7 @@
<li><%= sidebar_item(edit_cooperative_laboratory_setting_path, '网站设置', icon: 'cogs', controller: 'cooperative-laboratory_settings') %></li>
<li><%= sidebar_item(cooperative_carousels_path, '轮播图设置', icon: 'image', controller: 'cooperative-carousels') %></li>
<li><%= sidebar_item(cooperative_laboratory_users_path, '管理员列表', icon: 'user', controller: 'cooperative-laboratory_users') %></li>
<li><%= sidebar_item(cooperative_users_path, '用户列表', icon: 'users', controller: 'cooperative-users') %></li>
<li><%= sidebar_item(cooperative_laboratory_shixuns_path, '实训项目', icon: 'window-restore', controller: 'cooperative-laboratory_shixuns') %></li>
<li><%= sidebar_item(cooperative_laboratory_subjects_path, '实践课程', icon: 'th-list', controller: 'cooperative-laboratory_subjects') %></li>
<li><%= sidebar_item('/', '返回主页', icon: 'sign-out', controller: 'root') %></li>

@ -0,0 +1,6 @@
json.count @users.total_count
json.users do
json.array! @users.each do |user|
json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
end
end

@ -0,0 +1,21 @@
<% define_breadcrumbs do %>
<% add_breadcrumb('用户列表') %>
<% end %>
<div class="box search-form-container user-list-form">
<%= form_tag(cooperative_users_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-2">
<label for="identity">职业:</label>
<% identity_options = [['全部', ''], ['教师', 0], ['学生', 1], ['专业人士', 2]] %>
<%= select_tag(:identity, options_for_select(identity_options), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %>
<%= text_field_tag(:school_name, params[:school_name], class: 'form-control col-sm-2', placeholder: '学校/单位检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<% end %>
</div>
<div class="box cooperative-list-container user-list-container">
<%= render partial: 'cooperative/users/shared/list', locals: { users: @users } %>
</div>

@ -0,0 +1 @@
$('.user-list-container').html("<%= j(render partial: 'cooperative/users/shared/list', locals: { users: @users }) %>");

@ -0,0 +1,40 @@
<table class="table table-hover user-list-table">
<thead class="thead-light">
<tr>
<th width="10%" class="text-left">真实姓名</th>
<th width="16%">邮件地址</th>
<th width="10%">手机号码</th>
<th width="18%">单位</th>
<th width="10%">角色</th>
<th width="14%"><%= sort_tag('创建于', name: 'created_on', path: cooperative_users_path) %></th>
<th width="14%"><%= sort_tag('最后登录', name: 'last_login_on', path: cooperative_users_path) %></th>
<th width="6%"><%= sort_tag('经验值', name: 'experience', path: cooperative_users_path) %></th>
<th width="6%"><%= sort_tag('金币', name: 'grade', path: cooperative_users_path) %></th>
</tr>
</thead>
<tbody>
<% if users.present? %>
<% users.each do |user| %>
<tr class="user-item-<%= user.id %>">
<td class="text-left">
<%= link_to "/users/#{user.login}", target: '_blank' do %>
<%= overflow_hidden_span user.real_name, width: 100 %>
<% end %>
</td>
<td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td>
<td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td>
<td><%= overflow_hidden_span display_text(user.school_name), width: 150 %></td>
<td><%= user.identity %></td>
<td><%= display_text(user.created_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= display_text(user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= user.experience.to_i %></td>
<td class="grade-content"><%= user.grade.to_i %></td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'cooperative/shared/paginate', locals: { objects: users } %>

@ -1135,7 +1135,9 @@ Rails.application.routes.draw do
# get '/', to: 'dashboards#show'
get '/', to: 'laboratory_settings#edit'
resources :files, only: [:create]
resources :users, only: [:index]
resources :users, only: [:index] do
get :for_select, on: :collection
end
resources :laboratory_users, only: [:index, :create, :destroy]
resource :laboratory_setting, only: [:edit, :update]
resources :carousels, only: [:index, :create, :update, :destroy] do

@ -0,0 +1,5 @@
class AddLaboratoryIdToUsers < ActiveRecord::Migration[5.2]
def change
add_reference :users, :laboratory
end
end

@ -0,0 +1,5 @@
class AddCopyFromForSubjects < ActiveRecord::Migration[5.2]
def change
add_column :subjects, :copy_subject_id, :integer
end
end

@ -0,0 +1,5 @@
class AddLaboratoryIdToLibraries < ActiveRecord::Migration[5.2]
def change
add_reference :libraries, :laboratory
end
end

@ -0,0 +1,7 @@
class TransferLaboratoryData < ActiveRecord::Migration[5.2]
def change
Course.where(laboratory_id: nil).update_all(laboratory_id: 1)
Competition.where(laboratory_id: nil).update_all(laboratory_id: 1)
Library.where(laboratory_id: nil).update_all(laboratory_id: 1)
end
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -137990,8 +137990,8 @@ $(document).on('turbolinks:load', function() {
$subjectSelect.select2({
theme: 'bootstrap4',
placeholder: '请输入课程名称/创建者检索',
multiple: true,
closeOnSelect: false,
multiple: false,
closeOnSelect: true,
ajax: {
delay: 500,
url: '/admins/laboratories/' + laboratoryId + '/subjects_for_select',
@ -138037,7 +138037,7 @@ $(document).on('turbolinks:load', function() {
method: 'POST',
dataType: 'json',
url: '/admins/laboratories/' + laboratoryId + '/laboratory_subjects',
data: { subject_ids: subjectIds },
data: { subject_id: subjectIds },
success: function(){
show_success_flash();
window.location.reload();

@ -136218,7 +136218,7 @@ $(document).on('turbolinks:load', function() {
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/cooperative/users',
url: '/cooperative/users/for_select',
dataType: 'json',
data: function(params){
return { name: params.term };

@ -78,7 +78,6 @@ class CompetitionsIndex extends Component{
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.competition_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.competition_banner_url)});
background-color: #081C4B;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}

@ -153,7 +153,6 @@
.Competitionshead{
background-color: #2d28ba !important;
background-size: cover !important;
background-position: center !important;
background-position: 50% !important;
background-repeat: no-repeat !important;

@ -827,7 +827,7 @@ class Fileslists extends Component{
{this.props.isAdmin()?<WordsBtn style="blue" onClick={()=>this.addDir()} className={"mr30 font-16"}>新建目录</WordsBtn>:""}
{this.props.isAdmin()?parseInt(this.props.match.params.main_id)!=parseInt(this.props.coursesids)?<WordsBtn style="blue" onClick={()=>this.editDir(name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:"":""}
{this.props.isAdmin()||this.props.isStudent() ? <WordsBtn style="blue" className="mr30 font-16" onClick={()=>this.addResource()}>选用资源</WordsBtn>:""}
{this.props.isAdmin()||this.props.isStudent() ? this.props.user&&this.props.user.main_site===true? <WordsBtn style="blue" className="mr30 font-16" onClick={()=>this.addResource()}>选用资源</WordsBtn>:"":""}
{this.props.isAdmin()||this.props.isStudent() ? <WordsBtn style="blue" className=" font-16" onClick={()=>this.sendResources()}>上传资源</WordsBtn>:""}
</React.Fragment>
}

@ -1143,7 +1143,7 @@ class CommonWorkSetting extends Component{
rules={rules}
course_group={adaptered_group_settings}
rulesCheckInfo={(info)=>this.rulesCheckInfo(info)}
flagPageEdit={true}
flagPageEdit={startEditFlag}
moduleName="作业"
></PollDetailTabForthRules>
}

@ -173,7 +173,8 @@ class CCommentItem extends Component{
return parent.journals.map(item => {
// <div>{item.content} {item.user_info.user_name}</div>
// src={getImageUrl(`images/${item.image_url}`)}
// src={getImageUrl(`images/${item.image_url}`)}
const imgSrc = (!item.user_info.user_image_url || item.user_info.user_image_url === '--') ? `${getUrl()}/images/edu_user/anony.png` : item.user_info.user_image_url;
return (
<div className="comment_item_cont appraise df clearfix" key={item.id}>
<div className="J_Comment_Face fl">
@ -184,7 +185,7 @@ class CCommentItem extends Component{
</a>
: <a href={`${_origin}/users/${item.user_info.user_login}`} target="_blank">
<img alt="用户头像" height="50"
src={`/images/${item.user_info.user_image_url}`}
src={`${getImageUrl(`images/`+imgSrc)}`}
width="50"/>
</a>}
</div>

@ -119,7 +119,6 @@ class CoursesHome extends Component{
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.course_banner_url)});
background-color: #081C4B;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}

@ -58,5 +58,5 @@
.columnstwoachievement{
width: 199px;
text-align: right !important;
padding-right: 60px !important;
padding-right: 97px !important;
}

@ -585,6 +585,8 @@ class CoursesNew extends Component {
if(addonAfterfour){
addonAfteronelens4=String(addonAfterfour).length;
}
return (
<React.Fragment>
@ -874,8 +876,8 @@ class CoursesNew extends Component {
<Checkbox value={"announcement"} className="fl">公告栏</Checkbox>
<Checkbox value={"shixun_homework"} className="fl">实训作业</Checkbox>
<Checkbox value={"common_homework"} className="fl">普通作业</Checkbox>
<Checkbox value={"group_homework"} className="fl">分组作业</Checkbox>
<Checkbox value={"graduation"} className="fl">毕业设计</Checkbox>
{this.props.user&&this.props.user.main_site===true?<Checkbox value={"group_homework"} className="fl">分组作业</Checkbox>:""}
{this.props.user&&this.props.user.main_site===true?<Checkbox value={"graduation"} className="fl">毕业设计</Checkbox>:""}
<Checkbox value={"exercise"} className="fl">试卷</Checkbox>
<Checkbox value={"poll"} className="fl">问卷</Checkbox>
<Checkbox value={"attachment"} className="fl">资源</Checkbox>

@ -235,7 +235,7 @@ class ShixunsHome extends Component {
</div>
{/*实训路径*/}
{pathstype===true?"":<div className="clearfix pt20 educontent pr pb20">
{pathstype===true||homedatalist===undefined?"":homedatalist.subjects.length===0?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实践课程</p>
<p className="color-grey-cd font-12">TRAINING COURSE</p>
@ -314,7 +314,7 @@ class ShixunsHome extends Component {
</div>}
{/*精选实训 改为 开发社区*/}
{shixuntype===true?"":<div className="clearfix pt20 educontent pr pb20">
{shixuntype===true||homedatalist===undefined?"":homedatalist.shixuns.length===0?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实训项目</p>
<p className="color-grey-cd font-12">DEVELOPMENT COMMUNITY</p>

@ -604,7 +604,7 @@ class LoginDialog extends Component {
setNotcompleteds={()=>{this.setNotcompleteds()}}
/>
{this.state.isphone===false?<style>
{this.state.isphone===false||this.props.user&&this.props.user.main_site===false?<style>
{
`
#DialogID .dialogBox {
@ -713,7 +713,7 @@ class LoginDialog extends Component {
</p>
{this.state.isphone===true?<p className="clearfix mt20">
{this.props.user&&this.props.user.main_site===true?this.state.isphone===true?<p className="clearfix mt20">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
@ -735,7 +735,7 @@ class LoginDialog extends Component {
<img src={require('./qq.png')} alt="qq登录"/>
</a>
</div>
</p>}
</p>:""}

@ -3,7 +3,7 @@ import { Input , Spin , Pagination } from "antd";
import './css/moopCases.css'
import '../courses/css/Courses.css'
import { ActionBtn , LinkAfterLogin } from 'educoder';
import { ActionBtn , LinkAfterLogin ,getImageUrl} from 'educoder';
import axios from 'axios'
@ -98,8 +98,19 @@ class CaseList extends Component{
return(
<React.Fragment>
<img src={mainImg} width="100%" />
<div className="educontent">
<style>
{
`
.imgmoop_cases{width: 100%;
height: 300px;
background-color: #000a4f;
background-position: 50%;
background-repeat: no-repeat;}
`
}
</style>
<img className={"imgmoop_cases"} src={this.props.mygetHelmetapi&&this.props.mygetHelmetapi.moop_cases_banner_url===null?mainImg:getImageUrl(this.props.mygetHelmetapi&&this.props.mygetHelmetapi.moop_cases_banner_url)}/>
<div className="educontent">
<div className="edu-back-white mb30 mt30">
<p className="padding20-30 clearfix bor-bottom-greyE">
<span className="font-18 fl color-grey-3">教学案例</span>

@ -872,7 +872,6 @@ submittojoinclass=(value)=>{
}
}
// console.log("NewHeadergetHelmetapi432423423423");
// console.log(mygetHelmetapi2);
// console.log("NewHeadermygetHelmetapi123123123123");
@ -1234,11 +1233,11 @@ submittojoinclass=(value)=>{
</a>
<ul className="edu-menu-list" style={{top:'60px'}}>
<span className="bor-bottom-greyE currentName task-hide">{user.username}</span>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的翻转课堂</Link></li>
{coursestypes===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的翻转课堂</Link></li>}
{/* p 老师 l 学生 */}
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的开发项目</Link></li>
{shixuntype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>}
{pathstype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li>}
{this.props.user&&this.props.user.main_site===true?<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的开发项目</Link></li>:""}
{/*<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/package`}>我的众包</Link></li>*/}
<li style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.customer_management_url===null || this.props.Headertop.customer_management_url===""? 'none' : 'block'}}>
<a href={this.props.Headertop === undefined ? '' : this.props.Headertop.customer_management_url}>客户管理</a>
@ -1284,15 +1283,15 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===true?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建翻转课堂</a></li>}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
pathstype===true?"":<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
}
<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>
<ul className="fl with50 edu-txt-center">
{coursestypes===true&&this.props.user&&this.props.user.main_site===true?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>加入翻转课堂</a>
@ -1307,9 +1306,9 @@ submittojoinclass=(value)=>{
{/* /courses/join_course_multi_role */}
<li>
{this.props.user&&this.props.user.main_site===true?<li>
<a onClick={this.tojoinitem}>加入开发项目</a>
</li>
</li>:""}
{tojoinitemtype===true?<Modal
keyboard={false}
title="加入项目"
@ -1357,7 +1356,7 @@ submittojoinclass=(value)=>{
</div>
</div>
</Modal>:""}
</ul>
</ul>}
</div>
</div>

@ -218,4 +218,8 @@ body>.-task-title {
float: left;
min-width: 40px;
height:40px;
}
.headwith100b{
width: 100%;
}

@ -1078,7 +1078,7 @@ class LoginRegisterComponent extends Component {
<Button className="login_btn font-16" type="primary" style={{height:"46px"}} onClick={() => this.postLogin()}
size={"large"}>登录</Button>
{this.state.isphone===true?<p className="clearfix mb10 textcenter">
{this.props.user&&this.props.user.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
@ -1099,7 +1099,7 @@ class LoginRegisterComponent extends Component {
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>}
</p>:""}
</div>
}
@ -1253,7 +1253,7 @@ class LoginRegisterComponent extends Component {
<Button className=" font-16 mb20" type="primary" style={{height:"46px", width: "100%",marginTop:"26px"}} onClick={() => this.postregistered()}
size={"large"}>注册</Button>
{this.state.isphone===true?<p className="clearfix mb10 textcenter">
{this.props.user&&this.props.user.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
@ -1274,7 +1274,7 @@ class LoginRegisterComponent extends Component {
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>
</p>:""
}
</div>
}

@ -109,9 +109,9 @@ class AccountNav extends Component {
<li className={`navItem ${isSecure ? 'active' : ''}`} onClick={this.toSecure}>
<i className="iconfont icon-anquanshezhi color-grey-9 font-16"></i>
</li>
<li className={`navItem ${isBinding ? 'active' : ''}`} onClick={this.isBinding}>
{this.props.user&&this.props.user.main_site===true?<li className={`navItem ${isBinding ? 'active' : ''}`} onClick={this.isBinding}>
<i className="iconfont icon-lianjie color-grey-9 font-16"></i>
</li>
</li>:""}
</ul>
</div>
</React.Fragment>

@ -132,11 +132,11 @@ class InfosBanner extends Component{
onClick={() => this.setState({moduleName: 'paths'})}
to={`/users/${username}/paths`}>实践课程</Link>
</li>}
<li className={`${moduleName == 'projects' ? 'active' : '' }`}>
{this.props.user&&this.props.user.main_site===true?<li className={`${moduleName == 'projects' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'projects'})}
to={`/users/${username}/projects`}>开发项目</Link>
</li>
</li>:""}
{/*<li className={`${moduleName == 'package' ? 'active' : '' }`}>*/}
{/* <Link*/}
{/* onClick={() => this.setState({moduleName: 'package'})}*/}

Loading…
Cancel
Save