You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import { useState, useEffect, useRef } from 'react';
  2. import { HomeOutlined, FormOutlined, CameraOutlined } from '@ant-design/icons'
  3. import { LoginForm, ProConfigProvider, ProFormCaptcha, ProFormCheckbox, ProFormText, setAlpha, ProForm, ProFormDependency } from '@ant-design/pro-components';
  4. import { Space, Tabs, Button, Avatar, Row, Col, Image, Modal, Card, List, Popconfirm } from 'antd';
  5. import { Imageprefix } from '@/constants/index'
  6. import { GetJobapplicantListcertificate, PostJobapplicantDelcertificate} from '@/services/apis/resume'
  7. import ManageJobseekerResumeCertificateCreate from '../Create/Certificate'
  8. interface ManageJobseekerResumeCertificateProps {
  9. }
  10. const ManageJobseekerResumeCertificate: React.FC<ManageJobseekerResumeCertificateProps> = () => {
  11. const [openPreview, setOpenPreview] = useState(false);
  12. const [list, setList] = useState<object[]>([])
  13. const [total, setTotal] = useState<number>(0)
  14. const [detail, setDetail] = useState<any>({})
  15. const closeModel = (value: boolean) => {
  16. setOpenPreview(value)
  17. GetJobapplicantListcertificate({ page: 1, pagesize: 10, sortby: 'desc' }).then((res: any) => {
  18. setList(res.data.jobapplicantcertificates && res.data.jobapplicantcertificates.length > 0 ? res.data.jobapplicantcertificates : []);
  19. setTotal(res.data.total);
  20. })
  21. }
  22. useEffect(() => {
  23. GetJobapplicantListcertificate({ page: 1, pagesize: 10, sortby: 'desc' }).then((res: any) => {
  24. setList(res.data.jobapplicantcertificates && res.data.jobapplicantcertificates.length > 0 ? res.data.jobapplicantcertificates : []);
  25. setTotal(res.data.total);
  26. })
  27. }, [])
  28. return (
  29. <>
  30. <Card title={<><Space>证书 <div style={{ color: '#999', fontSize: 14 }}> {total} 条证书</div></Space> </>} extra={<><Button type='primary' onClick={() => {
  31. setOpenPreview(true)
  32. }}>添加证书</Button></>}>
  33. <List
  34. className="demo-loadmore-list"
  35. itemLayout="horizontal"
  36. // loadMore={loadMore}
  37. dataSource={list}
  38. renderItem={(item, index) => (
  39. <List.Item
  40. actions={[<Button size='small' onClick={() => { setOpenPreview(true); setDetail(item) }}>编辑</Button>,
  41. <Popconfirm
  42. title="是否删除"
  43. onConfirm={(e) => {
  44. PostJobapplicantDelcertificate({ id: item.id }).then((res: any) => {
  45. GetJobapplicantListcertificate({ page: 1, pagesize: 10, sortby: 'desc' }).then((res: any) => {
  46. setList(res.data.jobapplicantcertificates && res.data.jobapplicantcertificates.length > 0 ? res.data.jobapplicanttrainings : []);
  47. setTotal(res.data.total);
  48. })
  49. })
  50. }}
  51. okText="删除"
  52. cancelText="取消"
  53. >
  54. <Button size='small'>删除</Button>
  55. </Popconfirm>]}
  56. >
  57. <List.Item.Meta
  58. avatar={<><Avatar>{index + 1}</Avatar></>}
  59. title={<><h3 style={{ fontWeight: 'bold' }}>{item.name}</h3></>}
  60. description={
  61. <>
  62. <Space direction='vertical' style={{ color: '#000' }}>
  63. {
  64. item.certificate_photo ? <Image src={Imageprefix + item.certificate_photo} shape='square' width={200} height={200} />
  65. : ''
  66. }
  67. </Space>
  68. </>
  69. }
  70. />
  71. </List.Item>
  72. )}
  73. />
  74. </Card>
  75. <Modal
  76. open={openPreview}
  77. title='编辑简历信息'
  78. centered
  79. maskClosable={false}
  80. footer={null}
  81. destroyOnClose
  82. width={1000}
  83. onCancel={() => {
  84. setOpenPreview(false)
  85. }}
  86. >
  87. <ManageJobseekerResumeCertificateCreate detail={detail} closeModel={closeModel}></ManageJobseekerResumeCertificateCreate>
  88. </Modal>
  89. </>
  90. );
  91. };
  92. export default ManageJobseekerResumeCertificate;