From a43da43072b4e8e2cfffe7fcd2b8d27af7b389fa Mon Sep 17 00:00:00 2001 From: txz Date: Thu, 14 Jul 2016 17:34:26 +0800 Subject: [PATCH 01/32] =?UTF-8?q?checked.png=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/wechat/checked.png | Bin 1092 -> 1021 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/images/wechat/checked.png b/public/images/wechat/checked.png index 77986d62ec83b4cb56f0bb5b95dac6598a24f128..0d9713fed12fe68cccc4172216cdaac855296b2e 100644 GIT binary patch delta 344 zcmX@Y@t1vr8&iyto0Frnsj-={iK&sHp{tprp|i1zrK^FViKU5&shN?ILPc(YudkI$ zesXDUYF>$_i>(q+L@y;X#R{s|9GBk7i5|o-|m4e#>Q(Sr{>oGgk zJKE-5VPIe=^mK6yskoK&=l_3uX3K`oMjr?9UM&Y5pH;_76zmv}Bozn-JP0`CRJia6Q7ql4)EEa4LUT9|d v__MWg-;~8%N49@tHGX`-vxtF_jp6dw7f~1X@=Ztq+RotV>gTe~DWM4f+j?zC delta 415 zcmey%euQI#8&izAxq+d%tA(?%iHWJ9p{tptk%hCRo0GYlrJ1q0i>s58LPc(YudkI$ zesXDUYF>$_i>(q+L@y;X#R{s|1()8*i5|o-|m4e#>CtP|b>oGgk ze~RnzW?*30;pyTSQgQ3drHy=yjsnL%T9$LRHaUsRb6lymDBz{W3z0_;JGi+zpLlh; zU#MnmWlH=T?p74ZwSB5*-O02~_w$T)HyWx5O| Date: Thu, 14 Jul 2016 17:39:22 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=8F=AD=E7=BA=A7=E4=B8=8B=E6=9C=89=E6=8C=82=E8=B5=B7?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=80=E6=9C=89=E4=BD=9C=E4=B8=9A=E9=83=BD?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84BUG=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=B8=8B=E4=BD=9C=E4=B8=9A=E3=80=81=E6=B5=8B?= =?UTF-8?q?=E9=AA=8C=E5=8F=91=E9=80=81=E6=8C=89=E9=92=AE=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 2 +- public/assets/wechat/class.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index a55a81e89..294c77019 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -419,7 +419,7 @@ class CoursesService def homework_list params,current_user course = Course.find(params[:id]) if course.is_public != 0 || current_user.member_of_course?(course) - bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC') + bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC') bids = bids.like(params[:name]) if params[:name].present? homeworks = [] bids.each do |bid| diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index da58003cc..294610ac7 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -42,14 +42,14 @@
-
{{r.homework_name}}发送
+
{{r.homework_name}}发送

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

-
{{r.exercise_name}}发送
+
{{r.exercise_name}}发送

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

From 6ab1269c01217ceae0514ac9477b21d0cea0ee58 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 09:16:37 +0800 Subject: [PATCH 03/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=A1=86=E5=8A=A0=E5=85=A5=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=8F=90=E7=A4=BA=E6=9C=89=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 5 +---- app/controllers/wechats_controller.rb | 14 +++++++++++++- app/services/courses_service.rb | 6 +++--- app/views/courses/_set_join.js.erb | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 5908ef866..57fda4af1 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -393,10 +393,7 @@ module Mobile authenticate! course = Course.find(params[:course_id]) - exercises = course.exercises - exercises.each do |v| - v[:coursename] = course.nil? ? "未知" : course.name - end + exercises = course.exercises.where("exercise_status <> 1") present :data,exercises,with:Mobile::Entities::Exercise present :status,0 end diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 5f1e54b8a..ef935c597 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -208,8 +208,20 @@ class WechatsController < ActionController::Base course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code] raise "班级不存在,请确认您的邀请码是否输入正确,谢谢!" unless course + #取出用户角色类型 + role = 10 + + case user.user_extensions.identity + when 0 + role = "9" + when 1 + role = "10" + when 2 + role = "7" + end + cs = CoursesService.new - status = cs.join_course({invite_code: course.invite_code}, user) + status = cs.join_course({role:role,invite_code: course.invite_code}, user) logger.info status if status[:state] != 0 raise CoursesService::JoinCourseError.message(status[:state]) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 294c77019..fe23dc377 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -326,8 +326,8 @@ class CoursesService define_error [ 0, '加入成功', 1, '密码错误', - 2, '课程已过期 请联系课程管理员重启课程。', - 3, '您已经加入了课程', + 2, '班级已过期 请联系班级管理员重启班级。', + 3, '您已经加入了班级', 4, '您的邀请码不正确', 5, '您还未登录', 6, '申请成功,请等待审核完毕', @@ -522,7 +522,7 @@ class CoursesService def course_attachments params result = [] course = Course.find(params[:course_id]) - attachments = course.attachments.order("created_on ") + attachments = course.attachments.where("is_publish = 1").order("created_on desc") if !params[:name].nil? && params[:name] != "" attachments.each do |atta| result << atta if atta.filename.include?(params[:name]) diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index dbdf3d7f3..822757dfe 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -10,12 +10,12 @@ <% elsif @state == 1 %> alert("密码错误"); <% elsif @state == 2 %> - alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)"); + alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)"); <% elsif @state == 3 %> - alert("您已经加入了课程"); + alert("您已经加入了班级"); window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>" <% elsif @state == 4 %> - alert("您加入的课程不存在"); + alert("您加入的班级不存在"); <% elsif @state == 5 %> alert("您还未登录"); <% elsif @state == 6 %> From b8c8b2c4ae11e5a4717866e8f1c1655330883405 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 09:48:10 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 11 +-------- app/services/courses_service.rb | 33 +++------------------------ 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index ef935c597..38bff250e 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -211,17 +211,8 @@ class WechatsController < ActionController::Base #取出用户角色类型 role = 10 - case user.user_extensions.identity - when 0 - role = "9" - when 1 - role = "10" - when 2 - role = "7" - end - cs = CoursesService.new - status = cs.join_course({role:role,invite_code: course.invite_code}, user) + status = cs.join_course({invite_code: course.invite_code}, user) logger.info status if status[:state] != 0 raise CoursesService::JoinCourseError.message(status[:state]) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index fe23dc377..7ef08f6d8 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -354,54 +354,27 @@ class CoursesService roleName = member.roles[0].name if member if params[:invite_code].present? #如果加入角色为学生 并且当前是学生 - if params[:role] == "10" && roleName == "Student" + if roleName == "Student" @state = 3 #如果加入的角色为老师,并且当前已经是老师 - elsif params[:role] == "9" && roleName == "Teacher" + elsif roleName == "Teacher" @state = 8 #如果加入的角色教辅并且当前为教辅 - elsif params[:role] == "7" && roleName == "TeachingAsistant" + elsif roleName == "TeachingAsistant" @state = 9 elsif roleName == "Manager" @state = 10 - #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求 - elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" ) - #如果已经发送过消息了,那么就要给个提示 - if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0 - @state = 7 - else - Mailer.run.join_course_request(course, User.current, params[:role]) - CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) - @state = 6 - end - #如果加入角色是学生,但是是当前课程的教师或者教辅 - elsif params[:role] == "10" && roleName != "Student" - member.role_ids = [params[:role]] - member.save - StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) - @state = 0 end else @state = 1 end else if params[:invite_code].present? - if params[:role] == "10" || params[:role] == nil members = [] members << Member.new(:role_ids => [10], :user_id => current_user.id) course.members << members StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) @state = 0 - else - #如果已经发送过消息了,那么就要给个提示 - if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0 - @state = 7 - else - Mailer.run.join_course_request(course, User.current, params[:role]) - CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) - @state = 6 - end - end else @state = 1 end From 4be95cd9c5696b3b3c4b1b9916a423fa573107fb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 09:52:57 +0800 Subject: [PATCH 05/32] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=86=85=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E8=AF=BE=E4=BB=B6=E6=B5=8B=E9=AA=8C=E7=AD=89=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 57fda4af1..0467d6220 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -393,7 +393,7 @@ module Mobile authenticate! course = Course.find(params[:course_id]) - exercises = course.exercises.where("exercise_status <> 1") + exercises = course.exercises.where("exercise_status <> 1").order("created_at desc") present :data,exercises,with:Mobile::Entities::Exercise present :status,0 end From dc2ba9635394dc81411de2f8cc8d8f887a5e083b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 10:26:37 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=8F=91=E9=80=81=E7=BB=91=E5=AE=9A=E6=88=90=E5=8A=9F=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=EF=BC=8C=E5=8A=A0=E5=85=A5=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=B7=B3=E5=85=A5=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 3 ++- app/controllers/wechats_controller.rb | 2 +- public/assets/wechat/class_list.html | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index e2ea8d35b..e34bae63f 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -67,7 +67,8 @@ module Mobile openid: openid, user: user ) - + ws = WechatService.new + ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d")) present :data, user, with: Mobile::Entities::User present :status, 0 end diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 38bff250e..ea305d967 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -221,7 +221,7 @@ class WechatsController < ActionController::Base news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!', content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} } return request.reply.news(news) do |article, n, index| # article is return object - url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect" + url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect" pic_url = "#{ROOT_URL}/images/wechat/class.jpg" article.item title: "#{n[:title]}", description: n[:content], diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index dafce2cfc..b5feefc73 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -4,8 +4,8 @@
我创建的课程
-
{{syllabus.title}}
-
    +
    {{syllabus.title}}
    +
    • @@ -18,8 +18,8 @@
      我参与的课程
      -
      {{syllabus.title}}
      -
        +
        {{syllabus.title}}
        +
        • From df8b995d417bdeaeef6e5b83c820e25bfe621b91 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 15 Jul 2016 10:52:43 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=EF=BC=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=B1=9E=E6=80=A7=E5=AD=97=E4=BD=93=E5=87=8F=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 2da072cd8..cb1696dbf 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -36,8 +36,8 @@
          - 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
          - 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} + 迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
          + 缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
      @@ -163,8 +163,8 @@
      - 状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
      - 指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}% + 状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
      + 指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
      From 08c6c16cfd7f2ff9cac538c6fb1b6df4ea4735c3 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 15 Jul 2016 10:56:54 +0800 Subject: [PATCH 08/32] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=EF=BC=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=87=8F=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/homework_detail.html | 8 ++++---- public/assets/wechat/issue_detail.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 583d0bcd7..8ec30acd8 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -15,10 +15,10 @@
      {{homework.name}}
      {{homework.course_name}} - 普通作业编程作业分组作业{{homework.publish_time}}
      - 迟交扣分:{{homework.late_penalty}}分 - 缺评扣分:{{homework.absence_penalty}}分/作品 - 匿评开启时间:{{homework.evaluation_start}} - 匿评关闭时间:{{homework.evaluation_end}} + 迟交扣分:{{homework.late_penalty}}分 + 匿评开启时间:{{homework.evaluation_start}}
      + 缺评扣分:{{homework.absence_penalty}}分/作品 + 匿评关闭时间:{{homework.evaluation_end}}
      diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index c28b53698..953fec3c7 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -17,10 +17,10 @@
      {{issue.project_name}} - 项目问题{{issue.created_on}}
      - 状   态:{{issue.issue_status}} - 优先级:{{issue.issue_priority}}
      - 指派给:{{issue.issue_assigned_to}} - 完成度:{{issue.done_ratio}}% + 状   态:{{issue.issue_status}} + 优先级:{{issue.issue_priority}}
      + 指派给:{{issue.issue_assigned_to}} + 完成度:{{issue.done_ratio}}%
      From 5a463721b80142d49376fc6ac5c232ffbb74820e Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 15 Jul 2016 14:09:22 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/myresource.html | 6 +++--- public/stylesheets/weui/weixin.css | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 6300240d3..3744cf65c 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -13,21 +13,21 @@
      {{r.filename}}发送
      - 课件来源:{{r.coursename}}大小:{{r.attafile_size}} + 大小:{{r.attafile_size}}

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

      {{r.homework_name}}发送
      - 作业来源:{{r.coursename}} +

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

      {{r.exercise_name}}发送
      - 题目来源:{{r.coursename}} +

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

      diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 17c039a29..cc81a4c0c 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -194,6 +194,8 @@ a.underline {text-decoration:underline;} .img-circle {border-radius:50%;} .member-banner {height:24px; line-height:24px; text-align:center; vertical-align:middle; background-color:#dfdfdf;} .resource-width {width:76%;} +.courseware-from-width {max-width:57%;} +.other-from-width {max-width:80%;} /*20160614班级列表*/ .course-diff-row {width:100%; height:28px; line-height:28px; vertical-align:middle; background-color:#fff;} From b540ff7017238fe6e31df3864ec46263cc6a521b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 14:44:37 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=87=8C=E5=A2=9E=E5=8A=A0=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/resources.rb | 36 ++++- public/assets/wechat/class.html | 9 ++ public/assets/wechat/myresource.html | 9 ++ .../wechat/controllers/myresource.js | 130 +++++++++++++++--- 4 files changed, 160 insertions(+), 24 deletions(-) diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb index 16531940f..d5823d5b4 100644 --- a/app/api/mobile/apis/resources.rb +++ b/app/api/mobile/apis/resources.rb @@ -8,13 +8,23 @@ module Mobile desc '获取所有课件' params do requires :token, type: String + requires :page, type: Integer end - get do + post do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new # data = current_user.course_attachments data = rs.all_course_attachments current_user + all_count = data.count + data = data.limit(10).offset(page * 10) + count = data.count + present :data, data, with: Mobile::Entities::Attachment,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end @@ -24,14 +34,24 @@ module Mobile desc '获取所有作业' params do requires :token, type: String + requires :page, type: Integer end - get 'homeworks' do + post 'homeworks' do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new homeworks = rs.all_homework_commons current_user + all_count = homeworks.count + homeworks = homeworks.limit(10).offset(page * 10) + count = homeworks.count + present :data, homeworks, with: Mobile::Entities::Homework,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end @@ -39,13 +59,23 @@ module Mobile desc '获取所有测验' params do requires :token, type: String + requires :page, type: Integer end - get 'exercies' do + post 'exercises' do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new exercises = rs.all_exercises current_user + all_count = exercises.count + exercises = exercises.limit(10).offset(page * 10) + count = exercises.count + present :data, exercises, with: Mobile::Entities::Exercise,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 294610ac7..0539ee326 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -24,6 +24,9 @@
      {{r.filename}}发送
      +
      +
      更多
      +

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

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

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

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

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

      diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 6300240d3..bfa73b89b 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -14,6 +14,9 @@
      {{r.filename}}发送
      课件来源:{{r.coursename}}大小:{{r.attafile_size}} +
      +
      +
      更多

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

      @@ -22,12 +25,18 @@
      {{r.homework_name}}发送
      作业来源:{{r.coursename}}
      +
      +
      更多
      +

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

      {{r.exercise_name}}发送
      题目来源:{{r.coursename}} +
      +
      +
      更多

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

      diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index b371ee8cc..9aab39479 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -2,36 +2,124 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l var vm = $scope; vm.menus = ['课件', '作业', '测验']; - vm.resources = null; - vm.homeworks = null; - vm.exercise = null; + vm.resources = []; + vm.homeworks = []; + vm.exercise = []; + + vm.has_more = false; + vm.page = 0; + + vm.homework_has_more = false; + vm.homework_page = 0; + + vm.exercise_has_more = false; + vm.exercise_page = 0; vm.searchText = ""; + vm.sendFile = function(r){ + $location.path("/send_class_list").search({id: r.id}); + } + + vm.loadResourceData = function (index,page){ + if(index == 1){ + vm.page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.resources = vm.resources.concat(response.data.data); + } else { + vm.resources = response.data.data; + } + +// rms.save("resources", vm.resources); + vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; +// rms.save('homework_has_more', vm.has_more); +// rms.save('homework_page', vm.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + + } + else if(index==2 ){ + vm.homework_page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources/homeworks", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.homeworks = vm.homeworks.concat(response.data.data); + } else { + vm.homeworks = response.data.data; + } + +// rms.save("homeworks", vm.homeworks); + vm.homework_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; +// rms.save('homework_has_more', vm.has_more); +// rms.save('homework_page', vm.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + } + else if(index==3 ){ + vm.exercise_page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources/exercises", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.exercise = vm.exercise.concat(response.data.data); + } else { + vm.exercise = response.data.data; + } + +// rms.save("homeworks", vm.homeworks); + vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; +// rms.save('homework_has_more', vm.has_more); +// rms.save('homework_page', vm.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + } + } + vm.tab = function(index){ vm.currentTab = index; vm.searchText = ""; - if(index==1 && (!vm.resources || vm.resources.length <= 0 )){ - $http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.resources = response.data.data; - }); - } else if(index==2 && (!vm.homeworks || vm.homeworks.length <= 0) ){ - $http.get(config.apiUrl + "resources/homeworks?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.homeworks = response.data.data; - }); - } else if(index==3 && (!vm.exercise || vm.exercise.length <= 0) ){ - $http.get(config.apiUrl + "resources/exercies?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.exercise = response.data.data; - }); + + switch(index){ + //ALL + case 1: + if(vm.resources.length<=0){ + vm.loadResourceData(index,0); + } + break; + //homework + case 2: + if(vm.homeworks.length<=0){ + vm.loadResourceData(index,0); + } + break; + //exercise + case 3: + if(vm.exercise.length<=0){ + vm.loadResourceData(index,0); + } + break; } } vm.tab(1); - vm.sendFile = function(r){ - $location.path("/send_class_list").search({id: r.id}); - } }] ); From 8c2ae92d310da606e2fa136e364e75d86ce6314f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 14:45:01 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- config/menu.yml.test | 9 +++------ config/oneapm.yml | 4 ++-- config/wechat.yml | 8 ++++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 3bea83669..03dbb5785 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem 'elasticsearch-rails' ### profile -#gem 'oneapm_rpm' +gem 'oneapm_rpm' group :development do gem 'grape-swagger' diff --git a/config/menu.yml.test b/config/menu.yml.test index a163bac61..a43d72816 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -2,21 +2,18 @@ button: - type: "view" name: "我的动态" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_b -ase&state=activities#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect" - name: "我的课程" sub_button: - type: "view" name: "课程" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi -_base&state=class_list#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" name: "资源" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi -_base&state=myresource#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect" - name: "更多" diff --git a/config/oneapm.yml b/config/oneapm.yml index 7e85a3c65..3ab2385f5 100644 --- a/config/oneapm.yml +++ b/config/oneapm.yml @@ -11,7 +11,7 @@ common: &default_settings # 如果您修改了此处的app_name,一个新的应用会出现在后台, # 数据会上传到这个新应用,并停止向旧的应用上传数据。 # - app_name: trustie + app_name: trustie_wechat # # 环境相关配置 @@ -25,7 +25,7 @@ development: <<: *default_settings # development模式下,探针开启并上传性能数据 monitor_mode: true - app_name: trustie(Development) + app_name: My Application (Development) test: <<: *default_settings diff --git a/config/wechat.yml b/config/wechat.yml index d243ca44c..5740be9a6 100644 --- a/config/wechat.yml +++ b/config/wechat.yml @@ -8,12 +8,12 @@ default: &default #secret: "743e038392f1d89540e95f8f7645849a" #production - appid: "wx8e1ab05163a28e37" - secret: "beb4d3bc4b32b3557811680835357841" + #appid: "wx8e1ab05163a28e37" + #secret: "beb4d3bc4b32b3557811680835357841" #test - #appid: "wxc09454f171153c2d" - #secret: "dff5b606e34dcafe24163ec82c2715f8" + appid: "wxc09454f171153c2d" + secret: "dff5b606e34dcafe24163ec82c2715f8" token: "123456" access_token: "1234567" From dd892993dd2027e3ef982e30bf9cf30c7e4bc22b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 14:49:23 +0800 Subject: [PATCH 12/32] assets --- app/views/wechats/user_activities.html.erb | 52 +++++++++++----------- public/javascripts/wechat/build/app.min.js | 8 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index f724be392..5e86d32d1 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -27,32 +27,32 @@
      - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/javascripts/wechat/build/app.min.js b/public/javascripts/wechat/build/app.min.js index 7e4e69008..6511ffb0e 100644 --- a/public/javascripts/wechat/build/app.min.js +++ b/public/javascripts/wechat/build/app.min.js @@ -1,7 +1,7 @@ var app=angular.module("wechat",["ngRoute"]);app.constant("config",{rootPath:"/assets/wechat/",rootUrl:"/",apiUrl:"/api/v1/"}),app.run(["$rootScope","auth","$location","$routeParams",function(t,a,e,r){g_redirect_path&&g_redirect_path.length>1&&(e.path(g_redirect_path),g_redirect_path=null),t.$on("$routeChangeError",function(t,a,r){a&&a.templateUrl&&(a.templateUrl.endsWith("login.html")||a.templateUrl.endsWith("reg.html")||e.path("/login"))}),t.$on("$routeChangeStart",function(t,a,e){})}]); -app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,e,n){this.message=e,this.title=t,this.visible=!0,this.cb=n},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,e,n,o,a){var i=function(){var a=n.defer(),i=c();if(i&&i.length>10)a.resolve(i);else{window.g_code||e.code||o.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?a.reject(t.data.message):(o.save("token",t.data.token),a.resolve(t.data.token))})["catch"](function(t){a.reject(t)})}return a.promise},c=function(){return o.get("token")};return{get_bind:i,token:c}}]),app.factory("session",function(){return{save:function(t,e){sessionStorage.setItem(t,e)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},e=function(e,n){t[e]=n},n=function(e){return t[e]};return{save:e,get:n}}),app.factory("common",["$http","auth","$routeParams",function(t,e,n){var o=function(n,o,a,i){if(a.comment&&!(a.comment.length<=0)){var c=a.comment.replace(/\n/g,"
      "),s={type:o,content:c,token:e.token()};a.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+n,data:s}).then(function(t){a.disabled=!1,"function"==typeof i&&i()},function(t){})}},a=function(n,o){return t({method:"GET",url:apiUrl+o+"/"+n+"?token="+e.token()})},i=function(n){n.praise_count+=1,n.has_praise=!0,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},c=function(n){n.praise_count-=1,n.has_praise=!1,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},s=function(t){t.scope.formData={comment:""};var e=function(e){a(e,t.type).then(function(e){t.loadCallback(e.data)},function(t){})};e(t.id),t.scope.addReply=function(n){console.log(n.comment),o(t.id,t.replyType,n,function(){t.scope.formData={comment:""},e(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=i,t.scope.decreasePraise=c};return{init:s,addCommonReply:o,loadCommonData:a,addCommonPraise:i,decreaseCommonPraise:c}}]); +app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,i,e){this.message=i,this.title=t,this.visible=!0,this.cb=e},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,i,e,a,c){var s=function(){var c=e.defer(),s=o();if(s&&s.length>10)c.resolve(s);else{window.g_code||i.code||a.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?c.reject(t.data.message):(a.save("token",t.data.token),c.resolve(t.data.token))})["catch"](function(t){c.reject(t)})}return c.promise},o=function(){return a.get("token")};return{get_bind:s,token:o}}]),app.factory("session",function(){return{save:function(t,i){sessionStorage.setItem(t,i)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},i=function(i,e){t[i]=e},e=function(i){return t[i]};return{save:i,get:e}}),app.factory("common",["$http","auth","$routeParams","rms",function(t,i,e,a){var c=function(e,a,c,s){if(c.comment&&!(c.comment.length<=0)){var o=c.comment.replace(/\n/g,"
      "),n={type:a,content:o,token:i.token()};c.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+e,data:n}).then(function(t){c.disabled=!1,"function"==typeof s&&s()},function(t){})}},s=function(e,a){return t({method:"GET",url:apiUrl+a+"/"+e+"?token="+i.token()})},o=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},n=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},r=function(t){t.scope.formData={comment:""};var i=function(i){s(i,t.type).then(function(i){t.loadCallback(i.data)},function(t){})};i(t.id),t.scope.addReply=function(e){console.log(e.comment),c(t.id,t.replyType,e,function(){t.scope.formData={comment:""},i(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count+=1,activities[i].has_praise=!0;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count+=1,course_activities[i].has_praise=!0;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count+=1,project_activities[i].has_praise=!0;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count+=1,t.has_praise=!0,o(t)},t.scope.decreasePraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count-=1,activities[i].has_praise=!1;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count-=1,course_activities[i].has_praise=!1;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count-=1,project_activities[i].has_praise=!1;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count-=1,t.has_praise=!1,n(t)}};return{init:r,addCommonReply:c,loadCommonData:s,addCommonPraise:o,decreaseCommonPraise:n}}]); app.filter("safeHtml",["$sce",function(t){return function(n){return t.trustAsHtml(n)}}]),app.filter("identify",function(){return function(t){return"TeachingAsistant"==t?"教辅":""}}); -app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(e,a,t,c,o,i,r,s,n){t.replaceUrl=function(e){return e},t.menus=["所有动态","课程动态","项目动态"],t.alertService=n.create(),console.log("ActivityController load"),t.page=r.get("page")||0,t.activities=r.get("activities")||[],t.has_more=r.get("has_more"),t.course_page=r.get("course_page")||0,t.course_activities=r.get("course_activities")||[],t.course_has_more=r.get("course_has_more"),t.project_page=r.get("project_page")||0,t.project_activities=r.get("project_activities")||[],t.project_has_more=r.get("project_has_more"),t.loadActData=function(e,a){switch(container_type="All",e){case 1:container_type="All",t.page=a;break;case 2:container_type="Course",t.course_page=a;break;case 3:container_type="Project",t.project_page=a}c({method:"POST",url:apiUrl+"activities",data:{token:i.token(),page:a,container_type:container_type}}).then(function(e){if(e.data.page>0)switch(e.data.container_type){case"All":t.activities=t.activities.concat(e.data.data);break;case"Course":t.course_activities=t.course_activities.concat(e.data.data);break;case"Project":t.project_activities=t.project_activities.concat(e.data.data);break;case 3:}else switch(e.data.container_type){case"All":t.activities=e.data.data;break;case"Course":t.course_activities=e.data.data;break;case"Project":t.project_activities=e.data.data;break;case 3:}switch(e.data.container_type){case"All":r.save("activities",t.activities),t.has_more=e.data.count+10*e.data.page0)switch(a.data.container_type){case"All":t.activities=t.activities.concat(a.data.data);break;case"Course":t.course_activities=t.course_activities.concat(a.data.data);break;case"Project":t.project_activities=t.project_activities.concat(a.data.data);break;case 3:}else switch(a.data.container_type){case"All":t.activities=a.data.data;break;case"Course":t.course_activities=a.data.data;break;case"Project":t.project_activities=a.data.data;break;case 3:}switch(a.data.container_type){case"All":o.save("activities",t.activities),t.has_more=a.data.count+10*a.data.page Date: Fri, 15 Jul 2016 15:32:40 +0800 Subject: [PATCH 13/32] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=9B=B4=E5=A4=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/controllers/myresource.js | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 9aab39479..802982266 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -1,4 +1,4 @@ -app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', function($scope, $http, auth, config, $location){ +app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms', function($scope, $http, auth, config, $location,rms){ var vm = $scope; vm.menus = ['课件', '作业', '测验']; @@ -6,14 +6,17 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.homeworks = []; vm.exercise = []; - vm.has_more = false; - vm.page = 0; + vm.page = rms.get('page') || 0; + vm.resources = rms.get("resources") || []; + vm.has_more = rms.get("has_more"); - vm.homework_has_more = false; - vm.homework_page = 0; + vm.homework_page = rms.get('homework_page') || 0; + vm.homeworks = rms.get("homeworks") || []; + vm.homework_has_more = rms.get("homework_has_more"); - vm.exercise_has_more = false; - vm.exercise_page = 0; + vm.exercise_page = rms.get('exercise_page') || 0; + vm.exercise = rms.get("exercise") || []; + vm.exercise_has_more = rms.get("exercise_has_more"); vm.searchText = ""; @@ -35,10 +38,10 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.resources = response.data.data; } -// rms.save("resources", vm.resources); - vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; -// rms.save('homework_has_more', vm.has_more); -// rms.save('homework_page', vm.data.page); + rms.save("resources", vm.resources); + vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + rms.save('has_more', vm.has_more); + rms.save('page', response.data.page); console.log(response.data); @@ -59,10 +62,10 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.homeworks = response.data.data; } -// rms.save("homeworks", vm.homeworks); + rms.save("homeworks", vm.homeworks); vm.homework_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; -// rms.save('homework_has_more', vm.has_more); -// rms.save('homework_page', vm.data.page); + rms.save('homework_has_more', vm.has_more); + rms.save('homework_page', response.data.page); console.log(response.data); @@ -82,10 +85,10 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.exercise = response.data.data; } -// rms.save("homeworks", vm.homeworks); + rms.save("exercise", vm.exercise); vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; -// rms.save('homework_has_more', vm.has_more); -// rms.save('homework_page', vm.data.page); + rms.save('exercise_has_more', vm.exercise_has_more); + rms.save('exercise_page', response.data.page); console.log(response.data); From c476dae15b608f83ca02f2da3ab938176f8bcf67 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 16:08:04 +0800 Subject: [PATCH 14/32] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=AD=20=E6=9B=B4=E5=A4=9A=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=9A=82=E6=97=B6=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/resources.rb | 36 +---- public/assets/wechat/myresource.html | 27 ++-- .../wechat/controllers/myresource.js | 135 +++--------------- 3 files changed, 34 insertions(+), 164 deletions(-) diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb index d5823d5b4..16531940f 100644 --- a/app/api/mobile/apis/resources.rb +++ b/app/api/mobile/apis/resources.rb @@ -8,23 +8,13 @@ module Mobile desc '获取所有课件' params do requires :token, type: String - requires :page, type: Integer end - post do + get do authenticate! - page = params[:page] ? params[:page] : 0 - rs = ResourcesService.new # data = current_user.course_attachments data = rs.all_course_attachments current_user - all_count = data.count - data = data.limit(10).offset(page * 10) - count = data.count - present :data, data, with: Mobile::Entities::Attachment,user: current_user - present :all_count, all_count - present :count, count - present :page, page present :status, 0 end @@ -34,24 +24,14 @@ module Mobile desc '获取所有作业' params do requires :token, type: String - requires :page, type: Integer end - post 'homeworks' do + get 'homeworks' do authenticate! - page = params[:page] ? params[:page] : 0 - rs = ResourcesService.new homeworks = rs.all_homework_commons current_user - all_count = homeworks.count - homeworks = homeworks.limit(10).offset(page * 10) - count = homeworks.count - present :data, homeworks, with: Mobile::Entities::Homework,user: current_user - present :all_count, all_count - present :count, count - present :page, page present :status, 0 end @@ -59,23 +39,13 @@ module Mobile desc '获取所有测验' params do requires :token, type: String - requires :page, type: Integer end - post 'exercises' do + get 'exercies' do authenticate! - page = params[:page] ? params[:page] : 0 - rs = ResourcesService.new exercises = rs.all_exercises current_user - all_count = exercises.count - exercises = exercises.limit(10).offset(page * 10) - count = exercises.count - present :data, exercises, with: Mobile::Entities::Exercise,user: current_user - present :all_count, all_count - present :count, count - present :page, page present :status, 0 end diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 2de3a2ef7..e91185968 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -11,33 +11,24 @@
      -
      - {{r.filename}}发送
      - 大小:{{r.attafile_size}}
      -
      -
      -
      更多
      -
      +
      + {{r.filename}}发送
      + 大小:{{r.attafile_size}}
      +

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

      -
      {{r.homework_name}}发送
      -
      -
      -
      -
      更多
      +
      {{r.homework_name}}发送
      +

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

      -
      {{r.exercise_name}}发送
      -
      -
      -
      -
      更多
      -
      +
      {{r.exercise_name}}发送
      +
      +

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

      diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 802982266..b371ee8cc 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -1,128 +1,37 @@ -app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms', function($scope, $http, auth, config, $location,rms){ +app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', function($scope, $http, auth, config, $location){ var vm = $scope; vm.menus = ['课件', '作业', '测验']; - vm.resources = []; - vm.homeworks = []; - vm.exercise = []; - - vm.page = rms.get('page') || 0; - vm.resources = rms.get("resources") || []; - vm.has_more = rms.get("has_more"); - - vm.homework_page = rms.get('homework_page') || 0; - vm.homeworks = rms.get("homeworks") || []; - vm.homework_has_more = rms.get("homework_has_more"); - - vm.exercise_page = rms.get('exercise_page') || 0; - vm.exercise = rms.get("exercise") || []; - vm.exercise_has_more = rms.get("exercise_has_more"); + vm.resources = null; + vm.homeworks = null; + vm.exercise = null; vm.searchText = ""; - vm.sendFile = function(r){ - $location.path("/send_class_list").search({id: r.id}); - } - - vm.loadResourceData = function (index,page){ - if(index == 1){ - vm.page = page; - $http({ - method: 'POST', - url: apiUrl+ "resources", - data: {token: auth.token(), page: page} - }).then(function successCallback(response) { - if(response.data.page >0) { - vm.resources = vm.resources.concat(response.data.data); - } else { - vm.resources = response.data.data; - } - - rms.save("resources", vm.resources); - vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; - rms.save('has_more', vm.has_more); - rms.save('page', response.data.page); - - console.log(response.data); - - }, function errorCallback(response) { - }); - - } - else if(index==2 ){ - vm.homework_page = page; - $http({ - method: 'POST', - url: apiUrl+ "resources/homeworks", - data: {token: auth.token(), page: page} - }).then(function successCallback(response) { - if(response.data.page >0) { - vm.homeworks = vm.homeworks.concat(response.data.data); - } else { - vm.homeworks = response.data.data; - } - - rms.save("homeworks", vm.homeworks); - vm.homework_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; - rms.save('homework_has_more', vm.has_more); - rms.save('homework_page', response.data.page); - - console.log(response.data); - - }, function errorCallback(response) { - }); - } - else if(index==3 ){ - vm.exercise_page = page; - $http({ - method: 'POST', - url: apiUrl+ "resources/exercises", - data: {token: auth.token(), page: page} - }).then(function successCallback(response) { - if(response.data.page >0) { - vm.exercise = vm.exercise.concat(response.data.data); - } else { - vm.exercise = response.data.data; - } - - rms.save("exercise", vm.exercise); - vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; - rms.save('exercise_has_more', vm.exercise_has_more); - rms.save('exercise_page', response.data.page); - - console.log(response.data); - - }, function errorCallback(response) { - }); - } - } - vm.tab = function(index){ vm.currentTab = index; vm.searchText = ""; - - switch(index){ - //ALL - case 1: - if(vm.resources.length<=0){ - vm.loadResourceData(index,0); - } - break; - //homework - case 2: - if(vm.homeworks.length<=0){ - vm.loadResourceData(index,0); - } - break; - //exercise - case 3: - if(vm.exercise.length<=0){ - vm.loadResourceData(index,0); - } - break; + if(index==1 && (!vm.resources || vm.resources.length <= 0 )){ + $http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){ + console.log(response.data); + vm.resources = response.data.data; + }); + } else if(index==2 && (!vm.homeworks || vm.homeworks.length <= 0) ){ + $http.get(config.apiUrl + "resources/homeworks?token="+auth.token()).then(function(response){ + console.log(response.data); + vm.homeworks = response.data.data; + }); + } else if(index==3 && (!vm.exercise || vm.exercise.length <= 0) ){ + $http.get(config.apiUrl + "resources/exercies?token="+auth.token()).then(function(response){ + console.log(response.data); + vm.exercise = response.data.data; + }); } } vm.tab(1); + vm.sendFile = function(r){ + $location.path("/send_class_list").search({id: r.id}); + } }] ); From 606393284081509c417c846c3547eec74c77b031 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 15 Jul 2016 16:14:52 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=AF=B9=E8=AF=BE=E7=A8=8B,=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E5=90=8D=E7=A7=B0=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=8F=98=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_class.html | 4 ++-- public/javascripts/wechat/controllers/edit_class.js | 4 ++++ public/stylesheets/weui/weixin.css | 2 +- show | 0 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 show diff --git a/public/assets/wechat/edit_class.html b/public/assets/wechat/edit_class.html index c61ca8ce9..5953e046b 100644 --- a/public/assets/wechat/edit_class.html +++ b/public/assets/wechat/edit_class.html @@ -3,9 +3,9 @@
      管理课程
      -
      课程
      +
      课程
      -
      班级删除
      +
      班级删除
      完成
      diff --git a/public/javascripts/wechat/controllers/edit_class.js b/public/javascripts/wechat/controllers/edit_class.js index 5f377e594..b5ee1a025 100644 --- a/public/javascripts/wechat/controllers/edit_class.js +++ b/public/javascripts/wechat/controllers/edit_class.js @@ -107,4 +107,8 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale } + vm.fadeText = function () { + $scope.change = true; + } + }] ); \ No newline at end of file diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index cc81a4c0c..4d930bbb0 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -43,7 +43,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin: 5px 0.4em 5px 1.4e .mr55 {margin-right:55px;} .c-red {color:#e81a1a;} .c-blue {color:#269ac9;} -.c-grey {color:#9a9a9a;} +.c-grey {color:#9a9a9a !important;} .c-grey2 {color:#707070;} .c-grey3 {color:#555555;} .c-grey4 {color:#888888;} diff --git a/show b/show new file mode 100644 index 000000000..e69de29bb From 60dc0e72cf8c93116f7e4b0738b476c8dd51508c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 16:46:27 +0800 Subject: [PATCH 16/32] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=88=91=E6=88=91?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=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/resources.rb | 36 ++++- app/views/wechats/user_activities.html.erb | 50 +++---- public/assets/wechat/myresource.html | 9 ++ .../wechat/controllers/myresource.js | 135 +++++++++++++++--- 4 files changed, 180 insertions(+), 50 deletions(-) diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb index 16531940f..d5823d5b4 100644 --- a/app/api/mobile/apis/resources.rb +++ b/app/api/mobile/apis/resources.rb @@ -8,13 +8,23 @@ module Mobile desc '获取所有课件' params do requires :token, type: String + requires :page, type: Integer end - get do + post do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new # data = current_user.course_attachments data = rs.all_course_attachments current_user + all_count = data.count + data = data.limit(10).offset(page * 10) + count = data.count + present :data, data, with: Mobile::Entities::Attachment,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end @@ -24,14 +34,24 @@ module Mobile desc '获取所有作业' params do requires :token, type: String + requires :page, type: Integer end - get 'homeworks' do + post 'homeworks' do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new homeworks = rs.all_homework_commons current_user + all_count = homeworks.count + homeworks = homeworks.limit(10).offset(page * 10) + count = homeworks.count + present :data, homeworks, with: Mobile::Entities::Homework,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end @@ -39,13 +59,23 @@ module Mobile desc '获取所有测验' params do requires :token, type: String + requires :page, type: Integer end - get 'exercies' do + post 'exercises' do authenticate! + page = params[:page] ? params[:page] : 0 + rs = ResourcesService.new exercises = rs.all_exercises current_user + all_count = exercises.count + exercises = exercises.limit(10).offset(page * 10) + count = exercises.count + present :data, exercises, with: Mobile::Entities::Exercise,user: current_user + present :all_count, all_count + present :count, count + present :page, page present :status, 0 end diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 5e86d32d1..cb9f4095a 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -28,31 +28,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index e91185968..0782aeb3b 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -15,6 +15,9 @@ {{r.filename}}发送
      大小:{{r.attafile_size}}
      +
      +
      更多
      +

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

      @@ -22,6 +25,9 @@
      {{r.homework_name}}发送
      +
      +
      更多
      +

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

      @@ -29,6 +35,9 @@
      {{r.exercise_name}}发送
      +
      +
      更多
      +

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

diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index b371ee8cc..802982266 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -1,37 +1,128 @@ -app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', function($scope, $http, auth, config, $location){ +app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms', function($scope, $http, auth, config, $location,rms){ var vm = $scope; vm.menus = ['课件', '作业', '测验']; - vm.resources = null; - vm.homeworks = null; - vm.exercise = null; + vm.resources = []; + vm.homeworks = []; + vm.exercise = []; + + vm.page = rms.get('page') || 0; + vm.resources = rms.get("resources") || []; + vm.has_more = rms.get("has_more"); + + vm.homework_page = rms.get('homework_page') || 0; + vm.homeworks = rms.get("homeworks") || []; + vm.homework_has_more = rms.get("homework_has_more"); + + vm.exercise_page = rms.get('exercise_page') || 0; + vm.exercise = rms.get("exercise") || []; + vm.exercise_has_more = rms.get("exercise_has_more"); vm.searchText = ""; + vm.sendFile = function(r){ + $location.path("/send_class_list").search({id: r.id}); + } + + vm.loadResourceData = function (index,page){ + if(index == 1){ + vm.page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.resources = vm.resources.concat(response.data.data); + } else { + vm.resources = response.data.data; + } + + rms.save("resources", vm.resources); + vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + rms.save('has_more', vm.has_more); + rms.save('page', response.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + + } + else if(index==2 ){ + vm.homework_page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources/homeworks", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.homeworks = vm.homeworks.concat(response.data.data); + } else { + vm.homeworks = response.data.data; + } + + rms.save("homeworks", vm.homeworks); + vm.homework_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + rms.save('homework_has_more', vm.has_more); + rms.save('homework_page', response.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + } + else if(index==3 ){ + vm.exercise_page = page; + $http({ + method: 'POST', + url: apiUrl+ "resources/exercises", + data: {token: auth.token(), page: page} + }).then(function successCallback(response) { + if(response.data.page >0) { + vm.exercise = vm.exercise.concat(response.data.data); + } else { + vm.exercise = response.data.data; + } + + rms.save("exercise", vm.exercise); + vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + rms.save('exercise_has_more', vm.exercise_has_more); + rms.save('exercise_page', response.data.page); + + console.log(response.data); + + }, function errorCallback(response) { + }); + } + } + vm.tab = function(index){ vm.currentTab = index; vm.searchText = ""; - if(index==1 && (!vm.resources || vm.resources.length <= 0 )){ - $http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.resources = response.data.data; - }); - } else if(index==2 && (!vm.homeworks || vm.homeworks.length <= 0) ){ - $http.get(config.apiUrl + "resources/homeworks?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.homeworks = response.data.data; - }); - } else if(index==3 && (!vm.exercise || vm.exercise.length <= 0) ){ - $http.get(config.apiUrl + "resources/exercies?token="+auth.token()).then(function(response){ - console.log(response.data); - vm.exercise = response.data.data; - }); + + switch(index){ + //ALL + case 1: + if(vm.resources.length<=0){ + vm.loadResourceData(index,0); + } + break; + //homework + case 2: + if(vm.homeworks.length<=0){ + vm.loadResourceData(index,0); + } + break; + //exercise + case 3: + if(vm.exercise.length<=0){ + vm.loadResourceData(index,0); + } + break; } } vm.tab(1); - vm.sendFile = function(r){ - $location.path("/send_class_list").search({id: r.id}); - } }] ); From 5b070b6acc664177fd8b57569108c829a36481c4 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 16:52:18 +0800 Subject: [PATCH 17/32] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84html=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 3 ++- app/views/users/_user_message_userfeedaback.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1306d5625..fa0a60eea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3289,7 +3289,7 @@ def strip_html(text,len=0,endss="...") ss = "" if !text.nil? && text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip - ss = ss.gsub(/ /, ' ') + ss = ss.gsub(/ */, ' ') if len > 0 && ss.length > len ss = ss[0, len] + endss @@ -3303,6 +3303,7 @@ end def message_content content content = (strip_html content).strip + content = content.gsub(/\s+/, " ") if content.gsub(" ", "") == "" content = "[非文本消息]" end diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb index bfdbeb9f3..666fa37a3 100644 --- a/app/views/users/_user_message_userfeedaback.html.erb +++ b/app/views/users/_user_message_userfeedaback.html.erb @@ -9,7 +9,7 @@ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
  • - <%= link_to ma.journals_for_message.notes.gsub("

    ","").gsub("

    ","").gsub("
    ","").html_safe, feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%> + <%= link_to message_content(ma.journals_for_message.notes), feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>
  • <% if i == 9 && projects.count > 10 %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 4c8e17d5d..1b9490918 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -233,15 +233,13 @@ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %> <% end %> <% com_time = project.project_score.commit_time %> - <% time=project.updated_on %> <% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> - <% time= time > forge_time ? time : forge_time %>

    <%=(User.find project.user_id).show_name %>(组长)

    -

    <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

    +

    <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>  <%= project.project_score.changeset_num %>提交

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    - 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> + 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
    <% if i == 9 && projects.count > 10 %> From 6491e16c64c87919426af0df8a26a28436578595 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 15 Jul 2016 17:31:33 +0800 Subject: [PATCH 19/32] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=BA=95=E8=BE=B9=E9=87=8D=E5=90=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/class_list.html | 4 ++-- public/stylesheets/weui/weixin.css | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index b5feefc73..a3c709cb5 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -4,7 +4,7 @@
    我创建的课程
    -
    {{syllabus.title}}
    +
    {{syllabus.title}}
    • @@ -18,7 +18,7 @@
      我参与的课程
      -
      {{syllabus.title}}
      +
      {{syllabus.title}}
      • diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 4d930bbb0..7082955e3 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -198,13 +198,14 @@ a.underline {text-decoration:underline;} .other-from-width {max-width:80%;} /*20160614班级列表*/ -.course-diff-row {width:100%; height:28px; line-height:28px; vertical-align:middle; background-color:#fff;} +.course-diff-row {width:100%; height:28px; line-height:28px; vertical-align:middle; background-color:#fff; border-bottom:1px solid #ccc;} .course-list-row {width:100%; height:38px; line-height:38px; vertical-align:middle; border-top:1px solid #ccc; border-bottom:1px solid #ccc; background-color:#fff;} .class-list {width:100%; border-bottom:1px solid #ccc;} .class-list li {height:40px; line-height:40px; vertical-align:middle; margin:0 25px; border-left:1px solid #ccc; border-bottom:1px solid #ccc; position:relative;} .class-list-name {max-width:75%; display:inline-block;} .class-list-dot {position:absolute; top:13px; left:-8px;} .border-bottom-none {border-bottom:none !important;} +.border-top-none {border-top:none !important;} .students-amount {height:14px; line-height:14px; vertical-align:middle; padding:2px 5px; background-color:#e6e6e6; border-radius:10px;} .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;} From fcc8a08138320ab24e75007d198e58d3c04fdfeb Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 17:38:10 +0800 Subject: [PATCH 20/32] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_syllabus_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index 8e33696d6..aa77c727d 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -43,7 +43,7 @@

        <%=course.name %>

        - 主讲老师:<%=course.teacher.show_name %> +
        From 7725db9c69f7602aded20773e866f4caca88aa73 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 17:38:32 +0800 Subject: [PATCH 21/32] =?UTF-8?q?=E9=A2=98=E5=BA=93=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60715091215_delete_none_course_homework.rb | 17 ++ db/schema.rb | 214 +++++++++++++++++- 2 files changed, 220 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20160715091215_delete_none_course_homework.rb diff --git a/db/migrate/20160715091215_delete_none_course_homework.rb b/db/migrate/20160715091215_delete_none_course_homework.rb new file mode 100644 index 000000000..8e212bbe8 --- /dev/null +++ b/db/migrate/20160715091215_delete_none_course_homework.rb @@ -0,0 +1,17 @@ +class DeleteNoneCourseHomework < ActiveRecord::Migration + def up + count = HomeworkCommon.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + HomeworkCommon.page(i).per(30).each do |h| + if h.course_id.nil? || h.course.nil? + h.destroy + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 6ee190852..48f9aca23 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160414055511) do +ActiveRecord::Schema.define(:version => 20160715091215) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -57,6 +57,29 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.integer "user_id", :null => false end + create_table "apply_add_schools", :force => true do |t| + t.string "name" + t.string "province" + t.string "city" + t.string "address" + t.string "remarks" + t.integer "school_id" + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "apply_homeworks", :force => true do |t| + t.integer "status" + t.integer "user_id" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "apply_homeworks", ["homework_common_id"], :name => "index_apply_homeworks_on_homework_common_id" + add_index "apply_homeworks", ["user_id"], :name => "index_apply_homeworks_on_user_id" + create_table "apply_project_masters", :force => true do |t| t.integer "user_id" t.string "apply_type" @@ -66,6 +89,18 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.datetime "updated_at", :null => false end + create_table "apply_resources", :force => true do |t| + t.integer "status" + t.integer "user_id" + t.integer "attachment_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id" + t.string "container_type" + t.text "content" + t.integer "apply_user_id" + end + create_table "at_messages", :force => true do |t| t.integer "user_id" t.integer "at_message_id" @@ -334,6 +369,17 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.boolean "diff_all" end + create_table "code_tests", :force => true do |t| + t.integer "homework_id" + t.integer "wait_time", :default => 0 + t.integer "language" + t.integer "status" + t.integer "time_used", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "student_work_id", :default => 0 + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -428,15 +474,15 @@ ActiveRecord::Schema.define(:version => 20160414055511) do create_table "course_contributor_scores", :force => true do |t| t.integer "course_id" t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" + t.integer "message_num", :default => 0 + t.integer "message_reply_num", :default => 0 + t.integer "news_reply_num", :default => 0 + t.integer "resource_num", :default => 0 + t.integer "journal_num", :default => 0 + t.integer "journal_reply_num", :default => 0 t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "total_score" + t.integer "total_score", :default => 0 t.integer "homework_journal_num", :default => 0 t.integer "news_num", :default => 0 end @@ -463,8 +509,10 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.integer "viewed" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "content" + t.text "content" t.integer "status" + t.integer "apply_user_id" + t.integer "apply_result" end add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type" @@ -514,8 +562,14 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.integer "excellent_option", :default => 0 t.integer "is_copy", :default => 0 t.integer "visits", :default => 0 + t.integer "syllabus_id" + t.string "invite_code" + t.string "qrcode" end + add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true + add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" + create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -1241,6 +1295,7 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.boolean "locked", :default => false t.integer "sticky", :default => 0 t.integer "org_subfield_id" + t.integer "status", :default => 0 end create_table "org_member_roles", :force => true do |t| @@ -1304,6 +1359,7 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 t.integer "show_mode", :default => 0 + t.integer "allow_teacher", :default => 0 end create_table "phone_app_versions", :force => true do |t| @@ -1464,6 +1520,7 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.integer "journals_count", :default => 0 t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 + t.integer "hot", :default => 0 end add_index "projects", ["lft"], :name => "index_projects_on_lft" @@ -1477,6 +1534,19 @@ ActiveRecord::Schema.define(:version => 20160414055511) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "quality_analyses", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + t.string "sonar_name" + end + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1521,6 +1591,18 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.string "topic_resource" end + create_table "rep_statics", :force => true do |t| + t.integer "project_id" + t.integer "commits_num" + t.string "uname" + t.string "email" + t.integer "add" + t.integer "del" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "changeset" + end + create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -1563,10 +1645,11 @@ ActiveRecord::Schema.define(:version => 20160414055511) do create_table "schools", :force => true do |t| t.string "name" t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "logo_link" t.string "pinyin" + t.integer "school_type", :default => 0 end create_table "secdomains", :force => true do |t| @@ -1628,6 +1711,15 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.datetime "updated_at", :null => false end + create_table "shield_wechat_messages", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.integer "shield_id" + t.string "shield_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -1646,6 +1738,28 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.integer "project_id" end + create_table "sonar_errors", :force => true do |t| + t.integer "project_id" + t.string "jenkins_job_name" + t.text "output" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "ssos", :force => true do |t| + t.integer "user_id" + t.string "openid" + t.string "name" + t.string "password" + t.string "email" + t.integer "sex" + t.string "school" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id" + create_table "student_work_projects", :force => true do |t| t.integer "homework_common_id" t.integer "student_work_id" @@ -1688,6 +1802,8 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.boolean "is_test", :default => false t.integer "simi_id" t.integer "simi_value" + t.float "work_score" + t.integer "work_status", :default => 0 end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -1719,6 +1835,31 @@ ActiveRecord::Schema.define(:version => 20160414055511) do add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + create_table "sub_document_comments", :force => true do |t| + t.text "content" + t.text "title" + t.integer "sub_domain_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.integer "locked" + t.integer "sticky" + t.integer "org_subfield_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sub_domains", :force => true do |t| + t.integer "org_subfield_id" + t.integer "priority", :default => 0 + t.string "name" + t.string "field_type" + t.integer "hide", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "subfield_subdomain_dirs", :force => true do |t| t.integer "org_subfield_id" t.string "name" @@ -1726,6 +1867,26 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.datetime "updated_at", :null => false end + create_table "syllabuses", :force => true do |t| + t.string "title" + t.text "description" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "eng_name" + t.integer "syllabus_type" + t.integer "credit" + t.integer "hours" + t.integer "theory_hours" + t.integer "practice_hours" + t.string "applicable_major" + t.string "pre_course" + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 + end + + add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" + create_table "system_messages", :force => true do |t| t.integer "user_id" t.string "content" @@ -1920,6 +2081,25 @@ ActiveRecord::Schema.define(:version => 20160414055511) do add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + create_table "user_wechats", :force => true do |t| + t.integer "subscribe" + t.string "openid" + t.string "nickname" + t.integer "sex" + t.string "language" + t.string "city" + t.string "province" + t.string "country" + t.string "headimgurl" + t.string "subscribe_time" + t.string "unionid" + t.string "remark" + t.integer "groupid" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false @@ -1939,6 +2119,8 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.string "salt", :limit => 64 t.integer "gid" t.integer "visits", :default => 0 + t.integer "excellent_teacher", :default => 0 + t.integer "excellent_student", :default => 0 end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" @@ -1996,6 +2178,16 @@ ActiveRecord::Schema.define(:version => 20160414055511) do t.datetime "updated_at", :null => false end + create_table "wechat_logs", :force => true do |t| + t.string "openid", :null => false + t.text "request_raw" + t.text "response_raw" + t.text "session_raw" + t.datetime "created_at", :null => false + end + + add_index "wechat_logs", ["openid"], :name => "index_wechat_logs_on_openid" + create_table "wiki_content_versions", :force => true do |t| t.integer "wiki_content_id", :null => false t.integer "page_id", :null => false From ba1af901ad8605c79dcfb2fcca64b64ebbfa257c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 17:39:21 +0800 Subject: [PATCH 22/32] =?UTF-8?q?=E5=BC=BA=E5=88=B6=E6=9B=B4=E6=96=B0myres?= =?UTF-8?q?ource.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/wechats/user_activities.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index cb9f4095a..941cbed4a 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -29,7 +29,7 @@ - + @@ -50,7 +50,7 @@ - + From c02245adfb7c1eca183c64d0f499d5678862b12f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 18:08:19 +0800 Subject: [PATCH 23/32] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81=E5=88=86?= =?UTF-8?q?=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 6 +----- public/javascripts/wechat/controllers/invite_code.js | 2 +- public/javascripts/wechat/others/routes.js | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0467d6220..1765ce23d 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -193,14 +193,10 @@ module Mobile desc "返回单个课程" params do requires :id, type: Integer - optional :token, type: String end route_param :id do get do - authenticate! - cs = CoursesService.new - course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user)) - #course = Course.find(params[:id]) + course = Course.find(params[:id]) present :data, course, with: Mobile::Entities::Course,user: current_user { status: 0} end diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js index 1b92f592c..8ef93b21b 100644 --- a/public/javascripts/wechat/controllers/invite_code.js +++ b/public/javascripts/wechat/controllers/invite_code.js @@ -8,7 +8,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config vm.course = {}; var courseid = $routeParams.id; - $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( + $http.get(config.apiUrl+ 'courses/'+courseid+").then( function(response){ console.log(response.data); vm.course = response.data.data; diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 2c63609b0..a40951bcc 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -35,7 +35,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/edit_class', makeRoute('edit_class.html', 'EditClassController')) .when('/class_list', makeRoute('class_list.html', 'ClassListController')) .when('/myresource', makeRoute('myresource.html', 'MyResourceController')) - .when('/invite_code', makeRoute('invite_code.html', 'InviteCodeController')) + .when('/invite_code', {templateUrl: rootPath + 'invite_code.html', controller: 'InviteCodeController'}) .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .otherwise({ redirectTo: '/activites' @@ -66,4 +66,4 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func } }; }]); -}]); \ No newline at end of file +}]); From 7dd26bb5d9c470b95feb9d964ff2af1fac15a456 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 18:19:37 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81BUG=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/controllers/invite_code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js index 8ef93b21b..0b5841b5f 100644 --- a/public/javascripts/wechat/controllers/invite_code.js +++ b/public/javascripts/wechat/controllers/invite_code.js @@ -8,7 +8,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config vm.course = {}; var courseid = $routeParams.id; - $http.get(config.apiUrl+ 'courses/'+courseid+").then( + $http.get(config.apiUrl+ 'courses/'+courseid).then( function(response){ console.log(response.data); vm.course = response.data.data; From 596bfe4bfca42a9a55bd91da56675b24b81bd3fd Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 19:08:05 +0800 Subject: [PATCH 25/32] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 5 ++++- app/services/courses_service.rb | 8 ++++---- public/assets/wechat/class.html | 19 +++++-------------- .../wechat/controllers/invite_code.js | 8 ++++---- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 1765ce23d..caabad198 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -193,10 +193,13 @@ module Mobile desc "返回单个课程" params do requires :id, type: Integer + requires :token,type:String end route_param :id do get do - course = Course.find(params[:id]) + # course = Course.find(params[:id]) + cs = CoursesService.new + course = cs.show_course(params,current_user) present :data, course, with: Mobile::Entities::Course,user: current_user { status: 0} end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7ef08f6d8..39c77de4b 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -187,10 +187,10 @@ class CoursesService else work_unit = get_user_work_unit course.teacher end - unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) - raise '403' - end - {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} + # unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) + # raise '403' + # end + {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} end #创建课程 diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 0539ee326..c328ed226 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -8,10 +8,10 @@ - - - - + + + + @@ -23,10 +23,7 @@
        -
        {{r.filename}}发送
        -
        -
        更多
        -
        +
        {{r.filename}}发送

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

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

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

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

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

        diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js index 0b5841b5f..0c8bbe09e 100644 --- a/public/javascripts/wechat/controllers/invite_code.js +++ b/public/javascripts/wechat/controllers/invite_code.js @@ -5,16 +5,16 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth', function($scope, $http, $routeParams, config, auth){ var vm = $scope; - + vm.course = {}; var courseid = $routeParams.id; - $http.get(config.apiUrl+ 'courses/'+courseid).then( + $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( function(response){ console.log(response.data); vm.course = response.data.data; } ); - + vm.share = function(){ window.WeixinJSBridge.invoke('sendAppMessage',{ 'appid': 'wxf694495398c7d470', // 公众号appID @@ -30,5 +30,5 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config //alert(res.err_msg); }); } - + }]); From 67fa6da8ae6bfc27218a1ee82cbab0854bc1a340 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 19:18:30 +0800 Subject: [PATCH 26/32] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=8A=A0=E8=BD=BD=E5=89=8D=20=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=9A=82=E6=97=A0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/myresource.html | 6 +++--- public/javascripts/wechat/controllers/myresource.js | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 0782aeb3b..c89f39684 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -18,7 +18,7 @@
        更多
        -

        暂无课件,
        +

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

        @@ -28,7 +28,7 @@
        更多
        -

        暂无作业,
        +

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

        @@ -38,7 +38,7 @@
        更多
        -

        暂无测验,
        +

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

        diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 802982266..fb564cde8 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -6,6 +6,10 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.homeworks = []; vm.exercise = []; + vm.resources_tag = false; + vm.homeworks_tag = false; + vm.exercises_tag = false; + vm.page = rms.get('page') || 0; vm.resources = rms.get("resources") || []; vm.has_more = rms.get("has_more"); @@ -32,6 +36,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l url: apiUrl+ "resources", data: {token: auth.token(), page: page} }).then(function successCallback(response) { + vm.resources_tag = true if(response.data.page >0) { vm.resources = vm.resources.concat(response.data.data); } else { @@ -56,6 +61,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l url: apiUrl+ "resources/homeworks", data: {token: auth.token(), page: page} }).then(function successCallback(response) { + vm.homeworks_tag = true if(response.data.page >0) { vm.homeworks = vm.homeworks.concat(response.data.data); } else { @@ -79,6 +85,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l url: apiUrl+ "resources/exercises", data: {token: auth.token(), page: page} }).then(function successCallback(response) { + vm.exercises_tag = true; if(response.data.page >0) { vm.exercise = vm.exercise.concat(response.data.data); } else { From c9e0143fe8095b86dec541fb0539b2ba73b43e62 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 19:36:46 +0800 Subject: [PATCH 27/32] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- app/views/users/_course_homework.html.erb | 4 +--- app/views/users/_user_homework_detail.html.erb | 4 +--- lib/tasks/update_homework.rake | 6 ++++++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e6029d33c..603084cd1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2992,7 +2992,7 @@ int main(int argc, char** argv){ unless projects.empty? project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')' sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC") - + #sort_projects = sort_projects.sort_by{|sp| (!sp.project.project_score.nil? && !sp.project.project_score.commit_time.nil?) ? '' : sp.project.project_score.commit_time} return sort_projects end end diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 7b51ef568..f87b483da 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -198,10 +198,8 @@ <%# first_pro = sort_projects.first %> <% first_pro = Project.find sort_projects.first.project_id %> <% commit_time = first_pro.project_score.commit_time %> - <% one_time = first_pro.updated_on %> <% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> - <% one_time= one_time > one_forge_time ? one_time : one_forge_time %> - # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
        <% sort_projects.each_with_index do |pro, i| %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 1b9490918..6e325c2f0 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -208,10 +208,8 @@
        <% first_pro = Project.find sort_projects.first.project_id %> <% commit_time = first_pro.project_score.commit_time %> - <% one_time = first_pro.updated_on %> <% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> - <% one_time= one_time > one_forge_time ? one_time : one_forge_time %> - # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
        <% sort_projects.each_with_index do |pro, i| %> diff --git a/lib/tasks/update_homework.rake b/lib/tasks/update_homework.rake index 33bcc2231..d66f2aa25 100644 --- a/lib/tasks/update_homework.rake +++ b/lib/tasks/update_homework.rake @@ -29,6 +29,12 @@ namespace :update_homework do changesets = g.commits(project.gpid, :ref_name => default_branch) changesets_latest_coimmit = changesets[0] unless changesets[0].blank? + project_score = project.project_score + if project_score.nil? + ProjectScore.create(:project_id => project.id, :score => false) + else + project_score.update_column(:commit_time, changesets_latest_coimmit.created_at.to_time) + end if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S') #if format_time(time) < format_time(changesets_latest_coimmit.created_at) time = changesets_latest_coimmit.created_at.to_time From 552f1a2709ed3053eb22a181e14b72958067179f Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 15 Jul 2016 19:47:33 +0800 Subject: [PATCH 28/32] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=89=88=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/wechat.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/config/wechat.yml b/config/wechat.yml index 6b3799706..d839f1606 100644 --- a/config/wechat.yml +++ b/config/wechat.yml @@ -20,26 +20,26 @@ default: &default encrypt_mode: false # if true must fill encoding_aes_key #production -# encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw" -# jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket" -# -# #template -# binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc" -# journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM" -# homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps" -# class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA" -# create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw" - - #test - encoding_aes_key: "QyocNOkRmrT5HzBpCG54EVPUQjk86nJapXNVDQm6Yy6" + encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw" jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket" #template - binding_succ_notice: "n4KLwcWNrIMYkKxWL2hUwzunm5RTT54EbWem2MIUapU" - journal_notice: "XpHHYkqSGkwuF9vHthRdmPQLvCFRQ4_NbRBP12T7ciE" - homework_message_notice: "Kom0TsYYKsNKCS6luweYVRo9z-mH0wRPr24b1clGCPQ" - class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk" - create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I" + binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc" + journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM" + homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps" + class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA" + create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw" + + #test +# encoding_aes_key: "QyocNOkRmrT5HzBpCG54EVPUQjk86nJapXNVDQm6Yy6" +# jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket" +# +# #template +# binding_succ_notice: "n4KLwcWNrIMYkKxWL2hUwzunm5RTT54EbWem2MIUapU" +# journal_notice: "XpHHYkqSGkwuF9vHthRdmPQLvCFRQ4_NbRBP12T7ciE" +# homework_message_notice: "Kom0TsYYKsNKCS6luweYVRo9z-mH0wRPr24b1clGCPQ" +# class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk" +# create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I" production: <<: *default From c14979d878575c98685138c8f271028981336d5e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 19:53:38 +0800 Subject: [PATCH 29/32] assets --- app/views/wechats/user_activities.html.erb | 50 +++++++++++----------- public/javascripts/wechat/build/app.min.js | 6 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 941cbed4a..6c3da9cf4 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -28,31 +28,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/javascripts/wechat/build/app.min.js b/public/javascripts/wechat/build/app.min.js index 6511ffb0e..b704dfb6e 100644 --- a/public/javascripts/wechat/build/app.min.js +++ b/public/javascripts/wechat/build/app.min.js @@ -7,13 +7,13 @@ app.controller("ClassController",["$scope","config","$http","auth","$location"," app.controller("ClassListController",["$scope","config","auth","$http","$location","alertService","rms",function(e,s,a,t,o,l,n){var c=e;c.syllabuses=n.get("syllabuses")||[],c.alertService=l.create();var i=function(){t.get(s.apiUrl+"syllabuses?token="+a.token()).then(function(e){console.log(e.data),c.syllabuses=e.data.data,n.save("syllabuses",c.syllabuses)})};c.syllabuses.length<=0&&i(),c.goClass=function(e){console.log(e),o.path("/class").search({id:e})},c.newClass=function(){t.post(s.apiUrl+"syllabuses/auth",{token:a.token()}).then(function(e){console.log(e.data),0==e.data.auth?c.alertService.showMessage("提示","非教师身份不能创建课程哦~"):o.path("/new_class")})},c.goResource=function(){o.path("/myresource")},c.joinClass=function(){var e=window.prompt("请输入5位班级邀请码(不区分大小写)");e&&5==e.length?t.post(s.apiUrl+"courses/join",{token:a.token(),invite_code:e}).then(function(e){console.log(e.data),0!=e.data.status?c.alertService.showMessage("错误",e.data.message):(c.alertService.showMessage("提示","加入课程成功"),i())}):e&&c.alertService.showMessage("错误","邀请码格式不正确")},c.onSetting=function(e){console.log(e),n.save("current_edit_syllobus",e),o.path("/edit_class").search({id:e.id})}}]); app.controller("CourseNoticeController",["$scope","$http","$routeParams","auth","common",function(o,e,t,n,a){a.init({id:t.id,scope:o,type:"newss",replyType:"News",loadCallback:function(e){o.news=e.data},replyCallback:function(){}})}]); app.controller("DiscussionController",["$scope","$http","$routeParams","auth","common",function(o,s,a,e,n){n.init({id:a.id,scope:o,type:"messages",replyType:"Message",loadCallback:function(s){o.discussion=s.data},replyCallback:function(){}})}]); -app.controller("EditClassController",["$scope","$http","auth","config","alertService","$location","$routeParams","rms",function(s,e,a,l,t,o,r,u){var n=s;n.syllabus=u.get("current_edit_syllobus");var i=r.id;if(n.syllabus||e.get(l.apiUrl+"syllabuses/"+i+"?token="+a.token()).then(function(s){if(console.log(s.data),n.syllabus=s.data.data,n.syllabus){for(var e in n.syllabus.courses){var a=n.syllabus.courses[e];a.tmpname=a.name}n.syllabus.tmptitle=n.syllabus.title}}),console.log(n.syllabus),n.syllabus){for(var c in n.syllabus.courses){var d=n.syllabus.courses[c];d.tmpname=d.name}n.syllabus.tmptitle=n.syllabus.title}n.alertService_1=t.create(),n.alertService_2=t.create(),n.addClass=function(){n.syllabus.courses.push({can_setting:!0})},n.deleteClass=function(s){var t=n.syllabus.courses[s];t.id>0?n.alertService_2.showMessage("提示","您确定要删除该班级吗?",function(){e.post(l.apiUrl+"courses/"+t.id+"/del",{token:a.token()}).then(function(e){0!=e.data.status?n.alertService_1.showMessage("出错了",e.data.message):n.alertService_1.showMessage("提示","删除班级成功",function(){n.syllabus.courses.splice(s,1)}),console.log(e.data.data)})}):n.syllabus.courses.splice(s,1)},n.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var r=[],c=[];for(var d in n.syllabus.courses){var b=n.syllabus.courses[d];b.id?b.tmpname!=b.name&&c.push({id:b.id,name:b.tmpname}):r.push(b.tmpname)}e.post(l.apiUrl+"syllabuses/"+i+"/edit",{token:a.token(),id:i,title:n.syllabus.tmptitle,add_courses:r,modify_courses:c}).then(function(s){0!=s.data.status?n.alertService_1.showMessage("出错了",s.data.message):n.alertService_1.showMessage("提示","保存课程成功",function(){u.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})}}]); +app.controller("EditClassController",["$scope","$http","auth","config","alertService","$location","$routeParams","rms",function(s,e,a,l,t,o,r,n){var u=s;u.syllabus=n.get("current_edit_syllobus");var i=r.id;if(u.syllabus||e.get(l.apiUrl+"syllabuses/"+i+"?token="+a.token()).then(function(s){if(console.log(s.data),u.syllabus=s.data.data,u.syllabus){for(var e in u.syllabus.courses){var a=u.syllabus.courses[e];a.tmpname=a.name}u.syllabus.tmptitle=u.syllabus.title}}),console.log(u.syllabus),u.syllabus){for(var c in u.syllabus.courses){var d=u.syllabus.courses[c];d.tmpname=d.name}u.syllabus.tmptitle=u.syllabus.title}u.alertService_1=t.create(),u.alertService_2=t.create(),u.addClass=function(){u.syllabus.courses.push({can_setting:!0})},u.deleteClass=function(s){var t=u.syllabus.courses[s];t.id>0?u.alertService_2.showMessage("提示","您确定要删除该班级吗?",function(){e.post(l.apiUrl+"courses/"+t.id+"/del",{token:a.token()}).then(function(e){0!=e.data.status?u.alertService_1.showMessage("出错了",e.data.message):u.alertService_1.showMessage("提示","删除班级成功",function(){u.syllabus.courses.splice(s,1)}),console.log(e.data.data)})}):u.syllabus.courses.splice(s,1)},u.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var r=[],c=[];for(var d in u.syllabus.courses){var b=u.syllabus.courses[d];b.id?b.tmpname!=b.name&&c.push({id:b.id,name:b.tmpname}):r.push(b.tmpname)}e.post(l.apiUrl+"syllabuses/"+i+"/edit",{token:a.token(),id:i,title:u.syllabus.tmptitle,add_courses:r,modify_courses:c}).then(function(s){0!=s.data.status?u.alertService_1.showMessage("出错了",s.data.message):u.alertService_1.showMessage("提示","保存课程成功",function(){n.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})},u.fadeText=function(){s.change=!0}}]); app.controller("HomeworkController",["$scope","$http","$routeParams","auth","common",function(o,e,l,n,r){r.init({id:l.id,scope:o,type:"whomeworks",replyType:"HomeworkCommon",loadCallback:function(e){console.log(e),o.homework=e.data},replyCallback:function(){}})}]); app.controller("InviteCodeController",["$scope","$http","$routeParams","config","auth",function(t,e,i,n,o){var a=t;a.course={};var c=i.id;e.get(n.apiUrl+"courses/"+c+"?token="+o.token()).then(function(t){console.log(t.data),a.course=t.data.data}),a.share=function(){window.WeixinJSBridge.invoke("sendAppMessage",{appid:"wxf694495398c7d470",type:"link",data_url:"",img_url:"http://pnewsapp.tc.qq.com/newsapp_bt/0/9963967/640",img_height:370,img_width:550,link:"http://view.inews.qq.com/a/WXN2013101101385701",desc:"desc",title:"title"},function(t){})}}]); app.controller("IssueController",["$scope","$http","$routeParams","auth","common",function(o,e,l,s,t){t.init({id:l.id,scope:o,type:"issues",replyType:"Issue",loadCallback:function(e){console.log(e),o.issue=e.data},replyCallback:function(){}})}]); app.controller("JournalsController",["$scope","$http","$routeParams","auth","common",function(o,a,e,l,n){n.init({id:e.id,scope:o,type:"journal_for_messages",replyType:"JournalsForMessage",loadCallback:function(a){o.message=a.data},replyCallback:function(){}})}]); app.controller("LoginController",["$scope","$http","$location","$routeParams","alertService","config","auth","session",function(e,o,t,a,i,n,s,l){s.get_bind().then(function(){t.path("/activities")}),a.code&&l.save("code",a.code);var r=e;r.loginFailed=!1,r.alertService=i.create(),r.findPwdDialog=i.create(),r.login=function(a,i){return a.$setSubmitted(),console.log(i),a.$valid?(console.log(apiUrl+"auth"),void o.post(n.apiUrl+"users/wxbind",{login:i.login,password:i.password}).then(function(o){console.log(o.data),r.loginFailed=0!=o.data.status,e.loginFailed?r.alertService.showMessage("出错了",o.data.message):r.alertService.showMessage("提示",o.data.message,function(){t.path("/activities")})})["catch"](function(e){r.alertService.showMessage("出错了",e)})):void console.log(a.$error)},r.showBox=function(){r.findPwdDialog.showMessage("提示","请访问www.trustie.net获取密码,谢谢!")},r.goReg=function(){t.path("/reg")}}]); -app.controller("MyResourceController",["$scope","$http","auth","config","$location",function(e,o,t,n,r){var s=e;s.menus=["课件","作业","测验"],s.resources=null,s.homeworks=null,s.exercise=null,s.searchText="",s.tab=function(e){s.currentTab=e,s.searchText="",1==e&&(!s.resources||s.resources.length<=0)?o.get(n.apiUrl+"resources?token="+t.token()).then(function(e){console.log(e.data),s.resources=e.data.data}):2==e&&(!s.homeworks||s.homeworks.length<=0)?o.get(n.apiUrl+"resources/homeworks?token="+t.token()).then(function(e){console.log(e.data),s.homeworks=e.data.data}):3==e&&(!s.exercise||s.exercise.length<=0)&&o.get(n.apiUrl+"resources/exercies?token="+t.token()).then(function(e){console.log(e.data),s.exercise=e.data.data})},s.tab(1),s.sendFile=function(e){r.path("/send_class_list").search({id:e.id})}}]); +app.controller("MyResourceController",["$scope","$http","auth","config","$location","rms",function(e,a,o,s,r,t){var c=e;c.menus=["课件","作业","测验"],c.resources=[],c.homeworks=[],c.exercise=[],c.resources_tag=!1,c.homeworks_tag=!1,c.exercises_tag=!1,c.page=t.get("page")||0,c.resources=t.get("resources")||[],c.has_more=t.get("has_more"),c.homework_page=t.get("homework_page")||0,c.homeworks=t.get("homeworks")||[],c.homework_has_more=t.get("homework_has_more"),c.exercise_page=t.get("exercise_page")||0,c.exercise=t.get("exercise")||[],c.exercise_has_more=t.get("exercise_has_more"),c.searchText="",c.sendFile=function(e){r.path("/send_class_list").search({id:e.id})},c.loadResourceData=function(e,s){1==e?(c.page=s,a({method:"POST",url:apiUrl+"resources",data:{token:o.token(),page:s}}).then(function(e){c.resources_tag=!0,e.data.page>0?c.resources=c.resources.concat(e.data.data):c.resources=e.data.data,t.save("resources",c.resources),c.has_more=e.data.count+10*e.data.page0?c.homeworks=c.homeworks.concat(e.data.data):c.homeworks=e.data.data,t.save("homeworks",c.homeworks),c.homework_has_more=e.data.count+10*e.data.page0?c.exercise=c.exercise.concat(e.data.data):c.exercise=e.data.data,t.save("exercise",c.exercise),c.exercise_has_more=e.data.count+10*e.data.page Date: Fri, 15 Jul 2016 20:25:08 +0800 Subject: [PATCH 30/32] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=89=88=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/wechat.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/wechat.yml b/config/wechat.yml index d839f1606..9021a5c8b 100644 --- a/config/wechat.yml +++ b/config/wechat.yml @@ -8,12 +8,12 @@ default: &default #secret: "743e038392f1d89540e95f8f7645849a" #production - #appid: "wx8e1ab05163a28e37" - #secret: "beb4d3bc4b32b3557811680835357841" + appid: "wx8e1ab05163a28e37" + secret: "beb4d3bc4b32b3557811680835357841" #test - appid: "wxc09454f171153c2d" - secret: "dff5b606e34dcafe24163ec82c2715f8" +# appid: "wxc09454f171153c2d" +# secret: "dff5b606e34dcafe24163ec82c2715f8" token: "123456" access_token: "1234567" From 3198f8a4734d601f51cad9be3912a39c88675c38 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jul 2016 11:17:22 +0800 Subject: [PATCH 31/32] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95=E4=B8=AD=EF=BC=9A?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E6=88=96=E8=80=85=E9=9D=9E?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=A2=84=E8=A7=88=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=A6=E6=83=85500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- app/helpers/repositories_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 4764d1cd7..25d7b2a15 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -49,7 +49,7 @@ class RepositoriesController < ApplicationController helper :project_score #@root_path = RepositoriesHelper::ROOT_PATH $g=Gitlab.client - require 'net/ssh' + # require 'net/ssh' rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed def new diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index b525c4aed..72bee4843 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -65,7 +65,7 @@ module RepositoriesHelper # 获取diff内容行号 def diff_line_num content - content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i + content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i end # 处理内容 From 097374df1483fc5d6b8fff5920c44f33e7bba38d Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Jul 2016 11:25:45 +0800 Subject: [PATCH 32/32] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=8F=98=E9=87=8F=EF=BC=8C=E9=80=9A=E8=BF=87filter=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 25d7b2a15..6b41e39fc 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis] # 链接gitlab - before_filter :connect_gitlab, :only => [:quality_analysis, :show] + before_filter :connect_gitlab, :only => [:quality_analysis, :show, :commit_diff, :find_project_repository] # 版本库新增权限 before_filter :show_rep, :only => [:show] accept_rss_auth :revisions @@ -48,8 +48,7 @@ class RepositoriesController < ApplicationController include RepositoriesHelper helper :project_score #@root_path = RepositoriesHelper::ROOT_PATH - $g=Gitlab.client - # require 'net/ssh' + require 'net/ssh' rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed def new @@ -548,8 +547,8 @@ update # 每次提交对应的文件差异 def commit_diff - @commit_diff = $g.commit_diff(@project.gpid, params[:changeset]) - @commit_details = $g.commit(@project.gpid, params[:changeset]) + @commit_diff = @g.commit_diff(@project.gpid, params[:changeset]) + @commit_details = @g.commit(@project.gpid, params[:changeset]) render :layout => 'base_projects' end @@ -700,7 +699,8 @@ update (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s # gitlab端获取默认分支 - gitlab_branchs = $g.project(@project.gpid).default_branch + g = Gitlab.client + gitlab_branchs = g.project(@project.gpid).default_branch @project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip) @rev_to = params[:rev_to] unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)