Browse Source

fix: resolve multiple UI issues (#11678)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
pull/11684/head
afc163 1 month ago
committed by GitHub
parent
commit
7515b048fc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 30
      cloudflare-worker/src/data/common.ts
  2. 4
      mock/utils.ts
  3. 207
      src/pages/Welcome.tsx
  4. 4
      src/pages/account/center/Center.style.ts
  5. 8
      src/pages/account/center/components/Articles/index.tsx
  6. 55
      src/pages/account/center/index.tsx
  7. 4
      src/pages/dashboard/workplace/index.tsx
  8. 4
      src/pages/list/card-list/index.tsx
  9. 9
      src/pages/list/card-list/style.style.ts
  10. 8
      src/pages/list/search/articles/index.tsx
  11. 2
      types/cache/mock/login.mock.cache.js
  12. 2
      types/index.d.ts

30
cloudflare-worker/src/data/common.ts

@ -50,17 +50,20 @@ export const user = [
export const members = [
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
name: '曲丽丽',
id: 'member1',
},
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
name: '王昭君',
id: 'member2',
},
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
name: '董娜娜',
id: 'member3',
},
@ -68,12 +71,13 @@ export const members = [
export const defaultUser = {
name: 'Serati Ma',
avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
avatar:
'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
userid: '00000001',
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
group: '蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },
@ -96,7 +100,8 @@ export const defaultUser = {
const statuses = ['active', 'exception', 'normal'];
export function fakeList(count: number) {
const safeCount = Number.isFinite(count) && count >= 0 ? Math.floor(count) : 0;
const safeCount =
Number.isFinite(count) && count >= 0 ? Math.floor(count) : 0;
const list = [];
for (let i = 0; i < safeCount; i += 1) {
list.push({
@ -104,7 +109,10 @@ export function fakeList(count: number) {
owner: user[i % user.length],
title: titles[i % titles.length],
avatar: avatars[i % avatars.length],
cover: Math.floor(i / covers.length) % 2 === 0 ? covers[i % covers.length] : covers[covers.length - 1 - (i % covers.length)],
cover:
Math.floor(i / covers.length) % 2 === 0
? covers[i % covers.length]
: covers[covers.length - 1 - (i % covers.length)],
status: statuses[i % statuses.length],
percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % avatars.length],
@ -112,15 +120,17 @@ export function fakeList(count: number) {
updatedAt: Date.now() - Math.floor(Math.random() * 1000000000),
createdAt: Date.now() - Math.floor(Math.random() * 1000000000),
subDescription: desc[i % desc.length],
description: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的共通点和组成部分,该专案即是致力于归纳和吸收各种产品的各自优势,致力于打造成中后台产品的根底',
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的共通点和组成部分,该专案即是致力于归纳和吸收各种产品的各自优势,致力于打造成中后台产品的根底',
activeUser: Math.floor(Math.random() * 10000) + 1000,
newUser: Math.floor(Math.random() * 1000) + 100,
star: Math.floor(Math.random() * 100) + 10,
like: Math.floor(Math.random() * 100) + 10,
message: Math.floor(Math.random() * 100) + 10,
content: '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
content:
'段落示意:蚂蚁集团设计平台 ant.design,用最小的工作量,无缝接入蚂蚁集团生态,提供跨越设计与开发的体验解决方案。蚂蚁集团设计平台 ant.design,用最小的工作量,无缝接入蚂蚁集团生态,提供跨越设计与开发的体验解决方案。',
members,
});
}
return list;
}
}

4
mock/utils.ts

@ -62,7 +62,7 @@ export const defaultUser = {
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
group: '蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },
@ -133,7 +133,7 @@ export function fakeList(count: number) {
star: Math.ceil(Math.random() * 100) + 100,
like: Math.ceil(Math.random() * 100) + 100,
message: Math.ceil(Math.random() * 10) + 10,
content: '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
content: '段落示意:蚂蚁集团设计平台 ant.design,用最小的工作量,无缝接入蚂蚁集团生态,提供跨越设计与开发的体验解决方案。蚂蚁集团设计平台 ant.design,用最小的工作量,无缝接入蚂蚁集团生态,提供跨越设计与开发的体验解决方案。',
members,
});
}

207
src/pages/Welcome.tsx

@ -1,144 +1,129 @@
import { PageContainer } from '@ant-design/pro-components';
import { useModel } from '@umijs/max';
import { Card, theme } from 'antd';
import { Card, Col, Row, Typography } from 'antd';
import React from 'react';
const InfoCard: React.FC<{
const { Title, Paragraph, Text } = Typography;
interface InfoCardProps {
title: string;
index: number;
desc: string;
href: string;
isDark?: boolean;
}> = ({ title, href, index, desc, isDark }) => {
const { token } = theme.useToken();
return (
<a
href={href}
target="_blank"
rel="noreferrer"
className="group relative overflow-hidden rounded-2xl p-6 transition-all duration-300 hover:scale-[1.02]"
style={{
background: isDark
? 'rgba(255, 255, 255, 0.05)'
: 'rgba(255, 255, 255, 0.7)',
backdropFilter: 'blur(20px)',
border: `1px solid ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(255,255,255,0.5)'}`,
boxShadow: isDark
? '0 4px 24px rgba(0,0,0,0.3)'
: '0 4px 24px rgba(0,0,0,0.06)',
}}
>
{/* 悬停时的光效 */}
<div
className="absolute -inset-full top-0 block h-full w-1/2 -skew-x-12 bg-gradient-to-r from-transparent to-white opacity-0 transition-all duration-500 group-hover:animate-shine group-hover:opacity-10"
style={{ display: isDark ? 'none' : 'block' }}
/>
}
<div className="relative flex items-start gap-4">
const InfoCard: React.FC<InfoCardProps> = ({ title, index, desc, href }) => (
<a href={href} target="_blank" rel="noreferrer">
<Card hoverable style={{ height: '100%' }}>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 16 }}>
<div
className="shrink-0 w-14 h-14 rounded-2xl flex items-center justify-center text-white text-xl font-bold"
style={{
background: `linear-gradient(135deg, ${token.colorPrimary} 0%, ${token.colorPrimaryHover} 100%)`,
boxShadow: `0 8px 20px ${token.colorPrimary}40`,
width: 56,
height: 56,
borderRadius: 8,
background: '#1677ff',
color: '#fff',
fontSize: 24,
fontWeight: 'bold',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
}}
>
{index}
</div>
<div className="flex-1 min-w-0">
<h3
className="text-lg font-semibold mb-2 group-hover:text-primary transition-colors"
style={{ color: token.colorText }}
>
<div style={{ flex: 1, minWidth: 0 }}>
<Title level={4} style={{ marginBottom: 8, marginTop: 0 }}>
{title}
</h3>
<p
className="text-sm leading-relaxed line-clamp-2"
style={{ color: token.colorTextSecondary }}
</Title>
<Paragraph
type="secondary"
ellipsis={{ rows: 2 }}
style={{ marginBottom: 0 }}
>
{desc}
</p>
</Paragraph>
</div>
</div>
<div
className="mt-4 text-sm font-medium flex items-center gap-1 transition-colors group-hover:gap-2"
style={{ color: token.colorPrimary }}
>
<span className="transition-transform"></span>
</div>
</a>
);
};
</Card>
</a>
);
const Welcome: React.FC = () => {
const { token } = theme.useToken();
const { initialState } = useModel('@@initialState');
const isDark = initialState?.settings?.navTheme === 'realDark';
return (
<PageContainer>
<Card
className="rounded-2xl overflow-hidden"
styles={{
body: {
background: isDark
? 'linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%)'
: 'linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%)',
padding: '48px 0',
},
}}
>
<div className="max-w-6xl mx-auto px-6">
{/* 标题区域 */}
<div className="text-center mb-16">
<h1
className="text-5xl font-bold mb-6"
<Row justify="center">
<Col xs={24} lg={20}>
<Card>
{/* 标题区域 */}
<div style={{ textAlign: 'center', marginBottom: 40 }}>
<Title level={2} style={{ marginBottom: 16 }}>
使 Ant Design Pro
</Title>
<Paragraph
type="secondary"
style={{ fontSize: 16, maxWidth: 600, margin: '0 auto' }}
>
Ant Design Pro umiAnt Design ProComponents
//
</Paragraph>
</div>
{/* 卡片区域 */}
<Row gutter={[24, 24]}>
<Col xs={24} md={8}>
<InfoCard
index={1}
href="https://umijs.org/docs/introduce/introduce"
title="了解 umi"
desc="umi 是一个可扩展的企业级前端应用框架,umi 以路由为基础的,同时支持配置式路由和约定式路由,保证路由的功能完备,并以此进行功能扩展。"
/>
</Col>
<Col xs={24} md={8}>
<InfoCard
index={2}
title="了解 ant design"
href="https://ant.design"
desc="antd 是基于 Ant Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。"
/>
</Col>
<Col xs={24} md={8}>
<InfoCard
index={3}
title="了解 Pro Components"
href="https://procomponents.ant.design"
desc="ProComponents 是一个基于 Ant Design 做了更高抽象的模板组件,以 一个组件就是一个页面为开发理念,为中后台开发带来更好的体验。"
/>
</Col>
</Row>
{/* 底部链接 */}
<div
style={{
background: `linear-gradient(135deg, ${token.colorPrimary} 0%, ${token.colorPrimaryHover} 100%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
marginTop: 40,
paddingTop: 24,
borderTop: `1px solid ${isDark ? '#303030' : '#f0f0f0'}`,
textAlign: 'center',
}}
>
使 Ant Design Pro
</h1>
<p
className="text-lg max-w-2xl mx-auto leading-relaxed"
style={{ color: token.colorTextSecondary }}
>
Ant Design Pro umiAnt Design ProComponents
//
</p>
</div>
{/* 卡片区域 */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
<InfoCard
index={1}
href="https://umijs.org/docs/introduce/introduce"
title="了解 umi"
desc="umi 是一个可扩展的企业级前端应用框架,umi 以路由为基础的,同时支持配置式路由和约定式路由,保证路由的功能完备,并以此进行功能扩展。"
isDark={isDark}
/>
<InfoCard
index={2}
title="了解 ant design"
href="https://ant.design"
desc="antd 是基于 Ant Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。"
isDark={isDark}
/>
<InfoCard
index={3}
title="了解 Pro Components"
href="https://procomponents.ant.design"
desc="ProComponents 是一个基于 Ant Design 做了更高抽象的模板组件,以 一个组件就是一个页面为开发理念,为中后台开发带来更好的体验。"
isDark={isDark}
/>
</div>
</div>
</Card>
<Text type="secondary">
访{' '}
<a
href="https://pro.ant.design"
target="_blank"
rel="noreferrer"
>
Pro
</a>
</Text>
</div>
</Card>
</Col>
</Row>
</PageContainer>
);
};

4
src/pages/account/center/Center.style.ts

@ -41,9 +41,7 @@ const useStyles = createStyles(({ token }) => {
color: token.colorTextHeading,
fontWeight: '500',
},
tags: {
'.ant-tag': { marginBottom: '8px' },
},
tags: {},
team: {
'.ant-avatar': { marginRight: '12px' },
a: {

8
src/pages/account/center/components/Articles/index.tsx

@ -1,6 +1,6 @@
import { LikeOutlined, MessageFilled, StarTwoTone } from '@ant-design/icons';
import { useQuery } from '@tanstack/react-query';
import { List, Tag } from 'antd';
import { Flex, List, Tag } from 'antd';
import React from 'react';
import type { ListItemDataType } from '../../data.d';
import { queryFakeList } from '../../service';
@ -54,11 +54,11 @@ const Articles: React.FC = () => {
</a>
}
description={
<span>
<Flex wrap gap="small">
<Tag>Ant Design</Tag>
<Tag></Tag>
<Tag></Tag>
</span>
<Tag></Tag>
</Flex>
}
/>
<ArticleListContent data={item} />

55
src/pages/account/center/index.tsx

@ -11,6 +11,7 @@ import {
Card,
Col,
Divider,
Flex,
Input,
type InputRef,
Row,
@ -110,32 +111,34 @@ const TagList: React.FC<{
return (
<div className={styles.tags}>
<div className={styles.tagsTitle}></div>
{(tags || []).concat(newTags).map((item) => (
<Tag key={item.key}>{item.label}</Tag>
))}
{inputVisible && (
<Input
ref={ref}
size="small"
style={{
width: 78,
}}
value={inputValue}
onChange={handleInputChange}
onBlur={handleInputConfirm}
onPressEnter={handleInputConfirm}
/>
)}
{!inputVisible && (
<Tag
onClick={showInput}
style={{
borderStyle: 'dashed',
}}
>
<PlusOutlined />
</Tag>
)}
<Flex wrap gap="small">
{(tags || []).concat(newTags).map((item) => (
<Tag key={item.key}>{item.label}</Tag>
))}
{inputVisible && (
<Input
ref={ref}
size="small"
style={{
width: 78,
}}
value={inputValue}
onChange={handleInputChange}
onBlur={handleInputConfirm}
onPressEnter={handleInputConfirm}
/>
)}
{!inputVisible && (
<Tag
onClick={showInput}
style={{
borderStyle: 'dashed',
}}
>
<PlusOutlined />
</Tag>
)}
</Flex>
</div>
);
};

4
src/pages/dashboard/workplace/index.tsx

@ -67,7 +67,7 @@ const PageHeaderContent: FC<{
</div>
<div>
{currentUser.title} |{currentUser.group}
{currentUser.title} | {currentUser.group}
</div>
</div>
</div>
@ -148,7 +148,7 @@ const Workplace: FC = () => {
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
group: '蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED',
}}
/>
}

4
src/pages/list/card-list/index.tsx

@ -17,8 +17,8 @@ const CardList = () => {
const content = (
<div className={styles.pageHeaderContent}>
<p>
ant.design
ant.design
</p>
<div className={styles.contentLink}>

9
src/pages/list/card-list/style.style.ts

@ -52,19 +52,26 @@ const useStyles = createStyles(({ token }) => {
},
pageHeaderContent: {
position: 'relative',
overflow: 'visible',
[`@media screen and (max-width: ${token.screenSM}px)`]: {
paddingBottom: '30px',
},
},
contentLink: {
display: 'flex',
flexWrap: 'nowrap',
marginTop: '16px',
a: {
display: 'inline-flex',
alignItems: 'center',
marginRight: '32px',
whiteSpace: 'nowrap',
img: {
width: '24px',
flexShrink: 0,
},
},
img: { marginRight: '8px', verticalAlign: 'middle' },
img: { marginRight: '8px' },
[`@media screen and (max-width: ${token.screenLG}px)`]: {
a: {
marginRight: '16px',

8
src/pages/list/search/articles/index.tsx

@ -5,7 +5,7 @@ import {
StarOutlined,
} from '@ant-design/icons';
import { useQuery } from '@tanstack/react-query';
import { Button, Card, Col, Form, List, Row, Select, Tag } from 'antd';
import { Button, Card, Col, Flex, Form, List, Row, Select, Tag } from 'antd';
import type { DefaultOptionType } from 'antd/es/select';
import type { FC } from 'react';
import React, { useMemo, useRef } from 'react';
@ -256,11 +256,11 @@ const Articles: FC = () => {
</a>
}
description={
<span>
<Flex wrap gap="small">
<Tag>Ant Design</Tag>
<Tag></Tag>
<Tag></Tag>
</span>
<Tag></Tag>
</Flex>
}
/>
<ArticleListContent data={item} />

2
types/cache/mock/login.mock.cache.js

@ -7,7 +7,7 @@ module.exports = {
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
group: '蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },

2
types/index.d.ts

@ -8,7 +8,7 @@ export namespace API {
export type GET_API_CURRENT_USER_PAYLOAD = Record<string, any>;
export type GET_API_CURRENT_USER_RES = {
/** example: {"name": "Serati Ma", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", "userid": "00000001", "email": "antdesign@alipay.com", "signature": "海纳百川,有容乃大", "title": "交互专家", "group": "蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED", "tags": [{"key": "0", "label": "很有想法的"}, {"key": "1", "label": "专注设计"}, {"key": "2", "label": "辣~"}, {"key": "3", "label": "大长腿"}, {"key": "4", "label": "川妹子"}, {"key": "5", "label": "海纳百川"}], "notifyCount": 12, "unreadCount": 11, "country": "China", "geographic": {"province": {"label": "浙江省", "key": "330000"}, "city": {"label": "杭州市", "key": "330100"}}, "address": "西湖区工专路 77 号", "phone": "0752-268888888"} */
/** example: {"name": "Serati Ma", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", "userid": "00000001", "email": "antdesign@alipay.com", "signature": "海纳百川,有容乃大", "title": "交互专家", "group": "蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED", "tags": [{"key": "0", "label": "很有想法的"}, {"key": "1", "label": "专注设计"}, {"key": "2", "label": "辣~"}, {"key": "3", "label": "大长腿"}, {"key": "4", "label": "川妹子"}, {"key": "5", "label": "海纳百川"}], "notifyCount": 12, "unreadCount": 11, "country": "China", "geographic": {"province": {"label": "浙江省", "key": "330000"}, "city": {"label": "杭州市", "key": "330100"}}, "address": "西湖区工专路 77 号", "phone": "0752-268888888"} */
data: {
name: string;
avatar: string;

Loading…
Cancel
Save