知与行后台管理端

InviteClients.jsx 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import React, { useState, useEffect } from 'react';
  2. import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
  3. import { FormattedMessage } from 'umi-plugin-react/locale';
  4. import channels from './channelList.less';
  5. import router from 'umi/router';
  6. import request from '../../utils/request'
  7. const { Option } = Select;
  8. function handleChange(value) {
  9. console.log(`selected ${value}`);
  10. }
  11. const columns = [
  12. {
  13. title: '头像',
  14. dataIndex: 'img',
  15. key: 'img',
  16. align: 'center',
  17. render: (text, record) => <img src={record.avatarurl} className={channels.touxiang} />,
  18. },
  19. {
  20. title: '用户姓名',
  21. dataIndex: 'name',
  22. key: 'name',
  23. align: 'center',
  24. render: text => <a>{text}</a>,
  25. },
  26. {
  27. title: '电话',
  28. dataIndex: 'tel',
  29. key: 'tel',
  30. align: 'center',
  31. },
  32. {
  33. title: '性别',
  34. dataIndex: 'sex',
  35. key: 'sex',
  36. align: 'center',
  37. render: (text, record) => <a style={ { color: '#66B3FF' } } >{ record.sex === 1 ? '男' : '女' }</a>,
  38. },
  39. ];
  40. const header = props => {
  41. // eslint-disable-next-line react-hooks/rules-of-hooks
  42. const [data, setData] = useState({ channelNmae: [], result: [] })
  43. // eslint-disable-next-line react-hooks/rules-of-hooks
  44. useEffect(() => {
  45. getList({ id: props.location.query.id, pageNum: 1, pageSize: 10 })
  46. }, [])
  47. function getList(params) {
  48. request({
  49. url: '/api/admin/channel/InviteClientsList',
  50. method: 'GET',
  51. params: { ...params },
  52. // eslint-disable-next-line no-shadow
  53. }).then(data => {
  54. console.log(data)
  55. setData(data)
  56. })
  57. }
  58. // 分页
  59. function onChange(pageNumber) {
  60. // eslint-disable-next-line react-hooks/rules-of-hooks
  61. getList({ pageNum: pageNumber, pageSize: 9 })
  62. }
  63. return (
  64. <>
  65. <div className={channels.searchBox}>
  66. </div>
  67. <Table dataSource={data.records} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
  68. </>
  69. )
  70. }
  71. export default header