{{ item.description }}
+{{ t('feeCatalog.presets') }}:{{ item.presetAmounts.map(money).join(' / ') || '—' }}
+{{ t('feeCatalog.custom') }}:{{ item.allowCustomAmount ? t('feeCatalog.yes') : t('feeCatalog.no') }}
+diff --git a/web/e2e/tuition-responsive.spec.ts b/web/e2e/tuition-responsive.spec.ts new file mode 100644 index 0000000..f81951c --- /dev/null +++ b/web/e2e/tuition-responsive.spec.ts @@ -0,0 +1,47 @@ +import { expect, test } from '@playwright/test' + +for (const role of ['Student', 'AcademicAdmin']) { + test(`${role} tuition and fee catalog fit a mobile viewport`, async ({ page }) => { + await page.setViewportSize({ width: 360, height: 800 }) + const user = { id: 'user-1', userName: 'user', displayName: '测试用户', roles: [role], permissions: [], effectiveDataScope: 'All' } + await page.addInitScript(savedUser => { + localStorage.setItem('jiaowu_token', 'test-token') + localStorage.setItem('jiaowu_user', JSON.stringify(savedUser)) + localStorage.setItem('jiaowu_access_expires_at', '2099-01-01T00:00:00Z') + localStorage.setItem('jiaowu_session_expires_at', '2099-01-01T00:00:00Z') + }, user) + const bill = { id: 'bill-1', termName: '2026 秋季学期', studentName: '测试学生', studentNumber: '20260101', baseTuition: 100, basePaid: 0, creditFee: 30, creditPaid: 0, accommodationFee: 50, accommodationPaid: 0, reconciliationAdjustment: 0, adjustmentPaid: 0, isPayable: true } + await page.route(url => url.pathname.startsWith('/api/'), route => { + const path = new URL(route.request().url()).pathname + if (path === '/api/auth/me') return route.fulfill({ json: user }) + if (path === '/api/plugins/runtime') return route.fulfill({ json: [{ id: 'mingxu.campus-services', isEnabled: true, navigationPaths: [], capabilities: [] }] }) + if (path === '/api/tuition/mine') return route.fulfill({ json: [bill] }) + if (path === '/api/tuition/mine/payments') return route.fulfill({ json: [] }) + if (path === '/api/tuition/terms') return route.fulfill({ json: [{ id: 'term-1', name: '秋季', isCurrent: true, setting: { status: 'OpenForPayment', creditUnitPrice: 10 } }] }) + if (path === '/api/tuition/bills') return route.fulfill({ json: { items: [bill], total: 1 } }) + if (path === '/api/fee-catalog') return route.fulfill({ json: [{ id: 'fee-1', name: '学生证补办工本费', description: '长期收费项目', presetAmounts: [10, 20], allowCustomAmount: true, isEnabled: true }] }) + if (path === '/api/fee-catalog/payments') return route.fulfill({ json: [] }) + return route.fulfill({ json: {} }) + }) + await page.goto('/tuition') + const billCard = page.locator('.tuition .mobile-record').first() + await expect(billCard).toBeVisible() + await expect(billCard.getByText('基础学费')).toBeVisible() + await expect(billCard.getByRole('button', { name: role === 'Student' ? '缴基础费' : '余额划扣' }).first()).toBeVisible() + expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true) + await page.getByRole('tab', { name: '项目缴费' }).click() + const feeCard = page.locator('.fee-catalog .mobile-record').first() + await expect(feeCard.getByText('学生证补办工本费')).toBeVisible() + await expect(feeCard.getByRole('button', { name: role === 'Student' ? '余额缴费' : '编辑收费项目' })).toBeVisible() + if (role === 'Student') { + const input = feeCard.locator('.el-input-number input') + await input.fill('15') + await expect(input).toHaveValue('15') + } + expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true) + await page.setViewportSize({ width: 1440, height: 900 }) + await expect(page.locator('.fee-catalog .desktop-table').first()).toBeVisible() + await expect(feeCard).toBeHidden() + }) +} + diff --git a/web/src/views/FeeCatalogPanel.vue b/web/src/views/FeeCatalogPanel.vue index 36b3205..04d2d2c 100644 --- a/web/src/views/FeeCatalogPanel.vue +++ b/web/src/views/FeeCatalogPanel.vue @@ -70,7 +70,22 @@ onMounted(load)
{{ item.description }}
+{{ t('feeCatalog.presets') }}:{{ item.presetAmounts.map(money).join(' / ') || '—' }}
+{{ t('feeCatalog.custom') }}:{{ item.allowCustomAmount ? t('feeCatalog.yes') : t('feeCatalog.no') }}
+{{ payment.studentName }} · {{ payment.studentNumber }}
+{{ new Date(payment.createdAt).toLocaleString(locale) }}
+