迁移节日活动表单脚本
This commit is contained in:
@@ -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;
|
||||
@@ -4,6 +4,7 @@ import { bindAdminAutoactControls } from './admin/autoact.js';
|
||||
import { bindAdminFishingEventsControls } from './admin/fishing-events.js';
|
||||
import { bindAdminFormConfirmations } from './admin/form-confirmations.js';
|
||||
import { bindAdminGameConfigControls } from './admin/game-configs.js';
|
||||
import './admin/holiday-event-form.js';
|
||||
import { bindAdminHolidayEventsControls } from './admin/holiday-events.js';
|
||||
import { bindAdminInputSelection } from './admin/input-selection.js';
|
||||
import { bindAdminOpsControls } from './admin/ops.js';
|
||||
|
||||
@@ -306,22 +306,3 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function holidayEventForm(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',
|
||||
yearlySummary() {
|
||||
return `每年 ${this.scheduleMonth} 月 ${this.scheduleDay} 日 ${this.scheduleTime},连续 ${this.durationDays} 天,每天 ${this.dailyOccurrences} 次 / ${this.occurrenceIntervalMinutes} 分钟`;
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user