From 863ec9d3967f0b208b31cf7fae96b7ecde94cfdb Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 22 Aug 2016 16:50:14 +0800 Subject: [PATCH 01/23] =?UTF-8?q?iphone=E4=B8=8B=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/app.html | 1 + public/assets/wechat/blog_detail.html | 2 +- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/assets/wechat/homework_detail.html | 2 +- public/assets/wechat/issue_detail.html | 2 +- public/assets/wechat/jour_message_detail.html | 2 +- public/assets/wechat/project_discussion.html | 2 +- .../wechat/directives/iphone_recognize.js | 17 +++++++++++++++++ 9 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 public/javascripts/wechat/directives/iphone_recognize.js diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html index d49caedd5..5ab1dcb5a 100644 --- a/public/assets/wechat/app.html +++ b/public/assets/wechat/app.html @@ -39,6 +39,7 @@ + diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index c1e2fd2fd..daeec493d 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -69,7 +69,7 @@ -
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 3d7444c95..78a3fa0b7 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -66,7 +66,7 @@
-
+
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 95eeda60b..f991656b4 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -46,7 +46,7 @@
-
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 77aa0a48d..6ead09e69 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -70,7 +70,7 @@
-
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 14df1cfb1..b4d39d04e 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -52,7 +52,7 @@
-
+
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index b94bca8b2..41f7290e5 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -65,7 +65,7 @@
-
+
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index fef0a2f6e..4557ba55f 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -65,7 +65,7 @@
更多
-
+
diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js new file mode 100644 index 000000000..0d435e1a2 --- /dev/null +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -0,0 +1,17 @@ +/** + * Created by ttang on 2016/8/22. + */ +app.directive('iphoneRecognize',function(){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + var userAgent = navigator.userAgent; + if (/ipad|iphone|mac/i.test(navigator.userAgent)){ + element.css({"position":"relative","padding":"1px 0"}); + $(".post-wrapper").css("margin-bottom","0"); + $("#all_homework_reply").css("margin-bottom","0"); + } + } + } +}); \ No newline at end of file From bbc0277d39aeb9484b3c57e1d2000faf66353057 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 10:23:55 +0800 Subject: [PATCH 02/23] =?UTF-8?q?iphone=E7=AB=AF=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86js=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/directives/iphone_recognize.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index 0d435e1a2..fabba0e51 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -8,9 +8,16 @@ app.directive('iphoneRecognize',function(){ link: function(scope, element){ var userAgent = navigator.userAgent; if (/ipad|iphone|mac/i.test(navigator.userAgent)){ - element.css({"position":"relative","padding":"1px 0"}); - $(".post-wrapper").css("margin-bottom","0"); - $("#all_homework_reply").css("margin-bottom","0"); + $("#postInput1").bind('focus',function(){ + element.css({"position":"relative","padding":"1px 0"}); + $(".post-wrapper").css("margin-bottom","0"); + $("#all_homework_reply").css("margin-bottom","0"); + }); + $("#postInput1").bind('blur',function(){ + element.css("position","fixed"); + $(".post-wrapper").css("margin-bottom","10px"); + $("#all_homework_reply").css("margin-bottom","50px"); + }); } } } From 34acb1aa2f2509fc5597863c3c1cda198b523141 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 11:05:49 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E5=B8=83=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class.html | 10 ++++++---- public/assets/wechat/project.html | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index a1eb45a52..764bff0a5 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -17,7 +17,7 @@ -
+
@@ -143,9 +143,13 @@
-
+
更多
+
@@ -198,7 +202,5 @@ 请登录Trustie网站,在PC浏览器中上传测验。

- -
diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 733f0899d..5da7a68c7 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -5,7 +5,7 @@ {{menu}}
-
+
@@ -95,9 +95,12 @@
-
+
更多
+
From 7d671c77583c2135c14e0fb39b7f70e5110dc2a9 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 15:04:48 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86padding=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 7375fc80c..52125b768 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -220,7 +220,7 @@ a.underline {text-decoration:underline;} .amount-arrow {height:14px; line-height:14px; vertical-align:middle; margin-top:12px;} .new-class-btn {font-size:15px; color:#fff; background-color:#3b94d6; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;} .join-class-btn {font-size:15px; color:#444; background-color:#ccc; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;} -.new-class-input {width:60%; color:#555; height:16px; line-height:16px; border:none; outline:none; padding:11px 0;} +.new-class-input {width:60%; color:#555; height:16px; line-height:16px; border:none; outline:none; padding:10px 0;} .class-list-setting {position:absolute; top:11px; right:10px;} .class-setting-wrap {width:38px; height:38px; position:absolute; top:0; right:0;} From c8c5f5d415b25d87ab17a7d6a291e03de9f563b2 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 23 Aug 2016 16:36:59 +0800 Subject: [PATCH 05/23] =?UTF-8?q?iphone=E4=B8=8Bflex=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 52125b768..25293a027 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -92,14 +92,14 @@ a.underline {text-decoration:underline;} /*tab*/ .tab-wrap {position:relative; width:100%; line-height:38px; display:-webkit-box; display:-moz-box; display:-ms-flexbox; display:-webkit-flex; display:flex; font-size:13px; background-color:#fff;} -.tab-wrap a {position:relative; display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; flex:1;} +.tab-wrap a {position:relative; display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; -webkit-flex:1; flex:1;} .tab-wrap a:first-child:after {display:none;} .tab-wrap a:after {content:" "; position:absolute; left:0; top:0; width:1px; height:100%; border-left:1px solid #ccc; color:#707070;} .weixin-tab {text-align:center; border-bottom:1px solid #ccc;} /*bottom-tab*/ .bottom-tab-wrap {position:fixed; width:100%; bottom:0; line-height:38px; display:-webkit-box; display:-moz-box; display:-ms-flexbox; display:-webkit-flex; display:flex; font-size:13px; background-color:#fff;} -.bottom-tab-wrap a {display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; flex:1; position:relative;} +.bottom-tab-wrap a {display:block; -webkit-box-flex:1; -moz-box-flex:1; -ms-flex:1; -webkit-flex:1; flex:1; position:relative;} .bottom-tab-wrap a:after {content:" "; position:absolute; left:0; top:0; width:1px; height:100%; border-left:1px solid #ccc; color:#707070;} /*动态样式*/ From c612104fabf9fcd4c620e015aee55fb2ac468dee Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 16:52:35 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=91=E5=B8=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 79 +++++++++++++++ app/api/mobile/apis/projects.rb | 39 ++++++++ public/assets/wechat/class.html | 4 +- public/assets/wechat/class_publishissue.html | 14 +++ public/assets/wechat/class_publishnotice.html | 14 +++ public/assets/wechat/project.html | 2 +- public/assets/wechat/project_publishnote.html | 14 +++ .../javascripts/wechat/controllers/class.js | 96 ++++++++++++++----- .../wechat/controllers/class_list.js | 5 + .../wechat/controllers/class_publishissue.js | 73 ++++++++++++++ .../wechat/controllers/class_publishnotice.js | 72 ++++++++++++++ .../javascripts/wechat/controllers/project.js | 15 +++ .../wechat/controllers/project_publishnote.js | 74 ++++++++++++++ public/javascripts/wechat/others/routes.js | 3 + 14 files changed, 475 insertions(+), 29 deletions(-) create mode 100644 public/assets/wechat/class_publishissue.html create mode 100644 public/assets/wechat/class_publishnotice.html create mode 100644 public/assets/wechat/project_publishnote.html create mode 100644 public/javascripts/wechat/controllers/class_publishissue.js create mode 100644 public/javascripts/wechat/controllers/class_publishnotice.js create mode 100644 public/javascripts/wechat/controllers/project_publishnote.js diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b28d3eca0..bfd559402 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -582,6 +582,85 @@ module Mobile end end + desc "发布班级通知" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + requires :title, type: String + end + post ':id/publishnotice' do + authenticate! + + #老师或教辅才能发通知 + c = Course.find("#{params[:id]}") + + my_member = c.member_principals.where("users.id=#{current_user.id}").first + + roles_ids = [] + my_member.roles.each do |role| + roles_ids << role.id + end + if my_member && (roles_ids.include?(7)|| roles_ids.include?(9) || roles_ids.include?(3)) + + tmpparams = {} + tmpparams['title'] = params[:title] + tmpparams['description'] = params[:text] + tmpparams['sticky'] = 0 + + news = News.new(:course => c, :author => current_user) + #render :layout => 'base_courses' + news.safe_attributes = tmpparams + + news.save! + + present :status, 0 + else + present :status, -1 + present :message,"学生不能发布通知" + end + end + + desc "发布班级问题" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + end + post ':id/publishissue' do + authenticate! + + c = Course.find("#{params[:id]}") + + boards = c.boards.includes(:last_message => :author).all + if c.boards.empty? + board = c.boards.build + board.name = "班级问答区" + board.description = c.name.to_s + board.project_id = -1 + if board.save + boards = c.boards.includes(:last_message => :author).all + end + end + + board = boards.first + + message = Message.new + message.author = current_user + message.board = board + + tmpparams = {} + tmpparams['subject'] = params[:title] + tmpparams['content'] = params[:text] + + message.safe_attributes = tmpparams + + message.save! + + present :status, 0 + + end + end end end diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index 05d4036f9..2202fbd13 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -229,6 +229,45 @@ module Mobile present :message, result[:message] end + desc "发布项目帖子" + params do + requires :id, type: Integer + requires :token, type: String + requires :text, type: String + end + post ':id/publishnote' do + authenticate! + + project = Project.find("#{params[:id]}") + + boards = project.boards.includes(:last_message => :author).all + if project.boards.empty? + board = project.boards.build + board.name = "项目讨论区" + board.description = project.name.to_s + board.course_id = -1 + if board.save + boards = project.boards.includes(:last_message => :author).all + end + end + + board = boards.first + + message = Message.new + message.author = current_user + message.board = board + + tmpparams = {} + tmpparams['subject'] = params[:title] + tmpparams['content'] = params[:text] + + message.safe_attributes = tmpparams + + message.save! + + present :status, 0 + + end end end end diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 764bff0a5..d60aed1bd 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -147,8 +147,8 @@
更多
diff --git a/public/assets/wechat/class_publishissue.html b/public/assets/wechat/class_publishissue.html new file mode 100644 index 000000000..1d840239c --- /dev/null +++ b/public/assets/wechat/class_publishissue.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_course.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/assets/wechat/class_publishnotice.html b/public/assets/wechat/class_publishnotice.html new file mode 100644 index 000000000..25c485737 --- /dev/null +++ b/public/assets/wechat/class_publishnotice.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_course.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index 5da7a68c7..5b460ecad 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -99,7 +99,7 @@
更多
diff --git a/public/assets/wechat/project_publishnote.html b/public/assets/wechat/project_publishnote.html new file mode 100644 index 000000000..5da49397c --- /dev/null +++ b/public/assets/wechat/project_publishnote.html @@ -0,0 +1,14 @@ +
+
+ +
{{current_project.name}}
+
标题
+
+
+ 取消 + 确定 +
+ + + +
\ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index a0c575d92..91641ddcd 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -1,4 +1,4 @@ -app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common){ +app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){ // common.checkLogin(); var vm = $scope; @@ -103,7 +103,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.isTeacher = false; - vm.currentTab = 1; +// vm.currentTab = 1; + + vm.currentTab = rms.get('tab_num'); + vm.tab = function(index){ vm.currentTab = index; vm.searchText = ''; @@ -119,7 +122,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ - getClassActivities(0); + if(vm.course_activities.length <= 0){ + getClassActivities(0); + } vm.showActivities = true; } else if(index == 2){ //课件 @@ -137,7 +142,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ - getClassActivities(0); + if(vm.course_activities.length <= 0){ + getClassActivities(0); + } vm.showActivities = true; } else if(index == 3){ @@ -149,10 +156,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.showResources = true; } } - rms.save("tab_num",index); + rms.save("tab_num",vm.currentTab); }; - vm.tabRecord = rms.get('tab_num') || 1; +// vm.tabRecord = rms.get('tab_num') || 1; // vm.course = {}; vm.students = []; @@ -182,48 +189,61 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/send_class_list").search({id: r.id}); }; - $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( - function(response) { - console.log(response.data); + if(!vm.currentTab){ + $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( + function(response) { + console.log(response.data); - if (response.data.status == 0){ - vm.course = response.data.data; - resetMenu(vm.course.current_user_is_teacher,vm.tabRecord); - if(tag){ - vm.tab(4); - tag = null; + if (response.data.status == 0){ + vm.course = response.data.data; + resetMenu(vm.course.current_user_is_teacher,vm.currentTab); + if(tag){ + vm.tab(4); + tag = null; + vm.currentTab = 4; + } + else{ + vm.currentTab = 1; + vm.tab(vm.currentTab); + } } else{ - vm.tab(vm.tabRecord); + vm.alertService.showMessage('提示', response.data.message); } - } - else{ - vm.alertService.showMessage('提示', response.data.message); - } - - } - ); + } + ); + }else { + $timeout(function(){ + window.scrollTo(0, rms.get("yoffset")); + }); + } - var resetMenu = function(is_teacher){ + var resetMenu = function(is_teacher,index){ vm.isTeacher = is_teacher; if(is_teacher){ vm.menus = ["动态", "课件", "作业", "成员管理"]; } else { vm.menus = ['动态','课件', "我的同学"]; } - + vm.tab(index); }; + if(vm.course){ + resetMenu(vm.course.current_user_is_teacher,vm.currentTab); + } + + vm.onSetting = function(user){ rms.save('current_edit_member', user); + rms.save("tab_num",vm.currentTab); $location.path("/edit_class_member").search({id: courseid,user_id: user.id}); }; vm.review = function(user){ rms.save('current_review_member', user); rms.save('current_course', vm.course); - + rms.save("tab_num",vm.currentTab); $location.path("/review_class_member").search({id: courseid,user_id: user.id}); }; @@ -233,6 +253,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location rms.save('course_activities_page',vm.course_activities_page); rms.save("course_activities",vm.course_activities); rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); rms.save("course",vm.course); // $location.path('/'+type+'/'+act_id); $location.path("/"+type).search({id: act_id}); @@ -262,4 +283,27 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location common.decreaseCommonPraise(act); }; + vm.goPublishNotice = function(){ + if(!vm.isTeacher){ + return; + } + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); + rms.save('current_course', vm.course); + $location.path("/class_publishnotice").search({id:courseid}); + }; + + vm.goPublishIssue = function(){ + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); + rms.save('current_course', vm.course); + $location.path("/class_publishissue").search({id:courseid}); + }; + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class_list.js b/public/javascripts/wechat/controllers/class_list.js index cc5250970..5d3ca5b93 100644 --- a/public/javascripts/wechat/controllers/class_list.js +++ b/public/javascripts/wechat/controllers/class_list.js @@ -49,6 +49,11 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo } vm.goClass = function (course_id) { + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + rms.save("course",null); + rms.save("tab_num",null); console.log(course_id); $location.path("/class").search({id: course_id}); } diff --git a/public/javascripts/wechat/controllers/class_publishissue.js b/public/javascripts/wechat/controllers/class_publishissue.js new file mode 100644 index 000000000..1cd7f1285 --- /dev/null +++ b/public/javascripts/wechat/controllers/class_publishissue.js @@ -0,0 +1,73 @@ +app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_course = rms.get('current_course'); + + vm.issuetitle = ""; + vm.issue = ""; + var course_id = $routeParams.id; + + vm.alertService = alertService.create(); + + if(!vm.current_course){ + $http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_course = response.data.data; + console.log("courses"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + if(!vm.current_course){ + vm.tip_1 = "该班级不存在或已被删除"; + } + + } + ); + } + + vm.cancel = function(){ + window.history.back(); + }; + + //发布问题 即项目讨论区 + vm.publishIssue = function(){ + if(vm.issuetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.issue.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.issue.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "courses/"+course_id+"/publishissue", + {token: auth.token(),title: vm.issuetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布问题',function(){ + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + $location.path("/class").search({id: course_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class_publishnotice.js b/public/javascripts/wechat/controllers/class_publishnotice.js new file mode 100644 index 000000000..a0b9ab676 --- /dev/null +++ b/public/javascripts/wechat/controllers/class_publishnotice.js @@ -0,0 +1,72 @@ +app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_course = rms.get('current_course'); + + var course_id = $routeParams.id; + + vm.alertService = alertService.create(); + + vm.noticetitle = ""; + vm.notice = ""; + + if(!vm.current_course){ + $http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_course = response.data.data; + console.log("courses"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + if(!vm.current_course){ + vm.tip_1 = "该班级不存在或已被删除"; + } + + } + ); + } + vm.cancel = function(){ + window.history.back(); + }; + + //发布通知 只有老师能发布 + vm.publishNotice = function(){ + if(vm.noticetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.notice.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.notice.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "courses/"+course_id+"/publishnotice", + {token: auth.token(),title: vm.noticetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布通知',function(){ + rms.save('course_activities_page',0); + rms.save("course_activities",[]); + rms.save("course_has_more",false); + $location.path("/class").search({id: course_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 826a16424..c45696668 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -238,4 +238,19 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut $location.path("/review_project_member").search({id: projectid,user_id: user.id}); } + vm.goPublishNote = function(){ + rms.save('project_activities_page',vm.project_activities_page); + rms.save("project_activities",vm.project_activities); + rms.save("project_has_more",vm.project_has_more); + + rms.save("project",vm.project); + rms.save("project_master_members",vm.project_master_members); + rms.save("project_develop_members",vm.project_develop_members); + rms.save("project_report_members",vm.project_report_members); + rms.save("review_master_members",vm.review_master_members); + rms.save("review_develop_members",vm.review_develop_members); + rms.save('current_project', vm.project); + $location.path("/project_publishnote").search({id:projectid}); + }; + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project_publishnote.js b/public/javascripts/wechat/controllers/project_publishnote.js new file mode 100644 index 000000000..231faaea6 --- /dev/null +++ b/public/javascripts/wechat/controllers/project_publishnote.js @@ -0,0 +1,74 @@ +app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){ +// common.checkLogin(); + + var vm = $scope; + vm.current_project = rms.get('current_project'); + + var project_id = $routeParams.id; + + vm.alertService = alertService.create(); + + vm.notetitle = ""; + vm.note = ""; + + if(!vm.current_project){ + $http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then( + function(response) { + console.log(response.data); + if (response.data.status == 0){ + vm.current_project = response.data.data; + console.log("projects"); + console.log(response.data.data); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + + if(!vm.current_project){ + vm.tip_1 = "该项目不存在或已被删除"; + } + + } + ); + } + vm.cancel = function(){ + window.history.back(); + }; + + //发布通知 只有老师能发布 + vm.publishNote = function(){ + if(vm.notetitle.length == 0) + { + vm.alertService.showMessage('提示', '标题不能为空'); + return; + } + + if(vm.note.length == 0) + { + vm.alertService.showMessage('提示', '内容不能为空'); + return; + } + + var text = vm.note.replace(/\n/g,'
'); + + $http.post(config.apiUrl + "projects/"+project_id+"/publishnote", + {token: auth.token(),title: vm.notetitle, text: text} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService.showMessage('提示', '您已成功发布帖子',function(){ + rms.save('project_activities_page',0); + rms.save("project_activities",[]); + rms.save("project_has_more",false); + rms.save('tab_num',null); + $location.path("/project").search({id: project_id}); + }); + } + else{ + vm.alertService.showMessage('提示', response.data.message); + } + }); + + }; + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 7311c66c1..2182e16ee 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -40,6 +40,8 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .when('/join_class', makeRoute('join_class.html', 'JoinClassController')) .when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController')) + .when('/class_publishnotice', makeRoute('class_publishnotice.html', 'ClassPublishNoticeController')) + .when('/class_publishissue', makeRoute('class_publishissue.html', 'ClassPublishIssueController')) .when('/project_list', makeRoute('project_list.html', 'ProjectListController')) .when('/project', makeRoute('project.html', 'ProjectController')) .when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController')) @@ -47,6 +49,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/project_invite_code', {templateUrl: rootPath + 'project_invite_code.html', controller: 'ProjectInviteCodeController'}) .when('/join_project', makeRoute('join_project.html', 'JoinProjectController')) .when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController')) + .when('/project_publishnote', makeRoute('project_publishnote.html', 'ProjectPublishNoteController')) .when('/login_tip', makeRoute('login_tip.html', 'LoginTipController')) .otherwise({ redirectTo: '/activites' From c5cedbfcc26d1a8beb88517216904010bf69ef0a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 17:37:23 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=AE=A1=E6=A0=B8=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 8 ++++++-- app/services/wechat_service.rb | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index cfa5f4414..b21d82e87 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -435,8 +435,12 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - if params[:userid] - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return + if params[:state].match("review_class_member") || params[:state].match("review_project_member") + useridstr = params[:state].split('/')[1] + end + + if useridstr + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return elsif params[:id] redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return else diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 3b6cfe930..c28c5f7b2 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -115,8 +115,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -149,8 +149,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -188,8 +188,8 @@ class WechatService # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}" tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 - tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - # tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 + # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From 3af5bc581321575e4e78a53062eae363bc6c5904 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 17:42:48 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/wechat_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index c28c5f7b2..a9a62bc66 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -116,7 +116,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -150,7 +150,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -189,7 +189,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From e0ab93b739936740f0fb1129a1d051c784b97e97 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:30:28 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b21d82e87..b06a72137 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -436,6 +436,7 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] if params[:state].match("review_class_member") || params[:state].match("review_project_member") + @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] end From 2e1e9391b6600772951a4f4088d64ea082bbb4cd Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:39:41 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/wechat_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index a9a62bc66..c28c5f7b2 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -116,7 +116,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { touser:openid, @@ -150,7 +150,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { @@ -189,7 +189,7 @@ class WechatService tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3 if uid && uid != 0 # tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s - tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/userid="+uid.to_s+Wechat.config.auto_openid_url_3 + tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+"/user_id="+uid.to_s+Wechat.config.auto_openid_url_3 end data = { From 0eb1c1a392e4283941a7025b41ac18cd0793918d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 09:45:18 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b06a72137..54486221e 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -435,11 +435,10 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - if params[:state].match("review_class_member") || params[:state].match("review_project_member") + # if params[:state].match("review_class_member") || params[:state].match("review_project_member") @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] - end - + # end if useridstr redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return elsif params[:id] From f8dfe85156ffd19ea38a6cc6834e8342408819d6 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:03:38 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 21 ++++++++++++++++ app/services/projects_service.rb | 24 +++++++++++++++++++ app/services/wechat_service.rb | 13 +++++++++- config/wechat.yml.template | 1 + config/wechat.yml.test | 1 + public/assets/wechat/class.html | 2 +- public/assets/wechat/send_class_list.html | 2 +- .../javascripts/wechat/controllers/class.js | 13 +++++++++- .../wechat/controllers/send_class_list.js | 1 + 9 files changed, 74 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 63ef30b35..b0c83e869 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -189,6 +189,15 @@ class IssuesController < ApplicationController # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号 @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save + + senduser = User.find(params[:issue][:assigned_to_id]) + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| format.html { @@ -581,6 +590,18 @@ class IssuesController < ApplicationController end end @issue.safe_attributes = issue_attributes + + senduser = User.find(params[:issue][:assigned_to_id]) + + if senduser.id != User.current.id + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end + @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) true diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 56dfaceff..8de96fff4 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,4 +331,28 @@ class ProjectsService {:status => status,:message => message} end + def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + if count == 0 + title = "您有新的issue需要解决" + remark = "点击详情查看issue" + + case priority_id + when 1 + priority = "低" + when + priority = "正常" + when + priority = "高" + when + priority = "紧急" + when + priority = "立刻" + end + + ws = WechatService.new + ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + end + end + end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index c28c5f7b2..e1b849c13 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -417,8 +417,19 @@ class WechatService end Rails.logger.info "send over. #{req}" end + end - + def project_issue_notice(user_id, type, id, first, key1, key2,remark="") + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[project_issue_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end end end \ No newline at end of file diff --git a/config/wechat.yml.template b/config/wechat.yml.template index e6b942f09..adda8e7e8 100644 --- a/config/wechat.yml.template +++ b/config/wechat.yml.template @@ -24,6 +24,7 @@ default: &default create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs" project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E" join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg" + project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/config/wechat.yml.test b/config/wechat.yml.test index c0676cc26..8c0dafc2f 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,6 +24,7 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" + project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index d60aed1bd..8ab2a7d03 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -190,7 +190,7 @@
-
{{r.homework_name}}发送
+
{{r.homework_name}}发送

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

