86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame] | 1 | import { PageContainer } from '@ant-design/pro-components'; |
| 2 | import { useModel } from '@umijs/max'; |
| 3 | import { Card, theme } from 'antd'; |
| 4 | import React from 'react'; |
| 5 | |
| 6 | /** |
| 7 | * 每个单独的卡片,为了复用样式抽成了组件 |
| 8 | * @param param0 |
| 9 | * @returns |
| 10 | */ |
| 11 | const InfoCard: React.FC<{ |
| 12 | title: string; |
| 13 | index: number; |
| 14 | desc: string; |
| 15 | href: string; |
| 16 | }> = ({ title, href, index, desc }) => { |
| 17 | const { useToken } = theme; |
| 18 | |
| 19 | const { token } = useToken(); |
| 20 | |
| 21 | return ( |
| 22 | <div |
| 23 | style={{ |
| 24 | backgroundColor: token.colorBgContainer, |
| 25 | boxShadow: token.boxShadow, |
| 26 | borderRadius: '8px', |
| 27 | fontSize: '14px', |
| 28 | color: token.colorTextSecondary, |
| 29 | lineHeight: '22px', |
| 30 | padding: '16px 19px', |
| 31 | minWidth: '220px', |
| 32 | flex: 1, |
| 33 | }} |
| 34 | > |
| 35 | <div |
| 36 | style={{ |
| 37 | display: 'flex', |
| 38 | gap: '4px', |
| 39 | alignItems: 'center', |
| 40 | }} |
| 41 | > |
| 42 | <div |
| 43 | style={{ |
| 44 | width: 48, |
| 45 | height: 48, |
| 46 | lineHeight: '22px', |
| 47 | backgroundSize: '100%', |
| 48 | textAlign: 'center', |
| 49 | padding: '8px 16px 16px 12px', |
| 50 | color: '#FFF', |
| 51 | fontWeight: 'bold', |
| 52 | backgroundImage: |
| 53 | "url('https://gw.alipayobjects.com/zos/bmw-prod/daaf8d50-8e6d-4251-905d-676a24ddfa12.svg')", |
| 54 | }} |
| 55 | > |
| 56 | {index} |
| 57 | </div> |
| 58 | <div |
| 59 | style={{ |
| 60 | fontSize: '16px', |
| 61 | color: token.colorText, |
| 62 | paddingBottom: 8, |
| 63 | }} |
| 64 | > |
| 65 | {title} |
| 66 | </div> |
| 67 | </div> |
| 68 | <div |
| 69 | style={{ |
| 70 | fontSize: '14px', |
| 71 | color: token.colorTextSecondary, |
| 72 | textAlign: 'justify', |
| 73 | lineHeight: '22px', |
| 74 | marginBottom: 8, |
| 75 | }} |
| 76 | > |
| 77 | {desc} |
| 78 | </div> |
| 79 | <a href={href} target="_blank" rel="noreferrer"> |
| 80 | 了解更多 {'>'} |
| 81 | </a> |
| 82 | </div> |
| 83 | ); |
| 84 | }; |
| 85 | |
| 86 | const Welcome: React.FC = () => { |
| 87 | const { token } = theme.useToken(); |
| 88 | const { initialState } = useModel('@@initialState'); |
| 89 | return ( |
| 90 | <PageContainer> |
| 91 | <Card |
| 92 | style={{ |
| 93 | borderRadius: 8, |
| 94 | }} |
| 95 | bodyStyle={{ |
| 96 | backgroundImage: |
| 97 | initialState?.settings?.navTheme === 'realDark' |
| 98 | ? 'background-image: linear-gradient(75deg, #1A1B1F 0%, #191C1F 100%)' |
| 99 | : 'background-image: linear-gradient(75deg, #FBFDFF 0%, #F5F7FF 100%)', |
| 100 | }} |
| 101 | > |
| 102 | <div |
| 103 | style={{ |
| 104 | backgroundPosition: '100% -30%', |
| 105 | backgroundRepeat: 'no-repeat', |
| 106 | backgroundSize: '274px auto', |
| 107 | backgroundImage: |
| 108 | "url('https://gw.alipayobjects.com/mdn/rms_a9745b/afts/img/A*BuFmQqsB2iAAAAAAAAAAAAAAARQnAQ')", |
| 109 | }} |
| 110 | > |
| 111 | <div |
| 112 | style={{ |
| 113 | fontSize: '20px', |
| 114 | color: token.colorTextHeading, |
| 115 | }} |
| 116 | > |
| 117 | 欢迎使用 Ant Design Pro |
| 118 | </div> |
| 119 | <p |
| 120 | style={{ |
| 121 | fontSize: '14px', |
| 122 | color: token.colorTextSecondary, |
| 123 | lineHeight: '22px', |
| 124 | marginTop: 16, |
| 125 | marginBottom: 32, |
| 126 | width: '65%', |
| 127 | }} |
| 128 | > |
| 129 | Ant Design Pro 是一个整合了 umi,Ant Design 和 ProComponents |
| 130 | 的脚手架方案。致力于在设计规范和基础组件的基础上,继续向上构建,提炼出典型模板/业务组件/配套设计资源,进一步提升企业级中后台产品设计研发过程中的『用户』和『设计者』的体验。 |
| 131 | </p> |
| 132 | <div |
| 133 | style={{ |
| 134 | display: 'flex', |
| 135 | flexWrap: 'wrap', |
| 136 | gap: 16, |
| 137 | }} |
| 138 | > |
| 139 | <InfoCard |
| 140 | index={1} |
| 141 | href="https://umijs.org/docs/introduce/introduce" |
| 142 | title="了解 umi" |
| 143 | desc="umi 是一个可扩展的企业级前端应用框架,umi 以路由为基础的,同时支持配置式路由和约定式路由,保证路由的功能完备,并以此进行功能扩展。" |
| 144 | /> |
| 145 | <InfoCard |
| 146 | index={2} |
| 147 | title="了解 ant design" |
| 148 | href="https://ant.design" |
| 149 | desc="antd 是基于 Ant Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。" |
| 150 | /> |
| 151 | <InfoCard |
| 152 | index={3} |
| 153 | title="了解 Pro Components" |
| 154 | href="https://procomponents.ant.design" |
| 155 | desc="ProComponents 是一个基于 Ant Design 做了更高抽象的模板组件,以 一个组件就是一个页面为开发理念,为中后台开发带来更好的体验。" |
| 156 | /> |
| 157 | </div> |
| 158 | </div> |
| 159 | </Card> |
| 160 | </PageContainer> |
| 161 | ); |
| 162 | }; |
| 163 | |
| 164 | export default Welcome; |