From 2614a5fba1a4ad4c7b8cb18d3850b6c6b8cc6df5 Mon Sep 17 00:00:00 2001 From: zhoulexin Date: Thu, 18 Jun 2026 11:19:41 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=9C=9F?= =?UTF-8?q?=E6=AC=A1=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9C=9F=E6=AC=A1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/registration.js | 33 +++ src/main.js | 3 +- src/utils/format.js | 21 ++ src/views/admin/DashboardPage.vue | 181 +++++++++++--- src/views/admin/SessionManage.vue | 385 ++++++++++++++++++++++++++++++ src/views/client/FormPage.vue | 56 +++-- src/views/client/PaymentPage.vue | 30 ++- 7 files changed, 660 insertions(+), 49 deletions(-) create mode 100644 src/utils/format.js create mode 100644 src/views/admin/SessionManage.vue diff --git a/src/api/registration.js b/src/api/registration.js index 135e961..e5cefe3 100644 --- a/src/api/registration.js +++ b/src/api/registration.js @@ -52,3 +52,36 @@ export function getAllRegistrations() { method: 'get' }) } + +// ====== 期次管理 API ====== + +export function getSessionList(params) { + return request({ + url: '/api/period/list', + method: 'get', + params + }) +} + +export function addSession(data) { + return request({ + url: '/api/period', + method: 'post', + data + }) +} + +export function updateSession(id, data) { + return request({ + url: `/api/period/${id}`, + method: 'put', + data + }) +} + +export function deleteSession(id) { + return request({ + url: `/api/period/${id}`, + method: 'delete' + }) +} diff --git a/src/main.js b/src/main.js index 8897637..18dbcff 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ import App from './App.vue' import router from './router' import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' +import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import './assets/styles/main.css' @@ -14,5 +15,5 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) { } app.use(router) -app.use(ElementPlus) +app.use(ElementPlus, { locale: zhCn }) app.mount('#app') diff --git a/src/utils/format.js b/src/utils/format.js new file mode 100644 index 0000000..8a73bfe --- /dev/null +++ b/src/utils/format.js @@ -0,0 +1,21 @@ +/** + * 格式化期次显示标签 + * 同月:第一期 5月22-24日 + * 不同月:第一期 05月22日 - 06月01日 + */ +export function formatPeriodLabel(periodName, startDate, endDate) { + if (!startDate || !endDate) return periodName + const startParts = startDate.split('-') + const endParts = endDate.split('-') + if (startParts.length !== 3 || endParts.length !== 3) return periodName + const startMonth = parseInt(startParts[1], 10) + const startDay = parseInt(startParts[2], 10) + const endMonth = parseInt(endParts[1], 10) + const endDay = parseInt(endParts[2], 10) + if (startMonth === endMonth) { + return `${periodName} ${startMonth}月${startDay}-${endDay}日` + } else { + const pad = (n) => String(n).padStart(2, '0') + return `${periodName} ${pad(startMonth)}月${pad(startDay)}日 - ${pad(endMonth)}月${pad(endDay)}日` + } +} diff --git a/src/views/admin/DashboardPage.vue b/src/views/admin/DashboardPage.vue index 157ab72..c73cb6c 100644 --- a/src/views/admin/DashboardPage.vue +++ b/src/views/admin/DashboardPage.vue @@ -25,8 +25,27 @@ - -
+ +
+ + + + + + 报名管理 + + + + 期次管理 + + + +
+
@@ -76,11 +95,15 @@ - - + 搜索 - 刷新 + 重置
@@ -124,7 +147,11 @@ - + + +