From 9b20e9db29d79f5c9111be044c872a59f6944efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Fri, 15 Nov 2024 10:41:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- napcat.webui/package.json | 3 ++- napcat.webui/src/App.vue | 18 ++---------------- napcat.webui/src/components/Dashboard.vue | 12 ++++++++++++ napcat.webui/src/components/WebUiLogin.vue | 5 +++++ napcat.webui/src/main.ts | 3 ++- napcat.webui/src/router/index.ts | 16 ++++++++++++++++ napcat.webui/src/shims-vue.d.ts | 5 +++++ 7 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 napcat.webui/src/components/Dashboard.vue create mode 100644 napcat.webui/src/router/index.ts create mode 100644 napcat.webui/src/shims-vue.d.ts diff --git a/napcat.webui/package.json b/napcat.webui/package.json index fb89a689..dbb6d91a 100644 --- a/napcat.webui/package.json +++ b/napcat.webui/package.json @@ -11,7 +11,8 @@ "dependencies": { "qrcode": "^1.5.4", "tdesign-vue-next": "^1.10.3", - "vue": "^3.5.12" + "vue": "^3.5.12", + "vue-router": "^4.4.5" }, "devDependencies": { "@vitejs/plugin-vue": "^5.1.4", diff --git a/napcat.webui/src/App.vue b/napcat.webui/src/App.vue index 3c266b8b..17b2da68 100644 --- a/napcat.webui/src/App.vue +++ b/napcat.webui/src/App.vue @@ -1,25 +1,11 @@ - \ No newline at end of file diff --git a/napcat.webui/src/components/Dashboard.vue b/napcat.webui/src/components/Dashboard.vue new file mode 100644 index 00000000..b79c484b --- /dev/null +++ b/napcat.webui/src/components/Dashboard.vue @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/napcat.webui/src/components/WebUiLogin.vue b/napcat.webui/src/components/WebUiLogin.vue index 116ae86b..72771782 100644 --- a/napcat.webui/src/components/WebUiLogin.vue +++ b/napcat.webui/src/components/WebUiLogin.vue @@ -20,7 +20,10 @@ import { reactive, ref } from 'vue'; import { MessagePlugin } from 'tdesign-vue-next'; import { LockOnIcon } from 'tdesign-icons-vue-next'; +import { useRouter, useRoute } from 'vue-router'; +const router = useRouter() +const route = useRoute() const formData = reactive({ token: '', @@ -28,11 +31,13 @@ const formData = reactive({ const onSubmit = async ({ validateResult, firstError }) => { if (validateResult === true) { + await router.push({ path: '/dashboard' }); MessagePlugin.success('登录中...'); } else { MessagePlugin.error('登录失败'); } }; +