Merge branch 'dev_aliyun' into develop

dev_cs_new
daiao 6 years ago
commit ae9167caf2

@ -239,7 +239,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
User.current = User.find 57703
User.current = User.find 8686
end
@ -567,6 +567,10 @@ class ApplicationController < ActionController::Base
time.blank? ? '' : time.strftime("%Y-%m-%d %H:%M:%S")
end
def strf_date(date)
date.blank? ? '' : date.strftime("%Y-%m-%d")
end
def logger_error(error)
Rails.logger.error(error.message)
error.backtrace.each { |msg| Rails.logger.error(msg) }

@ -13,7 +13,7 @@ class CoursesController < ApplicationController
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner]
before_action :check_account, only: [:new, :create, :apply_to_join_course]
before_action :check_account, only: [:new, :create, :apply_to_join_course, :join_excellent_course]
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner, :apply_to_join_course, :exit_course]
before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,
@ -25,12 +25,13 @@ class CoursesController < ApplicationController
:transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search,
:base_info, :get_historical_courses, :create_group_by_importing_file,
:attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course]
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :join_excellent_course, :online_learning]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
:transfer_to_course_group, :delete_from_course,
:search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher]
before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin,
:set_course_group, :create_group_by_importing_file]
:set_course_group, :create_group_by_importing_file, :update_informs]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
:change_course_teacher, :export_member_scores_excel, :course_group_list,
:teacher_application_review, :apply_teachers, :delete_course_teacher]
@ -117,13 +118,19 @@ class CoursesController < ApplicationController
authentication: params[:authentication], professional_certification: params[:professional_certification])
@course.tea_id = current_user.id
@course_list_name = params[:course_list_name].strip
@course_list = CourseList.find_by(name: @course_list_name)
if @course_list
@course.course_list_id = @course_list.id
if params[:subject_id].blank?
@course_list_name = params[:course_list_name].strip
@course_list = CourseList.find_by(name: @course_list_name)
if @course_list
@course.course_list_id = @course_list.id
else
new_course_list = CourseList.create!(name: @course_list_name, user_id: current_user.id, is_admin: 0)
@course.course_list_id = new_course_list.id
end
else
new_course_list = CourseList.create!(name: @course_list_name, user_id: current_user.id, is_admin: 0)
@course.course_list_id = new_course_list.id
@course.start_date = params[:start_date]
@course.subject_id = params[:subject_id]
@course.excellent = true
end
@course.is_end = @course.end_date.present? && @course.end_date < Date.today
@ -133,6 +140,13 @@ class CoursesController < ApplicationController
CourseInfo.create!(user_id: current_user.id, course_id: @course.id)
CourseMember.create!(course_id: @course.id, user_id: current_user.id, role: 1)
# 将实践课程的教学团队成员以教师身份加入课堂
if @course.subject
@course.subject.subject_members.where.not(user_id: current_user.id).each do |s_member|
CourseMember.create!(course_id: @course.id, user_id: s_member.user_id, role: 2)
end
end
course_module_types = params[:course_module_types]
@course.create_course_modules(course_module_types)
end
@ -151,7 +165,6 @@ class CoursesController < ApplicationController
begin
extra_params = Hash.new
extra_params[:school_id] = @school.id
extra_params[:is_public] = params[:is_public].present? ? params[:is_public] : 0
if @course.is_end && (course_params[:end_date].blank? || course_params[:end_date].to_date > Date.today)
extra_params[:is_end] = 0
@ -162,13 +175,18 @@ class CoursesController < ApplicationController
extra_params[:authentication] = params[:authentication]
extra_params[:professional_certification] = params[:professional_certification]
@course_list_name = params[:course_list_name].strip
@course_list = CourseList.find_by(name: @course_list_name)
if @course_list
extra_params[:course_list_id] = @course_list.id
if @course.subject
@course.start_date = params[:start_date]
else
new_course_list = CourseList.create(name: @course_list_name, user_id: current_user.id, is_admin: 0)
extra_params[:course_list_id] = new_course_list.id
extra_params[:is_public] = params[:is_public].present? ? params[:is_public] : 0
@course_list_name = params[:course_list_name].strip
@course_list = CourseList.find_by(name: @course_list_name)
if @course_list
extra_params[:course_list_id] = @course_list.id
else
new_course_list = CourseList.create(name: @course_list_name, user_id: current_user.id, is_admin: 0)
extra_params[:course_list_id] = new_course_list.id
end
end
@course.update_attributes!(course_params.merge(extra_params))
@ -183,6 +201,42 @@ class CoursesController < ApplicationController
end
end
def join_excellent_course
tip_exception("您已是课堂成员") if current_user.member_of_course?(@course)
tip_exception("请通过邀请码加入课堂") unless @course.excellent
tip_exception("该课堂已结束") if @course.is_end
begin
new_student = CourseMember.new(user_id: current_user.id, course_id: @course.id, role: 4)
new_student.save!
CourseAddStudentCreateWorksJob.perform_later(@course.id, [current_user.id])
StudentJoinCourseNotifyJob.perform_later(current_user.id, @course.id)
normal_status(0, "加入成功")
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
end
end
def informs
end
def update_informs
tip_exception("公告内容不能为空") if params[:description].blank?
inform = @course.inform || Inform.new(container: @course)
inform.description = params[:description]
inform.save!
normal_status("更新成功")
end
def online_learning
@subject = @course.subject
@stages = @subject&.stages
@user = current_user
@start_learning = @user_course_identity == Course::STUDENT && @subject&.learning?(current_user.id)
end
def search_course_list
search = params[:search] ? "%#{params[:search].strip}%" : "%%"
@course_lists = CourseList.where("name like ?", "#{search}")
@ -1075,14 +1129,31 @@ class CoursesController < ApplicationController
def validate_course_name
tip_exception("课堂名称不能为空!") if params[:course][:name].blank?
tip_exception("课程名称不能为空!") if params[:course_list_name].blank?
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
if params[:subject_id].blank? || (@course && @course.subject.blank?)
tip_exception("课程名称不能为空!") if params[:course_list_name].blank?
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
params[:course][:name].index(params[:course_list_name]) == 0
else
@subject = @course.present? ? @course.subject : Subject.find_by!(id: params[:subject_id])
tip_exception("开始时间不能为空") if params[:start_date].blank?
tip_exception("结束时间不能为空") if params[:end_date].blank?
tip_exception("结束时间必须晚于开始时间") if params[:end_date] <= params[:start_date]
tip_exception("开始时间和结束时间不能与往期开课时间重叠") if @course.nil? && @subject.max_course_end_date && params[:start_date] <= strf_date(@subject.max_course_end_date)
validate_start_end_date if @course.present?
tip_exception("开放课堂必须包含公告栏和在线学习模块") unless params[:course_module_types].include?("announcement") && params[:course_module_types].include?("online_learning")
end
tip_exception("课堂所属单位不能为空!") if params[:school].blank?
tip_exception("请至少添加一个课堂模块") if params[:course_module_types].blank?
@school = School.find_by!(name: params[:school].strip)
end
def validate_start_end_date
prev_course = @subject.courses.where("id < #{@course.id}").last
next_course = @subject.courses.where("id > #{@course.id}").first
tip_exception("开始时间和结束时间不能与其他期开课时间重叠") if prev_course && params[:start_date] <= strf_date(prev_course.end_date)
tip_exception("开始时间和结束时间不能与其他期开课时间重叠") if next_course && params[:end_date] >= strf_date(next_course.start_date)
end
# 超级管理员和课堂管理员的权限判断
def admin_allowed
unless @user_course_identity < Course::PROFESSOR

