You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class Weapps::HomesController < Weapps::BaseController
|
|
|
|
before_action :require_wechat_login!
|
|
|
|
|
|
|
|
def show
|
|
|
|
# banner
|
|
|
|
@carousels = WeappSettings::Carousel.only_online
|
|
|
|
# 广告
|
|
|
|
@advert = WeappSettings::Advert.only_online.first
|
|
|
|
|
|
|
|
# 我的课堂
|
|
|
|
category = params[:category] && ["manage", "study"].include?(params[:category]) ? params[:category] : (current_user.is_teacher? ? "manage" : "study")
|
|
|
|
@courses = case category
|
|
|
|
when 'study' then
|
|
|
|
current_user.as_student_courses.started
|
|
|
|
when 'manage' then
|
|
|
|
current_user.manage_courses
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|