您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2 个月前
1 个月前
2 个月前
1 个月前
2 个月前
1 个月前
2 个月前
1 个月前
1 个月前
2 个月前
1 个月前
1 个月前
1 个月前
1 个月前
1 个月前
1 个月前
1 个月前
2 个月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import { useState, useEffect, useRef } from 'react';
  2. import { ProList, PageContainer } from '@ant-design/pro-components';
  3. import { ConfigProvider, Button, Flex, Input, Space, Image, Tooltip, Row, Col, Pagination, Tag, Card, Affix, Typography, Anchor } from 'antd';
  4. import { SearchOutlined, LikeOutlined, EnvironmentOutlined, FieldTimeOutlined } from '@ant-design/icons';
  5. import { useModel, connect, history, Link } from 'umi';
  6. import { Imageprefix } from '@/constants';
  7. import { GetRecruitmentList } from '@/services/apis/fair';
  8. import EmptyResult from '@/components/Common/EmptyResult'
  9. const HomePage: React.FC = () => {
  10. const [list, setList] = useState<object[]>([])
  11. const [total, setTotal] = useState<number>(0)
  12. const [page, setPage] = useState<number>(1)
  13. const [pageSize, setPageSize] = useState<number>(12)
  14. const [keyword, setKeyword] = useState<string>('')
  15. useEffect(() => {
  16. GetRecruitmentList({ page: 1, pagesize: 12, sortby: 'desc' }).then(res => {
  17. setList(res.data.recruitments)
  18. setTotal(res.data.total)
  19. })
  20. }, []);
  21. return (
  22. <>
  23. <ConfigProvider
  24. theme={{
  25. token: {
  26. colorPrimary: '#19be6e',
  27. },
  28. components: {
  29. Button: {
  30. colorText: '#19be6e'
  31. }
  32. }
  33. }}
  34. >
  35. <PageContainer
  36. header={{ title: '', }}
  37. style={{ minHeight: 1000 }}
  38. >
  39. <Flex justify='center' align='center' style={{ marginBottom: '40px' }}>
  40. <Input
  41. size='large'
  42. prefix={<SearchOutlined style={{ color: '#19be6e' }} />}
  43. placeholder="请输入要搜索的招聘会" allowClear onBlur={(e) => {
  44. setKeyword(e.target.value)
  45. }} addonAfter={
  46. <>
  47. <Button type='text' onClick={() => {
  48. GetRecruitmentList({ page: 1, pagesize: 12, sortby: 'desc', keyword: keyword }).then(res => {
  49. setList(res.data.recruitments)
  50. setTotal(res.data.total)
  51. })
  52. }}>开始搜索</Button>
  53. </>
  54. } />
  55. </Flex>
  56. <Row gutter={[20, 20]}>
  57. {
  58. list.length > 0 && list.map((item: any, index: number) => (
  59. <>
  60. <Col span={6}>
  61. <Link to={{ pathname: `/talent/fair/detail?id=${item.id}` }} target="_blank">
  62. <Flex vertical align='center' justify='center' style={{ background: '#fff', borderRadius: '4px' }}>
  63. <div style={{
  64. width: '100%',
  65. position: 'relative',
  66. paddingTop: '56.25%', /* 16:9 的比例 */
  67. overflow: 'hidden'
  68. }}>
  69. <img src={item.photo ? `${Imageprefix}${item.photo}` : '/images/logo.jpg'} style={{
  70. position: 'absolute',
  71. top: 0,
  72. left: 0,
  73. width: '100%',
  74. height: '100%',
  75. borderRadius: '8px 8px 0 0'
  76. }} />
  77. </div>
  78. <Typography.Paragraph
  79. ellipsis={{ rows: 2 }}
  80. style={{ fontSize: 16, fontWeight: 'bold', padding: '0 16px', marginTop: 8, minHeight: 50, width: '100%' }}
  81. >
  82. {item.title}
  83. </Typography.Paragraph>
  84. <Typography.Paragraph
  85. ellipsis={{ rows: 1 }}
  86. style={{ fontSize: 12, color: 'gray', padding: '0 16px', whiteSpace: 'nowrap', width: '100%' }}
  87. >
  88. <FieldTimeOutlined /> {item.open_date} {item.close_date ? <>至{item.close_date}</> : ''}
  89. </Typography.Paragraph>
  90. <Typography.Paragraph
  91. ellipsis={{ rows: 1 }}
  92. style={{ fontSize: 12, color: 'gray', padding: '0 16px', whiteSpace: 'nowrap', width: '100%' }}
  93. >
  94. <EnvironmentOutlined /> {item.address}
  95. </Typography.Paragraph>
  96. </Flex >
  97. </Link>
  98. </Col >
  99. </>
  100. ))
  101. }
  102. </Row>
  103. {
  104. !list || list.length == 0 && <EmptyResult description="没有找到符合条件的招聘会" />
  105. }
  106. <Flex justify='center' align='center' style={{ margin: '40px 0' }}>
  107. <Pagination
  108. hideOnSinglePage
  109. total={total}
  110. showTotal={(total) => `总共${total}条`}
  111. current={page}
  112. pageSize={pageSize}
  113. pageSizeOptions={['12', '24', '36']}
  114. onChange={(page, pageSize) => {
  115. setPage(page)
  116. setPageSize(pageSize)
  117. GetRecruitmentList({ page: page, pagesize: pageSize, sortby: 'desc', keyword: keyword ? keyword : '' }).then(res => {
  118. setList(res.data.recruitments)
  119. setTotal(res.data.total)
  120. })
  121. }}
  122. />
  123. </Flex>
  124. </PageContainer >
  125. </ConfigProvider >
  126. </>
  127. );
  128. };
  129. export default HomePage;