@ -23,24 +23,19 @@ class MyshixunsController < ApplicationController
begin
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
# 实训在申请发布前,是否玩过实训,如果玩过需要更改记录,防止二次重置
shixun_mod = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => @myshixun.id, :status => 1).take
shixun_mod.update_column(:status, 0) if shixun_mod
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")
end
end
# 删除版本库
GitService.delete_repository(repo_path: @repo_path)
GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type?
rescue Exception => e
if e.message != "ActiveRecord::RecordInvalid"
logger.error("######delete_repository_error:#{e.message}")
logger.error("######delete_repository_error-:#{e.message}")
end
raise "delete_repository_error:#{e.message}"
end

@ -25,13 +25,13 @@ class SubjectsController < ApplicationController
if reorder == "myshixun_count"
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, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
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 where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%'
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, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
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 where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%'
GROUP BY subjects.id ORDER BY myshixun_member_count DESC")

@ -28,6 +28,10 @@ module CoursesHelper
def module_url mod, course
return nil if mod.blank? or course.blank?
case mod.module_type
when "announcement"
"/courses/#{course.id}/informs"
when "online_learning"
"/courses/#{course.id}/online_learning"
when "shixun_homework"
"/courses/#{course.id}/shixun_homeworks/#{mod.id}"
when "common_homework"
@ -261,4 +265,10 @@ module CoursesHelper
group_info
end
def last_subject_shixun user_id, subject
myshixun = Myshixun.where(user_id: user_id, shixun_id: subject&.shixuns).order("updated_at desc").first
return "" unless myshixun
stage_shixun = subject&.stage_shixuns.where(shixun_id: myshixun.shixun_id).take
progress = stage_shixun&.position.to_s + "-" + stage_shixun&.position.to_s + " " + myshixun.shixun&.name
end
end

