import React from 'react';
import './index.less';
import { Icon, Checkbox } from 'antd';
import Page from '@src/containers/Page';
import { timeRange } from '@src/services/Tools';
import UserLayout from '../../../layouts/User';
import UserTable from '../../../components/UserTable';
import UserAction from '../../../components/UserAction';
import menu, { refreshQuestionType, refreshStruct } from '../index';
import Tabs from '../../../components/Tabs';
import Modal from '../../../components/Modal';
import Select from '../../../components/Select';
import GIcon from '../../../components/Icon';
import { TimeRange } from '../../../../Constant';
import { My } from '../../../stores/my';
const columns = [
{ key: 'question_type', title: '题型', fixSort: true },
{ key: 'title', title: '题目ID', fixSort: true },
{ key: 'description', title: '内容' },
{ key: 'time', title: '耗时', sort: true },
{ key: 'correct', title: '错误率', sort: true },
{ key: 'latest_time', title: '最近做题' },
{
key: '',
title: '',
render() {
return [, ];
},
},
];
const exportType = [
{ key: '1', title: '题目' },
{ key: '2', title: '官方解析' },
{ key: '3', title: '我的笔记' },
{ key: '4', title: '千行解析', auth: true },
{ key: '5', title: '题源联想', auth: true },
{ key: '6', title: '相关问答', auth: true },
];
export default class extends Page {
constructor(props) {
props.size = 10;
super(props);
}
initState() {
return {
tab: 'exercise',
timerange: 'today',
filterMap: {},
sortMap: {},
data: [{}, {}],
selectList: [],
allChecked: false,
};
}
initData() {
const data = Object.assign(this.state, this.state.search);
data.filterMap = this.state.search;
if (data.order) {
data.sortMap = { [data.order]: data.direction };
}
if (data.timerange) {
data.filterMap.timerange = data.timerange;
}
const [startTime, endTime] = timeRange(data.timerange);
refreshQuestionType(this, data.subject, data.questionType, {
all: true,
needSentence: true,
allSubject: true,
}).then(({ questionTypes }) => {
return refreshStruct(this, data.tab, data.one, data.two, {
all: true,
needPreview: false,
needTextbook: true,
}).then(({ structIds, latest, year }) => {
My.listQuestionAsk(
Object.assign(
{ module: data.tab, questionTypes, structIds, latest, year, startTime, endTime },
this.state.search,
{
order: Object.keys(data.sortMap)
.map(key => {
if (key === 'title') return 'pid desc, no desc';
return `${key} ${data.sortMap[key]}`;
})
.join(','),
},
),
).then(result => {
this.setState({ list: result.list, total: result.total });
});
});
});
}
onTabChange(tab) {
const data = { tab };
this.refreshQuery(data);
}
onFilter(value) {
this.search(value);
}
onSearch(value) {
console.log(value);
}
onSort(value) {
const keys = Object.keys(value);
// this.search({ order: keys.length ? keys.join('|') : null, direction: keys.length ? Object.values(value).join('|') : null });
const { sortMap } = this.state;
const index = keys.length > 1 && sortMap[keys[0]] ? 1 : 0;
this.search({ order: keys.length ? keys[index] : null, direction: keys.length ? value[keys[index]] : null });
}
onChangePage(page) {
this.search({ page });
}
onAll(checked) {
if (checked) {
const { data = [] } = this.state;
const list = [];
data.forEach(item => {
list.push(item.key);
});
this.setState({ selectList: list, allChecked: true });
} else {
this.setState({ selectList: [], allChecked: false });
}
}
onAction() {}
onSelect(selectList) {
this.setState({ selectList });
}
renderView() {
const { config } = this.props;
return ;
}
renderTable() {
const {
tab,
questionSubjectSelect,
questionSubjectMap = {},
oneSelect,
twoSelectMap = {},
filterMap = {},
sortMap = {},
list = [],
} = this.state;
const { selectList = [], allChecked, page, total } = this.state;
return (
this.onTabChange(key)}
/>
this.onFilter(value)}
onSearch={value => this.onSearch(value)}
/>
2019-06-03 15:30 组卷50题,做对30题。移除正确题目
}
onAll={checked => this.onAll(checked)}
onAction={key => this.onAction(key)}
/>
this.onSelect(l)}
onSort={v => this.onSort(v)}
onChange={p => this.onChangePage(p)}
/>
{this.renderModal()}
);
}
renderModal() {
return [
{}}>
组卷功能
操作数量:10-50;
注意事项:可跨题型、不可跨学科。
导出功能
操作数量:1-100;
注意事项:“综合推理IR”暂时无法导出。
*您可点击
查阅以上信息。
,
{}}>
不可同时选中语文题和数学题,请重新选择。
,
{}} onCancel={() => {}}>
您共选择了 50 道题目,是否开始练习?
剔除已组卷练习 {' '}
次以上的错题
,
{}} onCancel={() => {}}>
当前选中的 50 道题即将被移出错题本,移出后无法恢复,是否继续?
,
{}}>
正在下载中,请不要关闭当前页面!
,
{}} onCancel={() => {}}>
当前共选中 50 道题,请确认需要导出的内容:
{exportType.map(item => {
return (
{item.title}
);
})}
,
{}} onCancel={() => {}}>
当前共选中 50 道题,请确认需要导出的内容:
{exportType
.filter(item => !item.auth)
.map(item => {
return (
{item.title}
);
})}
{exportType
.filter(item => item.auth)
.map(item => {
return (
{item.title}
);
})}
,
];
}
}