dev_aliyun2
harry 5 years ago
parent e9b366523b
commit 42cbb4dbe6

@ -0,0 +1,10 @@
import React, { useEffect, useState } from 'react'
export default () => {
return (
<div className="shixun-home">
</div>
)
}

@ -1,81 +0,0 @@
import React, { Component } from 'react';
import Comments from '../comment/Comments'
import commentHOC from '../comment/CommentsHOC'
import './TPMShixunDiscuss.css'
import TPMRightSection from './component/TPMRightSection'
import TPMNav from './component/TPMNav'
import Loading from '../../components/loading';
class TPMShixunDiscuss extends Component {
constructor(props) {
super(props)
}
componentWillReceiveProps(newProps, newContext) {
if (newProps.shixun && newProps.shixun.id && (!this.props || !this.props.shixun || this.props.shixun.id != newProps.shixun.id)) {
window.document.title = newProps.shixun.name
// this.props.fetchCommentIfNotFetched &&
// this.props.fetchCommentIfNotFetched();
}
}
componentDidMount() {
// TODO 加了HOC后 mount了两次
this.props.fetchCommentIfNotFetched &&
this.props.fetchCommentIfNotFetched();
}
//
onPaginationChange = (page) => {
window.$("html,body").animate({ "scrollTop": 160 })
this.props.onPaginationChange(page)
}
render() {
const { loadingComments, creator, shixun, myshixun, recommend_shixuns, current_user, watched,
aboutFocus, user, match
} = this.props;
let _user = user;
if (user) {
_user = Object.assign({}, user);
_user.user_url = `/users/${user.login}`
}
return (
<React.Fragment>
<div className="tpmComment educontent clearfix mt30 mb80">
<div className="with65 fl edu-back-white commentsDelegateParent" >
<TPMNav
match={match}
user={user}
shixun={shixun}
{...this.props}
></TPMNav>
{loadingComments ?
<Loading /> :
<Comments
{...this.props}
user={_user}
onPaginationChange={this.onPaginationChange}
></Comments>
}
</div>
<div className="with35 fr pl20">
<TPMRightSection {...this.props}></TPMRightSection>
</div>
</div>
</React.Fragment>
);
}
}
export default commentHOC(TPMShixunDiscuss);

@ -1,10 +1,9 @@
import React from 'react';
import { getImageUrl, setImagesUrl } from 'educoder';
import { Spin, Tooltip, Rate } from 'antd';
import React, { Fragment } from 'react';
import './shixunCss/shixunCard.less';
import Pagination from '../../../components/mini-pagination'
import NodataPanel from '../../../components/nodata-panel'
import List from '../../../components/shixun-card-list'
import Loading from '../../../components/loading'
export default ({ middleshixundata, pagination, typepvisible, pages, totalcount, shixunsPage }) => {
function onPageChange(number) {
@ -13,24 +12,23 @@ export default ({ middleshixundata, pagination, typepvisible, pages, totalcount,
return (
<div className="educontent mb80 shixun-card">
<Spin spinning={typepvisible} tip="正在获取相关数据..." size="large" style={{ marginTop: '15%' }}>
{middleshixundata === undefined ? "" : middleshixundata.length === 0 ? <NodataPanel /> : ""}
<div className="mb20 clearfix">
<div className="shixun_list_content">
<div className="square-list clearfix">
<List list={middleshixundata} />
</div>
<div className="both"></div>
<div className={"educontent edu-txt-center mt10"}
style={{ display: pagination ? "block" : "none" }}>
<Pagination defaultCurrent={1} current={pages} total={totalcount || 1299} type="mini" pageSize={16} onChange={onPageChange} />
{typepvisible ? <Loading /> :
<Fragment>
{middleshixundata === undefined ? "" : middleshixundata.length === 0 ? <NodataPanel /> : ""}
<div className="mb20 clearfix">
<div className="shixun_list_content">
<div className="square-list clearfix">
<List list={middleshixundata} />
</div>
<div className="both"></div>
<div className={"educontent edu-txt-center mt10"}
style={{ display: pagination ? "block" : "none" }}>
<Pagination defaultCurrent={1} current={pages} total={totalcount || 1299} type="mini" pageSize={16} onChange={onPageChange} />
</div>
</div>
</div>
</div>
</Spin>
</Fragment>
}
</div>
)
}
Loading…
Cancel
Save