123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- import React, { Component } from 'react';
- // import { Link } from 'react-router-dom';
- import './index.less';
- import { Icon, Checkbox } from 'antd';
- import Page from '@src/containers/Page';
- import Assets from '@src/components/Assets';
- import { timeRange, getMap, formatMonth, formatDate, formatSeconds } from '@src/services/Tools';
- import UserLayout from '../../../layouts/User';
- import UserTable from '../../../components/UserTable';
- import UserAction from '../../../components/UserAction';
- import { RealAuth, QuestionNoteModal } from '../../../components/OtherModal';
- import Examination from '../../../components/Examination';
- import VipRenew from '../../../components/VipRenew';
- import menu, { refreshQuestionType } from '../index';
- import Tabs from '../../../components/Tabs';
- import Modal from '../../../components/Modal';
- import Select from '../../../components/Select';
- import GIcon from '../../../components/Icon';
- import { TimeRange, QuestionType, PrepareStatus, ExperiencePercent } from '../../../../Constant';
- import { My } from '../../../stores/my';
- import { Question } from '../../../stores/question';
- const QuestionTypeMap = getMap(QuestionType, 'value', 'label');
- const PrepareStatusMap = getMap(PrepareStatus, 'value', 'short');
- const ExperiencePercentMap = getMap(ExperiencePercent, 'value', 'label');
- const exportType = [
- { key: 'question', title: '题目' },
- { key: 'official', title: '官方解析' },
- { key: 'note', title: '我的笔记' },
- // { key: 'qx', title: '千行解析', auth: true },
- // { key: 'association', title: '题源联想', auth: true },
- // { key: 'qa', title: '相关问答', auth: true },
- ];
- export default class extends Page {
- constructor(props) {
- props.size = 10;
- super(props);
- }
- initState() {
- return {
- tab: 'question',
- module: 'exercise',
- timerange: 'all',
- filterMap: {},
- sortMap: {},
- list: [],
- selectList: [],
- allChecked: false,
- showDetail: false,
- defaultSortMap: { collect_time: 'desc' },
- };
- }
- init() {
- this.columns = [
- {
- key: 'question_type',
- title: '题型',
- width: 115,
- render: (text, record) => {
- return QuestionTypeMap[record.questionType];
- },
- fixSort: true,
- },
- {
- key: 'title',
- title: '题目ID',
- width: 100,
- fixSort: true,
- render: (text, record) => {
- return <a href={`/question/detail/${record.questionNoId}`} target="_blank">{text}</a>;
- },
- },
- {
- key: 'description',
- title: '内容',
- width: 180,
- render: (text) => {
- return <div style={{ maxHeight: '80px', overflow: 'hidden' }}>{text}</div>;
- },
- },
- {
- key: 'time',
- title: '耗时',
- width: 100,
- sort: true,
- render: (text, record) => {
- const user = record.stat ? record.stat.userTime / record.stat.userNumber : 0;
- const all = record.questionNo.totalNumber ? record.questionNo.totalTime / record.questionNo.totalNumber : 0;
- return <div className="sub">
- <div className="t-2 t-s-12">{user > 0 ? formatSeconds(user) : '-'}{user > 0 && <Assets height={10} width={10} name={user > all ? 'up' : 'down'} />}</div>
- <div className="t-6 t-s-12">全站{all > 0 ? formatSeconds(all) : '-'}</div>
- </div>;
- },
- },
- {
- key: 'update_time',
- title: '更新时间',
- width: 105,
- sort: true,
- render: (text) => {
- return <div className="sub">
- <div className="t-2 t-s-12">{text.split(' ')[0]}</div>
- <div className="t-6 t-s-12">{text.split(' ')[1]}</div>
- </div>;
- },
- },
- {
- key: 'collect_time',
- title: '收藏时间',
- width: 105,
- sort: true,
- render: (text) => {
- return <div className="sub">
- <div className="t-2 t-s-12">{text.split(' ')[0]}</div>
- <div className="t-6 t-s-12">{text.split(' ')[1]}</div>
- </div>;
- },
- },
- {
- key: '',
- title: '',
- render: (text, record, index) => {
- return <div><GIcon name="note" active={record.note} onClick={() => this.note(index)} /></div>;
- },
- },
- ];
- }
- initData() {
- const data = Object.assign(this.state, this.state.search);
- data.filterMap = this.state.search;
- if (data.order) {
- data.sortMap = { [data.order]: data.direction };
- } else if (data.order !== null && data.order !== '') {
- data.sortMap = Object.assign({}, this.state.defaultSortMap);
- }
- if (data.timerange) {
- data.filterMap.timerange = data.timerange;
- }
- switch (data.tab) {
- case 'question':
- return this.refreshQuestion(data);
- case 'article':
- return this.refreshArticle(data);
- default:
- return null;
- }
- }
- refreshQuestion(data) {
- const [startTime, endTime] = timeRange(data.timerange);
- refreshQuestionType(this, data.subject, data.questionType, {
- all: true,
- needSentence: data.module !== 'examination',
- allSubject: true,
- }).then(({ questionTypes, selectSentence }) => {
- const moduleSelect = [{ title: '练习', key: 'exercise' }];
- if (!selectSentence) {
- moduleSelect.push({ title: '模考', key: 'examination' });
- }
- this.setState({ moduleSelect });
- My.listQuestionCollect(
- Object.assign(
- { module: data.module, questionTypes, startTime, endTime },
- this.state.search,
- {
- order: Object.keys(data.sortMap)
- .map(key => {
- if (key === 'title') return 'pid asc, no asc';
- return `${key} ${data.sortMap[key]}`;
- })
- .join(','),
- },
- ),
- ).then(result => {
- result.list = result.list.map(row => {
- row.questionNo = row.questionNo || {};
- row.key = row.questionNoId;
- row.questionType = row.question.questionType;
- row.title = row.questionNo.title;
- row.description = row.question.description;
- row.latest_time = row.latestTime ? formatDate(row.latestTime, 'YYYY-MM-DD HH:mm:ss') : '';
- row.collect_time = row.createTime ? formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss') : '';
- row.update_time = row.question.updateTime ? formatDate(row.question.updateTime, 'YYYY-MM-DD HH:mm:ss') : '';
- return row;
- });
- const { selectList, allChecked, selectPage } = this.updateSelectInfo(data.page, result.list);
- this.setState({ list: result.list, total: result.total, selectList, allChecked, selectPage });
- });
- });
- }
- updateSelectInfo(page, list, selectList = null) {
- const { selectPage = {} } = this.state;
- let allChecked = false;
- if (selectList == null) {
- selectList = [];
- if (selectPage[Number(page)]) {
- selectList = selectPage[Number(page)];
- }
- } else {
- selectPage[Number(page)] = selectList;
- }
- allChecked = list.filter(row => selectList.indexOf(row.key) >= 0).length === list.length && list.length > 0;
- return { selectList, allChecked, selectPage };
- }
- refreshArticle(data) {
- const [startTime, endTime] = timeRange(data.timerange);
- My.listExperienceCollect(Object.assign({ startTime, endTime }, this.state.search)).then(result => {
- this.setState({ list: result.list, total: result.total });
- });
- }
- note(index) {
- const { list } = this.state;
- const userQuestion = list[index];
- const { questionNo } = userQuestion;
- My.getQuestionNote(questionNo.id)
- .then(result => {
- this.setState({ questionNo, note: result || {}, showNote: true, index });
- });
- }
- onTabChange(tab) {
- const data = { tab };
- this.refreshQuery(data);
- }
- onFilter(value) {
- this.search(value, false);
- this.initData();
- }
- onSearch(value) {
- this.search({ page: 1, keyword: value }, false);
- this.initData();
- }
- onSort(value) {
- const keys = Object.keys(value);
- const { sortMap, defaultSortMap } = this.state;
- const index = keys.length > 1 && sortMap[keys[0]] ? 1 : 0;
- let order = keys.length && value[keys[index]] ? keys[index] : null;
- let direction = keys.length ? value[keys[index]] : null;
- if (order == null) {
- const [prevOrder] = Object.keys(sortMap);
- console.log(prevOrder, defaultSortMap[prevOrder]);
- if (!defaultSortMap[prevOrder]) {
- [order] = Object.keys(defaultSortMap);
- direction = defaultSortMap[order];
- }
- }
- this.search({ order, direction }, false);
- this.initData();
- }
- onChangePage(page) {
- this.search({ page }, false);
- this.initData();
- }
- onAll(checked) {
- const { selectPage = {}, search = {} } = this.state;
- let { selectList } = this.state;
- const { page } = search;
- const { list = [] } = this.state;
- if (checked) {
- list.forEach(item => {
- if (selectList.indexOf(item.key) >= 0) return;
- selectList.push(item.key);
- });
- selectPage[Number(page)] = selectList;
- } else {
- selectList = [];
- delete selectPage[Number(page)];
- }
- this.setState({ selectList, selectPage, allChecked: checked });
- }
- onSelect(slist) {
- const { search = {}, list } = this.state;
- const { selectList, allChecked, selectPage } = this.updateSelectInfo(search.page, list, slist);
- this.setState({ selectList, allChecked, selectPage });
- }
- onAction(key) {
- const { info } = this.props.user;
- const { selectPage = {} } = this.state;
- const selectList = [].concat(...Object.values(selectPage).concat());
- switch (key) {
- case 'help':
- this.setState({ showTips: true });
- return;
- case 'clear':
- if (selectList.length === 0) {
- this.setState({ showWarn: true, warn: { title: '移除', content: '不可少于1题,请重新选择' } });
- return;
- }
- this.setState({ showClearConfirm: true, clearInfo: { questionNoIds: selectList } });
- break;
- case 'group':
- if (!info.vip) {
- this.setState({ showVip: true });
- return;
- }
- if (selectList.length < 10) {
- this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可小于10题,请重新选择' } });
- return;
- }
- if (selectList.length > 50) {
- this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可多余50题,请重新选择' } });
- return;
- }
- if (selectList.length === 0) {
- this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可同时选中语文题和数学题,请重新选择。' } });
- return;
- }
- this.setState({ showGroupConfirm: true, groupInfo: { questionNoIds: selectList, filterTimes: 2, checked: true } });
- break;
- case 'export':
- if (!info.vip) {
- this.setState({ showVip: true });
- return;
- }
- if (selectList.length < 1) {
- this.setState({ showWarn: true, warn: { title: '导出', content: '不可小于1题,请重新选择' } });
- return;
- }
- if (selectList.length > 100) {
- this.setState({ showWarn: true, warn: { title: '导出', content: '不可多余100题,请重新选择' } });
- return;
- }
- // if (info.bindReal) {
- this.setState({ showExportConfirm: true, exportInfo: { include: exportType.map(row => row.key), questionNoIds: selectList } });
- // } else {
- // this.setState({ showExportAuthConfirm: true, exportInfo: { include: exportType.filter(row => !row.auth).map(row => row.key), questionNoIds: selectList } });
- // }
- break;
- default:
- }
- }
- clearCollectQuestion() {
- const { clearInfo } = this.state;
- My.clearQuestionCollect(clearInfo.questionNoIds)
- .then(() => {
- this.refresh();
- })
- .catch(e => {
- this.setState({ showWarn: true, warn: { title: '移除', content: e.message }, showClearConfirm: false });
- });
- }
- group() {
- const { groupInfo } = this.state;
- My.groupQuestionCollect(groupInfo)
- .then((result) => {
- Question.startLink('collect', result);
- this.setState({ showGroupConfirm: false });
- })
- .catch(e => {
- this.setState({ showWarn: true, warn: { title: '组卷练习', content: e.message }, showGroupConfirm: false });
- });
- }
- export() {
- const { exportInfo } = this.state;
- this.setState({ showExportWait: true, showExportConfirm: false, showExportAuthConfirm: false });
- My.exportQuestionCollect(exportInfo)
- .then((result) => {
- openLink(`/export/${result}`);
- this.setState({ showExportWait: false });
- })
- .catch(e => {
- this.setState({ showWarn: true, warn: { title: '导出', content: e.message }, showExportWait: false });
- });
- }
- collectArticle(row, checked) {
- if (checked) {
- My.addExperienceCollect(row.id).then(() => {
- this.refresh();
- });
- } else {
- My.delExperienceCollect(row.id).then(() => {
- this.refresh();
- });
- }
- }
- prevArticle() {
- const { list, article } = this.state;
- let index = -1;
- list.forEach((row, i) => {
- if (row.id === article.id) {
- index = i;
- }
- });
- if (index === 0) return;
- this.setState({ article: list[index - 1] });
- }
- nextArticle() {
- const { list, article } = this.state;
- let index = -1;
- list.forEach((row, i) => {
- if (row.id === article.id) {
- index = i;
- }
- });
- if (index === list.length - 1) return;
- this.setState({ article: list[index + 1] });
- }
- renderView() {
- const { config } = this.props;
- return <UserLayout active={config.key} menu={menu} center={this.renderTable()} />;
- }
- renderTable() {
- const { tab } = this.state;
- return (
- <div className="table-layout">
- <Tabs
- border
- type="division"
- theme="theme"
- size="small"
- space={2.5}
- width={100}
- active={tab}
- tabs={[{ key: 'question', title: '题目' }, { key: 'article', title: '文章' }]}
- onChange={key => this.onTabChange(key)}
- />
- {this[`renderTab${tab}`]()}
- {this.renderModal()}
- </div>
- );
- }
- renderTabquestion() {
- const { info } = this.props.user;
- const {
- questionSubjectSelect,
- questionSubjectMap = {},
- moduleSelect,
- filterMap = {},
- sortMap = {},
- list = [],
- } = this.state;
- const { selectList = [], allChecked, page, total } = this.state;
- return (
- <div className="tab-1-layout">
- <UserAction
- search
- defaultSearch={filterMap.keyword}
- selectList={[
- {
- children: [
- {
- key: 'subject',
- placeholder: '学科',
- select: questionSubjectSelect,
- },
- {
- placeholder: '题型',
- key: 'questionType',
- be: 'subject',
- selectMap: questionSubjectMap,
- },
- ],
- },
- {
- label: '范围',
- key: 'module',
- select: moduleSelect,
- },
- {
- right: true,
- key: 'timerange',
- select: TimeRange,
- },
- ]}
- filterMap={filterMap}
- onFilter={value => this.onFilter(value)}
- onSearch={value => this.onSearch(value)}
- />
- <UserAction
- allCheckbox
- allChecked={allChecked}
- help
- btnList={[
- { title: '移除', key: 'clear' },
- { title: '组卷', key: 'group', tag: 'vip', disabled: !info.vip },
- { title: '导出', key: 'export', tag: 'vip', disabled: !info.vip },
- ]}
- onAll={checked => this.onAll(checked)}
- onAction={key => this.onAction(key)}
- />
- <UserTable
- select
- columns={this.columns}
- sortMap={sortMap}
- data={list}
- current={page}
- pageSize={this.state.search.size}
- total={total}
- selectList={selectList}
- onSelect={l => this.onSelect(l)}
- onSort={v => this.onSort(v)}
- onChange={p => this.onChangePage(p)}
- />
- </div>
- );
- }
- renderTabarticle() {
- const { filterMap = {}, sortMap = {}, list = [] } = this.state;
- return (
- <div className="tab-1-layout">
- <UserAction
- sortList={[
- {
- key: 'create_time',
- label: '收藏时间',
- },
- {
- key: 'update_time',
- label: '更新时间',
- },
- ]}
- sortMap={sortMap}
- filterMap={filterMap}
- onFilter={value => this.onFilter(value)}
- onSort={value => this.onSort(value)}
- />
- {list.map(item => {
- return <Article data={item} onClick={() => this.setState({ showDetail: true, article: item })} onUnCollect={() => this.collectArticle(item, false)} />;
- })}
- </div>
- );
- }
- renderModal() {
- const { article = {}, showTips, showWarn, warn = {}, showClearConfirm, clearInfo = {}, showGroupConfirm, groupInfo = {}, showExportConfirm, showExportAuthConfirm, exportInfo = {}, showExportWait, showExamination, showVip, showReal, showNote, note = {}, questionNo = {}, list } = this.state;
- const { info } = this.props.user;
- return [
- <ArticleDetail show={this.state.showDetail} data={article} onClose={() => this.setState({ showDetail: false })} onPrev={() => this.prevArticle()} onNext={() => this.nextArticle()} />,
- <Modal show={showTips} title="操作提示" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showTips: false })}>
- <div className="flex-layout m-b-2">
- <div className="flex-block">
- <div className="t-1 t-s-18">组卷功能</div>
- <div className="t-2">操作数量:10-50;</div>
- <div className="t-2">注意事项:可跨题型、不可跨学科。</div>
- </div>
- <div className="flex-block">
- <div className="t-1 t-s-18">导出功能</div>
- <div className="t-2">操作数量:1-100;</div>
- <div className="t-2">注意事项:“综合推理IR”暂时无法导出。</div>
- </div>
- </div>
- <div className="t-3">
- *您可点击
- <Icon type="question-circle" theme="filled" />
- 查阅以上信息。
- </div>
- </Modal>,
- <Modal show={showWarn} title={warn.title} confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showWarn: false })}>
- <div className="t-2 t-s-18">{warn.content}</div>
- </Modal>,
- <Modal show={showGroupConfirm} title="组卷练习" confirmText="开始练习" onConfirm={() => this.group()} onCancel={() => this.setState({ showGroupConfirm: false })}>
- <div className="t-2 t-s-18">
- 您共选择了 <span className="t-4">{groupInfo.questionNoIds ? groupInfo.questionNoIds.length : 0}</span> 道题目,是否开始练习?
- </div>
- <div className="t-2 t-s-16">
- <Checkbox checked={groupInfo.checked} className="m-r-5" onChange={() => {
- groupInfo.checked = !groupInfo.checked;
- this.setState({ groupInfo });
- }} />
- 剔除已组卷练习 <Select
- theme="white"
- value={groupInfo.filterTimes}
- list={[{ key: 2, title: '2' }, { key: 3, title: '3' }]}
- onChange={({ key }) => {
- groupInfo.filterTimes = key;
- this.setState({ groupInfo });
- }}
- />{' '}
- 次以上的题
- </div>
- </Modal>,
- <Modal show={showClearConfirm} title="移出" onConfirm={() => this.clearCollectQuestion()} onCancel={() => this.setState({ showClearConfirm: false })}>
- <div className="t-2 t-s-18">
- 当前选中的 <span className="t-4">{clearInfo.questionNoIds ? clearInfo.questionNoIds.length : 0}</span> 道题即将被移出收藏,移出后无法恢复,是否继续?
- </div>
- </Modal>,
- <Modal show={showExportWait} title="导出" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showExportWait: false })}>
- <div className="t-2 t-s-18">正在导出中,请不要关闭当前页面!</div>
- </Modal>,
- <Modal show={showExportConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportConfirm: false })}>
- <div className="t-2 t-s-18 m-b-5">
- 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
- </div>
- <div className="t-2 t-s-16">
- {exportType.map(item => {
- return (
- <div className="d-i-b m-b-5" style={{ width: 135 }}>
- <Checkbox checked={exportInfo.include ? exportInfo.include.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
- const index = exportInfo.include.indexOf(item.key);
- if (index >= 0) {
- exportInfo.include.splice(index, 1);
- } else {
- exportInfo.include.push(item.key);
- }
- this.setState({ exportInfo });
- }} />
- {item.title}
- </div>
- );
- })}
- </div>
- </Modal>,
- <Modal show={showExportAuthConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportAuthConfirm: false })}>
- <div className="t-2 t-s-18 m-b-5">
- 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
- </div>
- <div className="t-2 t-s-16 m-b-2">
- {exportType
- .filter(item => !item.auth)
- .map(item => {
- return (
- <div className="d-i-b m-b-2" style={{ width: 135 }}>
- <Checkbox checked={exportInfo.include ? exportInfo.include.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
- const index = exportInfo.include.indexOf(item.key);
- if (index >= 0) {
- exportInfo.include.splice(index, 1);
- } else {
- exportInfo.include.push(item.key);
- }
- this.setState({ exportInfo });
- }} />
- {item.title}
- </div>
- );
- })}
- </div>
- <div className="b-b m-b-2 m-t-2" />
- <div className="t-3 m-b-1">
- 以下内容需实名认证后才可导出: <a className="f-r" onClick={() => this.setState({ showExportAuthConfirm: false, showReal: true })}>去认证 ></a>
- </div>
- <div className="t-2 t-s-16 m-b-2">
- {exportType
- .filter(item => item.auth)
- .map(item => {
- return (
- <div className="d-i-b" style={{ width: 135 }}>
- <Checkbox disabled className="m-r-5" />
- {item.title}
- </div>
- );
- })}
- </div>
- </Modal>,
- <Examination
- show={showExamination}
- data={info}
- onConfirm={() => this.setState({ showExamination: false })}
- onCancel={() => this.setState({ showExamination: false })}
- onClose={() => this.setState({ showExamination: false })}
- />,
- <RealAuth show={showReal} data={info} onConfirm={() => this.setState({ showReal: false })} />,
- <VipRenew
- show={showVip}
- data={info}
- onReal={() => this.setState({ showVip: false, showReal: true })}
- onPrepare={() => this.setState({ showVip: false, showExamination: true })}
- onClose={(result) => {
- if (result) {
- this.refresh();
- } else {
- this.setState({ showVip: false });
- }
- }}
- />,
- <QuestionNoteModal show={showNote} defaultData={note} questionNo={questionNo} onConfirm={() => {
- list[this.state.index].note = true;
- this.setState({ showNote: false, list });
- }} onCancel={() => this.setState({ showNote: false })} />,
- ];
- }
- }
- class ArticleDetail extends Component {
- render() {
- const { show, data, onClose, onPrev, onNext } = this.props;
- return (
- <Modal
- className="article-detail-modal"
- body={false}
- show={show}
- width={720}
- maskClosable
- close={false}
- onClose={onClose}
- center
- >
- <Icon type="left" className="prev" onClick={() => onPrev && onPrev()} />
- <Icon type="right" className="next" onClick={() => onNext && onNext()} />
- <div className="t-1 t-s-20 m-b-5">{data.title}</div>
- <div className="t-1 t-s-12 m-b-2">
- <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
- <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
- <span className="m-r-2">备考:{!!data.experienceDay && formatMonth(data.experienceDay, false)}</span>
- <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
- {data.link && <a className="t-4" href={data.link} target="_blank">更多信息</a>}
- </div>
- <div className="t-2 t-s-18 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
- </Modal>
- );
- }
- }
- class Article extends Component {
- render() {
- const { data, onClick, onUnCollect } = this.props;
- return (
- <div className="article-item p-t-2 b-b" onClick={() => onClick && onClick()}>
- <div className="t-1 t-s-14 f-w-b">
- {data.title}
- <div className="f-r t-3 t-s-12 f-w-d">
- <span>{formatDate(data.updateTime, 'YYYY-MM-DD HH:mm:ss')}</span>
- <span className="m-l-2">阅读 {data.viewNumber}</span>
- <span className="m-l-2" onClick={(e) => {
- e.stopPropagation();
- onUnCollect();
- }}>取消收藏</span>
- </div>
- </div>
- <div className="t-1 t-s-12 m-b-2">
- <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
- <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
- <span className="m-r-2">备考:{formatMonth(data.experienceDay, false)}</span>
- <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
- </div>
- <div className="t-2 m-b-2 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
- </div>
- );
- }
- }
|