diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 98c70e0b4..7ebf7435d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -467,7 +467,8 @@ class CoursesController < ApplicationController # user_ids_of_course_members = @course.course_members.where(role: [1,2,3]).pluck(:user_id) # @users = User.where.not(id: user_ids_of_course_members) - @users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id) + @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? @@ -1083,7 +1084,8 @@ class CoursesController < ApplicationController school_name = params[:school_name] # REDO:Extension - @users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id) + @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? diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 619d2c8a7..9077192cf 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -919,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 diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 25cf93faa..d4f1281a2 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -302,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) diff --git a/app/controllers/users/recent_contacts_controller.rb b/app/controllers/users/recent_contacts_controller.rb index bc4b8ea8f..2576385b2 100644 --- a/app/controllers/users/recent_contacts_controller.rb +++ b/app/controllers/users/recent_contacts_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/users_for_private_messages_controller.rb b/app/controllers/users_for_private_messages_controller.rb index 1caf52a6c..610bf5d52 100644 --- a/app/controllers/users_for_private_messages_controller.rb +++ b/app/controllers/users_for_private_messages_controller.rb @@ -2,7 +2,8 @@ class UsersForPrivateMessagesController < ApplicationController before_action :require_login, :check_auth def index - users = User.active.where.not(id: current_user.id).where(laboratory_id: current_laboratory.id) + 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? diff --git a/app/models/user.rb b/app/models/user.rb index c2a7317e7..aa02ecb4c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -695,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位 diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb index e1c603215..607feb93a 100644 --- a/app/views/admins/identity_authentications/shared/_list.html.erb +++ b/app/views/admins/identity_authentications/shared/_list.html.erb @@ -43,6 +43,9 @@ <%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> <% end %> + <% if user.from_sub_site? %> + 合作 + <% end %> <%= user.real_name %> <%= user.ID_number %> diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb index 0bf8ea4a3..6ec6355ba 100644 --- a/app/views/admins/professional_authentications/shared/_list.html.erb +++ b/app/views/admins/professional_authentications/shared/_list.html.erb @@ -41,6 +41,9 @@ <%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> <% end %> + <% if user.from_sub_site? %> + 合作 + <% end %> <%= user.real_name %> <%= raw [user.school_name.presence, user.department_name.presence].compact.join('
') %> diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 873461600..6971cf36c 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -235,7 +235,7 @@ class ShixunsHome extends Component { {/*实训路径*/} - {pathstype===true?"":
+ {pathstype===true||homedatalist===undefined?"":homedatalist.subjects.length===0?"":

实践课程

TRAINING COURSE

@@ -314,7 +314,7 @@ class ShixunsHome extends Component {
} {/*精选实训 改为 开发社区*/} - {shixuntype===true?"":
+ {shixuntype===true||homedatalist===undefined?"":homedatalist.shixuns.length===0?"":

实训项目

DEVELOPMENT COMMUNITY

diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 04a0312fd..1a5802782 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -604,7 +604,7 @@ class LoginDialog extends Component { setNotcompleteds={()=>{this.setNotcompleteds()}} /> - {this.state.isphone===false?