@ -2,7 +2,7 @@ module StagesHelper
# 章节实训的通关情况
def stage_myshixun_status shixun, user
myshixun = Myshixun.where(user_id: user.id, shixun_id: shixun.id).first
myshixun = Myshixun.where(user_id: user.id, shixun_id: shixun.id).take
myshixun.try(:status) == 1 ? 1 : 0
end

@ -5,7 +5,11 @@ class Course < ApplicationRecord
belongs_to :teacher, class_name: 'User', foreign_key: :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, class_name: 'School', foreign_key: :school_id #定义一个方法school该方法通过school_id来调用School表
belongs_to :course_list
belongs_to :course_list, optional: true
# 所属实践课程
belongs_to :subject, optional: true
has_one :inform, as: :container, dependent: :destroy
has_many :course_infos, dependent: :destroy
# 课堂左侧导航栏的模块
@ -87,7 +91,7 @@ class Course < ApplicationRecord
NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录
validates :name, presence: true, length: { maximum: 30 }
validates :name, presence: true, length: { maximum: 60 }
after_create :create_board_sync, :act_as_course_activity, :send_tiding
@ -176,7 +180,7 @@ class Course < ApplicationRecord
end
def all_course_module_types
%w[activity shixun_homework common_homework group_homework graduation exercise poll attachment board course_group]
%w[activity announcement online_learning shixun_homework common_homework group_homework graduation exercise poll attachment board course_group]
end
def get_course_module_by_type(type)
@ -334,6 +338,8 @@ class Course < ApplicationRecord
def get_name_by_type(type)
case type
when 'activity' then '动态'
when 'announcement' then '公告栏'
when 'online_learning' then '在线学习'
when 'shixun_homework' then '实训作业'
when 'common_homework' then '普通作业'
when 'group_homework' then '分组作业'
@ -350,15 +356,17 @@ class Course < ApplicationRecord
def get_position_by_type(type)
case type
when 'activity' then 1
when 'shixun_homework' then 2
when 'common_homework' then 3
when 'group_homework' then 4
when 'graduation' then 5
when 'exercise' then 6
when 'poll' then 7
when 'attachment' then 8
when 'board' then 9
when 'course_group' then 10
when 'announcement' then 2
when 'online_learning' then 3
when 'shixun_homework' then 4
when 'common_homework' then 5
when 'group_homework' then 6
when 'graduation' then 7
when 'exercise' then 8
when 'poll' then 9
when 'attachment' then 10
when 'board' then 11
when 'course_group' then 12
else 100
end
end

@ -0,0 +1,3 @@
class Inform < ApplicationRecord
belongs_to :container, polymorphic: true, optional: true
end

@ -18,6 +18,9 @@ class Subject < ApplicationRecord
has_many :tidings, as: :container, dependent: :destroy
has_many :stages, -> { order("stages.position ASC") }, dependent: :destroy
# 开放课堂
has_many :courses, -> { order("courses.id ASC") }
validates :name, length: { maximum: 40 }
validates :description, length: { maximum: 5000 }
validates :learning_notes, length: { maximum: 500 }
@ -31,6 +34,11 @@ class Subject < ApplicationRecord
self.tidings << Tiding.new(user_id: self.user_id, trigger_user_id: self.user_id, belong_container_id: self.id, belong_container_type: 'Subject', tiding_type: "System", viewed: 0)
end
# 所有开课课堂的最大结束时间
def max_course_end_date
courses.pluck(:end_date).max
end
# 挑战过路径的成员数
def member_count
shixuns.pluck(:myshixuns_count).sum
@ -92,4 +100,8 @@ class Subject < ApplicationRecord
challenges = Challenge.where(shixun_id: shixuns.unhidden)
@tags = ChallengeTag.where(challenge_id: challenges).pluck(:name).uniq
end
def learning? user_id
Myshixun.where(user_id: user_id, shixun_id: shixuns).exists?
end
end

