diff --git a/app/api/mobile/apis/blog_comments.rb b/app/api/mobile/apis/blog_comments.rb index 5a064245a..bb5758e71 100644 --- a/app/api/mobile/apis/blog_comments.rb +++ b/app/api/mobile/apis/blog_comments.rb @@ -7,7 +7,7 @@ module Mobile desc "get special topic" get ':id' do - user = UserWechat.find_by_openid(params[:openid]).user + user = current_user blog = BlogComment.find params[:id] present :data, blog, with: Mobile::Entities::BlogComment,user: user present :status, 0 diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 70dd64fad..fa52c9ea4 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -21,7 +21,7 @@
{{r.filename}}发送
-

暂无课件,
+

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

@@ -38,14 +38,14 @@
{{r.homework_name}}
-

暂无作业,
+

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

{{r.exercise_name}}
-

暂无小测验,
+

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

diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index dc4d6ea78..1317ac11a 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -1,4 +1,5 @@
+
我的资源
{{menu}} @@ -8,19 +9,21 @@
+
{{r.filename}}发送
-

暂无课件,
+

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

{{r.homework_name}}
-

暂无作业,
+

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

{{r.exercise_name}}
-

暂无测验,
+

暂无测验,
请登录Trustie网站,在PC浏览器中创建测验。

+
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 1cd69bb43..d5de23859 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -31,6 +31,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location {token: auth.token(), name: ''} ).then(function(response){ vm.resources = response.data.data; + vm.resources_tag = true; }); } } @@ -40,6 +41,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $http.get(config.apiUrl + "courses/homeworks/"+courseid+"?token="+auth.token()).then(function(response){ vm.homeworks = response.data.data; console.log(response.data); + vm.homeworks_tag = true; }); } } @@ -49,6 +51,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $http.get(config.apiUrl + "courses/"+courseid+"/exercises?token="+auth.token()).then(function(response){ vm.exercises = response.data.data; console.log(response.data); + vm.exercises_tag = true; }); } } @@ -64,6 +67,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.showResources = false; vm.showHomework = false; vm.showTestcase = false; + vm.resources_tag = false; + vm.homeworks_tag = false; + vm.exercises_tag = false; if(vm.isTeacher){ if(index == 1){ //课件 diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 084205fbe..462a35842 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -2,23 +2,23 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l var vm = $scope; vm.menus = ['课件', '作业', '测验']; - vm.resources = []; - vm.homeworks = []; - vm.exercise = []; + vm.resources = null; + vm.homeworks = null; + vm.exercise = null; vm.tab = function(index){ vm.currentTab = index; - if(index==1){ + if(index==1 && (!vm.resources || vm.resources.length <= 0 )){ $http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){ console.log(response.data); vm.resources = response.data.data; }); - } else if(index==2){ + } else if(index==2 && (!vm.homeworks || vm.homeworks.length <= 0) ){ $http.get(config.apiUrl + "resources/homeworks?token="+auth.token()).then(function(response){ console.log(response.data); vm.homeworks = response.data.data; }); - } else if(index==3){ + } else if(index==3 && (!vm.exercise || vm.exercise.length <= 0) ){ $http.get(config.apiUrl + "resources/exercies?token="+auth.token()).then(function(response){ console.log(response.data); vm.exercise = response.data.data;