diff --git a/client/src/api/index.ts b/client/src/api/index.ts index 42e21df..3849832 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -32,6 +32,11 @@ export type DashboardTrends = SuccessBody export type DashboardMastery = SuccessBody export type DashboardWeakPoints = SuccessBody export type PracticeModules = SuccessBody +export type PracticeSessionStart = SuccessBody +export type PracticeQuestion = SuccessBody +export type PracticeAnswer = SuccessBody +export type PracticeFinish = SuccessBody +export type PracticeWrongReasons = SuccessBody export type Profile = SuccessBody export type Settings = SuccessBody export type PlansToday = SuccessBody @@ -70,24 +75,33 @@ export const practiceApi = { }) ), finish: (sessionId: string) => - unwrap(apiClient.POST('/api/practice/{sessionId}/finish', { params: { path: { sessionId } } })) + unwrap(apiClient.POST('/api/practice/{sessionId}/finish', { params: { path: { sessionId } } })), + wrongReasons: () => unwrap(apiClient.GET('/api/practice/wrong-reasons')) } // ---- 错题复习 ---- export const reviewApi = { list: (query?: QueryOf<'/api/review/list', 'get'>) => unwrap(apiClient.GET('/api/review/list', { params: { query } })), - submit: (id: string, answer: string) => + detail: (id: string) => + unwrap(apiClient.GET('/api/review/{id}/detail', { params: { path: { id } } })), + submit: (id: string, body: BodyOf<'/api/review/{id}/submit', 'post'>) => + unwrap(apiClient.POST('/api/review/{id}/submit', { params: { path: { id } }, body })), + selfAssess: (id: string, body: BodyOf<'/api/review/{id}/self-assess', 'post'>) => unwrap( - apiClient.POST('/api/review/{id}/submit', { + apiClient.POST('/api/review/{id}/self-assess', { params: { path: { id } }, - body: { answer } as BodyOf<'/api/review/{id}/submit', 'post'> + body }) ), markMastered: (id: string) => unwrap(apiClient.POST('/api/review/{id}/mark-mastered', { params: { path: { id } } })) } +export type ReviewListItem = SuccessBody['items'][number] +export type ReviewDetail = SuccessBody +export type ReviewSubmitResult = SuccessBody + // ---- 备考计划 ---- export const plansApi = { today: (date?: string) => unwrap(apiClient.GET('/api/plans/today', { params: { query: { date } } })), diff --git a/client/src/components/base/AppButton.vue b/client/src/components/base/AppButton.vue index 354b836..8a3b411 100644 --- a/client/src/components/base/AppButton.vue +++ b/client/src/components/base/AppButton.vue @@ -10,19 +10,21 @@ withDefaults( type?: 'button' | 'submit' disabled?: boolean block?: boolean + loading?: boolean }>(), - { variant: 'primary', size: 'md', type: 'button', disabled: false, block: false } + { variant: 'primary', size: 'md', type: 'button', disabled: false, block: false, loading: false } ) @@ -93,4 +95,18 @@ withDefaults( opacity: 0.5; cursor: not-allowed; } +.btn__spinner { + width: 14px; + height: 14px; + flex: none; + border-radius: 50%; + border: 2px solid rgba(255, 255, 255, 0.45); + border-top-color: currentColor; + animation: app-btn-spin 0.7s linear infinite; +} +@keyframes app-btn-spin { + to { + transform: rotate(360deg); + } +} diff --git a/client/src/components/base/icons.ts b/client/src/components/base/icons.ts index 25d74f9..2279255 100644 --- a/client/src/components/base/icons.ts +++ b/client/src/components/base/icons.ts @@ -19,6 +19,11 @@ export type IconName = | 'clock' | 'flame' | 'target' + | 'plus' + | 'sparkles' + | 'refresh' + | 'book-open' + | 'filter' interface IconNode { tag: 'path' | 'circle' | 'rect' | 'line' | 'polyline' @@ -113,5 +118,23 @@ export const icons: Record = { { tag: 'circle', attrs: { cx: 12, cy: 12, r: 10 } }, { tag: 'circle', attrs: { cx: 12, cy: 12, r: 6 } }, { tag: 'circle', attrs: { cx: 12, cy: 12, r: 2 } } + ], + plus: [{ tag: 'path', attrs: { d: 'M12 5v14' } }, { tag: 'path', attrs: { d: 'M5 12h14' } }], + sparkles: [ + { tag: 'path', attrs: { d: 'M12 3l1.9 4.9L18.8 9.8l-4.9 1.9L12 16.6l-1.9-4.9L5.2 9.8l4.9-1.9Z' } }, + { tag: 'path', attrs: { d: 'M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8Z' } } + ], + refresh: [ + { tag: 'path', attrs: { d: 'M3 12a9 9 0 0 1 15.5-6.4L21 8' } }, + { tag: 'path', attrs: { d: 'M21 3v5h-5' } }, + { tag: 'path', attrs: { d: 'M21 12a9 9 0 0 1-15.5 6.4L3 16' } }, + { tag: 'path', attrs: { d: 'M3 21v-5h5' } } + ], + 'book-open': [ + { tag: 'path', attrs: { d: 'M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z' } }, + { tag: 'path', attrs: { d: 'M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z' } } + ], + filter: [ + { tag: 'path', attrs: { d: 'M22 3H2l8 9.46V19l4 2v-8.54z' } } ] } diff --git a/client/src/layouts/MobileLayout.vue b/client/src/layouts/MobileLayout.vue index ab14295..545e35b 100644 --- a/client/src/layouts/MobileLayout.vue +++ b/client/src/layouts/MobileLayout.vue @@ -8,11 +8,13 @@ const route = useRoute() const title = computed(() => String(route.meta.title ?? '备考通')) // 首页以自己的问候语作为页头,不再重复显示顶部栏标题 const isHome = computed(() => route.path === '/') +// 刷题相关页面自带页头(AppPageHeader),隐藏顶栏标题避免重复 +const hideTopbar = computed(() => isHome.value || route.path.startsWith('/practice'))