From 10017d2c69dfab0bae482d71c7a5c4398e31fc5f Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 5 Sep 2016 11:02:34 +0800 Subject: [PATCH 01/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A3=E9=99=A4=E7=BB=91=E5=AE=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 21 +++++++++++++++++++++ app/services/users_service.rb | 7 ++++--- config/menu.yml.production | 4 ++++ config/menu.yml.test | 4 ++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 54486221e..0c6eb0910 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -167,6 +167,27 @@ class WechatsController < ActionController::Base end end + on :click, with: 'UNBIND' do |request, key| + uw = user_binded?(request[:FromUserName]) + unless uw + request.reply.text "您还未绑定帐号" + else + #解除绑定 + us = UsersService.new + us.wechat_unbind uw + + tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect" + news = (1..1).each_with_object([]) { |n, memo| memo << { title: '重新绑定提醒', + content: "尊敬的用户,您已解除绑定。\n解除时间:#{format_time(Time.now)}\n点击进入重新绑定!"} } + request.reply.news(news) do |article, n, index| # article is return object + url = tmpurl + article.item title: "#{n[:title]}", + description: n[:content], + url: url + end + end + end + def join_class_request(request) openid = request[:FromUserName] wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 5789befe5..abc0d513a 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -319,8 +319,9 @@ class UsersService my_jours_arr end - - - + def wechat_unbind uw + uw.user_id = nil + uw.delete + end end diff --git a/config/menu.yml.production b/config/menu.yml.production index 8929d002e..d825a8727 100644 --- a/config/menu.yml.production +++ b/config/menu.yml.production @@ -30,3 +30,7 @@ button: type: "click" name: "联系我们" key: "FEEDBACK" + - + type: "click" + name: "解除绑定" + key: "UNBIND" diff --git a/config/menu.yml.test b/config/menu.yml.test index 303b30c26..4508e843c 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -30,3 +30,7 @@ button: type: "click" name: "联系我们" key: "FEEDBACK" + - + type: "click" + name: "解除绑定" + key: "UNBIND" From 6f7b40b5addb9b5defc00e2a45695e189c62714f Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 5 Sep 2016 14:49:22 +0800 Subject: [PATCH 02/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/new_comment.rb | 193 +++++++++++++++++++---------- 1 file changed, 125 insertions(+), 68 deletions(-) diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 6d46b2f59..cd0a1367c 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -78,22 +78,25 @@ module Mobile subscribe = 0 #默认未关注 #-------------------获取用户是否关注此公众号----------------------------- - openid = session[:wechat_openid] - raise "无法获取到openid,请在微信中打开本页面" unless openid - user_info = Wechat.api.user(openid) - Rails.logger.info "user_info!!!!!!!!!" - Rails.logger.info user_info - subscribe = user_info["subscribe"] + # openid = session[:wechat_openid] + # raise "无法获取到openid,请在微信中打开本页面" unless openid + # user_info = Wechat.api.user(openid) + # Rails.logger.info "user_info!!!!!!!!!" + # Rails.logger.info user_info + # subscribe = user_info["subscribe"] + subscribe = "123" status = 0 tip = 0 #0班级1项目 type = params[:type] result = 1 + + #0回复 1回复的回复 + reply_type = params[:reply_type] + if params[:content]!="" && current_user case type when "HomeworkCommon" - homework_common = HomeworkCommon.find(params[:id]) - #如果是私有的 并且不是成员则不能回复 # is_public = homework_common.course.is_public # if is_public == 0 && !current_user.member_of_course?(homework_common.course) @@ -106,15 +109,27 @@ module Mobile # result = 2 # end # end - feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id]) - if (feedback.errors.empty?) - homework_common.update_column(:updated_at, Time.now) - result = 2 + if reply_type == nil || reply_type == 0 + homework_common = HomeworkCommon.find(params[:id]) + feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id]) + if (feedback.errors.empty?) + homework_common.update_column(:updated_at, Time.now) + result = 2 + end + else + #二级回复 + reply = JournalsForMessage.find params[:id].to_i + homework_common = HomeworkCommon.find reply.jour_id + + options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i} + feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, options) + if (feedback.errors.empty?) + homework_common.update_column(:updated_at, Time.now) + result = 2 + end end when "News" - news = News.find(params[:id]) - # if news.project # if news.project.is_public == false && !current_user.member_of?(news.project) # status = -1 @@ -126,19 +141,26 @@ module Mobile # tip = 0 # end # end - if status == 0 - comment = Comment.new - comment.comments = params[:content] - comment.author = current_user - if news.comments << comment - result = 2 + if reply_type == nil || reply_type == 0 + news = News.find(params[:id]) + comment = Comment.new + comment.comments = params[:content] + comment.author = current_user + if news.comments << comment + result = 2 + end + else + #二级回复 + comment = Comment.find(params[:id]) + news = News.find comment.commented_id + new_comment = news.comments.build(:author_id => current_user.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id) + if new_comment.save + result = 2 + end end end when "Message" - message = Message.find(params[:id]) - board = Board.find(message.board_id) - # if message.project # if message.project.is_public == false && !current_user.member_of?(message.project) # status = -1 @@ -152,20 +174,25 @@ module Mobile # end if status == 0 - topic = message.root - reply = Message.new - reply.author = current_user - reply.board = board - reply.content = params[:content] - reply.parent_id = params[:id] - reply.subject = "RE: #{topic.subject}" - if topic.children << reply - result = 2 - end + # if reply_type == nil || reply_type == 0 + message = Message.find(params[:id]) + board = Board.find(message.board_id) + topic = message.root + reply = Message.new + reply.author = current_user + reply.board = board + reply.content = params[:content] + reply.parent_id = params[:id] + reply.subject = "RE: #{topic.subject}" + if topic.children << reply + result = 2 + end + # else + #二级回复 + + # end end when "JournalsForMessage" - jour = JournalsForMessage.find params[:id] - # if jour.jour_type == "Project" # if jour.project.is_public == false && !current_user.member_of?(jour.project) # status = -1 @@ -179,50 +206,80 @@ module Mobile # end if status == 0 - parent_id = params[:id] - author_id = current_user.id - reply_user_id = jour.user_id - reply_id = params[:id] - content = params[:content] - options = {:user_id => author_id, - :status => true, - :m_parent_id => parent_id, - :m_reply_id => reply_id, - :reply_id => reply_user_id, - :notes => content, - :is_readed => false} - jfm = jour.user.add_jour(nil, nil, nil, options) - if jfm.errors.empty? - (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) - result = 2 - end + # if reply_type == nil || reply_type == 0 + jour = JournalsForMessage.find params[:id] + parent_id = params[:id] + author_id = current_user.id + reply_user_id = jour.user_id + reply_id = params[:id] + content = params[:content] + options = {:user_id => author_id, + :status => true, + :m_parent_id => parent_id, + :m_reply_id => reply_id, + :reply_id => reply_user_id, + :notes => content, + :is_readed => false} + jfm = jour.user.add_jour(nil, nil, nil, options) + if jfm.errors.empty? + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) + result = 2 + end + # else + #二级回复 + + # end end when 'Issue' - issue = Issue.find params[:id] - # if issue.project.is_public == false && !current_user.member_of?(issue.project) # status = -1 # tip = 1 # end if status == 0 - is_jour = Journal.new - is_jour.user_id = current_user.id - is_jour.notes = params[:content] - is_jour.journalized = issue - if is_jour.save - result = 2 + if reply_type == nil || reply_type == 0 + issue = Issue.find params[:id] + is_jour = Journal.new + is_jour.user_id = current_user.id + is_jour.notes = params[:content] + is_jour.journalized = issue + if is_jour.save + result = 2 + end + else + #二级回复 + + + end end when 'BlogComment' - blog = BlogComment.find(params[:id]).root - blogComment = BlogComment.new - blogComment.author = current_user - blogComment.blog = blog.blog - blogComment.content = params[:content] - blogComment.title = "RE: #{blog.title}" - if blog.children << blogComment - result = 2 + if reply_type == nil || reply_type == 0 + blog = BlogComment.find(params[:id]).root + blogComment = BlogComment.new + blogComment.author = current_user + blogComment.blog = blog.blog + blogComment.content = params[:content] + blogComment.title = "RE: #{blog.title}" + if blog.children << blogComment + result = 2 + end + else + #二级回复 + blog = BlogComment.find(params[:id]).root + blogComment = BlogComment.new + blogComment.author = current_user + blogComment.blog = blog.blog + blogComment.content = params[:content] + blogComment.title = "RE: #{blog.title}" + parent = BlogComment.find params[:id] + blogComment.parent_id = params[:id] #被回复的回复 + blogComment.reply_id = parent.author.id #被回复者id + + if parent.children << blogComment + result = 2 + end + end end if result == 2 From 252851b4adc7eb0e74f23ff6ceeb74af803b6484 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 5 Sep 2016 16:36:43 +0800 Subject: [PATCH 03/38] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_syllabus.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 9bd4a25c0..445af2a8b 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -41,9 +41,9 @@

位置:   - <%= link_to User.current, user_path(User.current.id), :class => 'sy_cgrey', :target => '_blank' %> + <%= link_to @syllabus.user.show_name, user_path(@syllabus.user), :class => 'sy_cgrey', :target => '_blank' %>  >  - <%= link_to '课程', user_courselist_user_path(User.current.id), :class => "sy_cgrey", :target => '_blank' %> + <%= link_to '课程', user_courselist_user_path(@syllabus.user), :class => "sy_cgrey", :target => '_blank' %>  >  <%= link_to @syllabus.title, syllabus_path(@syllabus.id), :class => "sy_cgrey" %>

From a07462076da2644a412eec74698c755aaf58238e Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 5 Sep 2016 16:38:25 +0800 Subject: [PATCH 04/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=90=8E=E5=8F=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/new_comment.rb | 26 +++++++----- app/services/courses_service.rb | 64 +++++++++++++----------------- 2 files changed, 43 insertions(+), 47 deletions(-) diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index cd0a1367c..b17c9204a 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -78,13 +78,12 @@ module Mobile subscribe = 0 #默认未关注 #-------------------获取用户是否关注此公众号----------------------------- - # openid = session[:wechat_openid] - # raise "无法获取到openid,请在微信中打开本页面" unless openid - # user_info = Wechat.api.user(openid) - # Rails.logger.info "user_info!!!!!!!!!" - # Rails.logger.info user_info - # subscribe = user_info["subscribe"] - subscribe = "123" + openid = session[:wechat_openid] + raise "无法获取到openid,请在微信中打开本页面" unless openid + user_info = Wechat.api.user(openid) + Rails.logger.info "user_info!!!!!!!!!" + Rails.logger.info user_info + subscribe = user_info["subscribe"] status = 0 tip = 0 #0班级1项目 @@ -248,9 +247,16 @@ module Mobile end else #二级回复 - - - + issue = Issue.find params[:id] + is_jour = Journal.new + is_jour.user_id = current_user.id + is_jour.notes = params[:content] + is_jour.reply_id = params[:id] + is_jour.parent_id = params[:id] + is_jour.journalized = issue + if is_jour.save + result = 2 + end end end when 'BlogComment' diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index f184fa923..24e15f369 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -941,46 +941,36 @@ class CoursesService :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation} end - - def student_homework_score(groupid,course_id, nums, score_sort_by) - #teachers = find_course_teachers(@course) - #start_from = start_from * nums + def student_homework_score(groupid,course_id, nums, score_sort_by, sort_type = 'score') sql_select = "" if groupid == 0 - if nums == 0 - sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches - WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id - AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id - UNION all - SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND - students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND - members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} ) - ) - GROUP BY members.user_id ORDER BY score #{score_sort_by}" - else - sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches - WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id - AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id - UNION all - SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND - students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND - members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} ) - ) - GROUP BY members.user_id ORDER BY score #{score_sort_by} " #limit #{start_from}, #{nums}" - - end + sql_select = "SELECT members.*,( + SELECT SUM(student_works.work_score) + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = course_id + AND student_works.user_id = members.user_id + ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{course_id} AND ccs.user_id = members.user_id + ) AS act_score + FROM members + JOIN students_for_courses + ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id + WHERE members.course_id = #{course_id} ORDER BY #{sort_type} #{score_sort_by}" else - sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches - WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id - and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) - GROUP BY members.user_id - UNION all - SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} - and members.course_group_id = #{groupid} AND - students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND - members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} ) - ) - GROUP BY members.user_id ORDER BY score #{score_sort_by}" + sql_select = "SELECT members.*,( + SELECT SUM(student_works.work_score) + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = #{course_id} + AND student_works.user_id = members.user_id + ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{course_id} AND ccs.user_id = members.user_id + ) AS act_score + FROM members + JOIN students_for_courses + ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id + WHERE members.course_id = #{course_id} AND members.course_group_id = #{groupid} ORDER BY #{sort_type} #{score_sort_by}" end sql = ActiveRecord::Base.connection() homework_scores = Member.find_by_sql(sql_select) From f5ef2bac50cb9daa1c30f0e06862cbb1410195ae Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 5 Sep 2016 17:06:25 +0800 Subject: [PATCH 05/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=90=8E=E5=8F=B0=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/new_comment.rb | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index b17c9204a..22b654e1b 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -93,6 +93,8 @@ module Mobile #0回复 1回复的回复 reply_type = params[:reply_type] + update_id = 0 + if params[:content]!="" && current_user case type when "HomeworkCommon" @@ -114,6 +116,7 @@ module Mobile if (feedback.errors.empty?) homework_common.update_column(:updated_at, Time.now) result = 2 + update_id = homework_common.id end else #二级回复 @@ -125,6 +128,7 @@ module Mobile if (feedback.errors.empty?) homework_common.update_column(:updated_at, Time.now) result = 2 + update_id = homework_common.id end end @@ -148,6 +152,7 @@ module Mobile comment.author = current_user if news.comments << comment result = 2 + update_id = news.id end else #二级回复 @@ -156,6 +161,7 @@ module Mobile new_comment = news.comments.build(:author_id => current_user.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id) if new_comment.save result = 2 + update_id = news.id end end end @@ -185,6 +191,7 @@ module Mobile reply.subject = "RE: #{topic.subject}" if topic.children << reply result = 2 + update_id = topic.id end # else #二级回复 @@ -206,7 +213,7 @@ module Mobile if status == 0 # if reply_type == nil || reply_type == 0 - jour = JournalsForMessage.find params[:id] + jour = JournalsForMessage.find(params[:id]).root parent_id = params[:id] author_id = current_user.id reply_user_id = jour.user_id @@ -223,6 +230,7 @@ module Mobile if jfm.errors.empty? (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) result = 2 + update_id = jour.id end # else #二级回复 @@ -244,10 +252,12 @@ module Mobile is_jour.journalized = issue if is_jour.save result = 2 + update_id = issue.id end else #二级回复 - issue = Issue.find params[:id] + jour = Journal.find(params[:id]) + issue = jour.journalized is_jour = Journal.new is_jour.user_id = current_user.id is_jour.notes = params[:content] @@ -256,6 +266,7 @@ module Mobile is_jour.journalized = issue if is_jour.save result = 2 + update_id = issue.id end end end @@ -269,6 +280,7 @@ module Mobile blogComment.title = "RE: #{blog.title}" if blog.children << blogComment result = 2 + update_id = blog.id end else #二级回复 @@ -284,16 +296,17 @@ module Mobile if parent.children << blogComment result = 2 + update_id = blog.id end end end if result == 2 - update_course_activity_api(type,params[:id]) - update_user_activity_api(type,params[:id]) - update_org_activity_api(type,params[:id]) - update_forge_activity_api(type,params[:id]) - update_principal_activity_api(type,params[:id]) + update_course_activity_api(type,update_id) + update_user_activity_api(type,update_id) + update_org_activity_api(type,update_id) + update_forge_activity_api(type,update_id) + update_principal_activity_api(type,update_id) end else result = 3 From 05170c43ed0ad95695ad1a2899585a74810d2a5c Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 6 Sep 2016 09:17:29 +0800 Subject: [PATCH 06/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/app.html | 2 +- public/assets/wechat/blog_detail.html | 10 ++++++ public/assets/wechat/course_discussion.html | 10 ++++++ public/assets/wechat/course_notice.html | 10 ++++++ public/assets/wechat/homework_detail.html | 10 ++++++ public/assets/wechat/issue_detail.html | 10 ++++++ public/assets/wechat/jour_message_detail.html | 10 ++++++ public/assets/wechat/project_discussion.html | 10 ++++++ .../wechat/directives/multi_reply.js | 32 +++++++++++++++++++ .../wechat/directives/submit_start.js | 17 ---------- 10 files changed, 103 insertions(+), 18 deletions(-) create mode 100644 public/javascripts/wechat/directives/multi_reply.js delete mode 100644 public/javascripts/wechat/directives/submit_start.js diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html index fdd4d3276..099384593 100644 --- a/public/assets/wechat/app.html +++ b/public/assets/wechat/app.html @@ -40,7 +40,7 @@ - + diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 570bfb797..3b97e7df4 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -73,7 +73,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index a3f6ae496..b574deff7 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -71,7 +71,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 33e8e77be..c7ffbd3d5 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -86,7 +86,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index bf2a89f35..c33090554 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -75,7 +75,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 5b55ebba0..69e3138d6 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -92,7 +92,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 5b06a22aa..05fb4c6e9 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -70,7 +70,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index e0ee87d78..1ae009927 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -71,7 +71,17 @@
{{journal.praise_count}}
{{journal.praise_count}}
+
+ 回复 +
+
+
+ + + +
+
diff --git a/public/javascripts/wechat/directives/multi_reply.js b/public/javascripts/wechat/directives/multi_reply.js new file mode 100644 index 000000000..92abe5d6c --- /dev/null +++ b/public/javascripts/wechat/directives/multi_reply.js @@ -0,0 +1,32 @@ +/** + * Created by ttang on 2016/9/5. + */ +app.directive('multiReply',["$timeout",function(timer){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + timer(function(){ + $(".reply-icons").each(function(){ + $(this).toggle(function(){ + var multiInput = $(this).next().next(); + multiInput.show(); + multiInput.focus(); + $(".post-reply-input").val(""); + $(multiInput).bind("focus",function(){ + $("#post_input_1").hide(); + }); + },function(){ + var multiInput = $(this).next().next(); + $(this).next().next().hide(); + $(this).next().next().blur(); + $(".post-reply-input").val(""); + $(multiInput).bind("blur",function(){ + $("#post_input_1").show(); + }); + }); + }); + }) + } + } +}]); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/submit_start.js b/public/javascripts/wechat/directives/submit_start.js deleted file mode 100644 index cbdc469ab..000000000 --- a/public/javascripts/wechat/directives/submit_start.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Created by ttang on 2016/8/31. - */ -app.directive('submitStart',["$timeout",function(timer){ - return{ - restrict: 'A', - scope: {}, - link: function(scope, element){ - timer(function(){ - $("#manageDelete,.login-box").click(function(){ - element.removeClass("bg-grey c-white"); - element.addClass("link-blue2"); - }); - }) - } - } -}]); From c9c63eeb85291930f14c87ac6842bc2ac4c731db Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 6 Sep 2016 14:41:22 +0800 Subject: [PATCH 07/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B5=84=E6=96=99=E5=90=8E=E5=8F=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/new_comment.rb | 1 + app/api/mobile/apis/users.rb | 93 +++++++++++++++++++ app/services/users_service.rb | 7 ++ app/services/wechat_service.rb | 37 ++++++++ config/wechat.yml.template | 1 + config/wechat.yml.test | 1 + public/assets/wechat/blog_detail.html | 12 +-- public/assets/wechat/course_discussion.html | 12 +-- public/assets/wechat/course_notice.html | 12 +-- public/assets/wechat/homework_detail.html | 12 +-- public/assets/wechat/issue_detail.html | 12 +-- public/assets/wechat/jour_message_detail.html | 12 +-- public/assets/wechat/project_discussion.html | 12 +-- .../wechat/directives/input_on_change.js | 25 +++++ public/javascripts/wechat/others/factory.js | 22 +++-- 15 files changed, 220 insertions(+), 51 deletions(-) create mode 100644 public/javascripts/wechat/directives/input_on_change.js diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 22b654e1b..d98977661 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -313,6 +313,7 @@ module Mobile end present :result, result present :status, status + present :act_id, update_id present :tip, tip present :subscribe,subscribe end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 764dc957f..ed9115382 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -221,6 +221,99 @@ module Mobile present :data,my_jours,with:Mobile::Entities::Jours present :status,0 end + + desc "我的资料" + + params do + requires :token, type: String + end + + get 'my_userinfo' do + authenticate! + present :data, current_user, with: Mobile::Entities::User + present :status, 0 + end + + desc "我的资料" + + params do + requires :token, type: String + requires :nickname, type: String + requires :sex, type: Integer + requires :mail, type: String + end + + post 'edit_userinfo' do + authenticate! + user = current_user + status = 0 + message = "" + + #昵称 不能超过30个字符 + if params[:nickname].length > 30 then + message = "姓名不能超过30个字符!" + status = -1 + end + + if params[:mail].length > 60 then + message = "邮箱地址不能超过60个字符!" + status = -1 + end + + if !(params[:mail].match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i)) + message = "请输入正确的邮箱地址!" + status = -1 + end + + if status == 0 + # 修改邮箱的时候同步修改到gitlab + if user.mail != params[:mail] + g = Gitlab.client + begin + g.edit_user(user.gid, :email => params[:mail]) + rescue + logger.error "sync user's email of gitlab failed!" + end + end + + user.lastname = params[:nickname] + + se = user.extensions + + se.gender = params[:sex] + + if user.save && se.save + status = 0 + else + message = "保存数据失败!" + status = -1 + end + end + + if status == 0 + present :data, current_user, with: Mobile::Entities::User + present :status, 0 + else + present :status, -1 + present :message, message + end + end + + desc "解除绑定" + + params do + requires :token, type: String + end + + post 'unbind' do + authenticate! + + us = UsersService.new + us.wechat_unbind uw + + present :status, 0 + end + end end end diff --git a/app/services/users_service.rb b/app/services/users_service.rb index abc0d513a..c275e20dd 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -320,8 +320,15 @@ class UsersService end def wechat_unbind uw + user = uw.user + + #发重新绑定的微信模版消息 + ws = WechatService.new + ws.rebind_notice user.id, "login", user.id, "尊敬的用户,您已解除绑定。", "个人原因",format_time(Time.now), "点击进入重新绑定" + uw.user_id = nil uw.delete + end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 8adc1392f..c11826896 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -445,4 +445,41 @@ class WechatService end end + def rebind_notice(user_id, type, id, first, key1, key2,remark="") + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = { + touser:uw.openid, + template_id:Wechat.config.rebind_notice, + url:Wechat.config.auto_openid_url_1+Wechat.config.auto_openid_url_2+"login"+Wechat.config.auto_openid_url_3, + topcolor:"#FF0000", + data:{ + first: { + value:first, + color:"#707070" + }, + keyword1:{ + value:key1, + color:"#707070" + }, + keyword2:{ + value:key2, + color:"#707070" + }, + remark:{ + value:remark, + color:"#707070" + } + } + } + #data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[rebind_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + end + end \ No newline at end of file diff --git a/config/wechat.yml.template b/config/wechat.yml.template index 8ca6ac237..734ed0e51 100644 --- a/config/wechat.yml.template +++ b/config/wechat.yml.template @@ -26,6 +26,7 @@ default: &default join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg" project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI" at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4" + rebind_notice: "OYsiECfqUlHKlzF_X-pz_xsGh_vAAUunX0jYRdHlyFU" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/config/wechat.yml.test b/config/wechat.yml.test index 12cee4751..28c9d974e 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -26,6 +26,7 @@ default: &default join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8" at_notice: "p4HfyZQuF8O5bP_44RbbJS30SGojLJAuZEqp34iB4JU" + rebind_notice: "B97nOiW9cscB_d078I3k0jaPLHeJThTKUuxMoUnWZ2U" auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities" auto_openid_url_2: "&response_type=code&scope=snsapi_base&state=" diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 3b97e7df4..9b9141481 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -79,9 +79,9 @@
- - - + + +
@@ -96,9 +96,9 @@
- - - + + +
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index b574deff7..ab5c91a5b 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -77,9 +77,9 @@
- - - + + +
@@ -93,9 +93,9 @@
- - - + + +
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index c7ffbd3d5..b3d16ec26 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -92,9 +92,9 @@
- - - + + +
@@ -108,9 +108,9 @@
- - - + + +
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index c33090554..ad63d29f3 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -81,9 +81,9 @@
- - - + + +
@@ -97,9 +97,9 @@
- - - + + +
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 69e3138d6..4adc4ca66 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -98,9 +98,9 @@
- - - + + +
@@ -114,9 +114,9 @@
- - - + + +
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 05fb4c6e9..721a62727 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -76,9 +76,9 @@
- - - + + +
@@ -92,9 +92,9 @@
- - - + + +
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 1ae009927..e2ebc2231 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -77,9 +77,9 @@
- - - + + +
@@ -92,9 +92,9 @@
- - - + + +
diff --git a/public/javascripts/wechat/directives/input_on_change.js b/public/javascripts/wechat/directives/input_on_change.js new file mode 100644 index 000000000..43baa3828 --- /dev/null +++ b/public/javascripts/wechat/directives/input_on_change.js @@ -0,0 +1,25 @@ +app.directive('inputOnChange', function(){ + return{ + restrict: 'A', + scope: {}, + link: function (scope, element, attrs) { + var onChangeFunc = scope.$eval(attrs.inputOnChange); + element.bind('change', onChangeFunc); + + scope.uploadDown = function () { + var file = event.target.files[0]; + //判断类型是不是图片 + if (!/image\/\w+/.test(file.type)) { + alert("非图片"); + return; + } + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function (e) { + alert(this.result);//base64 + } + } + + } + } +}); \ No newline at end of file diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index d4e365321..37ca00114 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -94,7 +94,7 @@ app.factory('rms', function(){ }); app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){ - var addCommonReply = function(id, type, data,args, cb){ + var addCommonReply = function(id, type, data,args,reply_type, cb){ //先判断有没有绑定 // $http.post( // '/wechat/is_bind', @@ -116,7 +116,8 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc var userInfo = { type: type, content: temp, - token: auth.token() + token: auth.token(), + reply_type:reply_type }; //回复按钮禁用 data.disabled = true; @@ -146,24 +147,26 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc cb(response.data.subscribe); } + var act_id = response.data.act_id; + //保证内外回复数一致 activities = rms.get("activities") || []; course_activities = rms.get("course_activities") || []; project_activities = rms.get("project_activities") || []; for(var i in activities){ - if(activities[i].act_id == id){ + if(activities[i].act_id == act_id){ activities[i].reply_count += 1; break; } } for(var i in course_activities){ - if(course_activities[i].act_id == id){ + if(course_activities[i].act_id == act_id){ course_activities[i].reply_count += 1; break; } } for(var i in project_activities){ - if(project_activities[i].act_id == id){ + if(project_activities[i].act_id == act_id){ project_activities[i].reply_count += 1; break; } @@ -222,7 +225,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc var init = function(args){ args.scope.replytip = "输入回复内容~"; - args.scope.formData = {comment: ''}; +// args.scope.formData = {comment: ''}; var loadData = function(id,replytype,page){ loadCommonData(id, args.type,replytype,page).then(function successCallback(response) { console.log(response.data); @@ -304,10 +307,10 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }; loadData(args.id,0,0); - args.scope.addReply = function(data){ + args.scope.addReply = function(data,reply_type){ console.log(data.comment); - addCommonReply(args.id, args.replyType, data,args, function(subscribe){ - args.scope.formData = {comment: ''}; + addCommonReply(data.act_id, args.replyType, data,args,reply_type, function(subscribe){ +// args.scope.formData = {comment: ''}; if(subscribe == 0){ $location.path("/login_tip"); return; @@ -322,6 +325,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }); }; + // 动态详情界面点赞与动态界面的数据要同步 保证进入详情点赞后出来显示一致 args.scope.addPraise = function(act){ activities = rms.get("activities") || []; From 1e7f3db946e0630b01014dc16089ed0517b3f56c Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 15:07:43 +0800 Subject: [PATCH 08/38] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E7=BB=84=E5=86=85=E6=AF=8F=E4=B8=AA=E6=88=90=E5=91=98?= =?UTF-8?q?=E9=83=BD=E5=A4=8D=E5=88=B6=E4=B8=80=E4=BB=BD=E7=BB=84=E9=95=BF?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=EF=BC=8C=E5=BE=97=E5=88=86=E7=9B=B8?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 150 +++++++++--------- app/controllers/users_controller.rb | 2 +- app/helpers/student_work_helper.rb | 7 + app/models/student_work.rb | 11 +- .../student_work/_evaluation_un_work.html.erb | 6 +- .../student_work/_evaluation_work.html.erb | 6 +- app/views/student_work/_show.html.erb | 7 +- ...20160905084821_group_homework_copy_work.rb | 24 +++ db/schema.rb | 2 +- 9 files changed, 130 insertions(+), 85 deletions(-) create mode 100644 db/migrate/20160905084821_group_homework_copy_work.rb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 64f85b5db..dd454d17d 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -410,11 +410,11 @@ class StudentWorkController < ApplicationController #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?) if @order == 'lastname' - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name elsif @order == 'student_id' - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name end @show_all = true elsif User.current.member_of_course?(@course) @@ -476,11 +476,11 @@ class StudentWorkController < ApplicationController else if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?) if @order == 'lastname' - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name elsif @order == 'student_id' - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name end @show_all = true elsif User.current.member_of_course?(@course) @@ -613,33 +613,23 @@ class StudentWorkController < ApplicationController student_work.work_status = 1 end if student_work.save - if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 - @student_work_project.student_work_id = student_work.id - @student_work_project.save - members = params[:group_member_ids].split(',') - for i in 1 .. members.count-1 - stu_project = StudentWorkProject.new - stu_project.homework_common_id = @homework.id - stu_project.student_work_id = student_work.id - stu_project.project_id = @student_work_project.project_id - stu_project.user_id = members[i].to_i - stu_project.is_leader = 0 + if @homework.homework_type == 3 + if @homework.homework_detail_group.base_on_project == 1 + @student_work_project.student_work_id = student_work.id + @student_work_project.save + elsif @homework.homework_detail_group.base_on_project == 0 + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1) stu_project.save end - elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 members = params[:group_member_ids].split(',') - for i in 0 .. members.count-1 - stu_project = StudentWorkProject.new - stu_project.homework_common_id = @homework.id - stu_project.student_work_id = student_work.id - stu_project.project_id = -1 - stu_project.user_id = members[i].to_i - if i == 0 - stu_project.is_leader = 1 - else - stu_project.is_leader = 0 + for i in 1 .. members.count-1 + stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first + stu_work ||= StudentWork.new + stu_work.update_attributes(:name => student_work.name, :description => student_work.description, :project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) + if stu_work.save + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project.save end - stu_project.save end end @homework.update_column(:updated_at, Time.now) @@ -687,20 +677,19 @@ class StudentWorkController < ApplicationController if @homework.homework_type == 3 @student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) + user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")" + student_works = @homework.student_works.where("user_id in #{user_ids}") + student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) student_work_projects.delete_all members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 - stu_project = StudentWorkProject.new - stu_project.homework_common_id = @homework.id - stu_project.student_work_id = @work.id - if @homework.homework_detail_group.base_on_project == 1 - stu_project.project_id = @student_work_project.project_id - else @homework.homework_detail_group.base_on_project == 0 - stu_project.project_id = -1 + stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first + stu_work ||= StudentWork.new + stu_work.update_attributes(:name => @work.name, :description => @work.description, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) + if stu_work.save + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project.save end - stu_project.user_id = members[i].to_i - stu_project.is_leader = 0 - stu_project.save end end @@ -735,28 +724,25 @@ class StudentWorkController < ApplicationController def destroy if @homework.homework_type == 3 - if @work.destroy - if @homework.homework_detail_group.base_on_project == 1 - pros = @work.student_work_projects.where("is_leader = 0") - pros.each do |pro| - pro.destroy - end - project = @work.student_work_projects.where("is_leader = 1").first - project.update_attributes(:student_work_id => nil) - elsif @homework.homework_detail_group.base_on_project == 0 - @work.student_work_projects.each do |pro2| - pro2.destroy - end - end + pros = @work.student_work_projects.where("is_leader = 0") + user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" + student_works = @homework.student_works.where("user_id in #{user_ids}") + student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) + pros.delete_all + + project = @work.student_work_projects.where("is_leader = 1").first + if @homework.homework_detail_group.base_on_project == 1 + project.update_attributes(:student_work_id => nil) + else + project.destroy end - else - @work.attachments.destroy_all - @work.student_works_scores.destroy_all - @work.course_messages.destroy_all - @work.student_work_tests.destroy_all - @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil) - @work.update_column("work_score",nil) end + @work.attachments.destroy_all + @work.student_works_scores.destroy_all + @work.course_messages.destroy_all + @work.student_work_tests.destroy_all + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) + @work.update_column("work_score",nil) respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -786,25 +772,23 @@ class StudentWorkController < ApplicationController def retry_work if @homework.homework_type == 3 - if @work.destroy - if @homework.homework_detail_group.base_on_project == 1 - pros = @work.student_work_projects.where("is_leader = 0") - pros.each do |pro| - pro.destroy - end - project = @work.student_work_projects.where("is_leader = 1").first - project.update_attributes(:student_work_id => nil) - elsif @homework.homework_detail_group.base_on_project == 0 - @work.student_work_projects.each do |pro2| - pro2.destroy - end - end + pros = @work.student_work_projects.where("is_leader = 0") + user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" + student_works = @homework.student_works.where("user_id in #{user_ids}") + student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0) + pros.delete_all + + project = @work.student_work_projects.where("is_leader = 1").first + if @homework.homework_detail_group.base_on_project == 1 + project.update_attributes(:student_work_id => nil) + else + project.destroy end - elsif @homework.homework_type == 1 - @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil) - @work.attachments.destroy_all - @work.course_messages.destroy_all end + + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0) + @work.attachments.destroy_all + @work.course_messages.destroy_all @student_work = StudentWork.new respond_to do |format| format.js @@ -1096,9 +1080,13 @@ class StudentWorkController < ApplicationController #创建作业的关联项目 def student_work_project + @work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first + if @work + @work.update_column('project_id', params[:projectName].to_i) + end @project = StudentWorkProject.new @project.homework_common_id = @homework.id - @project.project_id = (Project.find params[:projectName].to_i).id + @project.project_id = params[:projectName].to_i @project.user_id = User.current.id @project.is_leader = 1 if @project.save @@ -1147,6 +1135,10 @@ class StudentWorkController < ApplicationController end def cancel_relate_project + @work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first + if @work + @work.update_column('project_id', 0) + end relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first if relate_pro.destroy @user_activity_id = params[:user_activity_id].to_i @@ -1586,6 +1578,10 @@ class StudentWorkController < ApplicationController end end end + if homework.homework_type == 3 + student_works = group_student_works student_work, homework + student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score) + end end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5aab1df49..4d2b4794c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1115,7 +1115,7 @@ class UsersController < ApplicationController homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - if homework.homework_type != 3 && homework_detail_manual.comment_status == 1 + if homework_detail_manual.comment_status == 1 create_works_list homework end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 2ecb5516f..1e7df6466 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -158,4 +158,11 @@ module StudentWorkHelper end return status end + + def group_student_works student_work, homework + pros = student_work.student_work_projects.where("is_leader = 0") + user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" + student_works = homework.student_works.where("user_id in #{user_ids}") + return student_works + end end \ No newline at end of file diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 183570081..35308ca05 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -1,4 +1,4 @@ -#学生提交作品表 +#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品 class StudentWork < ActiveRecord::Base attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time @@ -13,7 +13,8 @@ class StudentWork < ActiveRecord::Base has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy has_many :attachments, :dependent => :destroy - scope :has_committed, lambda{where("work_status != 0")} + scope :has_committed, lambda{where("work_status != 0 and work_status != 3")} + scope :no_copy, lambda{where("work_status != 3")} before_destroy :delete_praise before_save :set_program_score, :set_src @@ -169,6 +170,12 @@ class StudentWork < ActiveRecord::Base end end end + if homework.homework_type == 3 + pros = student_work.student_work_projects.where("is_leader = 0") + user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" + student_works = homework.student_works.where("user_id in #{user_ids}") + student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score) + end end end diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index ed0ba5542..bb87bfde1 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -26,7 +26,11 @@ <%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word"%> - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> + <% if student_work.project_id == 0 || student_work.project_id.nil?%> + + -- + + <% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> <%= link_to( student_work.project.name, project_path(student_work.project.id))%> diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index c5db6a99f..06bc110b2 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -26,7 +26,11 @@ <%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%> - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> + <% if student_work.project_id == 0 || student_work.project_id.nil?%> + + -- + + <% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> <%= link_to( student_work.project.name, project_path(student_work.project.id))%> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index f6c0e25d0..9f65376e3 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -46,13 +46,16 @@ <% if @homework.homework_detail_group.base_on_project == 1 %>
  • 关联项目: - <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> + <% if work.project_id == 0 || work.project_id.nil? %> + 暂无 + <% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + (综合评分:<%=static_project_score(work.project.project_score).to_i %>) <% else %> <%=work.project.name %> + (综合评分:<%=static_project_score(work.project.project_score).to_i %>) <% end %> <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - (综合评分:<%=static_project_score(work.project.project_score).to_i %>)
  • <% end %> <% end%> diff --git a/db/migrate/20160905084821_group_homework_copy_work.rb b/db/migrate/20160905084821_group_homework_copy_work.rb new file mode 100644 index 000000000..b97d38aa8 --- /dev/null +++ b/db/migrate/20160905084821_group_homework_copy_work.rb @@ -0,0 +1,24 @@ +class GroupHomeworkCopyWork < ActiveRecord::Migration + def up + homeworks = HomeworkCommon.where("homework_type = 3") + count = homeworks.count / 30 + 2 + transaction do + for i in 1 ... count do i + homeworks.page(i).per(30).each do |homework| + homework.student_works.each do |stu| + stu.student_work_projects.each do |stu_pro| + if stu_pro.is_leader == 0 + new_stu = StudentWork.new(:name => stu.name, :description => stu.description, :homework_common_id =>homework.id, :user_id => stu_pro.user_id, :final_score => stu.final_score, :teacher_score => stu.teacher_score, :student_score => stu.student_score, :teaching_asistant_score => stu.teaching_asistant_score, + :project_id => stu.project_id, :late_penalty => stu.late_penalty,:absence_penalty => stu.absence_penalty,:work_score => stu.work_score,:work_status => 3,:commit_time => stu.commit_time) + new_stu.save + end + end + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index b5bd5f778..b8f931eed 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 => 20160830090214) do +ActiveRecord::Schema.define(:version => 20160905084821) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 17f6b9c28611ba31c93f4dcbffd321ba01860b95 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 15:17:49 +0800 Subject: [PATCH 09/38] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E8=A2=AB=E7=95=99=E8=A8=80=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E2=80=9CRE:=20=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/leave_messages.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index 986823faa..a9acba903 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -62,9 +62,9 @@ <%case journal.jour_type %> <% when 'Principal' %> - <%= link_to(strip_html(journal.notes), feedback_path(journal.jour_id)) %> + <%= link_to(journal.m_parent_id.nil? ? strip_html(journal.notes) : 'RE: ' + strip_html(journal.notes), feedback_path(journal.jour_id)) %> <% when 'Course' %> - <%= link_to(strip_html(journal.notes), course_feedback_path(journal.jour_id)) %> + <%= link_to(journal.m_parent_id.nil? ? strip_html(journal.notes) : 'RE: ' + strip_html(journal.notes), course_feedback_path(journal.jour_id)) %> <% end %> From bf4c6d049c8c90742d75df4cd782ec2c0e68047d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 16:38:29 +0800 Subject: [PATCH 10/38] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=E4=B8=8D=E5=88=9B=E5=BB=BA=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 37 +++++++++++----------- app/controllers/users_controller.rb | 2 +- app/models/student_work.rb | 2 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd454d17d..34bc889fd 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -623,9 +623,7 @@ class StudentWorkController < ApplicationController end members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 - stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first - stu_work ||= StudentWork.new - stu_work.update_attributes(:name => student_work.name, :description => student_work.description, :project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) + stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description, :homeowrk_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) if stu_work.save stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) stu_project.save @@ -679,13 +677,11 @@ class StudentWorkController < ApplicationController student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")" student_works = @homework.student_works.where("user_id in #{user_ids}") - student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) + student_works.delete_all student_work_projects.delete_all members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 - stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first - stu_work ||= StudentWork.new - stu_work.update_attributes(:name => @work.name, :description => @work.description, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) + stu_work = StudentWork.new(:name => @work.name, :description => @work.description, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) if stu_work.save stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) stu_project.save @@ -727,7 +723,7 @@ class StudentWorkController < ApplicationController pros = @work.student_work_projects.where("is_leader = 0") user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" student_works = @homework.student_works.where("user_id in #{user_ids}") - student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) + student_works.delete_all pros.delete_all project = @work.student_work_projects.where("is_leader = 1").first @@ -736,13 +732,15 @@ class StudentWorkController < ApplicationController else project.destroy end + @work.destroy + else + @work.attachments.destroy_all + @work.student_works_scores.destroy_all + @work.course_messages.destroy_all + @work.student_work_tests.destroy_all + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) + @work.update_column("work_score",nil) end - @work.attachments.destroy_all - @work.student_works_scores.destroy_all - @work.course_messages.destroy_all - @work.student_work_tests.destroy_all - @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0) - @work.update_column("work_score",nil) respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -784,11 +782,12 @@ class StudentWorkController < ApplicationController else project.destroy end + @work.destroy + else + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0) + @work.attachments.destroy_all + @work.course_messages.destroy_all end - - @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0) - @work.attachments.destroy_all - @work.course_messages.destroy_all @student_work = StudentWork.new respond_to do |format| format.js @@ -1127,7 +1126,7 @@ class StudentWorkController < ApplicationController end all_students = User.where("id in #{all_student_ids}") student_work_id = @homework.student_work_projects.where("user_id=? and student_work_id is not null",User.current.id).first.nil? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id - @commit_student_ids = @homework.student_work_projects.where("student_work_id != #{student_work_id}").map{|student| student.user_id} + @commit_student_ids = @homework.student_works.has_committed.where("id != #{student_work_id}").map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4d2b4794c..5aab1df49 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1115,7 +1115,7 @@ class UsersController < ApplicationController homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - if homework_detail_manual.comment_status == 1 + if homework.homework_type != 3 && homework_detail_manual.comment_status == 1 create_works_list homework end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 35308ca05..59e5b76bc 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -32,7 +32,7 @@ class StudentWork < ActiveRecord::Base private def set_program_score - if homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分 + if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分 #根据最后一次测试计算得分 unless last_test self.system_score = 0 From e2aef371141c3dbac9845663c7dfd34c33971edb Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 17:06:31 +0800 Subject: [PATCH 11/38] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E4=BA=A4=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 34bc889fd..8e0a07288 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -623,7 +623,7 @@ class StudentWorkController < ApplicationController end members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 - stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description, :homeowrk_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) + stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>members[i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) if stu_work.save stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) stu_project.save @@ -681,7 +681,7 @@ class StudentWorkController < ApplicationController student_work_projects.delete_all members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 - stu_work = StudentWork.new(:name => @work.name, :description => @work.description, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) + stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) if stu_work.save stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) stu_project.save From bd7cd7e24496b6e88e5e32e37e1ff02dd1db1dbe Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 6 Sep 2016 17:09:57 +0800 Subject: [PATCH 12/38] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=98=BE=E9=9A=90=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 4 +-- public/assets/wechat/course_discussion.html | 4 +-- public/assets/wechat/course_notice.html | 4 +-- public/assets/wechat/homework_detail.html | 4 +-- public/assets/wechat/issue_detail.html | 4 +-- public/assets/wechat/jour_message_detail.html | 4 +-- public/assets/wechat/project_discussion.html | 4 +-- .../wechat/directives/multi_reply.js | 30 +++++++++---------- 8 files changed, 28 insertions(+), 30 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 3b97e7df4..e146f9a7e 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -73,11 +73,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index b574deff7..66bebb35c 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -71,11 +71,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index c7ffbd3d5..e3ef7c767 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -86,11 +86,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index c33090554..e8b3ed500 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -75,11 +75,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 69e3138d6..9a7ad50bf 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -92,11 +92,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 05fb4c6e9..25c8cebc5 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -70,11 +70,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 1ae009927..234e496ea 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -71,11 +71,11 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    -
    +
    diff --git a/public/javascripts/wechat/directives/multi_reply.js b/public/javascripts/wechat/directives/multi_reply.js index 92abe5d6c..6c4f1cccc 100644 --- a/public/javascripts/wechat/directives/multi_reply.js +++ b/public/javascripts/wechat/directives/multi_reply.js @@ -7,24 +7,22 @@ app.directive('multiReply',["$timeout",function(timer){ scope: {}, link: function(scope, element){ timer(function(){ - $(".reply-icons").each(function(){ - $(this).toggle(function(){ - var multiInput = $(this).next().next(); - multiInput.show(); - multiInput.focus(); + $(".reply-icons").live("click",function(){ + if($(this).hasClass("multi-hide")){ + $(".multi-input-container").addClass("undis"); + $(".reply-icons").addClass("multi-hide"); + $(this).next().next().removeClass("undis"); + $(this).next().next().focus(); + $(this).removeClass("multi-hide"); $(".post-reply-input").val(""); - $(multiInput).bind("focus",function(){ - $("#post_input_1").hide(); - }); - },function(){ - var multiInput = $(this).next().next(); - $(this).next().next().hide(); - $(this).next().next().blur(); + $("#post_input_1").hide(); + } + else{ + $(this).addClass("multi-hide"); + $(".post-input-container").addClass("undis"); $(".post-reply-input").val(""); - $(multiInput).bind("blur",function(){ - $("#post_input_1").show(); - }); - }); + $("#post_input_1, #post_input_1 .post-input-container").show(); + } }); }) } From 99e63b1477063665fa2dc888d164ee2cd7b4ff62 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 6 Sep 2016 17:22:38 +0800 Subject: [PATCH 13/38] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E6=95=B0=E5=AD=97block=E9=A2=9C=E8=89=B2=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=E6=B5=8B=E9=AA=8C=E5=AD=A6=E5=8F=B7?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E7=9C=81=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_student_table.html.erb | 140 ++++++++++----------- public/stylesheets/syllabus.css | 4 +- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/app/views/exercise/_student_table.html.erb b/app/views/exercise/_student_table.html.erb index bdfd2c96f..c917cb03e 100644 --- a/app/views/exercise/_student_table.html.erb +++ b/app/views/exercise/_student_table.html.erb @@ -1,71 +1,71 @@ - - - - - - - - - - - - - <% @exercise_users_list.each_with_index do |exercise, index|%> - - - - - - - - - - - - - - -<% end%> +
    序号  姓名学号班级   - <%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%> - - <%= link_to "成绩",'',:class => "c_dark f14 fb",:remote => true%> -
    <%=index + 1 %> - <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %> - - <%=exercise.user.show_name %> - - - - -- -   - <% if exercise.created_at%> - <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  - <% if @exercise.end_time <= exercise.created_at %> - [未答] - <% end %> - <% end %> - - <%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%> -
    + + + + + + + + + + + + <% @exercise_users_list.each_with_index do |exercise, index|%> + + + + + + + + + + + + + + +<% end%>
    序号  姓名学号班级   + <%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%> + + <%= link_to "成绩",'',:class => "c_dark f14 fb",:remote => true%> +
    <%=index + 1 %> + <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %> + + <%=exercise.user.show_name %> + + + + -- +   + <% if exercise.created_at%> + <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  + <% if @exercise.end_time <= exercise.created_at %> + [未答] + <% end %> + <% end %> + + <%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%> +
    \ No newline at end of file diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index f6a8e8e6e..c92db8b76 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -566,9 +566,9 @@ a:hover.sy_btn_orange{ a.sy_class_ltitle{display: block; font-size: 14px; width: 185px; color:#888; } a:hover.sy_class_ltitle{ color:#333;} .sy_cir_grey{ - font-size:12px; + font-size:11px; padding: 0 10px; - background: #dbdbdb; + background: #eee; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; From 7b2ce93acc22ae0370db4adf72a9a3a6762d163f Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 17:51:13 +0800 Subject: [PATCH 14/38] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8e0a07288..791d9e398 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -1126,7 +1126,7 @@ class StudentWorkController < ApplicationController end all_students = User.where("id in #{all_student_ids}") student_work_id = @homework.student_work_projects.where("user_id=? and student_work_id is not null",User.current.id).first.nil? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id - @commit_student_ids = @homework.student_works.has_committed.where("id != #{student_work_id}").map{|student| student.user_id} + @commit_student_ids = @homework.student_works.where("id != #{student_work_id}").map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js From 7b2943c37ae4232590233624b7b62eef606a9b51 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 6 Sep 2016 18:01:16 +0800 Subject: [PATCH 15/38] =?UTF-8?q?=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 791d9e398..d1835408f 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -773,7 +773,7 @@ class StudentWorkController < ApplicationController pros = @work.student_work_projects.where("is_leader = 0") user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" student_works = @homework.student_works.where("user_id in #{user_ids}") - student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0) + student_works.delete_all pros.delete_all project = @work.student_work_projects.where("is_leader = 1").first From 95824e3b6b951adb1e6e5a341f40277855489c76 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 7 Sep 2016 11:24:38 +0800 Subject: [PATCH 16/38] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8D=E7=A7=B0=E6=AD=A3=E7=A1=AE=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=A4=BA=E4=BE=8B=EF=BC=8C=E8=AF=BE=E7=A8=8B=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/syllabuses/new.html.erb | 54 ++++++++++++++++--------------- public/stylesheets/css/common.css | 6 +++- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/app/views/syllabuses/new.html.erb b/app/views/syllabuses/new.html.erb index ced8a3d66..38b00ac5c 100644 --- a/app/views/syllabuses/new.html.erb +++ b/app/views/syllabuses/new.html.erb @@ -1,27 +1,29 @@ -
    -

    新建课程

    -
    -
    -
      - <%= labelled_form_for @syllabus do |f| %> -
    • - - - -
    • -
      -
    • - - - -
    • -
      -
    • - 提交 - <%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%> -
      -
    • - <% end%> -
    -
    +
    +

    新建课程

    +
    +
    +
      + <%= labelled_form_for @syllabus do |f| %> +
    • + + + +
    • +
      +
    • 正确示例:软件工程错误示例:2016软件工程
    • +
    • 课程是针对一个具体的学科方向开展的教学内容与进程安排
      本质上,一门课程就是一个教学计划
    • +
    • + + + +
    • +
      +
    • + 提交 + <%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%> +
      +
    • + <% end%> +
    +
    \ No newline at end of file diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index c275aec90..88f3e4cba 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -607,4 +607,8 @@ a:hover.sy_btn_blue{ background: #2788d0;} .is_public_checkbox{margin-left: 15px;margin-right: 10px;} .author_name{color: #3ca5c6 !important;} .ke-container-default{max-width: 100%;} -.borderRadius {border-radius:5px;} \ No newline at end of file +.borderRadius {border-radius:5px;} + +/*状态提示图标*/ +.success-icon {background:url("/images/icons_ziliao.png") 0 -28px no-repeat; padding-left:25px;} +.error-icon {background:url("/images/icons_ziliao.png") 0 -56px no-repeat; padding-left:25px;} \ No newline at end of file From c234a8d2cbc213bb46697cad33f1bd153aaa2015 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 7 Sep 2016 14:19:07 +0800 Subject: [PATCH 17/38] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 91 ++++++++++------ app/api/mobile/entities/user.rb | 6 +- app/services/users_service.rb | 9 +- public/assets/wechat/edit_userinfo.html | 42 +++++++ .../wechat/controllers/edit_userinfo.js | 103 ++++++++++++++++++ .../wechat/directives/input_on_change.js | 25 ----- .../wechat/directives/load_head.js | 36 ++++++ public/javascripts/wechat/others/routes.js | 1 + public/stylesheets/weui/weixin.css | 11 +- 9 files changed, 261 insertions(+), 63 deletions(-) create mode 100644 public/assets/wechat/edit_userinfo.html create mode 100644 public/javascripts/wechat/controllers/edit_userinfo.js delete mode 100644 public/javascripts/wechat/directives/input_on_change.js create mode 100644 public/javascripts/wechat/directives/load_head.js diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index ed9115382..7989d36d0 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -4,6 +4,54 @@ module Mobile class Users < Grape::API resource :users do + desc "我的资料" + params do + requires :token, type: String + end + + get 'get_userinfo' do + authenticate! + present :data, current_user, with: Mobile::Entities::User + present :status, 0 + end + + desc "上传头像" + params do + requires :token, type: String + requires :imgdata, type: String + end + + post 'upload_head' do + authenticate! + #直接生成头像 + dirPath = "public/images/avatars/User" + + fileDir = dirPath + "/"+current_user.id.to_s + begin + File.open(fileDir,'wb'){ |f| f.write(Base64.decode64(params[:imgdata].split(",")[1])) } + present :status, 0 + rescue + present :status, -1 + end + end + + desc "解除绑定" + params do + requires :token, type: String + end + + post 'user_unbind' do + authenticate! + + user = current_user + uw = user.user_wechat + + us = UsersService.new + us.wechat_unbind user.user_wechat + + present :status, 0 + end + desc "查询是否已绑定" params do requires :openid, type: String, desc: 'wechat openid' @@ -222,23 +270,11 @@ module Mobile present :status,0 end - desc "我的资料" + desc "修改我的资料" params do requires :token, type: String - end - - get 'my_userinfo' do - authenticate! - present :data, current_user, with: Mobile::Entities::User - present :status, 0 - end - - desc "我的资料" - - params do - requires :token, type: String - requires :nickname, type: String + requires :lastname, type: String requires :sex, type: Integer requires :mail, type: String end @@ -250,7 +286,7 @@ module Mobile message = "" #昵称 不能超过30个字符 - if params[:nickname].length > 30 then + if params[:lastname].length > 30 then message = "姓名不能超过30个字符!" status = -1 end @@ -272,20 +308,23 @@ module Mobile begin g.edit_user(user.gid, :email => params[:mail]) rescue - logger.error "sync user's email of gitlab failed!" + Rails.logger.error "sync user's email of gitlab failed!" end end - user.lastname = params[:nickname] + user.mail = params[:mail] + + user.lastname = params[:lastname] se = user.extensions se.gender = params[:sex] + if user.save && se.save status = 0 else - message = "保存数据失败!" + message = "该邮箱地址已被使用!" status = -1 end end @@ -298,22 +337,6 @@ module Mobile present :message, message end end - - desc "解除绑定" - - params do - requires :token, type: String - end - - post 'unbind' do - authenticate! - - us = UsersService.new - us.wechat_unbind uw - - present :status, 0 - end - end end end diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index dcdf48d3b..657b1cb7b 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -39,6 +39,10 @@ module Mobile expose :id #头像 + expose :login + expose :lastname + #邮箱地址 + expose :mail expose :nickname #真名 user_expose :img_url @@ -51,8 +55,6 @@ module Mobile #我的二维码 #工作单位 user_expose :work_unit - #邮箱地址 - user_expose :mail #地区 user_expose :location #签名 diff --git a/app/services/users_service.rb b/app/services/users_service.rb index c275e20dd..540e1bbff 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -1,3 +1,4 @@ +#coding=utf-8 class UsersService include ApplicationHelper include AccountHelper @@ -323,8 +324,14 @@ class UsersService user = uw.user #发重新绑定的微信模版消息 + + type = "login" + title = "尊敬的用户,您已解除绑定。" + key1 = "个人原因" + remark = "点击进入重新绑定。" + ws = WechatService.new - ws.rebind_notice user.id, "login", user.id, "尊敬的用户,您已解除绑定。", "个人原因",format_time(Time.now), "点击进入重新绑定" + ws.rebind_notice user.id, type, user.id, title, key1,format_time(Time.now), remark uw.user_id = nil uw.delete diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html new file mode 100644 index 000000000..dcd220a47 --- /dev/null +++ b/public/assets/wechat/edit_userinfo.html @@ -0,0 +1,42 @@ +
    +
    +
    编辑资料
    +
    +
    + + + +
    + {{user.login}}解除绑定
    + +
    + +
    姓名
    +
    + 性别 +
    + +
    +
    + +
    + 邮箱 + +
    + 电子邮箱地址不能为空 + 电子邮箱地址不合法 +
    +
    +
    + 取消 + 确定 +
    +
    + + + +
    \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/edit_userinfo.js b/public/javascripts/wechat/controllers/edit_userinfo.js new file mode 100644 index 000000000..2e5b356ad --- /dev/null +++ b/public/javascripts/wechat/controllers/edit_userinfo.js @@ -0,0 +1,103 @@ +app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout','wx', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout,wx){ +// common.checkLogin(); + + $scope.replaceUrl = function(url){ + return url; + }; + + var vm = $scope; + + //单弹框 + vm.alertService_1 = alertService.create(); + + //双弹框 + vm.alertService_2 = alertService.create(); + + vm.getuserinfo = function(){ + $http.get(config.apiUrl + 'users/get_userinfo?token='+auth.token()).then( + function(response) { + console.log(response.data); + vm.user = response.data.data; + vm.lastname = vm.user.lastname; + vm.mail = vm.user.mail; + vm.sex = vm.user.gender; + if(vm.sex == 0){ + vm.gender = "男"; + } + else{ + vm.gender = "女"; + } + } + ); + }; + + vm.getuserinfo(); + + vm.unbind = function(){ + vm.alertService_2.showMessage('提示', '是否确认解除绑定', function() { + $http.post(config.apiUrl + "users/user_unbind", + {token: auth.token()} + ).then(function (response) { + if (response.data.status == 0) { + vm.alertService_1.showMessage('提示', '解除绑定成功', function () { + wx.closeWindow(); + }); + } + else { + vm.alertService_1.showMessage('提示', response.data.message); + } + }); + }); + }; + + vm.cancel = function(){ + vm.alertService_2.showMessage('提示', '是否确认取消', function() { + wx.closeWindow(); + }); + }; + + vm.confirm = function(frm){ + frm.$setSubmitted(); + + console.log(frm); + if (!frm.$valid) { + console.log(frm.$error); + return; + } + + var sex = 0; + if(vm.gender == "女"){ + sex = 1; + } + + if(vm.lastname == ""){ + vm.alertService_1.showMessage('提示', '姓名不能为空'); + return; + } + + if(vm.mail == ""){ + vm.alertService_1.showMessage('提示', '邮箱不能为空'); + return; + } + +// if(!(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.test(vm.mail))){ +// vm.alertService_1.showMessage('提示', '邮箱不合法'); +// return; +// } + + $http.post(config.apiUrl + "users/edit_userinfo", + {token: auth.token(),lastname: vm.lastname, sex: sex, mail: vm.mail} + ).then(function(response){ + if(response.data.status == 0) + { + vm.alertService_1.showMessage('提示', '修改成功',function(){ + wx.closeWindow(); + }); + } + else{ + vm.alertService_1.showMessage('提示', response.data.message); + } + }); + }; + +}]); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/input_on_change.js b/public/javascripts/wechat/directives/input_on_change.js deleted file mode 100644 index 43baa3828..000000000 --- a/public/javascripts/wechat/directives/input_on_change.js +++ /dev/null @@ -1,25 +0,0 @@ -app.directive('inputOnChange', function(){ - return{ - restrict: 'A', - scope: {}, - link: function (scope, element, attrs) { - var onChangeFunc = scope.$eval(attrs.inputOnChange); - element.bind('change', onChangeFunc); - - scope.uploadDown = function () { - var file = event.target.files[0]; - //判断类型是不是图片 - if (!/image\/\w+/.test(file.type)) { - alert("非图片"); - return; - } - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = function (e) { - alert(this.result);//base64 - } - } - - } - } -}); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/load_head.js b/public/javascripts/wechat/directives/load_head.js new file mode 100644 index 000000000..54f464dcb --- /dev/null +++ b/public/javascripts/wechat/directives/load_head.js @@ -0,0 +1,36 @@ +app.directive('loadHead',['$http','config','auth','$location','alertService',function($http,config,auth,$location,alertService){ + return{ + restrict: 'A', + scope: {}, + link: function (scope, element, attrs) { + element.bind('change', function(){ + var file = event.target.files[0]; + //判断类型是不是图片 + if (!/image\/\w+/.test(file.type)) { + alert("非图片"); + return; + } + + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function (e) { + alert(this.result);//base64 + + $http.post(config.apiUrl + "users/upload_head", + {token: auth.token(),imgdata:this.result} + ).then(function (response) { + if(response.data.status == 0){ + scope.$parent.alertService_1.showMessage('提示',"上传成功",function(){ + scope.$parent.user = null; + scope.$parent.getuserinfo(); + }); + } + else{ + scope.$parent.alertService_1.showMessage('提示',"上传失败"); + } + }); + } + }); + } + } +}]); \ No newline at end of file diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 2182e16ee..e5c87d1ab 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -51,6 +51,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController')) .when('/project_publishnote', makeRoute('project_publishnote.html', 'ProjectPublishNoteController')) .when('/login_tip', makeRoute('login_tip.html', 'LoginTipController')) + .when('/edit_userinfo', makeRoute('edit_userinfo.html', 'EditUserInfoController')) .otherwise({ redirectTo: '/activites' }); diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 3d960b4ad..4e6e27bec 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -257,4 +257,13 @@ a.underline {text-decoration:underline;} /*发布帖子,通知*/ .full-width-wrap {padding:5px 15px; background-color:#fff; border-top:1px solid #ddd; border-bottom:1px solid #ddd;} -.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555; overflow-y:auto;} \ No newline at end of file +.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555; overflow-y:auto;} + +/*资料修改*/ +.blank-row {width:100%; height:38px; line-height:38px; vertical-align:middle;} +.upload-input-container {width:30px; height:30px; border:1px solid #ddd; position:relative;} +.upload-input {width:30px; height:30px; position:absolute; z-index:1; opacity:0;} +.upload-input-container:after {content:" "; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background-color:#ddd; background-image:url(../images/male.jpg); width:30px; height:30px; background-size:30px 30px; border-radius:50%;} +.select-container {position:relative; padding-left:62px;} +.select-text {position:absolute; left:15px;} +.select-model {width:100%; border:none; color:#999; margin-top:8px;} \ No newline at end of file From d8a4eb56cff5088b20281e17e06659086145587d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 7 Sep 2016 15:14:46 +0800 Subject: [PATCH 18/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=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/users.rb | 1 - public/javascripts/wechat/controllers/edit_userinfo.js | 2 ++ public/javascripts/wechat/directives/load_head.js | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 7989d36d0..3a1a897ee 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -320,7 +320,6 @@ module Mobile se.gender = params[:sex] - if user.save && se.save status = 0 else diff --git a/public/javascripts/wechat/controllers/edit_userinfo.js b/public/javascripts/wechat/controllers/edit_userinfo.js index 2e5b356ad..920e9dc0c 100644 --- a/public/javascripts/wechat/controllers/edit_userinfo.js +++ b/public/javascripts/wechat/controllers/edit_userinfo.js @@ -27,6 +27,8 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l else{ vm.gender = "女"; } + + vm.user.img_url = vm.user.img_url +"?t="+Math.random(); } ); }; diff --git a/public/javascripts/wechat/directives/load_head.js b/public/javascripts/wechat/directives/load_head.js index 54f464dcb..6cbb8e743 100644 --- a/public/javascripts/wechat/directives/load_head.js +++ b/public/javascripts/wechat/directives/load_head.js @@ -21,7 +21,6 @@ app.directive('loadHead',['$http','config','auth','$location','alertService',fun ).then(function (response) { if(response.data.status == 0){ scope.$parent.alertService_1.showMessage('提示',"上传成功",function(){ - scope.$parent.user = null; scope.$parent.getuserinfo(); }); } From 2bb2a64dde0cb5a3a78c6a1acd8b633c144b5d7f Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 7 Sep 2016 15:32:48 +0800 Subject: [PATCH 19/38] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=92=8C=E5=A4=B4=E5=83=8F=E9=87=8D=E5=90=88?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BD=BF=E4=B8=8A=E4=BC=A0=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=9C=89=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_userinfo.html | 2 +- public/stylesheets/weui/weixin.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index dcd220a47..18337807c 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -5,7 +5,7 @@
    - +
    {{user.login}}解除绑定
    diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 4e6e27bec..6a65b440a 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -263,7 +263,7 @@ a.underline {text-decoration:underline;} .blank-row {width:100%; height:38px; line-height:38px; vertical-align:middle;} .upload-input-container {width:30px; height:30px; border:1px solid #ddd; position:relative;} .upload-input {width:30px; height:30px; position:absolute; z-index:1; opacity:0;} -.upload-input-container:after {content:" "; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background-color:#ddd; background-image:url(../images/male.jpg); width:30px; height:30px; background-size:30px 30px; border-radius:50%;} +/*.upload-input-container:after {content:" "; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background-color:#ddd; background-image:url(../images/male.jpg); width:30px; height:30px; background-size:30px 30px; border-radius:50%;}*/ .select-container {position:relative; padding-left:62px;} .select-text {position:absolute; left:15px;} .select-model {width:100%; border:none; color:#999; margin-top:8px;} \ No newline at end of file From 18fbf305c16d5a9b3ebabdb450d149f5fa911903 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 7 Sep 2016 16:16:53 +0800 Subject: [PATCH 20/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=E4=B8=BA?= =?UTF-8?q?1M?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 15 +++++++++++---- config/menu.yml.test | 6 +++--- public/javascripts/wechat/directives/load_head.js | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 3a1a897ee..557b06cea 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -27,11 +27,18 @@ module Mobile dirPath = "public/images/avatars/User" fileDir = dirPath + "/"+current_user.id.to_s - begin - File.open(fileDir,'wb'){ |f| f.write(Base64.decode64(params[:imgdata].split(",")[1])) } - present :status, 0 - rescue + imgdata = Base64.decode64(params[:imgdata].split(",")[1]) + if imgdata.length > 1024*1024 + present :message,"上传图片不能超过1M" present :status, -1 + else + begin + File.open(fileDir,'wb'){ |f| f.write(imgdata) } + present :status, 0 + rescue + present :message,"上传失败" + present :status, -1 + end end end diff --git a/config/menu.yml.test b/config/menu.yml.test index 4508e843c..5888996cf 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -31,6 +31,6 @@ button: name: "联系我们" key: "FEEDBACK" - - type: "click" - name: "解除绑定" - key: "UNBIND" + type: "view" + name: "个人资料" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=edit_userinfo#wechat_redirect" diff --git a/public/javascripts/wechat/directives/load_head.js b/public/javascripts/wechat/directives/load_head.js index 6cbb8e743..47862f0b7 100644 --- a/public/javascripts/wechat/directives/load_head.js +++ b/public/javascripts/wechat/directives/load_head.js @@ -14,7 +14,7 @@ app.directive('loadHead',['$http','config','auth','$location','alertService',fun var reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { - alert(this.result);//base64 +// alert(this.result);//base64 $http.post(config.apiUrl + "users/upload_head", {token: auth.token(),imgdata:this.result} @@ -25,7 +25,7 @@ app.directive('loadHead',['$http','config','auth','$location','alertService',fun }); } else{ - scope.$parent.alertService_1.showMessage('提示',"上传失败"); + scope.$parent.alertService_1.showMessage('提示',response.data.message); } }); } From 1109eba4608938ccf3073e4d27efd5bfb5318a67 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 08:46:29 +0800 Subject: [PATCH 21/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=8A=9F=E8=83=BD=E5=85=88=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_userinfo.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index 18337807c..2d6fd6093 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -4,7 +4,7 @@
    - +
    {{user.login}}解除绑定
    From be0158fbb0e4ccc3fe81d47c3e364b59154c6e70 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 14:10:58 +0800 Subject: [PATCH 22/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8DBUG=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/new_comment.rb | 2 +- app/api/mobile/entities/user.rb | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index d98977661..e72daae6d 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -189,7 +189,7 @@ module Mobile reply.content = params[:content] reply.parent_id = params[:id] reply.subject = "RE: #{topic.subject}" - if topic.children << reply + if message.children << reply result = 2 update_id = topic.id end diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index 657b1cb7b..30a2a7edd 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -30,19 +30,24 @@ module Mobile u.nil? ? "" : u.show_name when :roles_id u[:roles_id].nil? ? nil : u.roles_id + when :login + u.login + when :lastname + u.lastname + when :mail + u.mail end end end - end end expose :id #头像 - expose :login - expose :lastname + user_expose :login + user_expose :lastname #邮箱地址 - expose :mail + user_expose :mail expose :nickname #真名 user_expose :img_url From 216c834a40fe159a0cc5cd9131dc5ec02dd6396d Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 8 Sep 2016 14:15:00 +0800 Subject: [PATCH 23/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B5=84=E6=96=99select=E6=A1=86=E5=8E=BB=E8=BE=B9=E6=A1=86?= =?UTF-8?q?=EF=BC=9B=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D=E6=98=BE=E9=9A=90?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=95=88=E6=9E=9C=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/directives/input_auto.js | 59 +++++++++++++------ .../wechat/directives/multi_reply.js | 40 ++++++++----- public/javascripts/wechat/others/factory.js | 1 - public/stylesheets/weui/weixin.css | 2 +- 4 files changed, 67 insertions(+), 35 deletions(-) diff --git a/public/javascripts/wechat/directives/input_auto.js b/public/javascripts/wechat/directives/input_auto.js index 9cd77188b..ea0a6bf1a 100644 --- a/public/javascripts/wechat/directives/input_auto.js +++ b/public/javascripts/wechat/directives/input_auto.js @@ -1,19 +1,40 @@ -app.directive('inputAuto',function(){ - return{ - restrict: 'A', - scope: {}, - link: function(scope, element){ - var copyContainer = element.parent().children().children().eq(0); - var sendButton = element.next(); - element.on('input',function(){ - //console.log(sendButton); - copyContainer.html(element[0].value); - var textHeight = copyContainer[0].scrollHeight-10; - element.css('height', textHeight + 'px'); - }); - sendButton.on('click',function(){ - element.css('height','18px'); - }); - } - } -}); \ No newline at end of file +//app.directive('inputAuto',function(){ +// return{ +// restrict: 'A', +// scope: {}, +// link: function(scope, element){ +// var copyContainer = element.parent().children().children().eq(0); +// var sendButton = element.next(); +// element.on('input',function(){ +// //console.log(sendButton); +// copyContainer.html(element[0].value); +// var textHeight = copyContainer[0].scrollHeight-10; +// element.css('height', textHeight + 'px'); +// }); +// sendButton.on('click',function(){ +// element.css('height','18px'); +// }); +// } +// } +//}); + +app.directive('inputAuto',["$timeout",function(timer){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + timer(function(){ + $(".post-reply-input").bind("input",function(){ + var copyInput = $(this).prev().children(); + var sendButton = $(this).next(); + copyInput.html($(this).val()); + var textHeight = copyInput[0].scrollHeight-10; + $(this).css("height",textHeight + "px"); + sendButton.click(function(){ + $(this).prev().css("height","18px"); + }) + }); + }); + } + } +}]); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/multi_reply.js b/public/javascripts/wechat/directives/multi_reply.js index 6c4f1cccc..5b1e2b483 100644 --- a/public/javascripts/wechat/directives/multi_reply.js +++ b/public/javascripts/wechat/directives/multi_reply.js @@ -7,23 +7,35 @@ app.directive('multiReply',["$timeout",function(timer){ scope: {}, link: function(scope, element){ timer(function(){ - $(".reply-icons").live("click",function(){ - if($(this).hasClass("multi-hide")){ - $(".multi-input-container").addClass("undis"); - $(".reply-icons").addClass("multi-hide"); + $(".reply-icons").each(function(){ + $(this).toggle(function(){ $(this).next().next().removeClass("undis"); $(this).next().next().focus(); - $(this).removeClass("multi-hide"); - $(".post-reply-input").val(""); - $("#post_input_1").hide(); - } - else{ - $(this).addClass("multi-hide"); - $(".post-input-container").addClass("undis"); - $(".post-reply-input").val(""); - $("#post_input_1, #post_input_1 .post-input-container").show(); - } + },function(){ + $(this).next().next().addClass("undis"); + }); }); +// $(".reply-icons").live("click",function(){ +// if($(this).hasClass("multi-hide")){ +// $(".multi-input-container").addClass("undis"); +// $(".reply-icons").addClass("multi-hide"); +// $(this).next().next().removeClass("undis"); +// $(this).next().next().focus(); +// $(this).removeClass("multi-hide"); +// $(".post-reply-input").val(""); +// } +// else{ +// $(this).addClass("multi-hide"); +// $(".post-input-container").addClass("undis"); +// $(".post-reply-input").val(""); +// $("#post_input_1, #post_input_1 .post-input-container").show(); +// } +// }); +// $(".post-reply-submit,#more_reply").click(function(){ +// $(".reply-icons").addClass("multi-hide"); +// $(".post-input-container").addClass("undis"); +// $("#post_input_1, #post_input_1 .post-input-container").show(); +// }); }) } } diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 37ca00114..01356003c 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -111,7 +111,6 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc } var temp = data.comment.replace(/\n/g,'
    '); - temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]"); var userInfo = { type: type, diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 6a65b440a..ed8cf1bd6 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -266,4 +266,4 @@ a.underline {text-decoration:underline;} /*.upload-input-container:after {content:" "; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background-color:#ddd; background-image:url(../images/male.jpg); width:30px; height:30px; background-size:30px 30px; border-radius:50%;}*/ .select-container {position:relative; padding-left:62px;} .select-text {position:absolute; left:15px;} -.select-model {width:100%; border:none; color:#999; margin-top:8px;} \ No newline at end of file +.select-model {width:100%; border:none; color:#999; margin-top:8px; outline:none;} \ No newline at end of file From 8584d1dccb22660a8e5d7784b54add90f2745451 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 15:05:27 +0800 Subject: [PATCH 24/38] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D=E5=9B=9E=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 8 ++++---- public/assets/wechat/course_discussion.html | 4 ++-- public/assets/wechat/course_notice.html | 4 ++-- public/assets/wechat/homework_detail.html | 4 ++-- public/assets/wechat/issue_detail.html | 4 ++-- public/assets/wechat/jour_message_detail.html | 4 ++-- public/assets/wechat/project_discussion.html | 4 ++-- public/javascripts/wechat/others/factory.js | 10 ++++++++++ 8 files changed, 26 insertions(+), 16 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 444f16957..3ed2d573b 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -73,14 +73,14 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index a21b5aec0..be927f9a9 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -75,10 +75,10 @@ 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 273f7e703..518829ceb 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -90,10 +90,10 @@ 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index f978fc01d..43efd2d21 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -79,10 +79,10 @@ 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index a3e861649..5a72fdc82 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -96,10 +96,10 @@ 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index fe746a1fc..e96f34768 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -74,10 +74,10 @@ 回复
    -
    +
    - +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index d30ef298b..ca3dc1bb0 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -75,10 +75,10 @@ 回复
    -
    +
    - +
    diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 01356003c..2c32a81e2 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -324,6 +324,16 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }); }; + args.scope.clickReply = function(act_id,allchidren) { + for(var i in allchidren){ + if(allchidren[i].act_id != act_id ){ + allchidren[i].showinput = false; + } + else{ + allchidren[i].showinput = !allchidren[i].showinput; + } + } + }; // 动态详情界面点赞与动态界面的数据要同步 保证进入详情点赞后出来显示一致 args.scope.addPraise = function(act){ From 031ba386554387210a34313a41d53c1fb43597aa Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 8 Sep 2016 15:28:22 +0800 Subject: [PATCH 25/38] =?UTF-8?q?=E6=80=A7=E5=88=AB=E9=80=89=E6=A1=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_userinfo.html | 18 ++++++++++-------- public/stylesheets/weui/weixin.css | 6 +----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index 2d6fd6093..e4a7a00f2 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -12,14 +12,16 @@
    姓名
    -
    - 性别 -
    - +
    +
    + 性别 + + +
    +
    + + +
    diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index ed8cf1bd6..cf44a3814 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -262,8 +262,4 @@ a.underline {text-decoration:underline;} /*资料修改*/ .blank-row {width:100%; height:38px; line-height:38px; vertical-align:middle;} .upload-input-container {width:30px; height:30px; border:1px solid #ddd; position:relative;} -.upload-input {width:30px; height:30px; position:absolute; z-index:1; opacity:0;} -/*.upload-input-container:after {content:" "; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background-color:#ddd; background-image:url(../images/male.jpg); width:30px; height:30px; background-size:30px 30px; border-radius:50%;}*/ -.select-container {position:relative; padding-left:62px;} -.select-text {position:absolute; left:15px;} -.select-model {width:100%; border:none; color:#999; margin-top:8px; outline:none;} \ No newline at end of file +.upload-input {width:30px; height:30px; position:absolute; z-index:1; opacity:0;} \ No newline at end of file From e74516cb68f48212a719ed71a090f41df543e3ba Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 15:34:48 +0800 Subject: [PATCH 26/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_userinfo.html | 4 ++-- .../wechat/controllers/edit_userinfo.js | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index e4a7a00f2..4b353229f 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -16,12 +16,12 @@
    性别 - +
    - +
    diff --git a/public/javascripts/wechat/controllers/edit_userinfo.js b/public/javascripts/wechat/controllers/edit_userinfo.js index 920e9dc0c..f367adf31 100644 --- a/public/javascripts/wechat/controllers/edit_userinfo.js +++ b/public/javascripts/wechat/controllers/edit_userinfo.js @@ -21,13 +21,6 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l vm.lastname = vm.user.lastname; vm.mail = vm.user.mail; vm.sex = vm.user.gender; - if(vm.sex == 0){ - vm.gender = "男"; - } - else{ - vm.gender = "女"; - } - vm.user.img_url = vm.user.img_url +"?t="+Math.random(); } ); @@ -67,11 +60,6 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l return; } - var sex = 0; - if(vm.gender == "女"){ - sex = 1; - } - if(vm.lastname == ""){ vm.alertService_1.showMessage('提示', '姓名不能为空'); return; @@ -88,7 +76,7 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l // } $http.post(config.apiUrl + "users/edit_userinfo", - {token: auth.token(),lastname: vm.lastname, sex: sex, mail: vm.mail} + {token: auth.token(),lastname: vm.lastname, sex: vm.sex, mail: vm.mail} ).then(function(response){ if(response.data.status == 0) { From ca4c668c9bd06e02ca608700448314fa780e4f66 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 8 Sep 2016 15:36:58 +0800 Subject: [PATCH 27/38] =?UTF-8?q?=E9=82=AE=E7=AE=B1=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_userinfo.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/wechat/edit_userinfo.html b/public/assets/wechat/edit_userinfo.html index e4a7a00f2..9c0611f46 100644 --- a/public/assets/wechat/edit_userinfo.html +++ b/public/assets/wechat/edit_userinfo.html @@ -29,8 +29,8 @@ 邮箱
    - 电子邮箱地址不能为空 - 电子邮箱地址不合法 + 电子邮箱地址不能为空 + 电子邮箱地址不合法
    From 58037c37960106e7de30b042650890be3bd0ecda Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 15:56:09 +0800 Subject: [PATCH 28/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/assets/wechat/homework_detail.html | 2 +- public/assets/wechat/issue_detail.html | 2 +- public/assets/wechat/jour_message_detail.html | 2 +- public/assets/wechat/project_discussion.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index be927f9a9..cba34e7b9 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -72,7 +72,7 @@
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 518829ceb..a2c39afef 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -87,7 +87,7 @@
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 43efd2d21..2e3e6b076 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -76,7 +76,7 @@
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 5a72fdc82..47a45a150 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -93,7 +93,7 @@
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index e96f34768..2ab72f259 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -71,7 +71,7 @@
    {{journal.praise_count}}
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index ca3dc1bb0..3b1b12159 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -72,7 +72,7 @@
    {{journal.praise_count}}
    From b6fdbc11a64fd68cc8463ec605aef2f9124e0cfb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 16:22:19 +0800 Subject: [PATCH 29/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=A1=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 6 +++--- public/assets/wechat/course_discussion.html | 6 +++--- public/assets/wechat/course_notice.html | 4 ++-- public/assets/wechat/homework_detail.html | 6 +++--- public/assets/wechat/issue_detail.html | 6 +++--- public/assets/wechat/jour_message_detail.html | 6 +++--- public/assets/wechat/project_discussion.html | 6 +++--- public/javascripts/wechat/others/factory.js | 12 +++++++++++- 8 files changed, 31 insertions(+), 21 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 3ed2d573b..0d9e07f9a 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -74,12 +74,12 @@
    {{journal.praise_count}}
    - +
    @@ -92,7 +92,7 @@
    -
    +
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index cba34e7b9..ee9cfc054 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -72,12 +72,12 @@
    {{journal.praise_count}}
    - +
    @@ -89,7 +89,7 @@
    -
    +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index a2c39afef..bc133601b 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -87,12 +87,12 @@
    {{journal.praise_count}}
    - +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 2e3e6b076..c1d99f8a3 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -76,12 +76,12 @@
    {{journal.praise_count}}
    - +
    @@ -93,7 +93,7 @@
    -
    +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 47a45a150..7fa7db27e 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -93,12 +93,12 @@
    {{journal.praise_count}}
    - +
    @@ -110,7 +110,7 @@
    -
    +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 2ab72f259..390866f83 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -71,12 +71,12 @@
    {{journal.praise_count}}
    - +
    @@ -88,7 +88,7 @@
    -
    +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 3b1b12159..b2f315a6c 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -72,12 +72,12 @@
    {{journal.praise_count}}
    - +
    @@ -88,7 +88,7 @@
    更多
    -
    +
    diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 2c32a81e2..190dd36b4 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -324,13 +324,23 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }); }; - args.scope.clickReply = function(act_id,allchidren) { + args.scope.inputfocus = function(data){ + data.notshow = true; + }; + + args.scope.inputblur = function(data){ + data.notshow = false; + }; + + args.scope.clickReply = function(act_id,data) { + allchidren = data.all_children; for(var i in allchidren){ if(allchidren[i].act_id != act_id ){ allchidren[i].showinput = false; } else{ allchidren[i].showinput = !allchidren[i].showinput; + data.notshow = allchidren[i].showinput; } } }; From 8f3a73d40049957266cf88c0a267b12193463c4d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 17:37:00 +0800 Subject: [PATCH 30/38] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/others/factory.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 190dd36b4..ae7317684 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -325,11 +325,11 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }; args.scope.inputfocus = function(data){ - data.notshow = true; +// data.notshow = true; }; args.scope.inputblur = function(data){ - data.notshow = false; +// data.notshow = false; }; args.scope.clickReply = function(act_id,data) { @@ -340,7 +340,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc } else{ allchidren[i].showinput = !allchidren[i].showinput; - data.notshow = allchidren[i].showinput; +// data.notshow = allchidren[i].showinput; } } }; From b43f8cf9749b9d24ccf5a9c941dd19d5758d71c7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 17:44:38 +0800 Subject: [PATCH 31/38] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 4 ++-- public/assets/wechat/course_discussion.html | 4 ++-- public/assets/wechat/course_notice.html | 4 ++-- public/assets/wechat/homework_detail.html | 4 ++-- public/assets/wechat/issue_detail.html | 4 ++-- public/assets/wechat/jour_message_detail.html | 4 ++-- public/assets/wechat/project_discussion.html | 4 ++-- public/javascripts/wechat/others/factory.js | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 0d9e07f9a..699d71842 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -73,8 +73,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index ee9cfc054..27f43f8c2 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -71,8 +71,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index bc133601b..3a4fc09db 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -86,8 +86,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index c1d99f8a3..9b5c7dc79 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -75,8 +75,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 7fa7db27e..786e8cda3 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -92,8 +92,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 390866f83..98e082448 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -70,8 +70,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index b2f315a6c..c8509ff50 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -71,8 +71,8 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    - 回复 +
    + 回复
    diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index ae7317684..190dd36b4 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -325,11 +325,11 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc }; args.scope.inputfocus = function(data){ -// data.notshow = true; + data.notshow = true; }; args.scope.inputblur = function(data){ -// data.notshow = false; + data.notshow = false; }; args.scope.clickReply = function(act_id,data) { @@ -340,7 +340,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc } else{ allchidren[i].showinput = !allchidren[i].showinput; -// data.notshow = allchidren[i].showinput; + data.notshow = allchidren[i].showinput; } } }; From 2ad432c5ce4afce004c02fd8715414bb62754b3c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 17:51:36 +0800 Subject: [PATCH 32/38] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/wechats_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/wechats_helper.rb b/app/helpers/wechats_helper.rb index 5c6b3da8c..34c4dd9a1 100644 --- a/app/helpers/wechats_helper.rb +++ b/app/helpers/wechats_helper.rb @@ -3,9 +3,9 @@ module WechatsHelper def include_wechat_jsfile - if Rails.env.production? - javascript_include_tag '/javascripts/wechat/build/app.min.js' - else + # if Rails.env.production? + # javascript_include_tag '/javascripts/wechat/build/app.min.js' + # else wechat_path = File.join(Rails.root, "public", "javascripts", "wechat") srcs = Rails.application.config.wechat_srcs paths = [] @@ -15,6 +15,6 @@ module WechatsHelper end end javascript_include_tag *paths - end + # end end end From 5c626f94b521bcfe19c94fa989fad21cacaab719 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 18:04:37 +0800 Subject: [PATCH 33/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=A1=86=E4=B8=8D=E6=98=BE=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/wechats_helper.rb | 8 ++++---- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/assets/wechat/homework_detail.html | 2 +- public/assets/wechat/issue_detail.html | 2 +- public/assets/wechat/jour_message_detail.html | 2 +- public/assets/wechat/project_discussion.html | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/wechats_helper.rb b/app/helpers/wechats_helper.rb index 34c4dd9a1..5c6b3da8c 100644 --- a/app/helpers/wechats_helper.rb +++ b/app/helpers/wechats_helper.rb @@ -3,9 +3,9 @@ module WechatsHelper def include_wechat_jsfile - # if Rails.env.production? - # javascript_include_tag '/javascripts/wechat/build/app.min.js' - # else + if Rails.env.production? + javascript_include_tag '/javascripts/wechat/build/app.min.js' + else wechat_path = File.join(Rails.root, "public", "javascripts", "wechat") srcs = Rails.application.config.wechat_srcs paths = [] @@ -15,6 +15,6 @@ module WechatsHelper end end javascript_include_tag *paths - # end + end end end diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 27f43f8c2..91aa58fcf 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -71,7 +71,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 3a4fc09db..35a2446f2 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -86,7 +86,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 9b5c7dc79..e5f73faa9 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -75,7 +75,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 786e8cda3..f4eed4bd9 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -92,7 +92,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 98e082448..a1db224a6 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -70,7 +70,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index c8509ff50..dcb5a68a6 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -71,7 +71,7 @@
    {{journal.praise_count}}
    {{journal.praise_count}}
    -
    +
    From 9e66bcb2ab3d2d3b220f4860bfb9a8691710592a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 18:11:40 +0800 Subject: [PATCH 34/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/course_notice.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 35a2446f2..247cd1fd0 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -104,7 +104,7 @@
    -
    +
    From dc051f0ec33d83b4be675fdaf2f2de897f280a25 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 18:17:11 +0800 Subject: [PATCH 35/38] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 699d71842..7aa629bb7 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -74,7 +74,7 @@
    {{journal.praise_count}}
    - 回复 + 回复
    From 5b8ecf6657333353438daa28b9c6e60581ca9b74 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 18:50:09 +0800 Subject: [PATCH 36/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/user.rb | 3 ++- config/menu.yml.production | 6 +++--- public/javascripts/wechat/controllers/edit_userinfo.js | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index 30a2a7edd..f4fc7cb66 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -13,7 +13,8 @@ module Mobile else case f when :img_url - "/images/#{url_to_avatar(u)}" + "/images/#{url_to_avatar(u)}"+"?t="+Time.now.to_i.to_s + #Time.now.strftime('%Y-%m-%d') when :gender u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender when :work_unit diff --git a/config/menu.yml.production b/config/menu.yml.production index d825a8727..0b8cd5b37 100644 --- a/config/menu.yml.production +++ b/config/menu.yml.production @@ -31,6 +31,6 @@ button: name: "联系我们" key: "FEEDBACK" - - type: "click" - name: "解除绑定" - key: "UNBIND" + type: "view" + name: "个人资料" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=edit_userinfo#wechat_redirect" diff --git a/public/javascripts/wechat/controllers/edit_userinfo.js b/public/javascripts/wechat/controllers/edit_userinfo.js index f367adf31..94722398d 100644 --- a/public/javascripts/wechat/controllers/edit_userinfo.js +++ b/public/javascripts/wechat/controllers/edit_userinfo.js @@ -21,7 +21,6 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l vm.lastname = vm.user.lastname; vm.mail = vm.user.mail; vm.sex = vm.user.gender; - vm.user.img_url = vm.user.img_url +"?t="+Math.random(); } ); }; From a6b03ed9f17fb884508ace873697fe376c2a0980 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 8 Sep 2016 18:53:36 +0800 Subject: [PATCH 37/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/user.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index f4fc7cb66..5c6b95771 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -13,8 +13,7 @@ module Mobile else case f when :img_url - "/images/#{url_to_avatar(u)}"+"?t="+Time.now.to_i.to_s - #Time.now.strftime('%Y-%m-%d') + "/images/#{url_to_avatar(u)}"+"?t="+Time.now.strftime('%Y-%m-%d') when :gender u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender when :work_unit From 4adc988ec1702e97e96e4a8f50e575d76c6d438b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 9 Sep 2016 08:35:08 +0800 Subject: [PATCH 38/38] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=9B=BE=E7=89=87url?= =?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/entities/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb index 5c6b95771..30a2a7edd 100644 --- a/app/api/mobile/entities/user.rb +++ b/app/api/mobile/entities/user.rb @@ -13,7 +13,7 @@ module Mobile else case f when :img_url - "/images/#{url_to_avatar(u)}"+"?t="+Time.now.strftime('%Y-%m-%d') + "/images/#{url_to_avatar(u)}" when :gender u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender when :work_unit