From 4ccd97254a662dad858e69a9dabddf5fad0db351 Mon Sep 17 00:00:00 2001 From: liyy <18435186204@163.com> Date: Fri, 28 Aug 2026 09:42:26 +0800 Subject: [PATCH] refactor: organize frontend application structure --- client/src/App.vue | 14 ++++++-------- client/src/api/client.ts | 7 +++++++ client/src/api/index.ts | 1 + client/src/composables/useResponsive.ts | 9 +++++++++ client/src/layouts/AppNavigation.vue | 9 +++++++++ client/src/layouts/DesktopLayout.vue | 9 +++++++++ client/src/layouts/MobileLayout.vue | 8 ++++++++ client/src/router/index.ts | 8 ++++++++ client/src/stores/app.ts | 9 +++++++++ client/src/stores/practice.ts | 5 +++++ client/src/stores/profile.ts | 5 +++++ client/src/types/view-models.ts | 1 + client/src/utils/format.ts | 1 + client/src/views/dashboard/DashboardView.vue | 3 +++ 14 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 client/src/api/client.ts create mode 100644 client/src/api/index.ts create mode 100644 client/src/composables/useResponsive.ts create mode 100644 client/src/layouts/AppNavigation.vue create mode 100644 client/src/layouts/DesktopLayout.vue create mode 100644 client/src/layouts/MobileLayout.vue create mode 100644 client/src/router/index.ts create mode 100644 client/src/stores/app.ts create mode 100644 client/src/stores/practice.ts create mode 100644 client/src/stores/profile.ts create mode 100644 client/src/types/view-models.ts create mode 100644 client/src/utils/format.ts create mode 100644 client/src/views/dashboard/DashboardView.vue diff --git a/client/src/App.vue b/client/src/App.vue index 366c106..cf9a543 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,5 +1,8 @@ + + + ✦备考中枢 + {{ item }} + diff --git a/client/src/layouts/DesktopLayout.vue b/client/src/layouts/DesktopLayout.vue new file mode 100644 index 0000000..482383c --- /dev/null +++ b/client/src/layouts/DesktopLayout.vue @@ -0,0 +1,9 @@ + + + + + diff --git a/client/src/layouts/MobileLayout.vue b/client/src/layouts/MobileLayout.vue new file mode 100644 index 0000000..3de89b3 --- /dev/null +++ b/client/src/layouts/MobileLayout.vue @@ -0,0 +1,8 @@ + + + + {{ ['⌂','▣','▥','▤','▤','●'][index] }}{{ item }} + diff --git a/client/src/router/index.ts b/client/src/router/index.ts new file mode 100644 index 0000000..3bd15d8 --- /dev/null +++ b/client/src/router/index.ts @@ -0,0 +1,8 @@ +export const routes = { + dashboard: '/', + practice: '/practice', + analysis: '/analysis', + plan: '/plan', + news: '/news', + profile: '/profile' +} as const diff --git a/client/src/stores/app.ts b/client/src/stores/app.ts new file mode 100644 index 0000000..dbd630b --- /dev/null +++ b/client/src/stores/app.ts @@ -0,0 +1,9 @@ +import { defineStore } from 'pinia' + +export const useAppStore = defineStore('app', { + state: () => ({ busy: false, notice: '' }), + actions: { + setBusy(value: boolean) { this.busy = value }, + notify(message: string) { this.notice = message } + } +}) diff --git a/client/src/stores/practice.ts b/client/src/stores/practice.ts new file mode 100644 index 0000000..0fb16d8 --- /dev/null +++ b/client/src/stores/practice.ts @@ -0,0 +1,5 @@ +import { defineStore } from 'pinia' + +export const usePracticeStore = defineStore('practice', { + state: () => ({ sessionId: null as string | null, currentIndex: 0 }) +}) diff --git a/client/src/stores/profile.ts b/client/src/stores/profile.ts new file mode 100644 index 0000000..ef65d6f --- /dev/null +++ b/client/src/stores/profile.ts @@ -0,0 +1,5 @@ +import { defineStore } from 'pinia' + +export const useProfileStore = defineStore('profile', { + state: () => ({ nickname: '备考人', targetScore: 72, examDate: '' }) +}) diff --git a/client/src/types/view-models.ts b/client/src/types/view-models.ts new file mode 100644 index 0000000..9ab237e --- /dev/null +++ b/client/src/types/view-models.ts @@ -0,0 +1 @@ +export type NavigationItem = { label: string; index: number } diff --git a/client/src/utils/format.ts b/client/src/utils/format.ts new file mode 100644 index 0000000..3eed9a4 --- /dev/null +++ b/client/src/utils/format.ts @@ -0,0 +1 @@ +export const formatPercent = (value: number) => `${Math.round(value)}%` diff --git a/client/src/views/dashboard/DashboardView.vue b/client/src/views/dashboard/DashboardView.vue new file mode 100644 index 0000000..d59c6af --- /dev/null +++ b/client/src/views/dashboard/DashboardView.vue @@ -0,0 +1,3 @@ + + 备考通已就绪前端工程架构已启动,后续任务将逐页还原原型并接入真实数据。 +
前端工程架构已启动,后续任务将逐页还原原型并接入真实数据。