diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 1765ce23d..caabad198 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -193,10 +193,13 @@ module Mobile desc "返回单个课程" params do requires :id, type: Integer + requires :token,type:String end route_param :id do get do - course = Course.find(params[:id]) + # course = Course.find(params[:id]) + cs = CoursesService.new + course = cs.show_course(params,current_user) present :data, course, with: Mobile::Entities::Course,user: current_user { status: 0} end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7ef08f6d8..39c77de4b 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -187,10 +187,10 @@ class CoursesService else work_unit = get_user_work_unit course.teacher end - unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) - raise '403' - end - {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} + # unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) + # raise '403' + # end + {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} end #创建课程 diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 0539ee326..c328ed226 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -8,10 +8,10 @@ - - - - + + + + @@ -23,10 +23,7 @@
-
{{r.filename}}发送
-
-
更多
-
+
{{r.filename}}发送

暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。

@@ -46,9 +43,6 @@
{{r.homework_name}}发送
-
-
更多
-

暂无作业,
请登录Trustie网站,在PC浏览器中上传作业。

@@ -56,9 +50,6 @@
{{r.exercise_name}}发送
-
-
更多
-

暂无小测验,
请登录Trustie网站,在PC浏览器中上传小测验。

diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js index 0b5841b5f..0c8bbe09e 100644 --- a/public/javascripts/wechat/controllers/invite_code.js +++ b/public/javascripts/wechat/controllers/invite_code.js @@ -5,16 +5,16 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth', function($scope, $http, $routeParams, config, auth){ var vm = $scope; - + vm.course = {}; var courseid = $routeParams.id; - $http.get(config.apiUrl+ 'courses/'+courseid).then( + $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( function(response){ console.log(response.data); vm.course = response.data.data; } ); - + vm.share = function(){ window.WeixinJSBridge.invoke('sendAppMessage',{ 'appid': 'wxf694495398c7d470', // 公众号appID @@ -30,5 +30,5 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config //alert(res.err_msg); }); } - + }]);