用户
@@ -68,7 +78,7 @@
diff --git a/web-src/layout/index.vue b/web-src/layout/index.vue
index 05bc89d..9ad6965 100644
--- a/web-src/layout/index.vue
+++ b/web-src/layout/index.vue
@@ -1,15 +1,11 @@
-
-
-
-
-
+
diff --git a/web-src/plugin/i18n/index.ts b/web-src/plugin/i18n/index.ts
new file mode 100644
index 0000000..7fbf85f
--- /dev/null
+++ b/web-src/plugin/i18n/index.ts
@@ -0,0 +1,12 @@
+import { createI18n } from 'vue-i18n';
+
+export type languageType = { [key: string]: string | languageType };
+const messages: languageType | any = {};
+
+const i18n = createI18n({
+ legacy: false, // 使用 Composition API
+ locale: 'zh', // 默认语言
+ messages,
+});
+
+export default i18n;
diff --git a/web-src/plugin/index.ts b/web-src/plugin/index.ts
index 34433bc..1c8cedd 100644
--- a/web-src/plugin/index.ts
+++ b/web-src/plugin/index.ts
@@ -1,11 +1,17 @@
import type { MessageApiInjection } from 'naive-ui/es/message/src/MessageProvider';
+import type { LoadingBarApiInjection } from 'naive-ui/es/loading-bar/src/LoadingBarProvider';
export * from './router';
export * from './stores';
export * from './alova';
export let message: MessageApiInjection;
+export let loadingBar: LoadingBarApiInjection;
export function setMessage(messages: MessageApiInjection) {
message = messages;
}
+
+export function setLoadingBar(loadingBars: LoadingBarApiInjection) {
+ loadingBar = loadingBars;
+}
diff --git a/web-src/plugin/router/index.ts b/web-src/plugin/router/index.ts
index b76a0d5..f408da5 100644
--- a/web-src/plugin/router/index.ts
+++ b/web-src/plugin/router/index.ts
@@ -1,4 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router';
+import { loadingBar } from '@/plugin';
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -12,6 +13,26 @@ const router = createRouter({
name: 'home',
component: () => import('@/views/HomeView.vue'),
},
+ {
+ path: '/file/:pathMatch(.*)*',
+ name: 'file',
+ component: () => import('@/views/FileView.vue'),
+ },
+ {
+ path: '/user',
+ name: 'user',
+ component: () => import('@/views/UserView.vue'),
+ },
+ {
+ path: '/login',
+ name: 'login',
+ component: () => import('@/views/loginView.vue'),
+ },
+ {
+ path: '/register',
+ name: 'register',
+ component: () => import('@/views/RegisterView.vue'),
+ },
{
path: '/swagger',
name: 'api',
@@ -22,4 +43,10 @@ const router = createRouter({
],
});
+router.beforeEach((to, from, next) => {
+ loadingBar.start();
+ next();
+ setTimeout(() => loadingBar.finish(), 100);
+});
+
export { router };
diff --git a/web-src/plugin/stores/auth.ts b/web-src/plugin/stores/auth.ts
index 3001f24..3f0b015 100644
--- a/web-src/plugin/stores/auth.ts
+++ b/web-src/plugin/stores/auth.ts
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
-import { login, woIsMe } from '@/api';
+import { login, logout, woIsMe } from '@/api';
import { LocalStorageApi } from '@/util';
export const UseAuthStore = defineStore('auth', {
@@ -39,6 +39,9 @@ export const UseAuthStore = defineStore('auth', {
})
.catch(() => this.$reset());
},
+ logout() {
+ logout().then(() => this.$reset());
+ },
},
persist: {
storage: LocalStorageApi.StorageApi,
diff --git a/web-src/views/FileView.vue b/web-src/views/FileView.vue
new file mode 100644
index 0000000..e873f66
--- /dev/null
+++ b/web-src/views/FileView.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/web-src/views/HomeView.vue b/web-src/views/HomeView.vue
index 886f3a1..9398b44 100644
--- a/web-src/views/HomeView.vue
+++ b/web-src/views/HomeView.vue
@@ -1,10 +1,11 @@
- 登录
+
+ 登录
+
diff --git a/web-src/views/RegisterView.vue b/web-src/views/RegisterView.vue
new file mode 100644
index 0000000..e6535e3
--- /dev/null
+++ b/web-src/views/RegisterView.vue
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web-src/views/UserView.vue b/web-src/views/UserView.vue
new file mode 100644
index 0000000..67eefb7
--- /dev/null
+++ b/web-src/views/UserView.vue
@@ -0,0 +1,19 @@
+
+
+ 注销
+
+
+
+
diff --git a/web-src/views/loginView.vue b/web-src/views/loginView.vue
new file mode 100644
index 0000000..91d67c6
--- /dev/null
+++ b/web-src/views/loginView.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 登录
+
+
+
+
+
+