From 9d0b5789d9493bfccc02049955358b066f7b5c8d Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Mon, 4 Jul 2016 16:50:49 +0800
Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=88=91=E7=9A=84=E5=8A=A8?=
=?UTF-8?q?=E6=80=81=E5=8D=9A=E5=AE=A2=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BA=86=E7=9A=84BUG=20=202.?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E7=95=8C=E9=9D=A2=E5=88=87=E6=8D=A2=E6=98=AF?=
=?UTF-8?q?=E6=9A=82=E6=97=A0XX=E5=85=88=E9=9A=90=E8=97=8F=20=203.=20?=
=?UTF-8?q?=E5=8F=91=E9=80=81=E8=B5=84=E6=BA=90=E4=B8=8D=E9=80=89=E6=8B=A9?=
=?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/mobile/apis/blog_comments.rb | 2 +-
public/assets/wechat/class.html | 6 +++---
public/assets/wechat/myresource.html | 9 ++++++---
public/javascripts/wechat/controllers/class.js | 6 ++++++
public/javascripts/wechat/controllers/myresource.js | 12 ++++++------
5 files changed, 22 insertions(+), 13 deletions(-)
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 @@
-
暂无课件,
+
暂无课件,
请登录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 @@
+
-
暂无课件,
+
暂无课件,
请登录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;