邀请码分享问题修改

This commit is contained in:
yuanke 2016-07-15 19:08:05 +08:00
parent 7dd26bb5d9
commit 596bfe4bfc
4 changed files with 17 additions and 23 deletions

View File

@ -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

View File

@ -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
#创建课程

View File

@ -8,10 +8,10 @@
<!--<div ng-repeat="menu in menus">-->
<!--<div id="class_tab_1" ng-class="[{'class-detail-tab': isTeacher},{'class-detail-tab3': !isTeacher},{'class-tab-active':currentTab==$index+1}]" ng-click="tab($index+1);"><a herf="javascript:void(0);">{{menu}}</a></div>-->
<!--<div ng-if="!$last" class="slice2 fl">-->
<!--<div class="slice-line2"></div>-->
<!--</div>-->
<!--<div id="class_tab_1" ng-class="[{'class-detail-tab': isTeacher},{'class-detail-tab3': !isTeacher},{'class-tab-active':currentTab==$index+1}]" ng-click="tab($index+1);"><a herf="javascript:void(0);">{{menu}}</a></div>-->
<!--<div ng-if="!$last" class="slice2 fl">-->
<!--<div class="slice-line2"></div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="slice3 fl"></div>-->
@ -23,10 +23,7 @@
</div>
<div ng-class="{'undis': !showResources}">
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.filename}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
<div ng-if="has_more">
<div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div>
</div>
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.filename}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
<p ng-show="resources_tag == true && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站在PC浏览器中上传课件。</p>
</div>
@ -46,9 +43,6 @@
<div ng-class="{'undis': !showHomework}">
<div ng-repeat="r in homeworks|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 undis" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
<div ng-if="homework_has_more">
<div id="homework_more" class="more-events mt10" ng-click="loadResourceData(2,page+1);">更多</div>
</div>
<p ng-show="homeworks_tag == true && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
请登录Trustie网站在PC浏览器中上传作业。</p>
@ -56,9 +50,6 @@
<div ng-class="{'undis': !showTestcase}">
<div ng-repeat="r in exercises|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/test.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.exercise_name}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 undis" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
<div ng-if="exercise_has_more">
<div id="exercise_more" class="more-events mt10" ng-click="loadResourceData(3,page+1);">更多</div>
</div>
<p ng-show="exercises_tag == true && exercises.length<=0" class="class-test-tip">暂无小测验,<br />
请登录Trustie网站在PC浏览器中上传小测验。</p>
</div>

View File

@ -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);
});
}
}]);