import React, { Component } from 'react'; import './index.less'; import Page from '@src/containers/Page'; import Assets from '@src/components/Assets'; import { getMap, formatDate } from '@src/services/Tools'; import { QuestionType } from '../../../../Constant'; import { My } from '../../../stores/my'; const QuestionTypeMap = getMap(QuestionType, 'value', 'label'); export default class extends Page { initState() { this.today = formatDate(new Date(), 'YYYY-MM-DD'); return { list: [], }; } initData() { My.listSearchHistory() .then(result => { const map = {}; const dateList = []; result.forEach((row) => { const date = formatDate(row.createTime, 'YYYY-MM-DD'); if (!map[date]) { map[date] = { date, list: [] }; dateList.push(date); } const item = map[date]; item.list.push(row); }); const list = dateList.map(row => { return map[row]; }); this.setState({ list }); }); } clearHistory(date) { My.clearSearchHistory(date) .then(() => { this.refresh(); }); } renderView() { const { list = [] } = this.state; return (