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

dev_video
daiao 5 years ago
commit 6e8db43b7f

@ -1146,6 +1146,7 @@ class CoursesController < ApplicationController
if existing_student.present?
# 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班
existing_student.update!(course_group_id: course_group.id) if course_group.present?
message = "您已是课堂成员"
else
correspond_teacher_exist = current_user.none_admin_teacher_of_course? course
new_student = CourseMember.new(user_id: current_user.id, course_id: course.id, role: 4)

@ -1,6 +1,7 @@
class Weapps::CoursesController < Weapps::BaseController
before_action :require_login
before_action :set_course, :user_course_identity, except: [:create]
before_action :set_course, except: [:create]
before_action :user_course_identity, except: [:basic_info, :create]
before_action :check_account, only: [:create]
before_action :teacher_allowed, only: [:edit, :update]
before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers]
@ -15,6 +16,10 @@ class Weapps::CoursesController < Weapps::BaseController
render_error(ex.message)
end
def basic_info
@course = current_course
end
def edit
@course = current_course
end

@ -0,0 +1,8 @@
json.course do
json.(@course, :id, :name)
json.code_halt @course.invite_code_halt == 1
json.invite_code @course.invite_code_halt == 0 ? @course.generate_invite_code : ""
json.teacher_name @course.teacher.real_name
json.teacher_img url_to_avatar(@course.teacher)
json.teacher_school @course.school.try(:name)
end

@ -1029,6 +1029,7 @@ Rails.application.routes.draw do
get :students
delete :delete_course_students
get :course_groups
get :basic_info
end
end

Loading…
Cancel
Save