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

chromesetting
杨树明 5 years ago
commit 1b460acb86

@ -23,7 +23,6 @@ class CommentsController < ApplicationController
@discuss.hidden = false @discuss.hidden = false
@discuss.user_id = current_user.id @discuss.user_id = current_user.id
@discuss.root_id = params[:comments][:parent_id] @discuss.root_id = params[:comments][:parent_id]
@discusses.parent_container_id =
@discuss.save! @discuss.save!
rescue Exception => e rescue Exception => e
uid_logger_error("reply discuss failed : #{e.message}") uid_logger_error("reply discuss failed : #{e.message}")

@ -4,11 +4,11 @@
* @Github: * @Github:
* @Date: 2019-12-18 10:49:46 * @Date: 2019-12-18 10:49:46
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-24 18:04:52 * @LastEditTime : 2019-12-25 10:03:21
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
import { Icon } from 'antd'; // import { Icon } from 'antd';
// import MyIcon from '../MyIcon'; // import MyIcon from '../MyIcon';
function CommentIcon ({ function CommentIcon ({
type, // 图标类型 type, // 图标类型
@ -25,13 +25,15 @@ function CommentIcon ({
} }
const _className = [undefined, null, ''].includes(count) ? 'comment_count_none' : 'comment_count'; const _className = [undefined, null, ''].includes(count) ? 'comment_count_none' : 'comment_count';
const _classIcon = `iconfont icon-${type} icon_font_size_14 comment_icon `;
return ( return (
<span <span
style={props.style} style={props.style}
className={`comment_icon_count ${props.className}`} className={`comment_icon_count ${props.className}`}
onClick={ handleSpanClick } onClick={ handleSpanClick }
> >
<Icon className="comment_icon" type={type} style={{ color: iconColor }} theme={theme}/> {/* <Icon className="comment_icon" type={type} style={{ color: iconColor }} theme={theme}/> */}
<span className={_classIcon} style={{ color: iconColor }}></span>
<span className={_className}>{ count }</span> <span className={_className}>{ count }</span>
</span> </span>
) )

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-17 17:35:17 * @Date: 2019-12-17 17:35:17
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-24 18:05:18 * @LastEditTime : 2019-12-25 14:53:41
*/ */
import './index.scss'; import './index.scss';
import React, { useState } from 'react'; import React, { useState } from 'react';
@ -28,7 +28,7 @@ function CommentItem ({
// 加载更多评论内容 // 加载更多评论内容
// const [showMore, setShowMore] = useState(false); // const [showMore, setShowMore] = useState(false);
// 显示子列数 // 显示子列数
const [showItemCount, setShowItemCount] = useState(1); const [showItemCount, setShowItemCount] = useState(5);
// 箭头方向 // 箭头方向
const [arrow, setArrow] = useState(false); const [arrow, setArrow] = useState(false);
@ -74,7 +74,7 @@ function CommentItem ({
<span className="item-name">{author.name || ''}</span> <span className="item-name">{author.name || ''}</span>
<span className="item-time">{time || ''}</span> <span className="item-time">{time || ''}</span>
<span className={_classNames}> <span className={_classNames}>
<Icon type="close" onClick={() => deleteComment(id)}/> <span className="iconfont icon-shanchu icon_font_size_14" onClick={() => deleteComment(id)}></span>
</span> </span>
</div> </div>
); );
@ -95,7 +95,7 @@ function CommentItem ({
const commentAppend = (children = []) => { const commentAppend = (children = []) => {
const len = children.length; const len = children.length;
const _moreClass = len > 1 ? 'comment_item_loadmore show' : 'comment_item_loadmore' const _moreClass = len > showItemCount ? 'comment_item_loadmore show' : 'comment_item_loadmore'
const lastTxt = len - showItemCount; const lastTxt = len - showItemCount;
const renderChild = (children) => { const renderChild = (children) => {
return children.map((child, i) => { return children.map((child, i) => {
@ -112,7 +112,7 @@ function CommentItem ({
key={`child_${i}`} key={`child_${i}`}
className={showOrHide} className={showOrHide}
> >
<div className="comment_item_area"> <div className="comment_item_area comment_child_item_area">
{commentAvatar(author)} {commentAvatar(author)}
<div className="item-flex item-desc"> <div className="item-flex item-desc">
{commentInfo(id, author, time, can_delete)} {commentInfo(id, author, time, can_delete)}
@ -179,13 +179,14 @@ function CommentItem ({
<CommentIcon <CommentIcon
style={{ display: isAdmin ? 'inline-block' : 'none'}} style={{ display: isAdmin ? 'inline-block' : 'none'}}
className='comment-icon-margin' className='comment-icon-margin'
type={!hidden ? "eye" : 'eye-invisible'} type={!hidden ? "xianshi" : 'yincang1'}
iconClick={() => handleShowOrHide(id, !hidden ? 1 : 0)} iconClick={() => handleShowOrHide(id, !hidden ? 1 : 0)}
/> />
{/* 回复 */} {/* 回复 */}
<CommentIcon <CommentIcon
className='comment-icon-margin' className='comment-icon-margin'
type="message" count="100" type="huifu1"
count={children.length}
iconClick={handleClickMessage} iconClick={handleClickMessage}
/> />
{/* 点赞 */} {/* 点赞 */}
@ -193,7 +194,7 @@ function CommentItem ({
iconColor={ user_praise ? '#5091FF' : '' } iconColor={ user_praise ? '#5091FF' : '' }
className='comment-icon-margin' className='comment-icon-margin'
theme={user_praise ? 'filled' : ''} theme={user_praise ? 'filled' : ''}
type="like" type="dianzan"
count={praise_count} count={praise_count}
iconClick={() => handleClickLick(id)} iconClick={() => handleClickLick(id)}
/> />

@ -27,6 +27,13 @@ $ml: 20px;
padding: 20px 0; padding: 20px 0;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid $bdColor; border-bottom: 1px solid $bdColor;
.comment_child_item_area:hover{
.item-close{
display: inline-block;
}
}
.flex-image{ .flex-image{
width: 48px; width: 48px;
height: 48px; height: 48px;
@ -46,7 +53,7 @@ $ml: 20px;
margin-left: $ml; margin-left: $ml;
} }
.item-close{ .item-close{
display: inline-block; display: none;
cursor: pointer; cursor: pointer;
float: right; float: right;
} }
@ -54,6 +61,7 @@ $ml: 20px;
.item-close.hide{ .item-close.hide{
display: none; display: none;
} }
} }
.item-ctx{ .item-ctx{
line-height: $lh22; line-height: $lh22;
@ -140,6 +148,10 @@ $ml: 20px;
} }
} }
} }
.icon_font_size_14{
font-size: 14px !important;
}
} }
.comment_form_area, .comment_form_area,

@ -3,8 +3,8 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-12-03 15:20:55 * @Date: 2019-12-03 15:20:55
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-03 20:36:24 * @LastEditTime : 2019-12-25 11:41:42
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
@ -46,6 +46,7 @@ function ErrorResult (props) {
case 3: // 创建pod失败 case 3: // 创建pod失败
result = ( result = (
<div className={'error_result_wrap'}> <div className={'error_result_wrap'}>
<p>系统繁忙请稍后重试</p>
</div> </div>
); );
break; break;

@ -3,8 +3,8 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-28 08:44:54 * @Date: 2019-11-28 08:44:54
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-19 10:44:16 * @LastEditTime : 2019-12-25 11:42:10
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -82,7 +82,7 @@ function ExecResult (props) {
} else if (state === 4){ } else if (state === 4){
return ( return (
<p className={'result_info_style'}> <p className={'result_info_style'}>
{error_msg} 系统繁忙请稍后重试
</p> </p>
) )
} else if (state === -1) { } else if (state === -1) {

@ -4,11 +4,11 @@
* @Github: * @Github:
* @Date: 2019-11-27 10:58:37 * @Date: 2019-11-27 10:58:37
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-24 16:48:56 * @LastEditTime : 2019-12-25 10:02:03
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
import { Icon } from 'antd'; // import { Icon } from 'antd';
const numberal = require('numeral'); const numberal = require('numeral');
const TextNumber = (props) => { const TextNumber = (props) => {
@ -47,14 +47,18 @@ const TextNumber = (props) => {
const renderCtx = (className, theme) => { const renderCtx = (className, theme) => {
if (type === 'icon') { // 图标加文字时 if (type === 'icon') { // 图标加文字时
const _className = `text_number_area text_icon_numb flex_${position} ${className}`; const _className = `text_number_area text_icon_numb flex_${position} ${className}`;
const _classIcon = `iconfont icon-${text} numb_icon`;
return ( return (
<div className={_className}> <div className={_className}>
<Icon {/* <Icon
theme={theme} theme={theme}
onClick={handleIconClick}
type={text} type={text}
className={'numb_icon'} className={'numb_icon'}
></Icon> ></Icon> */}
<span
className={_classIcon}
onClick={handleIconClick}>
</span>
{renderNumb()} {renderNumb()}
</div> </div>
) )

@ -77,7 +77,12 @@
} }
} }
.oj_item_name{ .oj_item_name{
flex-wrap: wrap;
color: #459be5; color: #459be5;
cursor: pointer; cursor: pointer;
max-width: 510px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
} }
} }

@ -117,7 +117,7 @@
} }
.comp_ctx{ .comp_ctx{
height: calc(100vh - 178px); // height: calc(100vh - 178px);
overflow-y: hidden; overflow-y: hidden;
} }

@ -4,17 +4,21 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:35 * @Date: 2019-11-27 09:49:35
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-24 17:58:26 * @LastEditTime : 2019-12-25 10:55:44
*/ */
import './index.scss'; import './index.scss';
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import Comment from '../../../../../common/components/comment'; import Comment from '../../../../../common/components/comment';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import actions from '../../../../../redux/actions'; import actions from '../../../../../redux/actions';
import { Pagination } from 'antd';
const CommentTask = (props) => { const CommentTask = (props) => {
// 当前页
const [current, setCurrent] = useState(1);
const { const {
pages,
isAdmin, isAdmin,
identifier, identifier,
commentLists, commentLists,
@ -23,7 +27,8 @@ const CommentTask = (props) => {
deleteComment, deleteComment,
getCommentLists, getCommentLists,
showOrHideComment, showOrHideComment,
replayChildComment replayChildComment,
changePagination
} = props; } = props;
useEffect(() => { useEffect(() => {
@ -35,7 +40,6 @@ const CommentTask = (props) => {
// 添加评论 // 添加评论
const handleAddComment = (ctx) => { const handleAddComment = (ctx) => {
console.log('添加的评论内容: ', ctx);
addComment(identifier, { addComment(identifier, {
comments: { comments: {
content: ctx content: ctx
@ -53,7 +57,7 @@ const CommentTask = (props) => {
} }
// 删除评论 // 删除评论
const handleSubmitDeleteComment = (id) => { const handleSubmitDeleteComment = (id) => {
console.log('删除评论:', identifier, id); // console.log('删除评论:', identifier, id);
deleteComment(identifier, id); deleteComment(identifier, id);
} }
@ -72,6 +76,20 @@ const CommentTask = (props) => {
}); });
} }
// 点击分页
const handlePageChange = (page, pageSize) => {
setCurrent(page);
changePagination(page);
// setTimeout(() => {
// 调用查询接口
getCommentLists(identifier);
// }, 300);
}
const _style = {
display: pages.total > pages.limit ? 'block' : 'none'
}
return ( return (
<div className="task_comment_task"> <div className="task_comment_task">
<Comment <Comment
@ -83,13 +101,24 @@ const CommentTask = (props) => {
showOrHideComment={handleShowOrHideComment} showOrHideComment={handleShowOrHideComment}
submitDeleteComment={handleSubmitDeleteComment} submitDeleteComment={handleSubmitDeleteComment}
/> />
<div className="task_comment_page" style={ _style }>
<Pagination
showQuickJumper
current={current}
pageSize={pages.limit}
total={pages.total}
onChange={handlePageChange}
/>
</div>
</div> </div>
) )
} }
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const { const {
commentLists // 评论列表 commentLists, // 评论列表
pages
} = state.commentReducer; } = state.commentReducer;
const { const {
comment_identifier comment_identifier
@ -98,7 +127,8 @@ const mapStateToProps = (state) => {
return { return {
commentLists, commentLists,
isAdmin: userInfo.admin, isAdmin: userInfo.admin,
identifier: comment_identifier identifier: comment_identifier,
pages
} }
} }
@ -110,6 +140,7 @@ const mapDispatchToProps = (dispatch) => ({
deleteComment: (identifier, id) => dispatch(actions.deleteComment(identifier, id)), deleteComment: (identifier, id) => dispatch(actions.deleteComment(identifier, id)),
likeComment: (identifier, id, params) => dispatch(actions.likeComment(identifier, id, params)), likeComment: (identifier, id, params) => dispatch(actions.likeComment(identifier, id, params)),
showOrHideComment: (identifier, id, params) => dispatch(actions.showOrHideComment(identifier, id, params)), showOrHideComment: (identifier, id, params) => dispatch(actions.showOrHideComment(identifier, id, params)),
changePagination: (page) => dispatch(actions.changePagination(page))
}) })
export default connect( export default connect(

@ -1,8 +1,16 @@
.task_comment_task{ .task_comment_task{
display: flex;
flex-direction: column;
justify-content: space-between;
background: #fff; background: #fff;
padding: 20px 30px 0; padding: 20px 30px 0;
height: calc(100vh - 177px); height: calc(100vh - 177px);
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
border-bottom: 1px solid rgba(244,244,244,1); border-bottom: 1px solid rgba(244,244,244,1);
.task_comment_page{
padding: 10px 0;
text-align: center;
}
} }

@ -3,12 +3,12 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-27 09:49:33 * @Date: 2019-11-27 09:49:33
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-20 19:35:01 * @LastEditTime : 2019-12-25 14:45:20
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Table, Icon, message } from 'antd'; import { Table, Icon, message, Pagination } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import actions from '../../../../../redux/actions'; import actions from '../../../../../redux/actions';
@ -20,6 +20,7 @@ import ErrorResult from '../../../components/errorResult';
const numberal = require('numeral'); const numberal = require('numeral');
const {reviewResult} = CONST; const {reviewResult} = CONST;
// 表格列
const columns = [ const columns = [
{ {
title: '提交时间', title: '提交时间',
@ -60,29 +61,30 @@ const columns = [
} }
] ]
const paginationConfig = { // const paginationConfig = {
total: 1, // 总条数 // total: 1, // 总条数
pageSize: 10, // 每页显示条数 // pageSize: 5, // 每页显示条数
current: 1, // 当前页数 // current: 1, // 当前页数
showQuickJumper: true // showQuickJumper: true
} // }
const CommitRecord = (props) => { const CommitRecord = (props) => {
const { const {
identifier, identifier,
pages,
commitRecord, commitRecord,
// excuteState, // excuteState,
language, language,
operateType, operateType,
commitRecordDetail, commitRecordDetail,
getUserCommitRecord getUserCommitRecord,
changeRecordPagination
} = props; } = props;
const [pagination, setPagination] = useState(paginationConfig); const [current, setCurrent] = useState(1);
const [tableData, setTableData] = useState([]); // const [pagination, setPagination] = useState(paginationConfig);
// const [tableData, setTableData] = useState([]);
// 复制面板
let clipboard; let clipboard;
// const [recordDetail, setRecordDetail] = useState({}); // const [recordDetail, setRecordDetail] = useState({});
const [renderCtx, setRenderCtx] = useState(() => { const [renderCtx, setRenderCtx] = useState(() => {
return function () { return function () {
@ -140,12 +142,12 @@ const CommitRecord = (props) => {
getUserCommitRecord(identifier); getUserCommitRecord(identifier);
}, []); }, []);
// 提交记录变化时,同步到表单数据 // 提交记录变化时,同步到表单数据
useEffect(() => { // useEffect(() => {
const len = commitRecord.length; // // const len = commitRecord.length;
const pageConfig = Object.assign({}, paginationConfig, {total: len}); // // const pageConfig = Object.assign({}, paginationConfig, {total: len});
setTableData(commitRecord); // setTableData(commitRecord);
setPagination(pageConfig); // // setPagination(pageConfig);
}, [commitRecord]); // }, [commitRecord]);
// 提交详情变化时,显示当前提交信息 // 提交详情变化时,显示当前提交信息
useEffect(() => { useEffect(() => {
// setRecordDetail(commitRecordDetail); // setRecordDetail(commitRecordDetail);
@ -179,20 +181,46 @@ const CommitRecord = (props) => {
// }); // });
// } // }
// //
const handleTableChange = (pagination) => { // const handleTableChange = (pagination) => {
setPagination(Object.assign({}, pagination)); // setPagination(Object.assign({}, pagination));
// }
const handlePaginationChange = (page) => {
setCurrent(page);
changeRecordPagination(page);
// 调用查询接口
getUserCommitRecord(identifier);
// setPagination(Object.assign({}, pagination, { current: page}));
// console.log('======>>>>>>', pagination)
} }
// console.log(commitRecord); // console.log(commitRecord);
const _style = {
display: pages.total > pages.limit ? 'block' : 'none'
};
return ( return (
<div className={'commit_record_area'}> <div className={'commit_record_area'}>
{renderCtx()} {renderCtx()}
<div className="commit_record_table_pagination">
<Table <Table
columns={columns} columns={columns}
rowKey={function (record) { return `key_${record.id}`}} rowKey={function (record) { return `key_${record.id}`}}
dataSource={tableData} dataSource={commitRecord}
pagination={pagination} // pagination={pagination}
onChange={handleTableChange} // onChange={handleTableChange}
pagination={false}
/> />
<div className="commit_record_pagination" style={_style}>
<Pagination
showQuickJumper
pageSize={pages.limit}
current={current}
total={pages.total}
onChange={handlePaginationChange}
/>
</div>
</div>
</div> </div>
) )
} }
@ -207,7 +235,8 @@ const mapStateToProps = (state) => {
commitRecordDetail, commitRecordDetail,
commitRecord, commitRecord,
hack, hack,
operateType operateType,
pages
} = ojForUserReducer; } = ojForUserReducer;
const { excuteState } = commonReducer; const { excuteState } = commonReducer;
return { return {
@ -216,11 +245,13 @@ const mapStateToProps = (state) => {
commitRecord, // 提交记录 commitRecord, // 提交记录
excuteState, // 代码执行状态 excuteState, // 代码执行状态
language: hack.language, language: hack.language,
operateType operateType,
pages
} }
} }
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier)) getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier)),
changeRecordPagination: (page) => dispatch(actions.changeRecordPagination(page))
}); });
export default connect( export default connect(

@ -2,7 +2,20 @@
// padding: 20px 30px; // padding: 20px 30px;
padding: 0 20px; padding: 0 20px;
overflow-y: auto; overflow-y: auto;
height: calc(100vh - 177px); // height: calc(100vh - 177px);
height: calc(100vh - 122px);
.commit_record_table_pagination{
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
.commit_record_pagination{
padding: 10px 0;
text-align: center;
}
}
.record_header{ .record_header{
display: flex; display: flex;
// justify-content: space-between; // justify-content: space-between;

@ -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-24 17:16:54 * @LastEditTime : 2019-12-25 11:07:42
// */ // */
import './index.scss'; import './index.scss';
import React, { useState, useEffect, useMemo } from 'react'; import React, { useState, useEffect, useMemo } from 'react';
@ -96,7 +96,7 @@ const LeftPane = (props) => {
// 添加评论 // 添加评论
const handleAddComment = (ctx) => { const handleAddComment = (ctx) => {
console.log('添加的评论内容: ', ctx, props.identifier); // console.log('添加的评论内容: ', ctx, props.identifier);
props.identifier && props.addComment(props.identifier, { props.identifier && props.addComment(props.identifier, {
comments: { comments: {
content: ctx content: ctx
@ -104,6 +104,10 @@ const LeftPane = (props) => {
}); });
}; };
const _style = {
display: defaultActiveKey === 'record' ? 'none' : 'flex'
};
return ( return (
<React.Fragment> <React.Fragment>
<ul className={'add_editor_list_area'}> <ul className={'add_editor_list_area'}>
@ -112,7 +116,7 @@ const LeftPane = (props) => {
<div className="comp_ctx"> <div className="comp_ctx">
{ renderComp } { renderComp }
</div> </div>
<div className={'number_area'}> <div className={'number_area'} style={_style}>
<div className="number_flex flex_count" style={{ display: defaultActiveKey !== 'comment' ? 'flex' : 'none'}}> <div className="number_flex flex_count" style={{ display: defaultActiveKey !== 'comment' ? 'flex' : 'none'}}>
<TextNumber text="通过次数" number={pass_count} position="vertical"/> <TextNumber text="通过次数" number={pass_count} position="vertical"/>
<Divider type="vertical" style={{ height: '20px', margin: '10px 20px' }}/> <Divider type="vertical" style={{ height: '20px', margin: '10px 20px' }}/>
@ -125,10 +129,10 @@ const LeftPane = (props) => {
/> />
</div> </div>
<div className="number_flex flex_info"> <div className="number_flex flex_info">
<TextNumber text="message" number={comments_count} type="icon" onIconClick={handleClickMessage}/> <TextNumber text="huifu1" number={comments_count} type="icon" onIconClick={handleClickMessage}/>
<TextNumber <TextNumber
className={user_praise ? 'like active' : 'like'} className={user_praise ? 'like active' : 'like'}
text="like" text="dianzan"
number={praises_count} number={praises_count}
theme={user_praise ? 'filled' : ''} theme={user_praise ? 'filled' : ''}
type="icon" type="icon"

@ -54,9 +54,9 @@
.commit_record_area{ .commit_record_area{
padding: 0 20px; padding: 0 20px;
// height: calc(100vh - 178px); // height: calc(100vh - 178px);
// overflow-y: auto;
} }
.task_description_area{ .task_description_area{
height: calc(100vh - 177px);
.task_desc_area{ .task_desc_area{
height: calc(100vh - 242px); height: calc(100vh - 242px);

@ -3,8 +3,8 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-27 09:49:30 * @Date: 2019-11-27 09:49:30
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-20 09:39:35 * @LastEditTime : 2019-12-25 14:50:37
*/ */
import '../index.scss'; import '../index.scss';
import React from 'react'; import React from 'react';
@ -37,7 +37,7 @@ const TaskDescription = (props) => {
</p> </p>
<p className={'header_flex'}> <p className={'header_flex'}>
<span className={'flex_label'}>出题者:</span> <span className={'flex_label'}>出题者:</span>
<Link to="/messages/innov/message_detail" target="_blank" style={{ color: '#5091FF'}}>{username}</Link> <Link to="/users/innov/courses" target="_blank" style={{ color: '#5091FF'}}>{username}</Link>
</p> </p>
</div> </div>
<div className="task_desc_area"> <div className="task_desc_area">

@ -55,6 +55,7 @@ const types = {
CLICK_OPERATE_TYPE: 'CLICK_OPERATE_TYPE', // 点击类型 CLICK_OPERATE_TYPE: 'CLICK_OPERATE_TYPE', // 点击类型
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', // 改变提交分页
/*** 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
@ -74,7 +75,8 @@ const types = {
GET_COMMENT_LISTS: 'GET_COMMENT_LISTS', // 获取评论列表 GET_COMMENT_LISTS: 'GET_COMMENT_LISTS', // 获取评论列表
REPLAY_CHILD_COMMENTS: 'REPLAY_CHILD_COMMENTS', // 子回复 REPLAY_CHILD_COMMENTS: 'REPLAY_CHILD_COMMENTS', // 子回复
DELETE_COMMENTS: 'DELETE_COMMENTS', // 删除评论 DELETE_COMMENTS: 'DELETE_COMMENTS', // 删除评论
SAVE_COMMENT_IDENTIFIER: 'SAVE_COMMENT_IDENTIFIER' // 评论时的identifier SAVE_COMMENT_IDENTIFIER: 'SAVE_COMMENT_IDENTIFIER', // 评论时的identifier
CHANGE_COMMENT_PAGINATION_PARAMS: 'CHANGE_COMMENT_PAGINATION_PARAMS', // 改变分页
} }
export default types; export default types;

@ -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-24 16:17:00 * @LastEditTime : 2019-12-25 10:55:27
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
@ -31,8 +31,12 @@ export const addComment = (identifier, comments) => {
// 获取评论列表 // 获取评论列表
export const getCommentLists = (identifier) => { export const getCommentLists = (identifier) => {
return (dispatch) => { return (dispatch, getState) => {
fetchCommentLists(identifier).then(res => { const {pages: {limit, page}} = getState().commentReducer;
fetchCommentLists(identifier, {
limit,
page
}).then(res => {
console.log('获取评论列表: ====>>>>', res); console.log('获取评论列表: ====>>>>', res);
if (res.status === 200) { if (res.status === 200) {
const {data} = res; const {data} = res;
@ -112,3 +116,10 @@ export const showOrHideComment = (identifier, id, params) => {
} }
} }
// 改变分页条件
export const changePagination = (page) => {
return {
type: types.CHANGE_COMMENT_PAGINATION_PARAMS,
payload: page
};
}

@ -49,7 +49,8 @@ import {
saveUserCodeForInterval, saveUserCodeForInterval,
saveEditorCodeForDetail, saveEditorCodeForDetail,
saveOpacityType, saveOpacityType,
clearOjForUserReducer clearOjForUserReducer,
changeRecordPagination
// isUpdateCodeCtx // isUpdateCodeCtx
} from './ojForUser'; } from './ojForUser';
@ -71,7 +72,8 @@ import {
replayChildComment, replayChildComment,
deleteComment, deleteComment,
likeComment, likeComment,
showOrHideComment showOrHideComment,
changePagination
} from './comment'; } from './comment';
import { import {
@ -134,6 +136,7 @@ export default {
saveEditorCodeForDetail, saveEditorCodeForDetail,
saveOpacityType, saveOpacityType,
clearOjForUserReducer, clearOjForUserReducer,
changeRecordPagination,
// jupyter // jupyter
getJupyterTpiDataSet, getJupyterTpiDataSet,
getJupyterTpiUrl, getJupyterTpiUrl,
@ -155,4 +158,5 @@ export default {
deleteComment, deleteComment,
likeComment, likeComment,
showOrHideComment, showOrHideComment,
changePagination
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:42:11 * @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-23 11:55:48 * @LastEditTime : 2019-12-25 14:27:58
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -315,8 +315,12 @@ export const debuggerCode = (identifier,value, type) => {
// 获取提交记录 // 获取提交记录
export const getUserCommitRecord = (identifier) => { export const getUserCommitRecord = (identifier) => {
return (dispatch) => { return (dispatch, getState) => {
fetchUserCommitRecord(identifier).then(res => { const { pages: { limit, page } } = getState().ojForUserReducer;
fetchUserCommitRecord(identifier, {
limit,
page
}).then(res => {
const {status, data} = res; const {status, data} = res;
if (status === 200) { if (status === 200) {
dispatch({ dispatch({
@ -477,5 +481,10 @@ export const clearOjForUserReducer = () => {
}; };
} }
export const changeRecordPagination = (page) => {
return {
type: types.CHANGE_RECORD_PAGINATION_PAGE,
payload: page
}
}
// 更新通知状态 // 更新通知状态

@ -6,7 +6,7 @@ import types from "../actions/actionTypes";
* @Github: * @Github:
* @Date: 2019-12-23 10:35:31 * @Date: 2019-12-23 10:35:31
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-23 14:51:42 * @LastEditTime : 2019-12-25 10:56:10
*/ */
const initialState = { const initialState = {
comments: { comments: {
@ -14,8 +14,9 @@ const initialState = {
}, },
commentLists: {}, // 评论列表 commentLists: {}, // 评论列表
pages: { pages: {
limit: 20, limit: 15,
page: 1 page: 1,
total: 1
} }
}; };
@ -28,9 +29,17 @@ const commentReducer = (state = initialState, action) => {
...state ...state
} }
case types.GET_COMMENT_LISTS: case types.GET_COMMENT_LISTS:
const {disscuss_count} = payload;
return { return {
...state, ...state,
commentLists: Object.assign({}, payload) commentLists: Object.assign({}, payload),
pages: Object.assign({}, state.pages, { total: disscuss_count })
}
case types.CHANGE_COMMENT_PAGINATION_PARAMS:
const _pages = Object.assign({}, state.pages, { page: payload });
return {
...state,
pages: _pages
} }
default: default:
return { return {

@ -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-24 16:35:09 * @LastEditTime : 2019-12-25 14:45:47
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -27,7 +27,12 @@ const initialState = {
notice: false, // 通知 notice: false, // 通知
hadCodeUpdate: false, // 更新代码 hadCodeUpdate: false, // 更新代码
operateType: '', // 点击类型: 调度或提交 operateType: '', // 点击类型: 调度或提交
comment_identifier: '' // 用户评论时使用的 identifier comment_identifier: '', // 用户评论时使用的 identifier
pages: {
limit: 15,
page: 1,
total: 1
}
}; };
const ojForUserReducer = (state = initialState, action) => { const ojForUserReducer = (state = initialState, action) => {
@ -81,9 +86,11 @@ const ojForUserReducer = (state = initialState, action) => {
} }
case types.COMMIT_RECORD: case types.COMMIT_RECORD:
const {records, records_count} = action.payload;
return { return {
...state, ...state,
commitRecord: [...action.payload] commitRecord: records,
pages: Object.assign({}, state.pages, { total: records_count })
} }
case types.SAVE_USER_CODE: case types.SAVE_USER_CODE:
let curCode = Base64.encode(action.payload); let curCode = Base64.encode(action.payload);
@ -199,6 +206,11 @@ const ojForUserReducer = (state = initialState, action) => {
...state, ...state,
hack: _hack hack: _hack
} }
case types.CHANGE_RECORD_PAGINATION_PAGE:
return {
...state,
pages: Object.assign({}, state.pages, { page: action.payload})
}
default: default:
return state; return state;
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-23 10:43:27 * @Date: 2019-12-23 10:43:27
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-24 17:10:49 * @LastEditTime : 2019-12-25 10:50:24
*/ */
import axios from 'axios'; import axios from 'axios';
@ -15,9 +15,9 @@ export async function fetchAddComment (identifier, params) {
} }
// 获取评论列表 // 获取评论列表
export async function fetchCommentLists (identifier) { export async function fetchCommentLists (identifier, params) {
const url = `/problems/${identifier}/comments.json`; const url = `/problems/${identifier}/comments.json`;
return axios.get(url); return axios.get(url, {params});
} }
// 添加子评论 // 添加子评论

@ -3,8 +3,8 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-20 10:55:38 * @Date: 2019-11-20 10:55:38
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-20 10:10:53 * @LastEditTime : 2019-12-25 14:27:30
*/ */
import axios from 'axios'; import axios from 'axios';
@ -70,10 +70,10 @@ export async function fetchUserProgramDetail (identifier) {
} }
// 获取提交记录 // 获取提交记录
export async function fetchUserCommitRecord (identifier) { export async function fetchUserCommitRecord (identifier, params) {
console.log('identifier=====', identifier); console.log('identifier=====', identifier);
const url = `/myproblems/${identifier}/submit_records.json`; const url = `/myproblems/${identifier}/submit_records.json`;
return axios.get(url); return axios.get(url, { params });
} }
// 获取提交记录详情 // 获取提交记录详情

Loading…
Cancel
Save