import React, { useState, useEffect } from 'react'; import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd'; import { FormattedMessage } from 'umi-plugin-react/locale'; import channels from './channelList.less'; import router from 'umi/router'; import request from '../../utils/request' const { Option } = Select; function handleChange(value) { console.log(`selected ${value}`); } const columns = [ { title: '头像', dataIndex: 'img', key: 'img', align: 'center', render: (text, record) => <img src={record.avatarurl} className={channels.touxiang} />, }, { title: '用户姓名', dataIndex: 'name', key: 'name', align: 'center', render: text => <a>{text}</a>, }, { title: '电话', dataIndex: 'tel', key: 'tel', align: 'center', }, { title: '性别', dataIndex: 'sex', key: 'sex', align: 'center', render: (text, record) => <a style={ { color: '#66B3FF' } } >{ record.sex === 1 ? '男' : '女' }</a>, }, ]; const header = props => { // eslint-disable-next-line react-hooks/rules-of-hooks const [data, setData] = useState({ channelNmae: [], result: [] }) // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { getList({ id: props.location.query.id, pageNum: 1, pageSize: 10 }) }, []) function getList(params) { request({ url: '/api/admin/channel/InviteClientsList', method: 'GET', params: { ...params }, // eslint-disable-next-line no-shadow }).then(data => { console.log(data) setData(data) }) } // 分页 function onChange(pageNumber) { // eslint-disable-next-line react-hooks/rules-of-hooks getList({ pageNum: pageNumber, pageSize: 9 }) } return ( <> <div className={channels.searchBox}> </div> <Table dataSource={data.records} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} /> </> ) } export default header