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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { useState, useEffect, useRef } from 'react';
  2. import { useModel, connect, history, Link } from 'umi';
  3. import { ConfigProvider, Button, Flex, Input, Space, Image, Select, Row, Col, Carousel, Tag, Card, Avatar, Typography } from 'antd';
  4. import { ProList, PageContainer } from '@ant-design/pro-components';
  5. import { SearchOutlined, RightOutlined, ArrowRightOutlined, StarOutlined } from '@ant-design/icons';
  6. import { Imageprefix } from '@/constants/index'
  7. import { GetSectionList, GetArticleList, GetSectionDetailByCode } from '@/services/apis/information';
  8. import TitleIndex from '@/components/Common/Title';
  9. import EmptyResult from '@/components/Common/EmptyResult'
  10. const ScienceTechnologyParkHomeIntroduction: React.FC = () => {
  11. const [list, setList] = useState<object[]>([{}])
  12. useEffect(() => {
  13. GetSectionDetailByCode({ code: 'KCYZXDT' }).then(res => {
  14. GetArticleList({ page: 1, pagesize: 6, section_id: res.data.id }).then(res1 => {
  15. setList(res1.data.articles)
  16. })
  17. })
  18. }, []);
  19. return (
  20. <>
  21. <ConfigProvider
  22. theme={{
  23. token: {
  24. colorPrimary: '#19be6e',
  25. },
  26. components: {
  27. Button: {
  28. colorText: '#19be6e'
  29. }
  30. }
  31. }}
  32. >
  33. <Space direction='vertical' size={10} style={{
  34. width: '100%',
  35. }}>
  36. <TitleIndex title="最新动态" link="/sciencetechnologypark/news"></TitleIndex>
  37. <Space direction='vertical' size={10} style={{ width: '100%', minHeight: '300px' }}>
  38. {
  39. list && list.length > 0 && list.map((item, index) => (
  40. <>
  41. <Link to={{ pathname: `/sciencetechnologypark/information/detail?id=${item.id}` }} target='_blank'>
  42. <Flex justify='space-between' align='center' style={{ width: '100%', padding: '16px', color: '#000000', background: '#ffffff', cursor: 'pointer' }}>
  43. <Space size={20}>
  44. <h3>{item.title}</h3>
  45. </Space>
  46. <Space size={20}>
  47. <div style={{ color: '#999' }}>
  48. {item.updated_at}
  49. </div>
  50. <RightOutlined style={{ color: '#999' }} />
  51. </Space>
  52. </Flex>
  53. </Link>
  54. {/* <Link to={{ pathname: `/sciencetechnologypark/information/detail?id=${item.id}` }} target='_blank' >
  55. <Flex justify='space-between' align='center' style={{ width: '100%', padding: '16px', color: '#000000', background: '#ffffff', borderRadius: 8, cursor: 'pointer' }}>
  56. <Space size={20}>
  57. <Image src={`${Imageprefix}${item.cover_img}`} width={68} height={68}></Image>
  58. <div style={{fontWeight: 'bold', fontSize: 16}}>{item.title}</div>
  59. </Space>
  60. <Space size={20}>
  61. <div>
  62. {item.updated_at}
  63. </div>
  64. <RightOutlined />
  65. </Space>
  66. </Flex>
  67. </Link> */}
  68. </>
  69. ))
  70. }
  71. {
  72. !list || list.length == 0 && <Flex justify='center' align='center' style={{ padding: '16px', borderRadius: 8, cursor: 'pointer' }}>
  73. <EmptyResult description="暂无数据" />
  74. </Flex>
  75. }
  76. </Space>
  77. </Space>
  78. </ConfigProvider >
  79. </>
  80. );
  81. };
  82. export default ScienceTechnologyParkHomeIntroduction;