From a3312331d20b90fd5ae027a9485d2260a3c24025 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:10:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E6=8E=88=E6=9D=83=20IP=20=E8=B7=B3=E8=BD=AC=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20(#4517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/layout/index.vue | 4 ++++ frontend/src/routers/index.ts | 2 +- frontend/src/views/login/entrance/index.vue | 15 +++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/layout/index.vue b/frontend/src/layout/index.vue index c54130bda..7da0b7c79 100644 --- a/frontend/src/layout/index.vue +++ b/frontend/src/layout/index.vue @@ -100,6 +100,10 @@ const resetSetting = () => { const loadProductProFromDB = async () => { const res = await getLicense(); + if (!res.data) { + globalStore.isProductPro = false; + return; + } globalStore.isProductPro = res.data.status === 'Enable' || res.data.status === 'Lost01' || res.data.status === 'Lost02'; diff --git a/frontend/src/routers/index.ts b/frontend/src/routers/index.ts index 6959fec84..aa6683783 100644 --- a/frontend/src/routers/index.ts +++ b/frontend/src/routers/index.ts @@ -13,7 +13,7 @@ router.beforeEach((to, from, next) => { if (to.name !== 'entrance' && !globalStore.isLogin) { next({ name: 'entrance', - params: to.params, + params: { code: to.params?.code || globalStore.entrance }, }); NProgress.done(); return; diff --git a/frontend/src/views/login/entrance/index.vue b/frontend/src/views/login/entrance/index.vue index 4e3da172e..9a8350f96 100644 --- a/frontend/src/views/login/entrance/index.vue +++ b/frontend/src/views/login/entrance/index.vue @@ -60,7 +60,6 @@ const loading = ref(); const mySafetyCode = defineProps({ code: { type: String, - required: true, default: '', }, }); @@ -94,10 +93,18 @@ const getStatus = async () => { errStatus.value = ''; loading.value = false; }) - .catch(() => { - pageCode.value = '200'; - errStatus.value = 'err-unsafe'; + .catch((errRes) => { + pageCode.value = pageCode.value || '200'; loading.value = false; + if (errRes?.code === 408) { + errStatus.value = 'err-ip'; + return; + } + if (errRes?.code === 409) { + errStatus.value = 'err-domain'; + return; + } + errStatus.value = 'err-unsafe'; }); }) .catch(() => {