diff --git a/config/proxy.ts b/config/proxy.ts index 22c8fd4a989f25310135348a44f86cf1a0ecdd8a..7a14647ab6cde14c622de3f960e5532df52368aa 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 823cbc02f3462df0c9733bf7b64538c20654fdf8..b40c5092db93f8b71b862da000efee82a0bebe93 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 096e79751844de213482a1142322a901178786da..204b43d0d6581cbeae5507f19c38a789e4040eb4 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() {