迁移节日活动表单脚本

This commit is contained in:
2026-04-25 13:36:51 +08:00
parent cedc787586
commit b7af9330c4
3 changed files with 33 additions and 19 deletions
+32
View File
@@ -0,0 +1,32 @@
// 节日福利表单 Alpine 工厂,提供周期、分配和目标范围的联动状态。
/**
* 创建节日福利表单状态对象。
*
* @param {object} config
* @returns {object}
*/
function createHolidayEventForm(config = {}) {
return {
repeatType: config.repeatType ?? "once",
distributeType: config.distributeType ?? "random",
targetType: config.targetType ?? "all",
scheduleMonth: config.scheduleMonth ?? "1",
scheduleDay: config.scheduleDay ?? "1",
scheduleTime: config.scheduleTime ?? "20:00",
durationDays: config.durationDays ?? "1",
dailyOccurrences: config.dailyOccurrences ?? "1",
occurrenceIntervalMinutes: config.occurrenceIntervalMinutes ?? "60",
/**
* 生成年节日循环计划摘要,供表单实时预览。
*
* @returns {string}
*/
yearlySummary() {
return `每年 ${this.scheduleMonth}${this.scheduleDay}${this.scheduleTime},连续 ${this.durationDays} 天,每天 ${this.dailyOccurrences} 次 / ${this.occurrenceIntervalMinutes} 分钟`;
},
};
}
window.holidayEventForm = createHolidayEventForm;