import { filterDifficulty, gradeObject } from '@constants' import { Button, Input, Radio, Space, Table, Tag } from 'antd' import React, { Fragment, useState } from 'react' import { useNavigate } from 'react-router-dom' import './index.less' const { Search } = Input const colors = [ '#ffffb8', '#f4ffb8', '#b5f5ec', '#bae0ff', '#d9f7be', '#efdbff', ' #ffd6e7', '#d6e4ff' ] const QuestionList = props => { const [difficuty, setDifficuty] = useState(0) const navigate = useNavigate() const RandomNumBoth = (Min, Max) => { //差值 const Range = Max - Min // 随机数 const Rand = Math.random() return Min + Math.round(Rand * Range) //四舍五入 } const handleSearch = close => { props.changeDifficuty(difficuty) close() } const changeDifficuty = e => { setDifficuty(e.target.value) } /** * 题目列表 */ const questionColumns = [ { title: (
题目{' '}
(当前 {props.total || 0} 道题)
), key: 'questionNo', align: 'centlefter', render: (item, record) => { return (
{record.subjectName}
{item?.labelName?.length > 0 && item.labelName.map(tagsItem => { return (
{tagsItem}
) })}
) } }, { title: '难度', dataIndex: 'subjectDifficult', key: 'subjectDifficult', align: 'center', filterDropdown: ({ close }) => (
e.stopPropagation()}>
请选择
{filterDifficulty.map(item => { return ( {item.title} ) })}
), width: 90, render: key => { return {gradeObject?.[key]?.title} } } ] /** * 进入详情 * @param {*} item * @param {*} type * @returns */ const onChangeAction = item => () => { // navigate('/brush-question/' + item.id) window.open('/brush-question/' + item.id, '_blank') // let { isNotToDetail } = props; // !isNotToDetail && // if (!isNotToDetail) return; } /** * 过滤框-搜索框-模块 * @returns */ const renderFilterContainer = () => { const { total, isShowSearch, setSearchStr } = props return (
{isShowSearch && ( setSearchStr(value)} style={{ width: 240 }} allowClear size='small' /> )}
) } const { questionList, isHideSelect } = props return (
{!isHideSelect && renderFilterContainer()}
{ return { onClick: onChangeAction(record, index) // 点击行 } }} columns={questionColumns} dataSource={questionList} rowKey='id' pagination={false} rowClassName='question-table-row' /> ) } export default QuestionList