@ -378,6 +378,8 @@ class User < ApplicationRecord
@identity =
if admin?
User::EDU_ADMIN
elsif business?
User::EDU_BUSINESS
elsif creator_of_shixun?(shixun)
User::EDU_SHIXUN_MANAGER
elsif member_of_shixun?(shixun)

@ -12,5 +12,6 @@ json.courses @courses do |course|
json.is_accessible course.is_public == 1 || @user.course_identity(course) < Course::NORMAL
json.is_end course.is_end
json.first_category_url module_url(course.none_hidden_course_modules.first, course)
json.excellent course.excellent
end
json.courses_count @courses_count

@ -0,0 +1 @@
json.description @course.inform&.description

@ -0,0 +1,11 @@
json.stages @stages do |stage|
json.partial! 'stages/stage', locals: {stage: stage, user:@user, subject:@subject}
end
json.description @subject&.description
json.start_learning @start_learning
json.learned @start_learning ? @subject&.my_subject_progress : 0
json.last_shixun @start_learning ? last_subject_shixun(@user.id, @subject) : ""

@ -1,5 +1,5 @@
json.course_list_id @course.course_list.id
json.course_list_name @course.course_list.name
json.course_list_id @course.course_list&.id
json.course_list_name @course.course_list&.name
json.name @course.name
json.course_id @course.id
json.school @course.school&.name
@ -9,4 +9,6 @@ json.end_date @course.end_date
json.is_public @course.is_public
json.course_module_types @course.course_modules.where(hidden: 0).pluck(:module_type)
json.authentication @course.authentication
json.professional_certification @course.professional_certification
json.professional_certification @course.professional_certification
json.subject_id @course.subject_id
json.excellent @course.excellent

@ -21,6 +21,7 @@ json.switch_to_assistant switch_assistant_role(@is_student, @course, @user)
#json.join_course !@user.member_of_course?(@course)
#json.copy_course !@user.member_of_course?(@course) && @user.is_teacher?
json.course_identity @user_course_identity
json.excellent @course.excellent
if @course.is_end == 0
json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i
end

@ -17,6 +17,8 @@ json.homeworks @homework_commons.each do |homework|
json.status_time curr_status[:time]
json.time_status curr_status[:time_status]
json.allow_late homework.allow_late
# 只有在主目录才显示
json.upper_category_name homework.course_second_category&.name unless params[:category]
unless curr_status[:status].include?("未发布")
json.commit_count studentwork_count homework, 1, @member

@ -11,7 +11,7 @@ json.array! @members do |member|
json.partial! 'users/user', locals: { user: member.user }
json.user_shixuns_count member.user.shixuns.published.count
#json.fans_count member.user.fan_count
json.brief_introduction member.user.user_extension.brief_introduction
#json.brief_introduction member.user.user_extension.brief_introduction
json.identity member.user.identity
json.school_name member.user.school_name
json.shixun_manager member.role == 1

@ -1,5 +1,6 @@
json.array! subjects do |subject|
json.id subject.id
json.excellent subject.excellent
json.image_url url_to_avatar(subject)
json.name subject.name
json.tag_name subject.repertoire.try(:name)

@ -1,3 +1,4 @@
json.members @subject.subject_members do |member|
json.partial! 'subject_member', locals: { user: member.user }
json.role member.role
end

@ -14,6 +14,7 @@ if @course
json.course_identity @course_identity
json.course_name @course.name
json.course_public @course.is_public
json.course_excellent @course.excellent
if params[:group_info]
json.group_info @course.teacher_group(@user.id) if @course_identity < Course::STUDENT
end

@ -7,7 +7,7 @@ json.grade @user.grade
json.follow_count @user.follow_count
json.fan_count @user.fan_count
json.identity @user.identity
json.brief_introduction @user.user_extension&.brief_introduction
#json.brief_introduction @user.user_extension&.brief_introduction
json.authentication @user.authentication
json.professional_certification @user.professional_certification
json.phone_binded @user.phone_binded?

@ -346,6 +346,10 @@ Rails.application.routes.draw do
post 'switch_to_assistant'
post 'switch_to_student'
post 'exit_course'
get 'informs'
post 'update_informs'
get 'online_learning'
post 'join_excellent_course'
end
collection do

@ -0,0 +1,8 @@
class AddNewColumnToCourse < ActiveRecord::Migration[5.2]
def change
add_column :courses, :start_date, :date
add_column :courses, :subject_id, :integer, default: 0
add_index :courses, :subject_id
end
end

