전투이벤트 진행시간 추가
진행시간 기준 종료시간 계산
This commit is contained in:
@@ -64,15 +64,15 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
}
|
||||
}, [modalType, content]);
|
||||
|
||||
useEffect(() => {
|
||||
if(modalType === TYPE_REGISTRY && configData?.length > 0){
|
||||
setResultData(prev => ({
|
||||
...prev,
|
||||
round_count: configData[0].default_round_count,
|
||||
round_time: configData[0].round_time
|
||||
}));
|
||||
}
|
||||
}, [modalType, configData]);
|
||||
// useEffect(() => {
|
||||
// if(modalType === TYPE_REGISTRY && configData?.length > 0){
|
||||
// setResultData(prev => ({
|
||||
// ...prev,
|
||||
// round_count: configData[0].default_round_count,
|
||||
// round_time: configData[0].round_time
|
||||
// }));
|
||||
// }
|
||||
// }, [modalType, configData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (checkCondition()) {
|
||||
@@ -126,6 +126,26 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
}));
|
||||
};
|
||||
|
||||
const handleEndTimeChange = (time) => {
|
||||
if (!time) return;
|
||||
|
||||
const newDateTime = resultData.event_end_time
|
||||
? new Date(resultData.event_end_time)
|
||||
: new Date();
|
||||
|
||||
newDateTime.setHours(
|
||||
time.getHours(),
|
||||
time.getMinutes(),
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
setResultData(prev => ({
|
||||
...prev,
|
||||
event_end_time: newDateTime
|
||||
}));
|
||||
};
|
||||
|
||||
// 종료 날짜 변경 핸들러
|
||||
const handleEndDateChange = (date) => {
|
||||
if (!date || !resultData.event_start_dt) return;
|
||||
@@ -190,6 +210,11 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
return;
|
||||
}
|
||||
|
||||
if(resultData.event_operation_time < 10){
|
||||
showToast('BATTLE_EVENT_MODAL_OPERATION_TIME_MIN_CHECK_WARNING', {type: alertTypes.warning});
|
||||
return;
|
||||
}
|
||||
|
||||
// if(resultData.round_time === 0){
|
||||
// const config = configData.find(data => data.id === resultData.config_id);
|
||||
// setResultData({ ...resultData, round_time: config.round_time });
|
||||
@@ -202,9 +227,15 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
|
||||
break;
|
||||
case "registConfirm":
|
||||
|
||||
const params = {
|
||||
...resultData,
|
||||
event_operation_time: resultData.event_operation_time * 60
|
||||
};
|
||||
|
||||
if(isView('modify')){
|
||||
await withLoading( async () => {
|
||||
return await BattleEventModify(token, content?.id, resultData);
|
||||
return await BattleEventModify(token, content?.id, params);
|
||||
}).then(data => {
|
||||
if(data.result === "SUCCESS") {
|
||||
showToast('UPDATE_COMPLETED', {type: alertTypes.success});
|
||||
@@ -221,7 +252,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
}
|
||||
else{
|
||||
await withLoading( async () => {
|
||||
return await BattleEventSingleRegist(token, resultData);
|
||||
return await BattleEventSingleRegist(token, params);
|
||||
}).then(data => {
|
||||
if(data.result === "SUCCESS") {
|
||||
showToast('REGIST_COMPLTE', {type: alertTypes.success});
|
||||
@@ -265,6 +296,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
case "round":
|
||||
case "hot":
|
||||
case "mode":
|
||||
case "operation_time":
|
||||
return modalType === TYPE_REGISTRY || (modalType === TYPE_MODIFY &&(content?.status === battleEventStatusType.stop));
|
||||
default:
|
||||
return modalType === TYPE_MODIFY && (content?.status !== battleEventStatusType.stop);
|
||||
@@ -302,12 +334,23 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
onDateChange={handleStartDateChange}
|
||||
selectedDate={resultData?.event_start_dt}
|
||||
/>
|
||||
</FormRowGroup>
|
||||
<FormRowGroup>
|
||||
<SingleTimePicker
|
||||
label="시작시간"
|
||||
disabled={!isView('start_dt')}
|
||||
selectedTime={resultData?.event_start_dt}
|
||||
onTimeChange={handleStartTimeChange}
|
||||
/>
|
||||
<FormLabel>진행시간(분)</FormLabel>
|
||||
<FormInput
|
||||
type="number"
|
||||
disabled={!isView('operation_time')}
|
||||
width='100px'
|
||||
min={10}
|
||||
value={resultData?.event_operation_time}
|
||||
onChange={e => setResultData({ ...resultData, event_operation_time: e.target.value })}
|
||||
/>
|
||||
</FormRowGroup>
|
||||
<FormRowGroup>
|
||||
<FormLabel>반복</FormLabel>
|
||||
@@ -328,24 +371,24 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
/>
|
||||
}
|
||||
</FormRowGroup>
|
||||
<FormRowGroup>
|
||||
{/*<FormLabel>라운드 시간</FormLabel>*/}
|
||||
{/*<SelectInput value={resultData.config_id} onChange={handleConfigChange} disabled={!isView('config')} width="200px">*/}
|
||||
{/* {configData && configData?.map((data, index) => (*/}
|
||||
{/* <option key={index} value={data.id}>*/}
|
||||
{/* {data.desc}({data.id})*/}
|
||||
{/* </option>*/}
|
||||
{/* ))}*/}
|
||||
{/*</SelectInput>*/}
|
||||
<FormLabel>라운드 수</FormLabel>
|
||||
<SelectInput value={resultData.round_count} onChange={e => setResultData({ ...resultData, round_count: e.target.value })} disabled={!isView('round')} width="100px">
|
||||
{battleEventRoundCount.map((data, index) => (
|
||||
<option key={index} value={data}>
|
||||
{data}
|
||||
</option>
|
||||
))}
|
||||
</SelectInput>
|
||||
</FormRowGroup>
|
||||
{/*<FormRowGroup>*/}
|
||||
{/* <FormLabel>라운드 시간</FormLabel>*/}
|
||||
{/* <SelectInput value={resultData.config_id} onChange={handleConfigChange} disabled={!isView('config')} width="200px">*/}
|
||||
{/* {configData && configData?.map((data, index) => (*/}
|
||||
{/* <option key={index} value={data.id}>*/}
|
||||
{/* {data.desc}({data.id})*/}
|
||||
{/* </option>*/}
|
||||
{/* ))}*/}
|
||||
{/* </SelectInput>*/}
|
||||
{/* <FormLabel>라운드 수</FormLabel>*/}
|
||||
{/* <SelectInput value={resultData.round_count} onChange={e => setResultData({ ...resultData, round_count: e.target.value })} disabled={!isView('round')} width="100px">*/}
|
||||
{/* {battleEventRoundCount.map((data, index) => (*/}
|
||||
{/* <option key={index} value={data}>*/}
|
||||
{/* {data}*/}
|
||||
{/* </option>*/}
|
||||
{/* ))}*/}
|
||||
{/* </SelectInput>*/}
|
||||
{/*</FormRowGroup>*/}
|
||||
<FormRowGroup>
|
||||
{/*<FormLabel>배정 포드</FormLabel>*/}
|
||||
{/*<SelectInput value={resultData.reward_group_id} onChange={e => setResultData({ ...resultData, reward_group_id: e.target.value })} disabled={!isView('reward')} width="200px">*/}
|
||||
@@ -434,7 +477,8 @@ export const initData = {
|
||||
hot_time: 1,
|
||||
game_mode_id: 1,
|
||||
event_start_dt: '',
|
||||
event_end_dt: ''
|
||||
event_end_dt: '',
|
||||
event_operation_time: 10
|
||||
}
|
||||
|
||||
export default BattleEventModal;
|
||||
|
||||
@@ -186,17 +186,17 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset, configData, rew
|
||||
))}
|
||||
</SelectInput>
|
||||
</InputGroup>
|
||||
<InputLabel>라운드 수</InputLabel>
|
||||
<InputGroup>
|
||||
<SelectInput value={searchParams.roundCount} onChange={e => onSearch({ roundCount: e.target.value })}>
|
||||
<option value='ALL'>전체</option>
|
||||
{battleEventRoundCount.map((data, index) => (
|
||||
<option key={index} value={data}>
|
||||
{data}
|
||||
</option>
|
||||
))}
|
||||
</SelectInput>
|
||||
</InputGroup>
|
||||
{/*<InputLabel>라운드 수</InputLabel>*/}
|
||||
{/*<InputGroup>*/}
|
||||
{/* <SelectInput value={searchParams.roundCount} onChange={e => onSearch({ roundCount: e.target.value })}>*/}
|
||||
{/* <option value='ALL'>전체</option>*/}
|
||||
{/* {battleEventRoundCount.map((data, index) => (*/}
|
||||
{/* <option key={index} value={data}>*/}
|
||||
{/* {data}*/}
|
||||
{/* </option>*/}
|
||||
{/* ))}*/}
|
||||
{/* </SelectInput>*/}
|
||||
{/*</InputGroup>*/}
|
||||
</>
|
||||
];
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ const resources = {
|
||||
//전투시스템
|
||||
BATTLE_EVENT_MODAL_START_DT_WARNING: "시작 시간은 현재 시간으로부터 10분 이후부터 가능합니다.",
|
||||
BATTLE_EVENT_MODAL_TIME_CHECK_WARNING :"해당 시간에 속하는 이벤트가 존재합니다.",
|
||||
BATTLE_EVENT_MODAL_OPERATION_TIME_MIN_CHECK_WARNING :"진행시간은 최소 10분 이상이여야 합니다.",
|
||||
BATTLE_EVENT_REGIST_CONFIRM: "이벤트를 등록하시겠습니까?",
|
||||
BATTLE_EVENT_UPDATE_CONFIRM: "이벤트를 수정하시겠습니까?",
|
||||
BATTLE_EVENT_SELECT_DELETE: "선택된 이벤트를 삭제하시겠습니까?",
|
||||
|
||||
@@ -30,7 +30,11 @@ import {
|
||||
} from '../../components/common';
|
||||
import { convertKTC, convertKTCDate, convertUTC, timeDiffMinute } from '../../utils';
|
||||
import { BattleEventModal } from '../../components/ServiceManage';
|
||||
import { INITIAL_PAGE_SIZE, INITIAL_PAGE_LIMIT } from '../../assets/data/adminConstants';
|
||||
import {
|
||||
INITIAL_PAGE_SIZE,
|
||||
INITIAL_PAGE_LIMIT,
|
||||
BATTLE_EVENT_OPERATION_TIME_WAIT_SECONDS,
|
||||
} from '../../assets/data/adminConstants';
|
||||
import { useDataFetch, useModal, useTable, withAuth } from '../../hooks/hook';
|
||||
import { StatusWapper, StatusLabel } from '../../styles/ModuleComponents';
|
||||
import { battleEventStatus, battleRepeatType } from '../../assets/data/options';
|
||||
@@ -98,7 +102,7 @@ const BattleEvent = () => {
|
||||
const endTime = (start_dt, operation_time) =>{
|
||||
const startDate = new Date(start_dt);
|
||||
|
||||
startDate.setSeconds(startDate.getSeconds() + operation_time);
|
||||
startDate.setSeconds(startDate.getSeconds() + operation_time + BATTLE_EVENT_OPERATION_TIME_WAIT_SECONDS);
|
||||
|
||||
return startDate;
|
||||
}
|
||||
@@ -295,16 +299,16 @@ const BattleEvent = () => {
|
||||
<th width="90">그룹</th>
|
||||
<th width="70">이벤트 ID</th>
|
||||
<th width="200">이벤트명</th>
|
||||
<th width="90">게임모드</th>
|
||||
<th width="80">반복</th>
|
||||
<th width="100">기간 시작일(KST)</th>
|
||||
<th width="100">기간 종료일(KST)</th>
|
||||
<th width="100">이벤트 시작시간(KST)</th>
|
||||
<th width="100">이벤트 종료시간(KST)</th>
|
||||
<th width="90">이벤트 상태</th>
|
||||
<th width="90">게임모드</th>
|
||||
{/*<th width="90">라운드 시간</th>*/}
|
||||
{/*<th width="90">배정포드</th>*/}
|
||||
<th width="70">라운드 수</th>
|
||||
{/*<th width="70">라운드 수</th>*/}
|
||||
<th width="70">핫타임</th>
|
||||
<th width="100">확인 / 수정</th>
|
||||
<th width="150">히스토리</th>
|
||||
@@ -321,6 +325,7 @@ const BattleEvent = () => {
|
||||
<td>{battle.group_id}</td>
|
||||
<td>{battle.id}</td>
|
||||
<td>{battle.event_name}</td>
|
||||
<td>{battle.game_mode_id}</td>
|
||||
<StatusWapper>
|
||||
<StatusLabel $status={battle.repeat_type}>
|
||||
{battleRepeatType.find(data => data.value === battle.repeat_type).name}
|
||||
@@ -335,10 +340,9 @@ const BattleEvent = () => {
|
||||
{battleEventStatus.find(data => data.value === battle.status).name}
|
||||
</StatusLabel>
|
||||
</StatusWapper>
|
||||
<td>{battle.game_mode_id}</td>
|
||||
{/*<td>{secondToMinutes(battle.round_time)}분</td>*/}
|
||||
{/*<td>{battle.reward_group_id}</td>*/}
|
||||
<td>{battle.round_count}</td>
|
||||
{/*<td>{battle.round_count}</td>*/}
|
||||
<td>{battle.hot_time}</td>
|
||||
<td>
|
||||
<Button theme="line" text="상세보기"
|
||||
|
||||
Reference in New Issue
Block a user