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('登录失败'); } }; +