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 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; }