|
@@ -1,7 +1,7 @@
|
|
|
import React from 'react';
|
|
|
import './index.less';
|
|
|
import { Modal } from 'antd';
|
|
|
-import { Link } from 'react-router-dom';
|
|
|
+// import { Link } from 'react-router-dom';
|
|
|
import Page from '@src/containers/Page';
|
|
|
import { asyncConfirm } from '@src/services/AsyncTools';
|
|
|
import { formatTreeData, formatSeconds, formatDate, formatPercent, getMap } from '@src/services/Tools';
|
|
@@ -274,7 +274,7 @@ export default class extends Page {
|
|
|
return {
|
|
|
tab1: SENTENCE,
|
|
|
tab2: '',
|
|
|
- tab3: '1',
|
|
|
+ tab3: 'faq',
|
|
|
previewType: PREVIEW_COURSE,
|
|
|
tabs: [],
|
|
|
allCourse: [],
|
|
@@ -356,6 +356,11 @@ export default class extends Page {
|
|
|
// result.code = '123123';
|
|
|
// result.trailPages = 20;
|
|
|
this.setState({ sentence: result });
|
|
|
+ if (result.dataId) {
|
|
|
+ Main.listComment({ page: 1, size: 100, channel: 'course_data', position: result.dataId }).then(r => {
|
|
|
+ this.setState({ comments: r.list });
|
|
|
+ });
|
|
|
+ }
|
|
|
return result;
|
|
|
})
|
|
|
.then(({ code, trailPages, chapters }) => {
|
|
@@ -423,6 +428,9 @@ export default class extends Page {
|
|
|
this.setState({ paperList: result, paperFilterList: result });
|
|
|
});
|
|
|
});
|
|
|
+ Main.listFaq({ page: 1, size: 100, channel: 'exercise-sentence' }).then(result => {
|
|
|
+ this.setState({ faqs: result.list });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -670,7 +678,7 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderView() {
|
|
|
- const { tab1, tab2, tab3, tabs, latest, sentenceModel, previewType, courseTabs = [] } = this.state;
|
|
|
+ const { tab1, tab2, tabs, latest, sentenceModel, previewType, courseTabs = [] } = this.state;
|
|
|
const [subject] = tabs.filter(row => row.key === tab1);
|
|
|
const children = (subject && subject.children) ? subject.children : (tab1 === 'preview' && previewType === PREVIEW_COURSE ? courseTabs : []);
|
|
|
return (
|
|
@@ -711,17 +719,9 @@ export default class extends Page {
|
|
|
{tab1 === SENTENCE && this.renderSentence()}
|
|
|
{tab1 === PREVIEW && this.renderPreview()}
|
|
|
|
|
|
- {this.state.faqs && <QAList data={this.state.faqs} active={'faq'} tabs={[{ key: 'faq', name: 'FAQs' }]} />}
|
|
|
- </div>
|
|
|
- <div className='bottom-info'>
|
|
|
- <div className='content'>
|
|
|
- <Tabs active={tab3} space={7.5} type='tag' theme='white' tabs={[{ key: '1', title: '千行长难句' }, { key: '2', title: '关于CODE' }, { key: '3', title: '考生评价' }]} onChange={(key) => this.setState({ tab3: key })} />
|
|
|
- {tab3 === '1' && <AnswerCarousel hideBtn />}
|
|
|
- {tab3 === '3' && [{}].map((item) => {
|
|
|
- return <Comment data={item} />;
|
|
|
- })}
|
|
|
- </div>
|
|
|
+ {tab1 !== SENTENCE && this.state.faqs && <QAList data={this.state.faqs} active={'faq'} tabs={[{ key: 'faq', name: 'FAQs' }]} />}
|
|
|
</div>
|
|
|
+ {tab1 === SENTENCE && this.renderSentenceInfo()}
|
|
|
{sentenceModel && this.renderInputCodeModel()}
|
|
|
</div>
|
|
|
);
|
|
@@ -902,6 +902,30 @@ export default class extends Page {
|
|
|
return this.renderInputCode();
|
|
|
}
|
|
|
|
|
|
+ renderSentenceInfo() {
|
|
|
+ const { sentence = {}, tab3, sentenceInfo = {}, faqs = [], comments = [] } = this.state;
|
|
|
+ const { sentenceTrail } = this.props.user;
|
|
|
+ if (sentence.code || sentenceTrail) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return <div className='bottom-info'>
|
|
|
+ <div className='content'>
|
|
|
+ <Tabs active={tab3} space={7.5} type='tag' theme='white' tabs={[{ key: 'faq', title: '千行长难句' }, { key: 'code', title: '关于CODE' }, { key: 'comment', title: '考生评价' }]} onChange={(key) => {
|
|
|
+ this.setState({ tab3: key });
|
|
|
+ }} />
|
|
|
+ {tab3 === 'faq' && <AnswerCarousel
|
|
|
+ hideBtn
|
|
|
+ list={faqs}
|
|
|
+ onFaq={() => User.needLogin().then(() => this.setState({ showFaq: true, faq: { channel: 'exercise-sentence' } }))}
|
|
|
+ />}
|
|
|
+ {tab3 === 'code' && <div dangerouslySetInnerHTML={{ __html: sentenceInfo.detail }} />}
|
|
|
+ {tab3 === 'comment' && (comments || []).map((item) => {
|
|
|
+ return <Comment data={item} />;
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
+ </div>;
|
|
|
+ }
|
|
|
+
|
|
|
renderSentenceArticle() {
|
|
|
const {
|
|
|
sentence = {},
|
|
@@ -1082,11 +1106,11 @@ export default class extends Page {
|
|
|
}}
|
|
|
/>
|
|
|
{sentenceError && <div className="error">{sentenceError}</div>}
|
|
|
- <div className="tip">
|
|
|
+ {/* <div className="tip">
|
|
|
<Link to="/" className="right link">
|
|
|
什么是CODE?
|
|
|
</Link>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
</div>
|
|
|
<div className="btn-list">
|
|
|
<AnswerButton size="lager" theme="confirm" width={150} onClick={() => this.activeSentence()}>
|