|
@@ -1,10 +1,13 @@
|
|
|
import React from 'react';
|
|
|
import './index.less';
|
|
|
+import { Link } from 'react-router-dom';
|
|
|
import { Anchor, Icon } from 'antd';
|
|
|
import Assets from '@src/components/Assets';
|
|
|
import Page from '@src/containers/Page';
|
|
|
import Select from '../../../components/Select';
|
|
|
import Button from '../../../components/Button';
|
|
|
+import QAList from '../../../components/QAList';
|
|
|
+import Tabs from '../../../components/Tabs';
|
|
|
import { SuppleModal, SuppleFinishModal } from '../../../components/OtherModal';
|
|
|
import { Main } from '../../../stores/main';
|
|
|
import { User } from '../../../stores/user';
|
|
@@ -17,6 +20,7 @@ export default class extends Page {
|
|
|
this.loadArticleMap = {};
|
|
|
this.dataList = null;
|
|
|
return {
|
|
|
+ readTab: '1',
|
|
|
// load: false,
|
|
|
// list: [
|
|
|
// {
|
|
@@ -177,11 +181,11 @@ export default class extends Page {
|
|
|
});
|
|
|
this.dataList = result;
|
|
|
this.setState({ datas: item.children });
|
|
|
- this.initScroll(item.children);
|
|
|
+ this.readyScroll(item.children);
|
|
|
});
|
|
|
} else {
|
|
|
this.setState({ datas: item.children });
|
|
|
- this.initScroll(item.children);
|
|
|
+ this.readyScroll(item.children);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -192,18 +196,18 @@ export default class extends Page {
|
|
|
.then(result => {
|
|
|
this.loadArticleMap[key] = result;
|
|
|
this.setState({ articles: result });
|
|
|
- this.initScroll(item.children);
|
|
|
+ this.readyScroll(item.children);
|
|
|
});
|
|
|
} else {
|
|
|
const list = this.loadArticleMap[key];
|
|
|
this.setState({ articles: list });
|
|
|
- this.initScroll(item.children);
|
|
|
+ this.readyScroll(item.children);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
refreshRead() {
|
|
|
if (!this.readList) {
|
|
|
- Main.listRead()
|
|
|
+ Main.listRead({ page: 1, size: 1000, plate: 'getready' })
|
|
|
.then(result => {
|
|
|
this.readList = result.list;
|
|
|
this.setState({ reads: this.readList });
|
|
@@ -225,6 +229,11 @@ export default class extends Page {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ readyScroll(list) {
|
|
|
+ if (this.scrollTimeKey) clearTimeout(this.scrollTimeKey);
|
|
|
+ this.initScroll(list);
|
|
|
+ }
|
|
|
+
|
|
|
initScroll(list) {
|
|
|
this.load = false;
|
|
|
try {
|
|
@@ -234,7 +243,7 @@ export default class extends Page {
|
|
|
});
|
|
|
this.load = true;
|
|
|
} catch (e) {
|
|
|
- setTimeout(() => {
|
|
|
+ this.scrollTimeKey = setTimeout(() => {
|
|
|
this.initScroll(list);
|
|
|
}, 500);
|
|
|
}
|
|
@@ -288,6 +297,10 @@ export default class extends Page {
|
|
|
this.setState({ current: key });
|
|
|
}
|
|
|
|
|
|
+ onChangeReadTab(key) {
|
|
|
+ this.setState({ readTab: key });
|
|
|
+ }
|
|
|
+
|
|
|
renderView() {
|
|
|
const { list, current, scrollCurrent } = this.state;
|
|
|
let detail = {};
|
|
@@ -402,10 +415,34 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderRead() {
|
|
|
- return <div />;
|
|
|
+ const { readTab, reads = [] } = this.state;
|
|
|
+ return <div className='read-layout'>
|
|
|
+ <Tabs
|
|
|
+ className='m-b-2'
|
|
|
+ type="division"
|
|
|
+ theme="gray"
|
|
|
+ space={2.5}
|
|
|
+ active={readTab}
|
|
|
+ tabs={[{ title: '单项攻略', key: '1' }, { title: '模考&PACE', key: '2' }, { title: '换库&机经', key: '3' }, { title: '经验分享', key: '4' }, { title: '申请相关', key: '5' }]}
|
|
|
+ onChange={key => this.onChangeReadTab(key)}
|
|
|
+ />
|
|
|
+ <div className='m-b-2'>
|
|
|
+ <Button className='m-r-1'>CAT模考 ></Button>
|
|
|
+ <Button>非CAT模考 ></Button>
|
|
|
+ </div>
|
|
|
+ {reads.map((item) => {
|
|
|
+ return <div className='m-b-5'>
|
|
|
+ <Link to={item.path}>{item.title}</Link>
|
|
|
+ </div>;
|
|
|
+ })}
|
|
|
+ </div>;
|
|
|
}
|
|
|
|
|
|
renderFaq() {
|
|
|
- return <div />;
|
|
|
+ const { faqs = [] } = this.state;
|
|
|
+ return <div className='faq-layout'>
|
|
|
+ <Button>我要提问 ></Button>
|
|
|
+ <QAList data={faqs} />
|
|
|
+ </div>;
|
|
|
}
|
|
|
}
|