Browse Source

refactor: update UI components and styles, adjust configs (#11511)

pull/11512/head
afc163 9 months ago
committed by GitHub
parent
commit
cf2d02a931
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      biome.json
  2. 8
      config/config.ts
  3. 4
      src/loading.tsx
  4. 4
      src/pages/account/center/components/ArticleListContent/index.style.ts
  5. 3
      src/pages/account/center/components/Articles/index.tsx
  6. 7
      src/pages/account/center/index.tsx
  7. 32
      src/pages/dashboard/analysis/components/ProportionSales.tsx
  8. 12
      src/pages/dashboard/analysis/components/SalesCard.tsx
  9. 5
      src/pages/dashboard/analysis/index.tsx
  10. 25
      src/pages/list/basic-list/index.tsx

2
biome.json

@ -14,6 +14,8 @@
"!**/dist/**", "!**/dist/**",
"!**/server/**", "!**/server/**",
"!**/public/**", "!**/public/**",
"!**/coverage/**",
"!**/node_modules/**",
"!biome.json" "!biome.json"
] ]
}, },

8
config/config.ts

@ -45,13 +45,9 @@ export default defineConfig({
* @name * @name
* @description less * @description less
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn * @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
* @doc umi theme https://umijs.org/docs/api/config#theme * @doc umi theme https://umijs.org/docs/api/config#theme
*/ */
theme: { // theme: { '@primary-color': '#1DA57A' }
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
// 只有设置为 variable, 才能使用 configProvide 动态设置主色调
'root-entry-name': 'variable',
},
/** /**
* @name moment * @name moment
* @description js的包大小 * @description js的包大小

4
src/loading.tsx

@ -1,5 +1,7 @@
import { Skeleton } from 'antd'; import { Skeleton } from 'antd';
const Loading: React.FC = () => <Skeleton style={{ margin: '24px 40px' }} active />; const Loading: React.FC = () => (
<Skeleton style={{ margin: '24px 40px' }} active />
);
export default Loading; export default Loading;

4
src/pages/account/center/components/ArticleListContent/index.style.ts

@ -10,8 +10,10 @@ const useStyles = createStyles(({ token }) => {
marginTop: '16px', marginTop: '16px',
color: token.colorTextSecondary, color: token.colorTextSecondary,
lineHeight: '22px', lineHeight: '22px',
display: 'flex',
gap: '8px',
alignItems: 'center',
'& > em': { '& > em': {
marginLeft: '16px',
color: token.colorTextDisabled, color: token.colorTextDisabled,
fontStyle: 'normal', fontStyle: 'normal',
}, },

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

@ -31,6 +31,9 @@ const Articles: React.FC = () => {
rowKey="id" rowKey="id"
itemLayout="vertical" itemLayout="vertical"
dataSource={listData?.list || []} dataSource={listData?.list || []}
style={{
margin: '0 -24px',
}}
renderItem={(item) => ( renderItem={(item) => (
<List.Item <List.Item
key={item.id} key={item.id}

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

@ -116,7 +116,6 @@ const TagList: React.FC<{
{inputVisible && ( {inputVisible && (
<Input <Input
ref={ref} ref={ref}
type="text"
size="small" size="small"
style={{ style={{
width: 78, width: 78,
@ -227,7 +226,7 @@ const Center: React.FC = () => {
loading={loading} loading={loading}
> >
{!loading && currentUser && ( {!loading && currentUser && (
<div> <>
<div className={styles.avatarHolder}> <div className={styles.avatarHolder}>
<img alt="" src={currentUser.avatar} /> <img alt="" src={currentUser.avatar} />
<div className={styles.name}>{currentUser.name}</div> <div className={styles.name}>{currentUser.name}</div>
@ -255,14 +254,14 @@ const Center: React.FC = () => {
))} ))}
</Row> </Row>
</div> </div>
</div> </>
)} )}
</Card> </Card>
</Col> </Col>
<Col lg={17} md={24}> <Col lg={17} md={24}>
<Card <Card
className={styles.tabsCard} className={styles.tabsCard}
bordered={false} variant="borderless"
tabList={operationTabList} tabList={operationTabList}
activeTabKey={tabKey} activeTabKey={tabKey}
onTabChange={(_tabKey: string) => { onTabChange={(_tabKey: string) => {

32
src/pages/dashboard/analysis/components/ProportionSales.tsx

@ -1,6 +1,5 @@
import { Pie } from '@ant-design/plots'; import { Pie } from '@ant-design/plots';
import { Card, Radio, Typography } from 'antd'; import { Card, Segmented, Typography } from 'antd';
import type { RadioChangeEvent } from 'antd/es/radio';
import numeral from 'numeral'; import numeral from 'numeral';
import React from 'react'; import React from 'react';
import type { DataItem } from '../data.d'; import type { DataItem } from '../data.d';
@ -18,14 +17,14 @@ const ProportionSales = ({
dropdownGroup: React.ReactNode; dropdownGroup: React.ReactNode;
salesType: 'all' | 'online' | 'stores'; salesType: 'all' | 'online' | 'stores';
salesPieData: DataItem[]; salesPieData: DataItem[];
handleChangeSalesType?: (e: RadioChangeEvent) => void; handleChangeSalesType?: (value: 'all' | 'online' | 'stores') => void;
}) => { }) => {
const { styles } = useStyles(); const { styles } = useStyles();
return ( return (
<Card <Card
loading={loading} loading={loading}
className={styles.salesCard} className={styles.salesCard}
bordered={false} variant="borderless"
title="销售额类别占比" title="销售额类别占比"
style={{ style={{
height: '100%', height: '100%',
@ -33,17 +32,20 @@ const ProportionSales = ({
extra={ extra={
<div className={styles.salesCardExtra}> <div className={styles.salesCardExtra}>
{dropdownGroup} {dropdownGroup}
<div className={styles.salesTypeRadio}> <Segmented
<Radio.Group value={salesType} onChange={handleChangeSalesType}> className={styles.salesTypeRadio}
<Radio.Button value="all"></Radio.Button> value={salesType}
<Radio.Button value="online">线</Radio.Button> onChange={handleChangeSalesType}
<Radio.Button value="stores"></Radio.Button> options={[
</Radio.Group> { label: '全部渠道', value: 'all' },
</div> { label: '线上', value: 'online' },
{ label: '门店', value: 'stores' },
]}
size="middle"
/>
</div> </div>
} }
> >
<div>
<Text></Text> <Text></Text>
<Pie <Pie
height={340} height={340}
@ -55,12 +57,10 @@ const ProportionSales = ({
legend={false} legend={false}
label={{ label={{
position: 'spider', position: 'spider',
text: (item: { x: number; y: number }) => { text: (item: { x: number; y: number }) =>
return `${item.x}: ${numeral(item.y).format('0,0')}`; `${item.x}: ${numeral(item.y).format('0,0')}`,
},
}} }}
/> />
</div>
</Card> </Card>
); );
}; };

12
src/pages/dashboard/analysis/components/SalesCard.tsx

@ -39,13 +39,15 @@ const SalesCard = ({
return ( return (
<Card <Card
loading={loading} loading={loading}
bordered={false} variant="borderless"
bodyStyle={{ styles={{
padding: 0, body: {
padding: loading ? 24 : 0,
},
}} }}
> >
<div className={styles.salesCard}>
<Tabs <Tabs
className={styles.salesCard}
tabBarExtraContent={ tabBarExtraContent={
<div className={styles.salesExtraWrap}> <div className={styles.salesExtraWrap}>
<div className={styles.salesExtra}> <div className={styles.salesExtra}>
@ -77,6 +79,7 @@ const SalesCard = ({
<RangePicker <RangePicker
value={rangePickerValue} value={rangePickerValue}
onChange={handleRangePickerChange} onChange={handleRangePickerChange}
variant="filled"
style={{ style={{
width: 256, width: 256,
}} }}
@ -212,7 +215,6 @@ const SalesCard = ({
}, },
]} ]}
/> />
</div>
</Card> </Card>
); );
}; };

5
src/pages/dashboard/analysis/index.tsx

@ -3,7 +3,6 @@ import { GridContent } from '@ant-design/pro-components';
import { useRequest } from '@umijs/max'; import { useRequest } from '@umijs/max';
import { Col, Dropdown, Row } from 'antd'; import { Col, Dropdown, Row } from 'antd';
import type { RangePickerProps } from 'antd/es/date-picker'; import type { RangePickerProps } from 'antd/es/date-picker';
import type { RadioChangeEvent } from 'antd/es/radio';
import type { Dayjs } from 'dayjs'; import type { Dayjs } from 'dayjs';
import type { FC } from 'react'; import type { FC } from 'react';
import { Suspense, useState } from 'react'; import { Suspense, useState } from 'react';
@ -90,8 +89,8 @@ const Analysis: FC<AnalysisProps> = () => {
</Dropdown> </Dropdown>
</span> </span>
); );
const handleChangeSalesType = (e: RadioChangeEvent) => { const handleChangeSalesType = (value: SalesType) => {
setSalesType(e.target.value); setSalesType(value);
}; };
const handleTabChange = (key: string) => { const handleTabChange = (key: string) => {
setCurrentTabKey(key); setCurrentTabKey(key);

25
src/pages/list/basic-list/index.tsx

@ -11,8 +11,8 @@ import {
List, List,
Modal, Modal,
Progress, Progress,
Radio,
Row, Row,
Segmented,
} from 'antd'; } from 'antd';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { FC } from 'react'; import type { FC } from 'react';
@ -27,8 +27,6 @@ import {
} from './service'; } from './service';
import useStyles from './style.style'; import useStyles from './style.style';
const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
const { Search } = Input; const { Search } = Input;
const Info: FC<{ const Info: FC<{
title: React.ReactNode; title: React.ReactNode;
@ -139,15 +137,20 @@ export const BasicList: FC = () => {
}; };
const extraContent = ( const extraContent = (
<div> <div>
<RadioGroup defaultValue="all"> <Segmented
<RadioButton value="all"></RadioButton> defaultValue="all"
<RadioButton value="progress"></RadioButton> options={[
<RadioButton value="waiting"></RadioButton> { label: '全部', value: 'all' },
</RadioGroup> { label: '进行中', value: 'progress' },
{ label: '等待中', value: 'waiting' },
]}
// 如有需要可添加 onChange 事件
/>
<Search <Search
className={styles.extraContentSearch} className={styles.extraContentSearch}
placeholder="请输入" placeholder="请输入"
onSearch={() => ({})} onSearch={() => ({})}
variant="filled"
/> />
</div> </div>
); );
@ -204,13 +207,15 @@ export const BasicList: FC = () => {
<Card <Card
className={styles.listCard} className={styles.listCard}
bordered={false} variant="borderless"
title="基本列表" title="基本列表"
style={{ style={{
marginTop: 24, marginTop: 24,
}} }}
bodyStyle={{ styles={{
body: {
padding: '0 32px 40px 32px', padding: '0 32px 40px 32px',
},
}} }}
extra={extraContent} extra={extraContent}
> >

Loading…
Cancel
Save