Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

chromesetting
杨树明 5 years ago
commit dfb81b90ea

@ -83,9 +83,9 @@ class Admins::ShixunSettingsController < Admins::BaseController
sheet1[count_row, 6] = shixun.myshixuns_count sheet1[count_row, 6] = shixun.myshixuns_count
sheet1[count_row, 7] = shixun.myshixuns.select{|m| m.status == 1}.size sheet1[count_row, 7] = shixun.myshixuns.select{|m| m.status == 1}.size
sheet1[count_row, 8] = shixun.shixun_status sheet1[count_row, 8] = shixun.shixun_status
sheet1[count_row, 9] = shixun.user.show_real_name sheet1[count_row, 9] = shixun.user&.show_real_name
sheet1[count_row, 10] = shixun.user.school_name sheet1[count_row, 10] = shixun.user&.school_name
sheet1[count_row, 11] = shixun.user.identity sheet1[count_row, 11] = shixun.user&.identity
shixun.challenges.each do |challenge| shixun.challenges.each do |challenge|
sheet1[count_row, 12] = "#{challenge.position}" sheet1[count_row, 12] = "#{challenge.position}"
sheet1[count_row, 13] = challenge.subject sheet1[count_row, 13] = challenge.subject
@ -112,13 +112,16 @@ class Admins::ShixunSettingsController < Admins::BaseController
sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name 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, 3] = shixun.fork_from
sheet1[count_row, 4] = shixun.shixun_status sheet1[count_row, 4] = shixun.shixun_status
sheet1[count_row, 5] = shixun.user.show_real_name sheet1[count_row, 5] = shixun.user&.show_real_name
sheet1[count_row, 6] = shixun.user.school_name sheet1[count_row, 6] = shixun.user&.school_name
sheet1[count_row, 7] = shixun.user.identity 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, 8] = "#{challenge.position}"
sheet1[count_row, 9] = challenge.subject sheet1[count_row, 9] = challenge.subject
count_row += 1 if index + 1 != challenge_count
count_row += 1
end
end end
count_row += 1 count_row += 1
end end

@ -909,16 +909,20 @@ class ShixunsController < ApplicationController
# 搜索成员 # 搜索成员
if request.get? if request.get?
@collaborators = @shixun.shixun_members.where("user_id != #{@shixun.user_id}") @collaborators = @shixun.shixun_members.where("user_id != #{@shixun.user_id}")
else else
if params[:user_id] begin
man_member = ShixunMember.where(:shixun_id => @shixun.id, :user_id => @shixun.user_id).first raise("请先选择成员") if params[:user_id].blank?
cha_member = ShixunMember.where(:user_id => params[:user_id], :shixun_id => @shixun.id).first man_member = ShixunMember.where(:shixun_id => @shixun.id, :user_id => @shixun.user_id).first
if man_member && cha_member cha_member = ShixunMember.where(:user_id => params[:user_id], :shixun_id => @shixun.id).first
man_member.update_attribute(:role, 2) if man_member && cha_member
cha_member.update_attribute(:role, 1) man_member.update_attribute(:role, 2)
@shixun.update_attribute(:user_id, cha_member.user_id) cha_member.update_attribute(:role, 1)
end @shixun.update_attribute(:user_id, cha_member.user_id)
end end
rescue => e
logger.error("######change_manager_error: #{e.message}")
render_error(e.message)
end
end end
end end

@ -16,7 +16,9 @@ module Searchable::Shixun
name: name, name: name,
description: Util.extract_content(description)[0..Searchable::MAXIMUM_LENGTH], description: Util.extract_content(description)[0..Searchable::MAXIMUM_LENGTH],
status: status, status: status,
myshixuns_count: myshixuns_count myshixuns_count: myshixuns_count,
created_at: created_at,
publish_time: publish_time
}.merge!(searchable_user_data) }.merge!(searchable_user_data)
.merge!(searchable_challenge_data) .merge!(searchable_challenge_data)
end end

