Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.tsx 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import { useState, useEffect, useRef } from 'react';
  2. import { ProList, PageContainer } from '@ant-design/pro-components';
  3. import { ConfigProvider, Button, Flex, Input, Space, Image, Select, Row, Col, Pagination, Tag, Card, Divider, Typography, Anchor } from 'antd';
  4. import { SearchOutlined, LikeOutlined, ArrowRightOutlined, StarOutlined } from '@ant-design/icons';
  5. import { useModel, connect, history, Link, useSearchParams } from 'umi';
  6. import SearchFilter from '@/components/Talent/Search/Filter/Company';
  7. import SearchJob from '@/components/Talent/Search/Company/index';
  8. import { Imageprefix } from '@/constants/index'
  9. import { PostCompanySearch } from '@/services/apis/company';
  10. import { GetAdvertscheduleList } from '@/services/apis/advertschedule';
  11. import EmptyResult from '@/components/Common/EmptyResult'
  12. import CommonJob from '@/components/Common/Job'
  13. const HomePage: React.FC = () => {
  14. const [searchParams, setSearchParams] = useSearchParams();
  15. const [list, setList] = useState<object[]>([])
  16. const [advertscheduleList, setAdvertscheduleList] = useState<object[]>([])
  17. const [search, setSearch] = useState<object | null>(null)
  18. const [total, setTotal] = useState<number>(0)
  19. const [page, setPage] = useState<number>(1)
  20. const [pagesize, setPageSize] = useState<number>(18)
  21. useEffect(() => {
  22. GetAdvertscheduleList({ page: 1, pagesize: 4, code: 'wzsylbt' }).then(res => {
  23. setAdvertscheduleList(res.data.advertschedules)
  24. })
  25. }, []);
  26. // useEffect(() => {
  27. // PostJobSearch({
  28. // page: 1,
  29. // pagesize: 12,
  30. // sort: 'updated_at',
  31. // sortby: 'desc'
  32. // }).then(res => {
  33. // setList(res.data.jobs)
  34. // getTotal(res.data.total)
  35. // })
  36. // }, []);
  37. const getSearchParams = async (value) => {
  38. setPage(value.page)
  39. setPageSize(value.pagesize)
  40. let res = await PostCompanySearch(value ? value : {
  41. page: page,
  42. pagesize: pagesize,
  43. sort: 'updated_at',
  44. sortby: 'desc',
  45. })
  46. setList(res.data.list)
  47. getTotal(res.data.total)
  48. }
  49. const getTotal = (value) => {
  50. setTotal(value)
  51. }
  52. return (
  53. <>
  54. <ConfigProvider
  55. theme={{
  56. token: {
  57. colorPrimary: '#19be6e',
  58. },
  59. components: {
  60. Button: {
  61. colorText: '#19be6e'
  62. }
  63. }
  64. }}
  65. >
  66. <Space direction='vertical' size={30} style={{ minHeight: '800px' }}>
  67. <SearchFilter getSearchParams={getSearchParams}
  68. famous={searchParams.get('famous') ? searchParams.get('famous') : 0}
  69. probation={searchParams.get('probation') ? searchParams.get('probation') : 0}
  70. page={page}
  71. pagesize={pagesize}></SearchFilter>
  72. <Row gutter={[16, 16]}>
  73. <Col span={18}>
  74. <Row gutter={[16, 16]}>
  75. {
  76. list && list.length > 0 && list.map((item: any, index: number) => (
  77. <>
  78. <Col span={8}>
  79. <Link to={{ pathname: `/talent/company/detail?id=${item.id}` }} target="_blank" style={{ width: '100%' }}>
  80. <Flex vertical align='center' justify='center' className='company-item'>
  81. <Image src={item.photo ? `${Imageprefix}${item.photo}` : '/images/logo.jpg'} preview={false} width={100} height={100} style={{ borderRadius: '4px', objectFit: 'contain' }}></Image>
  82. <Typography.Paragraph
  83. ellipsis={{ rows: 1 }}
  84. style={{ fontSize: 16, textAlign: 'center', whiteSpace: 'nowrap', marginTop: 8, width: '100%' }}
  85. >
  86. {item.full_name}
  87. </Typography.Paragraph>
  88. <Typography.Paragraph
  89. ellipsis={{ rows: 1 }}
  90. style={{ fontSize: 12, color: '#999', textAlign: 'center', whiteSpace: 'nowrap', width: '100%' }}
  91. >
  92. {item.nature_text ? item.nature_text : '性质不限'}
  93. {item.industry_text ? <><Divider type='vertical' />{item.industry_text}</> : <><Divider type='vertical' />行业不限</>}
  94. {item.scale_text ? <><Divider type='vertical' />{item.scale_text}</> : <><Divider type='vertical' />规模不限</>}
  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. }}
  118. />
  119. </Flex>
  120. </Col>
  121. <Col span={6}>
  122. {
  123. advertscheduleList && advertscheduleList.length && advertscheduleList.map((item, index) => (
  124. <div style={{ borderRadius: 8, marginBottom: 20 }}>
  125. <div style={{
  126. width: '100%',
  127. position: 'relative',
  128. paddingTop: '56.25%', /* 16:9 的比例 */
  129. overflow: 'hidden'
  130. }}>
  131. <Link to={{ pathname: item.target_url }} target='_blank'>
  132. <img src={Imageprefix + item.image_url} style={{
  133. position: 'absolute',
  134. top: 0,
  135. left: 0,
  136. width: '100%',
  137. height: '100%',
  138. borderRadius: 8
  139. }} />
  140. </Link>
  141. </div>
  142. </div>
  143. ))
  144. }
  145. </Col>
  146. </Row>
  147. </Space>
  148. </ConfigProvider >
  149. </>
  150. );
  151. };
  152. export default HomePage;