From 5617454d22c0bca55a3adfc8672da0909584ffa0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 25 Dec 2019 16:45:37 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=9A=84=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/searchable/shixun.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/searchable/shixun.rb b/app/models/searchable/shixun.rb index 359b8b4dc..e01920490 100644 --- a/app/models/searchable/shixun.rb +++ b/app/models/searchable/shixun.rb @@ -16,7 +16,9 @@ module Searchable::Shixun name: name, description: Util.extract_content(description)[0..Searchable::MAXIMUM_LENGTH], status: status, - myshixuns_count: myshixuns_count + myshixuns_count: myshixuns_count, + created_at: created_at, + publish_time: publish_time }.merge!(searchable_user_data) .merge!(searchable_challenge_data) end From 94fe6e0fceace211ed2f8e176aba0c9a057907b7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 25 Dec 2019 17:00:58 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=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 --- app/views/admins/shixuns/shared/_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/shixuns/shared/_list.html.erb b/app/views/admins/shixuns/shared/_list.html.erb index b0a0c715d..f34db3fa3 100644 --- a/app/views/admins/shixuns/shared/_list.html.erb +++ b/app/views/admins/shixuns/shared/_list.html.erb @@ -32,7 +32,7 @@ <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> <% end%> - <%= overflow_hidden_span(shixun&.fork_reason) %> + <%= overflow_hidden_span(shixun&.fork_reason, width: 150) %> <%= shixun.challenges.where(:st => 0).size %> <%= shixun.challenges.where(:st => 1).size %> <%= shixun_authentication_status shixun %> From cbb064b9e872cf8e95b7c762c244bb2fd8c21bcf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 17:06:53 +0800 Subject: [PATCH 3/9] 1 --- app/controllers/shixuns_controller.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 859dce6f6..36a9e03ac 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -909,16 +909,20 @@ class ShixunsController < ApplicationController # 搜索成员 if request.get? @collaborators = @shixun.shixun_members.where("user_id != #{@shixun.user_id}") - else - if params[:user_id] - man_member = ShixunMember.where(:shixun_id => @shixun.id, :user_id => @shixun.user_id).first - cha_member = ShixunMember.where(:user_id => params[:user_id], :shixun_id => @shixun.id).first - if man_member && cha_member - man_member.update_attribute(:role, 2) - cha_member.update_attribute(:role, 1) - @shixun.update_attribute(:user_id, cha_member.user_id) - end - end + else + begin + raise("必须选择一个用户才能更换管理员") if params[:user_id].blank? + man_member = ShixunMember.where(:shixun_id => @shixun.id, :user_id => @shixun.user_id).first + cha_member = ShixunMember.where(:user_id => params[:user_id], :shixun_id => @shixun.id).first + if man_member && cha_member + man_member.update_attribute(:role, 2) + cha_member.update_attribute(:role, 1) + @shixun.update_attribute(:user_id, cha_member.user_id) + end + rescue => e + logger.error("######change_manager_error: #{e.message}") + render_error(e.message) + end end end From 3b8bd6d454904dc05d13258f121ce4022955c2c1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 17:07:23 +0800 Subject: [PATCH 4/9] 1 --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 36a9e03ac..992bd87f8 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -911,7 +911,7 @@ class ShixunsController < ApplicationController @collaborators = @shixun.shixun_members.where("user_id != #{@shixun.user_id}") else begin - raise("必须选择一个用户才能更换管理员") if params[:user_id].blank? + raise("请先选择成员") if params[:user_id].blank? man_member = ShixunMember.where(:shixun_id => @shixun.id, :user_id => @shixun.user_id).first cha_member = ShixunMember.where(:user_id => params[:user_id], :shixun_id => @shixun.id).first if man_member && cha_member From fed9f6e912cd4d96472d0038c04910d0b25b1d19 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 17:11:26 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/shixun_settings_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 6dbbc077a..547e31fd9 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -115,10 +115,13 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1[count_row, 5] = shixun.user.show_real_name sheet1[count_row, 6] = shixun.user.school_name sheet1[count_row, 7] = shixun.user.identity - shixun.challenges.each do |challenge| + challenge_count = shixun.challenges.count + shixun.challenges.each_with_index do |challenge, index| sheet1[count_row, 8] = "第#{challenge.position}关" sheet1[count_row, 9] = challenge.subject - count_row += 1 + if index + 1 != challenge_count + count_row += 1 + end end count_row += 1 end From b57f3a83059b9c086c1b3aec59e050d7c302c8eb Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Wed, 25 Dec 2019 17:13:23 +0800 Subject: [PATCH 6/9] sync comment count --- .../src/common/components/comment/index.scss | 2 +- .../developer/studentStudy/leftpane/index.js | 4 ++-- public/react/src/redux/actions/actionTypes.js | 1 + public/react/src/redux/actions/comment.js | 17 ++++++++++++++++- .../src/redux/reducers/ojForUserReducer.js | 9 ++++++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/public/react/src/common/components/comment/index.scss b/public/react/src/common/components/comment/index.scss index 067fc7e9a..41371e8cc 100644 --- a/public/react/src/common/components/comment/index.scss +++ b/public/react/src/common/components/comment/index.scss @@ -180,7 +180,7 @@ $ml: 20px; background: #fff; left: 0px; right: 0px; - top: -220px; + top: -250px; padding: 0 20px; } } \ No newline at end of file diff --git a/public/react/src/modules/developer/studentStudy/leftpane/index.js b/public/react/src/modules/developer/studentStudy/leftpane/index.js index d9527a13e..30eedea18 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 11:33:41 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-25 11:07:42 + * @LastEditTime : 2019-12-25 17:10:30 // */ import './index.scss'; import React, { useState, useEffect, useMemo } from 'react'; @@ -129,7 +129,7 @@ const LeftPane = (props) => { />
- + { if (res.status === 200) { // 重新加载评论列表 dispatch(getCommentLists(identifier)); + // 成功后,评论加一条 + dispatch({ + type: types.UPDATE_OJ_FOR_USER_COMMENT_COUNT, + payload: 'add' // + }); } }); } @@ -57,6 +62,11 @@ export const replayChildComment = (identifier, comment) => { if (res.status === 200) { // 重新加载评论列表 dispatch(getCommentLists(identifier)); + // 成功后,评论加一条 + dispatch({ + type: types.UPDATE_OJ_FOR_USER_COMMENT_COUNT, + payload: 'add' // + }); } }); } @@ -69,6 +79,11 @@ export const deleteComment = (identifier, delId) => { if (res.status === 200) { // 重新加载评论列表 dispatch(getCommentLists(identifier)); + // 成功后,评论加一条 + dispatch({ + type: types.UPDATE_OJ_FOR_USER_COMMENT_COUNT, + payload: 'minus' // + }); } }); } diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js index 8d82b8307..18ffd30c8 100644 --- a/public/react/src/redux/reducers/ojForUserReducer.js +++ b/public/react/src/redux/reducers/ojForUserReducer.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 13:41:48 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-25 14:45:47 + * @LastEditTime : 2019-12-25 17:09:53 */ import types from "../actions/actionTypes"; import { Base64 } from 'js-base64'; @@ -211,6 +211,13 @@ const ojForUserReducer = (state = initialState, action) => { ...state, pages: Object.assign({}, state.pages, { page: action.payload}) } + case types.UPDATE_OJ_FOR_USER_COMMENT_COUNT: + const {comments_count} = state.hack; + const _comments_count = action.payload === 'add' ? comments_count + 1 : comments_count - 1; + return { + ...state, + hack: Object.assign({}, state.hack, { comments_count: _comments_count }) + } default: return state; } From 45a6dc1f3c1c7541d99cff23911b4a4425fac726 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 17:14:37 +0800 Subject: [PATCH 7/9] 1 --- app/controllers/admins/shixun_settings_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 547e31fd9..1fcac9362 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -83,9 +83,9 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1[count_row, 6] = shixun.myshixuns_count sheet1[count_row, 7] = shixun.myshixuns.select{|m| m.status == 1}.size sheet1[count_row, 8] = shixun.shixun_status - sheet1[count_row, 9] = shixun.user.show_real_name - sheet1[count_row, 10] = shixun.user.school_name - sheet1[count_row, 11] = shixun.user.identity + sheet1[count_row, 9] = shixun.user&.show_real_name + sheet1[count_row, 10] = shixun.user&.school_name + sheet1[count_row, 11] = shixun.user&.identity shixun.challenges.each do |challenge| sheet1[count_row, 12] = "第#{challenge.position}关" sheet1[count_row, 13] = challenge.subject From e9bc18e455f5b5934de6db9021eec9868e6e629c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 17:19:50 +0800 Subject: [PATCH 8/9] 1 --- app/controllers/admins/shixun_settings_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 1fcac9362..fd06fddb3 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -112,9 +112,9 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name sheet1[count_row, 3] = shixun.fork_from sheet1[count_row, 4] = shixun.shixun_status - sheet1[count_row, 5] = shixun.user.show_real_name - sheet1[count_row, 6] = shixun.user.school_name - sheet1[count_row, 7] = shixun.user.identity + sheet1[count_row, 5] = shixun.user&.show_real_name + sheet1[count_row, 6] = shixun.user&.school_name + sheet1[count_row, 7] = shixun.user&.identity challenge_count = shixun.challenges.count shixun.challenges.each_with_index do |challenge, index| sheet1[count_row, 8] = "第#{challenge.position}关" From 67ba77f06700e1471d83a809c72db34b119c703a Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Wed, 25 Dec 2019 17:22:01 +0800 Subject: [PATCH 9/9] update comment style --- public/react/src/common/components/comment/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/common/components/comment/index.scss b/public/react/src/common/components/comment/index.scss index 41371e8cc..e45ae4e5d 100644 --- a/public/react/src/common/components/comment/index.scss +++ b/public/react/src/common/components/comment/index.scss @@ -180,7 +180,7 @@ $ml: 20px; background: #fff; left: 0px; right: 0px; - top: -250px; + top: -230px; padding: 0 20px; } } \ No newline at end of file