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 @@ - + + +