From 22da03a1e068405957f5d8cc99a533a108ae85cd Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 13 Sep 2016 13:44:26 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=90=8E=E8=B7=B3=E5=85=A5=E7=BC=96=E8=BE=91=E8=B5=84=E6=96=99?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E8=BF=9B=E5=85=A5=E5=88=AB=E7=9A=84?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=97=A0=E5=A7=93=E5=90=8D=E5=88=99=E8=B7=B3?= =?UTF-8?q?=E5=85=A5=E7=BC=96=E8=BE=91=E8=B5=84=E6=96=99=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 29 ++++++++++++++------ public/assets/wechat/edit_userinfo.html | 8 +++++- public/javascripts/wechat/controllers/reg.js | 3 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 0c6eb0910..cd911bcd6 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -456,18 +456,29 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - # if params[:state].match("review_class_member") || params[:state].match("review_project_member") + if !(params[:state] == "invite_code" || params[:state] == "project_invite_code" || params[:state] == "blog_comment" || params[:state] == "course_notice" || params[:state] == "project_discussion" || params[:state] == "course_discussion" || params[:state] == "homework" || params[:state] == "issues" || params[:state] == "journal_for_message") + uw = user_binded?(open_id) + if uw + user = uw.user + lastname = user.lastname + end + end + + if lastname && lastname == "" + @path = '/edit_userinfo' + else @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] - # end - if useridstr - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return - elsif params[:id] - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return - else - redirect_to "/wechat/user_activities##{@path}" and return + + if useridstr + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return + elsif params[:id] + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return + else + redirect_to "/wechat/user_activities##{@path}" and return + end + # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return end - # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return end end render 'wechats/user_activities', layout: nil diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index e299b8feb..f4178fee4 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -11,7 +11,7 @@
-
姓名
+
姓名
性别 @@ -33,6 +33,12 @@ 电子邮箱地址不合法
+
+ 提示 + +
取消 确定 diff --git a/public/javascripts/wechat/controllers/reg.js b/public/javascripts/wechat/controllers/reg.js index 1247cd931..34ced26d5 100644 --- a/public/javascripts/wechat/controllers/reg.js +++ b/public/javascripts/wechat/controllers/reg.js @@ -36,7 +36,8 @@ app.controller('RegController', ['$scope', '$http', '$location', 'alertService', vm.successDialog.showMessage("提示","注册且绑定微信成功", function(){ // $location.path("/activities"); // window.WeixinJSBridge.call('closeWindow'); - wx.closeWindow(); +// wx.closeWindow(); + $location.path("/edit_userinfo"); }); } }, function (response) { From f882c0e8c31c4522ce998107a62e3563d5841aed Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 13 Sep 2016 14:11:41 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/activities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 4d07c23f8..6ce01aac0 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -36,7 +36,7 @@ module Mobile principal_types = "JournalsForMessage" watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(',')) user_ids = "(" + user.id.to_s + watched_user_ids + ")" - watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") + watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? "-1" :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") blog_ids = "(" + watched_user_blog_ids + ")" if container_type == "Course" From 9002844188e3dacc0e3b424ea7b0efe54d443703 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 13 Sep 2016 16:18:57 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E6=96=B0=E7=89=88=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 + app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 18 +++ app/views/homework_common/edit.html.erb | 14 +++ app/views/users/_user_group_attr.html.erb | 52 ++++---- .../users/_user_homework_attachment.html.erb | 11 -- app/views/users/_user_homework_form.html.erb | 116 +++++++++--------- .../users/_user_programing_attr.html.erb | 83 ++++++++----- app/views/users/user_select_homework.js.erb | 10 +- public/javascripts/course.js | 51 ++++++++ public/javascripts/new_user.js | 51 ++++++++ public/stylesheets/css/common.css | 1 + 12 files changed, 275 insertions(+), 135 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6704f7401..0fddd7e6c 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -85,6 +85,7 @@ class HomeworkCommonController < ApplicationController homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] + @homework.homework_type = params[:homework_type].to_i || @homework.homework_type anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0 if anonymous != @homework.anonymous_comment if anonymous == 1 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 559f29235..2a91b75ae 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1052,7 +1052,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 94b0b2c6e..a370f226c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3521,3 +3521,21 @@ def get_forge_act_message(act, type) format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) end +#作业类型 +def homework_type_option + type = [] + option1 = [] + option1 << "普通作业" + option1 << 1 + option2 = [] + option2 << "编程作业" + option2 << 2 + option3 = [] + option3 << "分组作业" + option3 << 3 + type << option1 + type << option2 + type << option3 + type +end + diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 1bd71e7a9..4a3de027b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -41,6 +41,20 @@
+ <% committed_work_count = @homework.student_works.has_committed.count %> + <% stu_pro_count = @homework.student_work_projects.count %> + <% if committed_work_count != 0 %> + <% if @homework.homework_type == 1 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。

+ <% elsif @homework.homework_type == 2 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。

+ <% elsif @homework.homework_type == 3 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置。

+ <% end %> + <% elsif stu_pro_count != 0 && @homework.homework_type == 3 %> +

已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。

+ <% end %> + <%= form_for @homework do |f| %> diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index 6d09f6896..4596ef411 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -1,27 +1,27 @@ -分组设置 - -
- 每组最小人数: - 人 - +
+
分组设置: +
每组最小人数: + />人 +
+
每组最大人数: + />人 +
+ +
+
+ +

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

+
+
+
-
- 每组最大人数: - 人 - -
-

-
- -

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

-
-
- 确定 -
-
- 取消 -
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 6051d8de9..4f35326b0 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -71,17 +71,6 @@ 上传附件 <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %> - <% if defined?(has_program) && has_program %> -
- 编程 - -
- <% end %> - <% if defined?(has_group) && has_group %> -
- 分组 -
- <% end %>
<% content_for :header_tags do %> diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index b3f9970c6..231c78b91 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,3 +1,4 @@ +<% not_allow_select = edit_mode && homework.student_works.has_committed.count != 0 %> <% content_for :header_tags do %> <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> @@ -5,14 +6,31 @@ - - - - - - - - <% unless edit_mode %>