From f76ff1753076c1545a6bd1cc0d1a96005302c2dc Mon Sep 17 00:00:00 2001
From: yuetsh <517252939@qq.com>
Date: Tue, 16 Jun 2026 00:28:06 -0600
Subject: [PATCH] feat: add login gate and admin navigation to App.vue
---
src/App.test.ts | 12 ++++++++++--
src/App.vue | 34 +++++++++++++++++++++++++++++++---
src/components/AdminPage.vue | 4 ++++
3 files changed, 45 insertions(+), 5 deletions(-)
create mode 100644 src/components/AdminPage.vue
diff --git a/src/App.test.ts b/src/App.test.ts
index bebec99..0841ca1 100644
--- a/src/App.test.ts
+++ b/src/App.test.ts
@@ -1,10 +1,18 @@
import { flushPromises, mount } from '@vue/test-utils'
+import { computed, ref } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import App from './App.vue'
import { createEmptyBook } from './domain/teachingDesign'
import * as booksApi from './services/booksApi'
vi.mock('./services/booksApi')
+vi.mock('./composables/useAuth', () => ({
+ useAuth: () => ({
+ isLoggedIn: computed(() => true),
+ fetchMe: vi.fn(),
+ user: ref(null),
+ }),
+}))
describe('App', () => {
beforeEach(() => {
@@ -17,7 +25,7 @@ describe('App', () => {
const wrapper = mount(App)
await flushPromises()
- expect(wrapper.text()).toContain('教学设计整本')
+ expect(wrapper.text()).toContain('教学设计')
expect(wrapper.text()).toContain('新建整本')
})
@@ -61,6 +69,6 @@ describe('App', () => {
await wrapper.get('[data-testid="back"]').trigger('click')
await flushPromises()
- expect(wrapper.text()).toContain('教学设计整本')
+ expect(wrapper.text()).toContain('教学设计')
})
})
diff --git a/src/App.vue b/src/App.vue
index 6ff8242..6b5d7d3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,20 +1,48 @@
-
-
+
+
+
+
+
+
diff --git a/src/components/AdminPage.vue b/src/components/AdminPage.vue
new file mode 100644
index 0000000..9226ef5
--- /dev/null
+++ b/src/components/AdminPage.vue
@@ -0,0 +1,4 @@
+
+Admin placeholder