@ -32,7 +32,7 @@
<%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%>
<% end%> <% end%>
</td> </td>
<td><%= overflow_hidden_span(shixun&.fork_reason) %></td> <td><%= overflow_hidden_span(shixun&.fork_reason, width: 150) %></td>
<td><%= shixun.challenges.where(:st => 0).size %></td> <td><%= shixun.challenges.where(:st => 0).size %></td>
<td><%= shixun.challenges.where(:st => 1).size %></td> <td><%= shixun.challenges.where(:st => 1).size %></td>
<td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td> <td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td>

@ -180,7 +180,7 @@ $ml: 20px;
background: #fff; background: #fff;
left: 0px; left: 0px;
right: 0px; right: 0px;
top: -220px; top: -230px;
padding: 0 20px; padding: 0 20px;
} }
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-23 11:33:41 * @Date: 2019-11-23 11:33:41
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 11:07:42 * @LastEditTime : 2019-12-25 17:10:30
// */ // */
import './index.scss'; import './index.scss';
import React, { useState, useEffect, useMemo } from 'react'; import React, { useState, useEffect, useMemo } from 'react';
@ -129,7 +129,7 @@ const LeftPane = (props) => {
/> />
</div> </div>
<div className="number_flex flex_info"> <div className="number_flex flex_info">
<TextNumber text="huifu1" number={comments_count} type="icon" onIconClick={handleClickMessage}/> <TextNumber text="huifu1" number={hack.comments_count} type="icon" onIconClick={handleClickMessage}/>
<TextNumber <TextNumber
className={user_praise ? 'like active' : 'like'} className={user_praise ? 'like active' : 'like'}
text="dianzan" text="dianzan"

@ -56,6 +56,7 @@ const types = {
CLEAR_OJ_FOR_USER_REDUCER: 'CLEAR_OJ_FOR_USER_REDUCER', // 退出时清空 ojForUserReducer保存内容 CLEAR_OJ_FOR_USER_REDUCER: 'CLEAR_OJ_FOR_USER_REDUCER', // 退出时清空 ojForUserReducer保存内容
ADD_OJ_LIKE_COUNT: 'ADD_OJ_LIKE_COUNT', // 增加点赞数 ADD_OJ_LIKE_COUNT: 'ADD_OJ_LIKE_COUNT', // 增加点赞数
CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页 CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页
UPDATE_OJ_FOR_USER_COMMENT_COUNT: 'UPDATE_OJ_FOR_USER_COMMENT_COUNT', // 更新 hack 中的评论数
/*** jupyter */ /*** jupyter */
GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集 GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集
GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-23 10:53:25 * @Date: 2019-12-23 10:53:25
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 10:55:27 * @LastEditTime : 2019-12-25 17:06:57
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
@ -24,6 +24,11 @@ export const addComment = (identifier, comments) => {
if (res.status === 200) { if (res.status === 200) {
// 重新加载评论列表 // 重新加载评论列表
dispatch(getCommentLists(identifier)); 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) { if (res.status === 200) {
// 重新加载评论列表 // 重新加载评论列表
dispatch(getCommentLists(identifier)); 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) { if (res.status === 200) {
// 重新加载评论列表 // 重新加载评论列表
dispatch(getCommentLists(identifier)); dispatch(getCommentLists(identifier));
// 成功后,评论加一条
dispatch({
type: types.UPDATE_OJ_FOR_USER_COMMENT_COUNT,
payload: 'minus' //
});
} }
}); });
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:41:48 * @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 14:45:47 * @LastEditTime : 2019-12-25 17:09:53
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -211,6 +211,13 @@ const ojForUserReducer = (state = initialState, action) => {
...state, ...state,
pages: Object.assign({}, state.pages, { page: action.payload}) 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: default:
return state; return state;
} }

Loading…
Cancel
Save