From 37c8518289caea10a583321d2f30e0bf7424688e Mon Sep 17 00:00:00 2001 From: tikkhun Date: Tue, 14 Oct 2025 11:08:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?build:=20=E6=B7=BB=E5=8A=A0=20code-inspecto?= =?UTF-8?q?r-plugin=20=E4=BE=9D=E8=B5=96=E5=8F=8A=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 code-inspector-plugin 作为开发依赖,并在 webpack 配置中启用该插件以增强代码检查能力 --- .umirc.ts | 8 ++++++++ package.json | 1 + 2 files changed, 9 insertions(+) diff --git a/.umirc.ts b/.umirc.ts index 8abb35a..723972c 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -4,6 +4,7 @@ const isDev = process.env.NODE_ENV === 'development'; const UMI_APP_API_URL = isDev ? 'http://localhost:7001' : 'https://api.yoone.ca'; + import { codeInspectorPlugin } from 'code-inspector-plugin'; export default defineConfig({ hash: true, @@ -18,6 +19,13 @@ export default defineConfig({ define: { UMI_APP_API_URL, }, + chainWebpack(config) { + config.plugin('code-inspector-plugin').use( + codeInspectorPlugin({ + bundler: 'webpack', + }) + ); + }, routes: [ { path: '/', redirect: '/home' }, { name: '追踪', path: '/track', component: './Track', layout: false }, diff --git a/package.json b/package.json index b09cc56..07c5682 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "devDependencies": { "@types/react": "^18.0.33", "@types/react-dom": "^18.0.11", + "code-inspector-plugin": "^1.2.10", "husky": "^9", "lint-staged": "^13.2.0", "prettier": "^2.8.7", From 87534c4d2261432d34f7c6a8d2c63e016afa25e0 Mon Sep 17 00:00:00 2001 From: tikkhun Date: Tue, 14 Oct 2025 11:13:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(Order/List):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E7=9B=B8=E5=85=B3=E7=8A=B6=E6=80=81=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=B8=BA=E6=9B=B4=E7=AE=80=E6=B4=81=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refund_approved 已退款 refund_cancelled 已完成 --- src/pages/Order/List/index.tsx | 75 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/src/pages/Order/List/index.tsx b/src/pages/Order/List/index.tsx index 4d5e162..2e2aff3 100644 --- a/src/pages/Order/List/index.tsx +++ b/src/pages/Order/List/index.tsx @@ -128,11 +128,13 @@ const ListPage: React.FC = () => { }, { key: 'refund_approved', - label: '退款申请已通过', + label: "已退款", + // label: '退款申请已通过', }, { key: 'refund_cancelled', - label: '已取消退款', + label: "已完成" + // label: '已取消退款', }, // { // key: 'pending_refund', @@ -289,7 +291,7 @@ const ListPage: React.FC = () => { record.orderStatus, ) ? ( <> - + ) : ( @@ -419,7 +421,7 @@ const ListPage: React.FC = () => { actionRef={actionRef} rowKey="id" rowClassName={(record) => { - return record.id === activeLine ? styles['selected-line-order-protable']: ''; + return record.id === activeLine ? styles['selected-line-order-protable'] : ''; }} toolBarRender={() => [ , @@ -763,16 +765,17 @@ const Detail: React.FC<{ valueEnum={ORDER_STATUS_ENUM} /> - - { return ( -
- - {record?.shipping?.phone || record?.billing?.phone || '-'} - -
- ); - }} /> + + { + return ( +
+ + {record?.shipping?.phone || record?.billing?.phone || '-'} + +
+ ); + }} /> @@ -905,7 +908,7 @@ const Detail: React.FC<{ ); }} /> - { @@ -1389,16 +1392,16 @@ const Shipping: React.FC<{ - // value && value.length > 0 - // ? Promise.resolve() - // : Promise.reject('至少需要一个商品'), - // }, - // ]} + // rules={[ + // { + // required: true, + // message: '至少需要一个商品', + // validator: (_, value) => + // value && value.length > 0 + // ? Promise.resolve() + // : Promise.reject('至少需要一个商品'), + // }, + // ]} > { - let idx = acc.findIndex((v: any) => v.productId === cur.productId); - if (idx === -1) { - acc.push(cur); - } else { - acc[idx].quantity += cur.quantity; - } - return acc; - }, + let idx = acc.findIndex((v: any) => v.productId === cur.productId); + if (idx === -1) { + acc.push(cur); + } else { + acc[idx].quantity += cur.quantity; + } + return acc; + }, [], ); // setOptions( @@ -1990,11 +1993,11 @@ const SalesChange: React.FC<{ }} onFinish={async (formData: any) => { const { sales } = formData; - const res = await ordercontrollerUpdateorderitems({orderId:id}, sales); + const res = await ordercontrollerUpdateorderitems({ orderId: id }, sales); if (!res.success) { message.error(`更新货物信息失败: ${res.message}`); return false; - } + } message.success('更新成功') detailRef?.current?.reload(); return true; @@ -2006,7 +2009,7 @@ const SalesChange: React.FC<{ > { try { const { data } = await productcontrollerSearchproducts({