diff --git a/app/components/Admin/AdminDatePicker.vue b/app/components/Admin/AdminDatePicker.vue index b063b06..9017dc5 100644 --- a/app/components/Admin/AdminDatePicker.vue +++ b/app/components/Admin/AdminDatePicker.vue @@ -1,9 +1,10 @@ diff --git a/app/components/Admin/AdminMultiDatePicker.vue b/app/components/Admin/AdminMultiDatePicker.vue index 1f5ca30..2457eac 100644 --- a/app/components/Admin/AdminMultiDatePicker.vue +++ b/app/components/Admin/AdminMultiDatePicker.vue @@ -1,9 +1,10 @@ diff --git a/app/components/Admin/PlayTimeManager.vue b/app/components/Admin/PlayTimeManager.vue index 7315f1d..114a5d8 100644 --- a/app/components/Admin/PlayTimeManager.vue +++ b/app/components/Admin/PlayTimeManager.vue @@ -8,7 +8,7 @@ 定义校园广播的常规播放窗口,用户仅可在这些时间段内进行点歌或查看排期

-
+
@@ -30,6 +30,21 @@ />
+
+ 批量 + + +
+
+
+
{ } } +// 应用快速模板 +const applyPreset = (preset) => { + Object.assign(formData, { + name: preset.name, + startTime: preset.startTime, + endTime: preset.endTime, + description: preset.description, + enabled: true + }) +} + +// 复制时段 +const duplicatePlayTime = (playTime: PlayTime) => { + showAddForm.value = true + editingPlayTime.value = null + Object.assign(formData, { + id: 0, + name: `${playTime.name} (副本)`, + startTime: playTime.startTime || '', + endTime: playTime.endTime || '', + description: playTime.description || '', + enabled: playTime.enabled + }) +} + +// 批量切换启用状态 +const batchToggleAll = async (enable: boolean) => { + if (!isAdmin.value) return + const ids = playTimes.value + .filter((pt) => pt.enabled !== enable) + .map((pt) => pt.id) + if (ids.length === 0) { + showNotification(`所有时段已是${enable ? '启用' : '禁用'}状态`, 'info') + return + } + try { + const authConfig = getAuthConfig() + await Promise.all( + ids.map((id) => + $fetch(`/api/admin/play-times/${id}`, { + method: 'PATCH', + body: { enabled: enable }, + ...authConfig + }) + ) + ) + await fetchPlayTimes() + showNotification(`已${enable ? '启用' : '禁用'} ${ids.length} 个时段`, 'success') + } catch (err: any) { + showNotification(err.message || '批量操作失败', 'error') + } +} + // 取消表单 const cancelForm = () => { showAddForm.value = false diff --git a/app/components/Admin/RequestTimeManager.vue b/app/components/Admin/RequestTimeManager.vue index 762281f..2ead769 100644 --- a/app/components/Admin/RequestTimeManager.vue +++ b/app/components/Admin/RequestTimeManager.vue @@ -291,26 +291,64 @@ >
+
+
+ + 点击可一键套用常见时段 +
+
+ +
+
+
- 开始时间 +
+ + +
+

+ 实际值: {{ formData.startTime || '尚未设置' }} +

- 结束时间 +
+ + +
+

+ 实际值: {{ formData.endTime || '尚未设置' }} +

@@ -502,7 +540,7 @@