增加刷新按钮

ecloud_sso
杨树明 5 years ago
parent 610bc76ad7
commit aff978fe14

@ -1,29 +1,15 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
import axios from 'axios'
import moment from 'moment'
import Comments from '../../comment/Comments'
import update from 'immutability-helper'
import RewardDialog from '../../common/RewardDialog';
import {ImageLayerOfCommentHOC} from '../../page/layers/ImageLayerOfCommentHOC'
import MemoDetailMDEditor from '../../forums/MemoDetailMDEditor'
import { RouteHOC } from './common.js'
import '../../forums/Post.css'
import '../../forums/RightSection.css'
import './TopicDetail.css'
import '../common/courseMessage.css'
import { Pagination, Tooltip } from 'antd'
import { Pagination, Tooltip,Button } from 'antd'
import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml , setImagesUrl } from 'educoder'
import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal'
import CBreadcrumb from '../common/CBreadcrumb'
@ -32,7 +18,8 @@ import { generateComments, generateChildComments, _findById, handleContentBefore
, handleDeleteComment, handleCommentPraise, handleHiddenComment } from '../common/CommentsHelper'
const $ = window.$
const REPLY_PAGE_COUNT = 10
const REPLY_PAGE_COUNT = 10;
let setTime;
function urlStringify(params) {
let noParams = true;
let paramsUrl = '';
@ -57,7 +44,8 @@ class TopicDetail extends Component {
pageCount: 1,
comments: [],
goldRewardDialogOpen: false,
author:undefined
author:undefined,
commentstype:false
}
}
componentDidMount() {
@ -512,11 +500,26 @@ class TopicDetail extends Component {
}
}
startcomments=()=>{
setTime = setInterval( ()=> {
this.fetchReplies()
}, 5000);
this.setState({
commentstype:true
})
}
clearcomments=()=>{
clearInterval(setTime);
this.setState({
commentstype:false
})
}
render() {
const { match, history } = this.props
const { recommend_shixun, current_user,author_info } = this.props;
const { memo, comments, hasMoreComments, goldRewardDialogOpen, pageCount, total_count , author } = this.state;
const { memo, comments, hasMoreComments, commentstype, pageCount, total_count , author } = this.state;
const messageId = match.params.topicId
if (this.state.memoLoading || !current_user) {
return <div className="edu-back-white" id="forum_index_list"></div>
@ -560,7 +563,7 @@ class TopicDetail extends Component {
ref="sendToCourseModal"
{...this.props}
moduleName="帖子"
selectedMessageIds={[messageId]}
seletedMessageIds={[messageId]}
></SendToCourseModal>
<div className="clearfix">
<div id="forum_list" className="forum_table mh650">
@ -690,9 +693,15 @@ class TopicDetail extends Component {
*/}
<div className="padding20 memoReplies commentsDelegateParent comments_hideSecondReplyUserHeader"
style={{ display: (comments && !!comments.length) ? 'block' : 'none', paddingBottom: '0px' }}>
<div className="replies_count">
<div className="replies_count commentstypetop">
{this.props.isAdmin()===true? <span className="commentstypebutton font-16 ">
{this.state.commentstype===false?<Button type="primary" onClick={()=>this.startcomments()}>开启刷新评论</Button>
:<Button type="danger" onClick={()=>this.clearcomments()}>停止刷新</Button>}
</span>:""}
<span className="labal font-16">全部回复</span>
<span className="count font-16">({memo.total_replies_count})</span>
</div>
<Comments comments={comments} user={current_user}

@ -56,4 +56,12 @@
.panel-comment_item .comment_content {
margin-top: 4px;
}
.commentstypetop{
position: relative;
}
.commentstypebutton{
position: absolute;
right: 0px;
}
Loading…
Cancel
Save