diff --git a/public/assets/wechat/send_class_list.html b/public/assets/wechat/send_class_list.html index b6d250d5d..1fe699a20 100644 --- a/public/assets/wechat/send_class_list.html +++ b/public/assets/wechat/send_class_list.html @@ -8,7 +8,7 @@
{{syllabus.title}}
    -
  • +
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 91641ddcd..95d108151 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -186,7 +186,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.sendFile = function(r,index){ vm.myresource_sendIndex = index; rms.save('myresource_sendIndex',index); - $location.path("/send_class_list").search({id: r.id}); + $location.path("/send_class_list").search({id: r.id,course_id: courseid}); }; if(!vm.currentTab){ @@ -306,4 +306,15 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/class_publishissue").search({id:courseid}); }; + vm.goHomeworkDetail = function(id){ + rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save('course_has_more', vm.course_has_more); + rms.save("tab_num",vm.currentTab); + rms.save("course",vm.course); +// $location.path('/'+type+'/'+act_id); + $location.path("/homework").search({id: id}); + } + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/send_class_list.js b/public/javascripts/wechat/controllers/send_class_list.js index ead0860f5..815d0d4b3 100644 --- a/public/javascripts/wechat/controllers/send_class_list.js +++ b/public/javascripts/wechat/controllers/send_class_list.js @@ -3,6 +3,7 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co var vm = $scope; var send_id = $routeParams.id; + vm.course_id = $routeParams.course_id; //发送类别 1课件 2作业 3测验 vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1; From bd3911c072fb457fcd74f42212ebc812a4254f7a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:22:34 +0800 Subject: [PATCH 13/23] . --- app/controllers/issues_controller.rb | 34 ++++++++++---------- app/services/projects_service.rb | 46 ++++++++++++++-------------- app/services/wechat_service.rb | 24 +++++++-------- config/wechat.yml.test | 1 - 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b0c83e869..1e79f64bf 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -190,13 +190,13 @@ class IssuesController < ApplicationController @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save - senduser = User.find(params[:issue][:assigned_to_id]) - issue_id = @issue.id - issue_title = params[:issue][:subject] - priority_id = params[:issue][:priority_id] - - ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + # senduser = User.find(params[:issue][:assigned_to_id]) + # issue_id = @issue.id + # issue_title = params[:issue][:subject] + # priority_id = params[:issue][:priority_id] + # + # ps = ProjectsService.new + # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| @@ -591,16 +591,16 @@ class IssuesController < ApplicationController end @issue.safe_attributes = issue_attributes - senduser = User.find(params[:issue][:assigned_to_id]) - - if senduser.id != User.current.id - issue_id = @issue.id - issue_title = params[:issue][:subject] - priority_id = params[:issue][:priority_id] - - ps = ProjectsService.new - ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - end + # senduser = User.find(params[:issue][:assigned_to_id]) + # + # if senduser.id != User.current.id + # issue_id = @issue.id + # issue_title = params[:issue][:subject] + # priority_id = params[:issue][:priority_id] + # + # ps = ProjectsService.new + # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + # end @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 8de96fff4..5f8d5323a 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,28 +331,28 @@ class ProjectsService {:status => status,:message => message} end - def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id - count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count - if count == 0 - title = "您有新的issue需要解决" - remark = "点击详情查看issue" - - case priority_id - when 1 - priority = "低" - when - priority = "正常" - when - priority = "高" - when - priority = "紧急" - when - priority = "立刻" - end - - ws = WechatService.new - ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark - end - end + # def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + # count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + # if count == 0 + # title = "您有新的issue需要解决" + # remark = "点击详情查看issue" + # + # case priority_id + # when 1 + # priority = "低" + # when + # priority = "正常" + # when + # priority = "高" + # when + # priority = "紧急" + # when + # priority = "立刻" + # end + # + # ws = WechatService.new + # ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + # end + # end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index e1b849c13..429c95f60 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -419,17 +419,17 @@ class WechatService end end - def project_issue_notice(user_id, type, id, first, key1, key2,remark="") - uw = UserWechat.where(user_id: user_id).first - unless uw.nil? - data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark - begin - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) - rescue Exception => e - Rails.logger.error "[project_issue_notice] ===> #{e}" - end - Rails.logger.info "send over. #{req}" - end - end + # def project_issue_notice(user_id, type, id, first, key1, key2,remark="") + # uw = UserWechat.where(user_id: user_id).first + # unless uw.nil? + # data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark + # begin + # req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + # rescue Exception => e + # Rails.logger.error "[project_issue_notice] ===> #{e}" + # end + # Rails.logger.info "send over. #{req}" + # end + # end end \ No newline at end of file diff --git a/config/wechat.yml.test b/config/wechat.yml.test index 8c0dafc2f..c0676cc26 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,7 +24,6 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" - project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" From e0957113d811d9b1be025bc5691a6db2975d7faf Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 24 Aug 2016 11:28:50 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 34 ++++++++++---------- app/services/projects_service.rb | 46 ++++++++++++++-------------- app/services/wechat_service.rb | 24 +++++++-------- config/wechat.yml.test | 1 + 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 1e79f64bf..b0c83e869 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -190,13 +190,13 @@ class IssuesController < ApplicationController @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save - # senduser = User.find(params[:issue][:assigned_to_id]) - # issue_id = @issue.id - # issue_title = params[:issue][:subject] - # priority_id = params[:issue][:priority_id] - # - # ps = ProjectsService.new - # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + senduser = User.find(params[:issue][:assigned_to_id]) + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| @@ -591,16 +591,16 @@ class IssuesController < ApplicationController end @issue.safe_attributes = issue_attributes - # senduser = User.find(params[:issue][:assigned_to_id]) - # - # if senduser.id != User.current.id - # issue_id = @issue.id - # issue_title = params[:issue][:subject] - # priority_id = params[:issue][:priority_id] - # - # ps = ProjectsService.new - # ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id - # end + senduser = User.find(params[:issue][:assigned_to_id]) + + if senduser.id != User.current.id + issue_id = @issue.id + issue_title = params[:issue][:subject] + priority_id = params[:issue][:priority_id] + + ps = ProjectsService.new + ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id + end @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 5f8d5323a..8de96fff4 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -331,28 +331,28 @@ class ProjectsService {:status => status,:message => message} end - # def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id - # count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count - # if count == 0 - # title = "您有新的issue需要解决" - # remark = "点击详情查看issue" - # - # case priority_id - # when 1 - # priority = "低" - # when - # priority = "正常" - # when - # priority = "高" - # when - # priority = "紧急" - # when - # priority = "立刻" - # end - # - # ws = WechatService.new - # ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark - # end - # end + def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + if count == 0 + title = "您有新的issue需要解决" + remark = "点击详情查看issue" + + case priority_id + when 1 + priority = "低" + when + priority = "正常" + when + priority = "高" + when + priority = "紧急" + when + priority = "立刻" + end + + ws = WechatService.new + ws.project_issue_notice user.id, "issues", issue_id,title, issue_title,priority, remark + end + end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 429c95f60..423676983 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -419,17 +419,17 @@ class WechatService end end - # def project_issue_notice(user_id, type, id, first, key1, key2,remark="") - # uw = UserWechat.where(user_id: user_id).first - # unless uw.nil? - # data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark - # begin - # req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) - # rescue Exception => e - # Rails.logger.error "[project_issue_notice] ===> #{e}" - # end - # Rails.logger.info "send over. #{req}" - # end - # end + def project_issue_notice(user_id, type, id, first, key1, key2,remark="",uid=0) + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = two_keys_template uw.openid,Wechat.config.project_issue_notice, type, id, first, key1, key2,remark,0 + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[project_issue_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + end end \ No newline at end of file diff --git a/config/wechat.yml.test b/config/wechat.yml.test index c0676cc26..8c0dafc2f 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -24,6 +24,7 @@ default: &default create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" + project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" From f35c3e85285e0eef2bbd751e358a33f445d2b058 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 09:45:23 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E3=80=81issue=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BA=A7=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 2 +- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/apis/issues.rb | 16 ++- app/api/mobile/apis/newss.rb | 15 ++- app/api/mobile/entities/activity.rb | 4 + app/api/mobile/entities/issue.rb | 120 +++++++++++++++++- app/api/mobile/entities/news.rb | 109 +++++++++++++++- app/services/projects_service.rb | 8 +- public/assets/wechat/activities.html | 72 +++++++++++ public/assets/wechat/class.html | 79 +++++++++++- public/assets/wechat/course_notice.html | 57 +++++++-- public/assets/wechat/issue_detail.html | 45 ++++++- public/assets/wechat/myresource.html | 2 +- .../wechat/templates/comment_reply.html | 4 +- .../javascripts/wechat/controllers/class.js | 8 +- .../wechat/controllers/course_notice.js | 33 ++++- .../javascripts/wechat/controllers/issue.js | 31 ++++- .../wechat/controllers/myresource.js | 5 + 18 files changed, 553 insertions(+), 59 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 4d07c23f8..69d9ef524 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -29,7 +29,7 @@ module Mobile if container_type == "All" || container_type == "Course" shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" end page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index bfd559402..d26779332 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -297,7 +297,7 @@ module Mobile user = current_user - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/issues.rb b/app/api/mobile/apis/issues.rb index dfd5a3335..271e3419d 100644 --- a/app/api/mobile/apis/issues.rb +++ b/app/api/mobile/apis/issues.rb @@ -17,11 +17,21 @@ module Mobile #0一级回复的更多 1 二级回复的更多 type = params[:type] || 0 page = params[:page] || 0 - issue = Issue.find params[:id] - present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page + + is_public = 1 + + if type == 0 + issue = Issue.find params[:id] + issue.project.is_public + present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page + else + jour = Journal.find params[:id] + present :data, jour, with: Mobile::Entities::Issue,user: user,type: type,page: page + end + present :type, type present :page, page - present :is_public, issue.project.is_public + present :is_public,is_public present :status, 0 rescue Exception=>e present :status, -1 diff --git a/app/api/mobile/apis/newss.rb b/app/api/mobile/apis/newss.rb index c2e2fcb5c..810e4ff2a 100644 --- a/app/api/mobile/apis/newss.rb +++ b/app/api/mobile/apis/newss.rb @@ -14,14 +14,19 @@ module Mobile #0一级回复的更多 1 二级回复的更多 type = params[:type] || 0 page = params[:page] || 0 - news = News.find params[:id] is_public = 1 - if news.project - is_public = news.project.is_public - elsif news.course - is_public = news.course.is_public + if type == 0 + news = News.find params[:id] + + if news.project + is_public = news.project.is_public + elsif news.course + is_public = news.course.is_public + end + else + news = Comment.find params[:id] end present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 2856354a1..95940c0c5 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -40,6 +40,8 @@ module Mobile ac.act.subject unless ac.nil? || ac.act.nil? elsif ac.act_type == "JournalsForMessage" ac.act.private == 0 ? "留言" : "私信" unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Poll" + ac.act.polls_name unless ac.nil? || ac.act.nil? end when :description if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News" @@ -48,6 +50,8 @@ module Mobile strip_html(ac.act.content) unless ac.nil? || ac.act.nil? elsif ac.act_type == "JournalsForMessage" strip_html(ac.act.notes) unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Poll" + ac.act.polls_description unless ac.nil? || ac.act.nil? end when :latest_update time_from_now ac.updated_at unless ac.nil? diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index 9cbeb3459..e3dbb5023 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -36,15 +36,42 @@ module Mobile issue.id when :title issue.subject + when :subject + issue.subject + when :description + issue.description + when :done_ratio + issue.done_ratio end end + elsif issue.is_a?(::Journal) + case f + when :content + issue[:notes] + when :lasted_comment + time_from_now issue.created_on + when :act_id + issue.id + end end end end - expose :subject - expose :description - expose :author, using: Mobile::Entities::User - expose :done_ratio + issue_expose :subject + issue_expose :description + expose :author, using: Mobile::Entities::User do |f, opt| + if f.is_a?(::Issue) + f.send(:author) + end + end + expose :user,using: Mobile::Entities::User do |f, opt| + if f.is_a?(::Journal) + f.send(:user) + end + end + issue_expose :content + issue_expose :lasted_comment + + issue_expose :done_ratio issue_expose :title issue_expose :act_type issue_expose :act_id @@ -55,11 +82,29 @@ module Mobile issue_expose :comment_count issue_expose :project_name issue_expose :praise_count - expose :issue_journals, using: Mobile::Entities::Journal do |f, opt| + + expose :id + # expose :issue_journals, using: Mobile::Entities::Journal do |f, opt| + # if f.is_a?(::Issue) + # f.journals.where("notes is not null and notes != ''").reverse + # end + # end + + expose :all_children, using: Mobile::Entities::Issue do |f, opt| + #f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages) if f.is_a?(::Issue) - f.journals.where("notes is not null and notes != ''").reverse + # f.journals_for_messages.reverse + if !opt[:children] && opt[:type] == 0 + opt[:children] = true + tStart = opt[:page]*5 + tEnd = (opt[:page]+1)*5 - 1 + + all_comments = f.journals.where("notes is not null and notes != ''").reorder("created_on desc") + all_comments[tStart..tEnd] + end end end + expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| has_praise = false current_user = options[:user] @@ -67,6 +112,69 @@ module Mobile has_praise = obj.empty? ? false : true has_praise end + + expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options| + if instance.is_a?(::Journal) + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, instance) + parents_reply.count + end + end + + expose :parents_reply_bottom, using:Mobile::Entities::Issue do |f,opt| + if f.is_a? (::Journal) + #取二级回复的底楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 0 && !opt[:bottom] + if opt[:type] == 1 + # opt[:bottom] = true + # parents_reply[opt[:page]..opt[:page]] + else + opt[:bottom] = true + parents_reply[0..0] + end + else + [] + end + end + end + + expose :parents_reply_top, using:Mobile::Entities::Issue do |f,opt| + if f.is_a? (::Journal) + #取二级回复的顶楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 2 && !opt[:top] + if opt[:type] == 1 + opt[:top] = true + tStart = (opt[:page]-1)*5+2 + tEnd = (opt[:page])*5+2 - 1 + + if tEnd >= parents_reply.count - 1 + tEnd = parents_reply.count - 2 + end + + if tStart <= parents_reply.count - 2 + parents_reply = parents_reply.reverse[tStart..tEnd] + parents_reply.reverse + else + [] + end + else + opt[:top] = true + parents_reply = parents_reply.reverse[0..1] + parents_reply.reverse + end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse + else + [] + end + end + end end end end \ No newline at end of file diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index be9fa3ceb..a64081d8a 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -28,6 +28,16 @@ module Mobile f.comments.count end end + elsif f.is_a?(::Comment) + case field + when :content + f[:comments] + when :lasted_comment + time_from_now f.created_on + when :act_id + f.id + end + elsif f.is_a?(Hash) && !f.key?(field) n = f[:news] comments = f[:comments] @@ -43,14 +53,16 @@ module Mobile end end end - news_expose :id + expose :id #新闻标题 news_expose :title - expose :author,using: Mobile::Entities::User do |f, opt| + expose :user,using: Mobile::Entities::User do |f, opt| obj = nil if f.is_a?(::News) && f.respond_to?(:author) obj = f.send(:author) + elsif f.is_a?(::Comment) && f.respond_to?(:author) + obj = f.send(:author) elsif f.is_a?(Hash) && f.key?(:author) obj = f[:author] end @@ -73,14 +85,34 @@ module Mobile news_expose :praise_count #课程名字 news_expose :course_name + news_expose :lasted_comment + #评论 - expose :comments, using: Mobile::Entities::Comment do |f, opt| - if f.is_a?(Hash) && f.key?(:comments) - f[:comments] - elsif f.is_a?(::News) && f.respond_to?(:comments) - f.comments.reverse + # expose :comments, using: Mobile::Entities::Comment do |f, opt| + # if f.is_a?(Hash) && f.key?(:comments) + # f[:comments] + # elsif f.is_a?(::News) && f.respond_to?(:comments) + # f.comments.reverse + # end + # end + + news_expose :content + + expose :all_children, using: Mobile::Entities::News do |f, opt| + #f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages) + if f.is_a?(::News) + # f.journals_for_messages.reverse + if !opt[:children] && opt[:type] == 0 + opt[:children] = true + tStart = opt[:page]*5 + tEnd = (opt[:page]+1)*5 - 1 + + all_comments = f.comments.reorder("created_on desc") + all_comments[tStart..tEnd] + end end end + expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| has_praise = false current_user = options[:user] @@ -88,6 +120,69 @@ module Mobile has_praise = obj.empty? ? false : true has_praise end + + expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options| + if instance.is_a?(::Comment) + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, instance) + parents_reply.count + end + end + + expose :parents_reply_bottom, using:Mobile::Entities::News do |f,opt| + if f.is_a? (::Comment) + #取二级回复的底楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 0 && !opt[:bottom] + if opt[:type] == 1 + # opt[:bottom] = true + # parents_reply[opt[:page]..opt[:page]] + else + opt[:bottom] = true + parents_reply[0..0] + end + else + [] + end + end + end + + expose :parents_reply_top, using:Mobile::Entities::News do |f,opt| + if f.is_a? (::Comment) + #取二级回复的顶楼层 + parents_reply = [] + parents_reply = get_reply_parents(parents_reply, f) + if parents_reply.count > 2 && !opt[:top] + if opt[:type] == 1 + opt[:top] = true + tStart = (opt[:page]-1)*5+2 + tEnd = (opt[:page])*5+2 - 1 + + if tEnd >= parents_reply.count - 1 + tEnd = parents_reply.count - 2 + end + + if tStart <= parents_reply.count - 2 + parents_reply = parents_reply.reverse[tStart..tEnd] + parents_reply.reverse + else + [] + end + else + opt[:top] = true + parents_reply = parents_reply.reverse[0..1] + parents_reply.reverse + end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse + else + [] + end + end + end end end end \ No newline at end of file diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 8de96fff4..cfd6aeb2c 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -340,13 +340,13 @@ class ProjectsService case priority_id when 1 priority = "低" - when + when 2 priority = "正常" - when + when 3 priority = "高" - when + when 4 priority = "紧急" - when + when 5 priority = "立刻" end diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index a4aa9a4c7..548641748 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -127,6 +127,78 @@
+
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
+
+
+
+
+
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 8ab2a7d03..6c1c35860 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -41,7 +41,7 @@
- +
{{act.praise_count}}
@@ -76,7 +76,7 @@
- +
{{act.praise_count}}
@@ -112,7 +112,7 @@
- +
{{act.praise_count}}
@@ -128,6 +128,77 @@
+
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+ +
{{act.latest_update}}
+
+ +
+
+
+ +
+
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
+
+
+
+
@@ -144,7 +215,7 @@
-
更多
+
更多
发布通知 diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index f991656b4..af9f22da1 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -6,11 +6,11 @@
私有内容,请谨慎传播
-
+
@@ -30,20 +30,55 @@
-
-
-
+ + + + + + + + + + + + + + + + +
+
+
-
+
-
{{comments.created_on}}
+
{{journal.lasted_comment}}
-
+ +
+ + +
点击展开更多楼层
+
+ +
{{reply_bottom.lasted_comment}}
+
+
+
+
+
+ +
+
+
更多
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index b4d39d04e..c10d15ddb 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -36,20 +36,55 @@
-
-
-
+ + + + + + + + + + + + + + + + +
+
+
-
{{journal.created_on}}
+
{{journal.lasted_comment}}
-
+ +
+ + +
点击展开更多楼层
+
+ +
{{reply_bottom.lasted_comment}}
+
+
+
+
+
+ +
+
+
更多
+
diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index e58b1c80c..8bfa818de 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -23,7 +23,7 @@
-
{{r.homework_name}}发送
+
{{r.homework_name}}发送
diff --git a/public/assets/wechat/templates/comment_reply.html b/public/assets/wechat/templates/comment_reply.html index f5699abca..992acc56d 100644 --- a/public/assets/wechat/templates/comment_reply.html +++ b/public/assets/wechat/templates/comment_reply.html @@ -4,7 +4,7 @@
    {{journal.parents_reply_top[i].lasted_comment}}
    @@ -19,7 +19,7 @@
      {{journal.parents_reply_top[i].lasted_comment}}
      diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 95d108151..1605ac71b 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -11,7 +11,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.course = rms.get("course") || null; - var getClassActivities = function(page){ + vm.getClassActivities = function(page){ $http({ method: 'POST', url: apiUrl + "courses/activities?id=" + courseid, @@ -22,7 +22,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.class_activities_page = response.data.page; if(response.data.page > 0) { - vm.course_activities = vm.class_activities.concat(response.data.data); + vm.course_activities = vm.course_activities.concat(response.data.data); } else{ vm.course_activities = response.data.data; @@ -123,7 +123,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ if(vm.course_activities.length <= 0){ - getClassActivities(0); + vm.getClassActivities(0); } vm.showActivities = true; } @@ -143,7 +143,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ if(vm.course_activities.length <= 0){ - getClassActivities(0); + vm.getClassActivities(0); } vm.showActivities = true; } diff --git a/public/javascripts/wechat/controllers/course_notice.js b/public/javascripts/wechat/controllers/course_notice.js index 9f9ba83d6..48ec19889 100644 --- a/public/javascripts/wechat/controllers/course_notice.js +++ b/public/javascripts/wechat/controllers/course_notice.js @@ -8,8 +8,37 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au replyType: 'News', urlName: 'course_notice', loadCallback: function(data){ - $scope.news = data.data; - $scope.is_public = data.is_public; + console.log(data.data); + + //回复级别 0 一级回复 1 二级回复 + replytype = data.type; + page = data.page; + + if (replytype == 0){ + if (page == 0){ + $scope.news = data.data; + $scope.page = 0; + $scope.is_public = data.is_public; + } + else{ + $scope.news.all_children = $scope.news.all_children.concat(data.data.all_children); + } + $scope.has_more = $scope.news.all_children.length < $scope.news.comment_count; + console.log($scope.has_more); + } + else{ + comment_id = data.data.id; + for (var i in $scope.news.all_children) { + var comment = $scope.news.all_children[i]; + if(comment.id == comment_id){ +// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top); + comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top); + } + } + } + + + }, replyCallback: function(){ } diff --git a/public/javascripts/wechat/controllers/issue.js b/public/javascripts/wechat/controllers/issue.js index 131fab6f6..91db1d535 100644 --- a/public/javascripts/wechat/controllers/issue.js +++ b/public/javascripts/wechat/controllers/issue.js @@ -7,9 +7,34 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c replyType: 'Issue', urlName: 'issues', loadCallback: function(data){ - console.log(data); - $scope.issue = data.data; - $scope.is_public = data.is_public; + console.log(data.data); + + //回复级别 0 一级回复 1 二级回复 + replytype = data.type; + page = data.page; + + if (replytype == 0){ + if (page == 0){ + $scope.issue = data.data; + $scope.page = 0; + $scope.is_public = data.is_public; + } + else{ + $scope.issue.all_children = $scope.issue.all_children.concat(data.data.all_children); + } + $scope.has_more = $scope.issue.all_children.length < $scope.issue.comment_count; + console.log($scope.has_more); + } + else{ + comment_id = data.data.id; + for (var i in $scope.issue.all_children) { + var comment = $scope.issue.all_children[i]; + if(comment.id == comment_id){ +// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top); + comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top); + } + } + } }, replyCallback: function(){ } diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 089b63dfc..3c5e46a75 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -147,4 +147,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.tab(currentTab); + vm.goHomeworkDetail = function(id){ + rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); + $location.path("/homework").search({id: id}); + } + }] ); From 4932b9fad83201b001c73ae494b7a748a0987b35 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 10:55:22 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=95=99=E8=A8=80?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 2 +- app/api/mobile/apis/courses.rb | 2 +- config/menu.yml | 2 +- config/menu.yml.production | 2 +- config/menu.yml.test | 2 +- public/assets/wechat/activities.html | 70 ++++++++++++++-------------- public/assets/wechat/class.html | 70 ++++++++++++++-------------- 7 files changed, 75 insertions(+), 75 deletions(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 69d9ef524..4d07c23f8 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -29,7 +29,7 @@ module Mobile if container_type == "All" || container_type == "Course" shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" end page = params[:page] ? params[:page] : 0 diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index d26779332..bfd559402 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -297,7 +297,7 @@ module Mobile user = current_user - course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') page = params[:page] ? params[:page] : 0 diff --git a/config/menu.yml b/config/menu.yml index 52272e8a0..8cc920707 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/config/menu.yml.production b/config/menu.yml.production index c1431172e..55318e811 100644 --- a/config/menu.yml.production +++ b/config/menu.yml.production @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/config/menu.yml.test b/config/menu.yml.test index dc4aacbe5..45e23aaf3 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -8,7 +8,7 @@ button: sub_button: - type: "view" - name: "我的课程" + name: "我的班级" url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 548641748..506dcc724 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -163,41 +163,41 @@
      -
      -
      -
      -
      -
      -
      - -
      {{act.latest_update}}
      -
      - -
      -
      -
      - -
      -
      - -
      -
      -
      {{act.praise_count}}
      -
      {{act.praise_count}}
      -
      - -
      -
      -
      -
      -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 6c1c35860..349c3bd75 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -164,41 +164,41 @@
      -
      -
      -
      -
      -
      -
      - -
      {{act.latest_update}}
      -
      - -
      -
      -
      - -
      -
      - -
      -
      -
      {{act.praise_count}}
      -
      {{act.praise_count}}
      -
      - -
      -
      -
      -
      -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      From 6abdb47ec5f07e4db4bd14cd9f06e6d307aa8b6b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 11:25:51 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A0=87=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/projects_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index ca89e252a..fc7f25d1f 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -334,8 +334,8 @@ class ProjectsService def send_wechat_project_issue_notice user,project,issue_id,issue_title,priority_id count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count if count == 0 - title = "您有新的issue需要解决" - remark = "点击详情查看issue" + title = "您有新的issue需要解决。" + remark = "点击详情查看issue。" case priority_id when "1" From bb935e42a886f9ef0a34c57095b0e39a77ddf3a0 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 25 Aug 2016 13:39:02 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E5=8F=91=E5=B8=96=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=AD=97=E7=AC=A6=E9=99=90=E5=88=B6=EF=BC=9B?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=8C=89=E9=92=AE=E4=B8=8D=E9=81=AE=E4=BD=8F?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class_publishissue.html | 4 ++-- public/assets/wechat/class_publishnotice.html | 4 ++-- public/assets/wechat/project_publishnote.html | 4 ++-- public/stylesheets/weui/weixin.css | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/assets/wechat/class_publishissue.html b/public/assets/wechat/class_publishissue.html index 1d840239c..c6f20421f 100644 --- a/public/assets/wechat/class_publishissue.html +++ b/public/assets/wechat/class_publishissue.html @@ -2,8 +2,8 @@
      {{current_course.name}}
      -
      标题
      -
      +
      标题
      +
      取消 确定 diff --git a/public/assets/wechat/class_publishnotice.html b/public/assets/wechat/class_publishnotice.html index 25c485737..d27e378d3 100644 --- a/public/assets/wechat/class_publishnotice.html +++ b/public/assets/wechat/class_publishnotice.html @@ -2,8 +2,8 @@
      {{current_course.name}}
      -
      标题
      -
      +
      标题
      +
      取消 确定 diff --git a/public/assets/wechat/project_publishnote.html b/public/assets/wechat/project_publishnote.html index 5da49397c..bc792640e 100644 --- a/public/assets/wechat/project_publishnote.html +++ b/public/assets/wechat/project_publishnote.html @@ -2,8 +2,8 @@
      {{current_project.name}}
      -
      标题
      -
      +
      标题
      +
      取消 确定 diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 25293a027..3d960b4ad 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -257,4 +257,4 @@ a.underline {text-decoration:underline;} /*发布帖子,通知*/ .full-width-wrap {padding:5px 15px; background-color:#fff; border-top:1px solid #ddd; border-bottom:1px solid #ddd;} -.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555;} \ No newline at end of file +.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555; overflow-y:auto;} \ No newline at end of file From fd2021a1feeb3f7a22b5cdc1b4464b98d022435a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 14:05:21 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=8F=91=E9=80=81=E5=90=8E=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/controllers/class.js | 4 ++++ public/javascripts/wechat/controllers/myresource.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 1605ac71b..77520fe85 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -185,6 +185,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.sendFile = function(r,index){ vm.myresource_sendIndex = index; + rms.save('course_activities_page',vm.course_activities_page); + rms.save("course_activities",vm.course_activities); + rms.save("course_has_more",vm.course_has_more); + rms.save("course",vm.course); rms.save('myresource_sendIndex',index); $location.path("/send_class_list").search({id: r.id,course_id: courseid}); }; diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 84ae3a73f..822428d45 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -35,6 +35,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.sendFile = function(r,index){ vm.myresource_sendIndex = index; + + rms.save("has_more",vm.has_more); + rms.save("homework_has_more",vm.homework_has_more); rms.save('myresource_sendIndex',index); // $location.path("/send_class_list").search({id: r.id}); From bb2a1de98c839ed9f9103a21f97ac7f18b64119b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 14:26:31 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AEBUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/controllers/myresource.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 822428d45..d920b376a 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -152,6 +152,8 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.tab(currentTab); vm.goHomeworkDetail = function(id){ + rms.save("has_more",vm.has_more); + rms.save("homework_has_more",vm.homework_has_more); rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); $location.path("/homework").search({id: id}); } From 78123b5db79058afa9b785031694db835fe6b4df Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 25 Aug 2016 14:30:42 +0800 Subject: [PATCH 21/23] =?UTF-8?q?iphone=E8=AE=BE=E5=A4=87=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=88=B0=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/directives/iphone_recognize.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js index fabba0e51..66014e71a 100644 --- a/public/javascripts/wechat/directives/iphone_recognize.js +++ b/public/javascripts/wechat/directives/iphone_recognize.js @@ -1,24 +1,28 @@ /** * Created by ttang on 2016/8/22. */ -app.directive('iphoneRecognize',function(){ +app.directive('iphoneRecognize',["$timeout",function(timer){ return{ restrict: 'A', scope: {}, link: function(scope, element){ - var userAgent = navigator.userAgent; + timer(function(){ + var userAgent = navigator.userAgent; + var contentHeight = $(".post-container").height(); if (/ipad|iphone|mac/i.test(navigator.userAgent)){ - $("#postInput1").bind('focus',function(){ - element.css({"position":"relative","padding":"1px 0"}); - $(".post-wrapper").css("margin-bottom","0"); - $("#all_homework_reply").css("margin-bottom","0"); - }); - $("#postInput1").bind('blur',function(){ - element.css("position","fixed"); - $(".post-wrapper").css("margin-bottom","10px"); - $("#all_homework_reply").css("margin-bottom","50px"); - }); + $("#postInput1").bind('focus',function(){ + element.css({"position":"relative","padding":"1px 0"}); + $(".post-wrapper").css("margin-bottom","0"); + $("#all_homework_reply").css("margin-bottom","0"); + window.scrollTo(0,contentHeight); + }); + $("#postInput1").bind('blur',function(){ + element.css("position","fixed"); + $(".post-wrapper").css("margin-bottom","10px"); + $("#all_homework_reply").css("margin-bottom","50px"); + }); } + }) } } -}); \ No newline at end of file +}]); \ No newline at end of file From 5b73e7dc196d4e718d7d1604c6d525c8317574e7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 15:34:13 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E6=A0=87=E9=A2=98=E7=9A=84=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E5=8F=8A=E7=8F=AD=E7=BA=A7=E5=8A=A8=E6=80=81=E4=B8=AD=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class.html | 6 +++--- public/assets/wechat/class_publishissue.html | 2 +- public/assets/wechat/project_publishnote.html | 2 +- public/javascripts/wechat/controllers/activity.js | 2 +- public/javascripts/wechat/controllers/class.js | 4 ++++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 349c3bd75..423f2cf67 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -169,7 +169,7 @@ - + @@ -181,10 +181,10 @@ - + - + diff --git a/public/assets/wechat/class_publishissue.html b/public/assets/wechat/class_publishissue.html index c6f20421f..de7887d61 100644 --- a/public/assets/wechat/class_publishissue.html +++ b/public/assets/wechat/class_publishissue.html @@ -2,7 +2,7 @@
      {{current_course.name}}
      -
      标题
      +
      标题
      取消 diff --git a/public/assets/wechat/project_publishnote.html b/public/assets/wechat/project_publishnote.html index bc792640e..d5d794dab 100644 --- a/public/assets/wechat/project_publishnote.html +++ b/public/assets/wechat/project_publishnote.html @@ -2,7 +2,7 @@
      {{current_project.name}}
      -
      标题
      +
      标题
      取消 diff --git a/public/javascripts/wechat/controllers/activity.js b/public/javascripts/wechat/controllers/activity.js index e646da5b9..25ced0a17 100644 --- a/public/javascripts/wechat/controllers/activity.js +++ b/public/javascripts/wechat/controllers/activity.js @@ -10,7 +10,7 @@ app.controller('ActivityController', return url; }; - $scope.menus = ['所有动态', '课程动态', '项目动态']; + $scope.menus = ['所有动态', '班级动态', '项目动态']; $scope.alertService = alertService.create(); console.log("ActivityController load"); diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 77520fe85..a6fb0feed 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -1,6 +1,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){ // common.checkLogin(); + $scope.replaceUrl = function(url){ + return url; + }; + var vm = $scope; var courseid = $routeParams.id; var tag = $routeParams.tag; From ea238cd407904f86af75a00897286de090ee593a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 25 Aug 2016 15:45:39 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=97=AE=E9=A2=98=E6=94=B9=E4=B8=BA=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=E8=AE=A8=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class.html | 2 +- public/assets/wechat/class_publishissue.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 423f2cf67..9b69916c8 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -219,7 +219,7 @@
      diff --git a/public/assets/wechat/class_publishissue.html b/public/assets/wechat/class_publishissue.html index de7887d61..f4dd40552 100644 --- a/public/assets/wechat/class_publishissue.html +++ b/public/assets/wechat/class_publishissue.html @@ -2,8 +2,8 @@
      {{current_course.name}}
      -
      标题
      -
      +
      标题
      +