@ -0,0 +1,5 @@
class AddExcellentToCourses < ActiveRecord::Migration[5.2]
def change
add_column :courses, :excellent, :boolean, default: false
end
end

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -69,19 +69,33 @@ class ListPageIndex extends Component{
super(props);
this.state={
yslGuideone:undefined,
mysearch:undefined,
}
}
componentDidMount(){
var yslGuideone = window.sessionStorage.getItem('yslGuideone');
console.log("77");
var yslGuideone = window.localStorage.getItem('yslGuideone');
console.log("78");
console.log(yslGuideone);
var mysearchs= this.props.location.search===""?undefined:this.props.location.search===undefined?undefined:this.props.location.search==="?exhibition=true"?true:undefined;
this.setState({
yslGuideone:yslGuideone,
mysearch:mysearchs,
})
try {
if (yslGuideone === "true") {
console.log("true 字符串");
this.setState({
yslGuideone:true,
})
} else {
this.setState({
yslGuideone:false,
});
console.log("false 字符串");
}
}catch (e) {
console.log(e);
this.setState({
yslGuideone:false,
});
}
}
//
@ -93,20 +107,33 @@ class ListPageIndex extends Component{
// })
// }
componentWillUnmount(){
window.sessionStorage.setItem('yslGuideone', false);
// window.localStorage.setItem('yslGuideone', "false");
}
setwindowlocal=(bool)=>{
window.sessionStorage.setItem('yslGuideone', bool);
this.setState({
yslGuideone:bool,
mysearch:undefined,
});
var currenturl = this.props.location.pathname;
var newUrl = (currenturl.split("?"))[0];
window.history.pushState('','',newUrl);
window.localStorage.setItem('yslGuideone', bool);
try {
if (bool === "true") {
console.log("115");
console.log("true 字符串");
this.setState({
yslGuideone:true,
})
} else {
this.setState({
yslGuideone:false,
});
console.log("124");
console.log("false 字符串");
}
}catch (e) {
console.log(e);
this.setState({
yslGuideone:false,
});
}
}
render() {
let {yslGuideone,mysearch} =this.state;
let {yslGuideone} =this.state;
// console.log("98");
// console.log(yslGuideone);
// console.log(this.props.isAdmin());
@ -118,10 +145,10 @@ class ListPageIndex extends Component{
<div className="newMain clearfix">
{/*头部banner*/}
<CoursesBanner {...this.props}></CoursesBanner>
{/*{mysearch!==undefined?*/}
{/*下面是指引哦*/}
{/*{yslGuideone!==undefined?*/}
{/*(*/}
{/* mysearch===true?*/}
{/* yslGuideone===true?*/}
{/* <Guide*/}
{/* setwindowlocal={(b)=>this.setwindowlocal(b)}*/}
{/* >*/}

@ -310,7 +310,7 @@ class BoardsNew extends Component{
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}帖子</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.goBack()}>
返回
{/*返回*/}
</a>
</p>
{/* notRequired */}

@ -283,11 +283,11 @@ class GraduateTaskItem extends Component{
{this.props.isAdmin?
<div className="mt13">
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+taskid+"/edit"} className="colorblue font-16 mrf4 fr">
<a className="btn colorblue">编辑</a>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/setting"} className="colorblue font-16 mrf4 fr">
<a className="btn colorblue">设置</a>
</WordsBtn>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/setting"} className="colorblue font-16 mr20 fr">
<a className="btn colorblue" >设置</a>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+taskid+"/edit"} className="colorblue font-16 mr20 fr">
<a className="btn colorblue" >编辑</a>
</WordsBtn>
</div>

@ -41,7 +41,8 @@ class CoursesNew extends Component {
searchlist: [],
searchlistscholl:[],
listvalue: undefined,
fetching:false
fetching:false,
boolxinjian:false,
}
}
@ -80,6 +81,9 @@ class CoursesNew extends Component {
}).catch((error) => {
console.log(error);
})
this.setState({
boolxinjian:false,
});
}else{
let url = "/courses/new.json"
axios.get(url).then((result) => {
@ -96,18 +100,25 @@ class CoursesNew extends Component {
});
this.handleSearchschool(user_school);
this.setState({
boolxinjian:true,
});
}
}
componentDidUpdate(prevProps){
// if(prevProps.current_user!=this.props.current_user){
// if(this.props.current_user.user_identity==="学生"){
// window.location.href ="/403"
// }
// }
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user){
let user_school=this.props.current_user&&this.props.current_user.user_school;
this.props.form.setFieldsValue({
school:user_school,
});
this.setState({
school:user_school,
});
this.handleSearchschool(user_school);
}
}
onChangeTimepublishs = (date, dateString) => {
if(dateString===""){
this.setState({
@ -206,8 +217,23 @@ class CoursesNew extends Component {
if (response.data.status === 0) {
// this.goback()
window.location.href=first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
window.location.href=first_category_url;
if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if (yslGuideone === null) {
window.localStorage.setItem('yslGuideone', "true");
return
}
if (yslGuideone === undefined) {
window.localStorage.setItem('yslGuideone', "true");
return
}
} catch (e) {
}
}
}
}).catch((error) => {
console.log(error)
@ -251,8 +277,24 @@ class CoursesNew extends Component {
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
window.location.href=response.data.first_category_url;
if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if(yslGuideone=== null){
window.localStorage.setItem('yslGuideone', "true");
return
}
if(yslGuideone=== undefined){
window.localStorage.setItem('yslGuideone', "true");
return
}
}catch (e) {
}
}
}
}).catch((error) => {
console.log(error)
@ -405,9 +447,10 @@ class CoursesNew extends Component {
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
const options = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
const optionschool = this.state.searchlistscholl===undefined?"":this.state.searchlistscholl===null?"":this.state.searchlistscholl==="[]"?"":this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school)
// form合并了
console.log("获取到的数据");
console.log(this.state);
console.log(this.props);
console.log(this.props.current_user);

@ -6,7 +6,9 @@ import guihome2 from "../../../images/guideimg/guihome2.jpg";
import guihome3 from "../../../images/guideimg/guihome3.jpg";
import guihome4 from "../../../images/guideimg/guihome4.jpg";
import guihome5 from "../../../images/guideimg/guihome5.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
// import guihome6 from "../../../images/guideimg/guihome6.png";
// import guihome7 from "../../../images/guideimg/guihome7.png";
class Guide extends Component {
@ -60,7 +62,7 @@ class Guide extends Component {
page:i,
})
if(i===7){
this.props.setwindowlocal(false);
this.props.setwindowlocal("false");
}
}
render() {
@ -123,6 +125,7 @@ class Guide extends Component {
page===6?
<div className="guide-content">
<img className={mywidth===1?"ysldiv61024":mywidth===2?"ysldiv61280":mywidth===3?"ysldiv61440":mywidth===4?"ysldiv61680":mywidth===5?"ysldiv61900":mywidth===6?"ysldiv61366":mywidth===7?"ysldiv61600":"ysldiv61900"} src={guihome6} onClick={(i)=>this.thissetPage(7)}/>
{/*<img className={mywidth===1?"ysldiv71024":mywidth===2?"ysldiv71280":mywidth===3?"ysldiv71440":mywidth===4?"ysldiv71680":mywidth===5?"ysldiv71900":mywidth===6?"ysldiv71366":mywidth===7?"ysldiv71600":"ysldiv71900"} src={guihome7} onClick={(i)=>this.thissetPage(7)}/>*/}
</div>
:
""

@ -157,6 +157,7 @@ class ShixunStudentWork extends Component {
lunxun:false,
duplicatechecking:false,
});
return;
}
}
}
@ -177,6 +178,9 @@ class ShixunStudentWork extends Component {
description: response.data.message
});
}
this.setState({
lunxun:true,
})
setInterval(() => {
console.log("开始轮询了");
if(this.state.lunxun===true){

@ -470,4 +470,49 @@
margin-left: 27%;
margin-right: 0;
height: 40%;
}
.ysldiv71900{
margin-top: 16%;
margin-left: 34%;
margin-right: 19%
}
.ysldiv71680{
margin-top: 18%;
margin-left: 31%;
margin-right: 14%;
}
.ysldiv71600{
margin-top: 19%;
margin-left: 30%;
margin-right: 12%;
}
.ysldiv71440{
margin-top: 21%;
margin-left: 28%;
margin-right: 8%;
}
.ysldiv71280{
margin-top: 24%;
margin-left: 25%;
margin-right: 3%;
height: 53%;
}
.ysldiv71366{
margin-top: 22%;
margin-left: 26%;
margin-right: 6%;
height: 53%;
}
.ysldiv71024{
margin-top: 31%;
margin-left: 27%;
margin-right: 0;
height: 40%;
}

@ -113,7 +113,7 @@ class Collaborators extends Component {
onSearchcalue:""
})
let admintype = this.props.identity;
if (admintype>3) {
if (admintype>4) {
this.props.showSnackbar("您没有权限");
return
}

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Inform, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save