From a587ebafec5404d6a3696f145d943cc8feabd964 Mon Sep 17 00:00:00 2001 From: wulibaibao <13366578180@163.com> Date: Thu, 22 Sep 2022 19:57:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E7=A9=BA=E5=88=97=E8=A1=A8=E6=83=85=E5=86=B5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/proxy.ts | 2 +- src/pages/Plan/components/LeftList/index.tsx | 4 ++-- src/pages/Plan/index.tsx | 15 +++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config/proxy.ts b/config/proxy.ts index 22c8fd4..7a14647 100644 --- a/config/proxy.ts +++ b/config/proxy.ts @@ -12,7 +12,7 @@ export default { dev: { '/api/': { - target: "https://testlib.aliyun.test", + target: "http://121.196.236.71:8083/", changeOrigin: true, https: true, secure: false, diff --git a/src/pages/Plan/components/LeftList/index.tsx b/src/pages/Plan/components/LeftList/index.tsx index 823cbc0..b40c509 100644 --- a/src/pages/Plan/components/LeftList/index.tsx +++ b/src/pages/Plan/components/LeftList/index.tsx @@ -48,7 +48,7 @@ const PlanLeftContent: React.FC = () => { align="middle" style={{ padding: "0 12px", height: 48 }} > - {`测试方案 (${planList.length})`} + {`测试方案 (${planList?.length || 0})`} = () => {
{ - planList.length === 0 ? + !planList || planList?.length === 0 ? : { diff --git a/src/pages/Plan/index.tsx b/src/pages/Plan/index.tsx index 096e797..204b43d 100644 --- a/src/pages/Plan/index.tsx +++ b/src/pages/Plan/index.tsx @@ -30,14 +30,17 @@ const TestPlan: React.FC = (props) => { { initialData: [], onSuccess(data) { - const firstId = data[0].id - if (!plan_id) - history.replace(`/plan/${firstId}`) - else { - const idx = data.findIndex((p: any) => p.id === + plan_id) - if (idx === -1) + if (data && data.legnth > 0) { + const firstId = data[0]?.id + if (!plan_id) history.replace(`/plan/${firstId}`) + else { + const idx = data.findIndex((p: any) => p.id === + plan_id) + if (idx === -1) + history.replace(`/plan/${firstId}`) + } } + setTimeout(() => setLoading(false), 300) }, onError() { -- Gitee