Browse Source

fix: resolve lint errors for antd v6 compatibility

- Use node: protocol for fs and path imports in scripts/simple.js
- Replace deprecated hideRequiredMark with requiredMark={false}
- Replace Steps.Step with Steps items prop for antd v6
- Add missing data.d.ts for table-list service
- Fix formRef type in step-form using Form.useForm()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pull/11631/head
afc163 3 weeks ago
parent
commit
38febe063e
  1. 8
      scripts/simple.js
  2. 2
      src/pages/account/settings/components/base.tsx
  3. 2
      src/pages/form/advanced-form/index.tsx
  4. 2
      src/pages/form/basic-form/index.tsx
  5. 12
      src/pages/form/step-form/index.tsx
  6. 14
      src/pages/list/table-list/data.d.ts
  7. 15
      src/pages/profile/advanced/index.tsx
  8. 102
      src/pages/result/success/index.tsx

8
scripts/simple.js

@ -8,8 +8,8 @@
* - 替换路由配置为简单版
*/
const fs = require('fs');
const path = require('path');
const fs = require('node:fs');
const path = require('node:path');
// 需要删除的页面目录
const pageDirsToDelete = [
@ -108,14 +108,14 @@ function updatePackageJson() {
}
// 移除 simple 脚本
if (pkg.scripts && pkg.scripts.simple) {
if (pkg.scripts?.simple) {
delete pkg.scripts.simple;
console.log('✓ 已移除 simple 脚本');
modified = true;
}
if (modified) {
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
console.log('✓ 已更新 package.json');
} else {
console.log('- package.json 无需更新');

2
src/pages/account/settings/components/base.tsx

@ -65,7 +65,7 @@ const BaseView: React.FC = () => {
...currentUser,
phone: currentUser?.phone.split('-'),
}}
hideRequiredMark
requiredMark={false}
>
<ProFormText
width="md"

2
src/pages/form/advanced-form/index.tsx

@ -172,7 +172,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
return (
<ProForm
layout="vertical"
hideRequiredMark
requiredMark={false}
submitter={{
render: (_props, dom) => {
return (

2
src/pages/form/basic-form/index.tsx

@ -30,7 +30,7 @@ const BasicForm: FC<Record<string, any>> = () => {
<PageContainer content="表单页用于向用户收集或验证信息,基础表单常见于数据项较少的表单场景。">
<Card variant="borderless">
<ProForm
hideRequiredMark
requiredMark={false}
style={{
margin: 'auto',
marginTop: 8,

12
src/pages/form/step-form/index.tsx

@ -6,17 +6,17 @@ import {
ProFormText,
StepsForm,
} from '@ant-design/pro-components';
import type { FormInstance } from 'antd';
import {
Alert,
Button,
Card,
Descriptions,
Divider,
Form,
Result,
Statistic,
} from 'antd';
import React, { useRef, useState } from 'react';
import React, { useState } from 'react';
import type { StepDataType } from './data.d';
import useStyles from './style.style';
@ -82,7 +82,7 @@ const StepForm: React.FC<Record<string, any>> = () => {
receiverMode: 'alipay',
});
const [current, setCurrent] = useState(0);
const formRef = useRef<FormInstance>(null);
const [form] = Form.useForm<StepDataType>();
return (
<PageContainer content="将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。">
<Card variant="borderless">
@ -99,7 +99,9 @@ const StepForm: React.FC<Record<string, any>> = () => {
}}
>
<StepsForm.StepForm<StepDataType>
formRef={formRef}
formRef={{
current: form,
}}
title="填写转账信息"
initialValues={stepData}
onFinish={async (values) => {
@ -218,7 +220,7 @@ const StepForm: React.FC<Record<string, any>> = () => {
<StepResult
onFinish={async () => {
setCurrent(0);
formRef.current?.resetFields();
form.resetFields();
}}
>
<StepDescriptions stepData={stepData} />

14
src/pages/list/table-list/data.d.ts

@ -0,0 +1,14 @@
export type TableListItem = {
key: number;
disabled?: boolean;
href: string;
avatar: string;
name: string;
owner: string;
desc: string;
callNo: number;
status: 0 | 1 | 2 | 3;
updatedAt: string;
createdAt: string;
progress: number;
};

15
src/pages/profile/advanced/index.tsx

@ -32,8 +32,6 @@ import type { AdvancedProfileData } from './data.d';
import { queryAdvancedProfile } from './service';
import useStyles from './style.style';
const { Step } = Steps;
const action = (
<RouteContext.Consumer>
{({ isMobile }) => {
@ -349,12 +347,13 @@ const Advanced: FC = () => {
direction={isMobile ? 'vertical' : 'horizontal'}
progressDot={customDot}
current={1}
>
<Step title="创建项目" description={desc1} />
<Step title="部门初审" description={desc2} />
<Step title="财务复核" />
<Step title="完成" />
</Steps>
items={[
{ title: '创建项目', description: desc1 },
{ title: '部门初审', description: desc2 },
{ title: '财务复核' },
{ title: '完成' },
]}
/>
)}
</RouteContext.Consumer>
</Card>

102
src/pages/result/success/index.tsx

@ -3,8 +3,6 @@ import { GridContent } from '@ant-design/pro-components';
import { Button, Card, Descriptions, Result, Steps } from 'antd';
import useStyles from './index.style';
const { Step } = Steps;
export default () => {
const { styles } = useStyles();
const desc1 = (
@ -60,54 +58,58 @@ export default () => {
</Descriptions.Item>
</Descriptions>
<br />
<Steps progressDot current={1}>
<Step
title={
<span
style={{
fontSize: 14,
}}
>
</span>
}
description={desc1}
/>
<Step
title={
<span
style={{
fontSize: 14,
}}
>
</span>
}
description={desc2}
/>
<Step
title={
<span
style={{
fontSize: 14,
}}
>
</span>
}
/>
<Step
title={
<span
style={{
fontSize: 14,
}}
>
</span>
}
/>
</Steps>
<Steps
progressDot
current={1}
items={[
{
title: (
<span
style={{
fontSize: 14,
}}
>
</span>
),
description: desc1,
},
{
title: (
<span
style={{
fontSize: 14,
}}
>
</span>
),
description: desc2,
},
{
title: (
<span
style={{
fontSize: 14,
}}
>
</span>
),
},
{
title: (
<span
style={{
fontSize: 14,
}}
>
</span>
),
},
]}
/>
</>
);
const extra = (

Loading…
Cancel
Save