battle event 조회조건 처리
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
import { Axios } from '../utils';
|
import { Axios } from '../utils';
|
||||||
|
|
||||||
// 전투시스템 리스트 조회
|
// 전투시스템 리스트 조회
|
||||||
export const BattleEventView = async (token, landType, landData, userType, userData, landSize, status, startDate, endDate, order, size, currentPage) => {
|
export const BattleEventView = async (token, searchType, searchData, configId, rewardId, repeatType, status, roundCount, hotTime, startDate, endDate, order, size, currentPage) => {
|
||||||
try {
|
try {
|
||||||
const res = await Axios.get(
|
const res = await Axios.get(
|
||||||
`/api/v1/battle/event/list?land_type=${landType}&land_data=${landData}&user_type=${userType}&user_data=${userData}&land_size=${landSize}&status=${status}&start_dt=${startDate}&end_dt=${endDate}&orderby=${order}&page_no=${currentPage}
|
`/api/v1/battle/event/list?search_type=${searchType}&search_data=${searchData}&config_id=${configId}&reward_id=${rewardId}&repeat_type=${repeatType}&status=${status}&round_count=${roundCount}&hot_time=${hotTime}&start_dt=${startDate}&end_dt=${endDate}&orderby=${order}&page_no=${currentPage}
|
||||||
&page_size=${size}`,
|
&page_size=${size}`,
|
||||||
{
|
{
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
|||||||
@@ -195,4 +195,12 @@ export const battleRepeatType = [
|
|||||||
{ value: 'THURSDAY', name: 'Week-목' },
|
{ value: 'THURSDAY', name: 'Week-목' },
|
||||||
{ value: 'FRIDAY', name: 'Week-금' },
|
{ value: 'FRIDAY', name: 'Week-금' },
|
||||||
{ value: 'SATURDAY', name: 'Week-토' },
|
{ value: 'SATURDAY', name: 'Week-토' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const eventSearchType = [
|
||||||
|
{ value: 'ID', name: '이벤트 ID' },
|
||||||
|
{ value: 'NAME', name: '이벤트명' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const battleEventRoundCount = [1,2,3,4,8,12,16];
|
||||||
|
export const battleEventHotTime = [1,2,3,4,5,6,7,8];
|
||||||
@@ -33,7 +33,12 @@ import { NONE, TYPE_MODIFY, TYPE_REGISTRY } from '../../../assets/data/adminCons
|
|||||||
import { landAuctionStatus, landAuctionStatusType, languageType, CurrencyType } from '../../../assets/data';
|
import { landAuctionStatus, landAuctionStatusType, languageType, CurrencyType } from '../../../assets/data';
|
||||||
import { useModal } from '../../../utils/hook';
|
import { useModal } from '../../../utils/hook';
|
||||||
import { convertKTCDate } from '../../../utils';
|
import { convertKTCDate } from '../../../utils';
|
||||||
import { battleEventStatus, battleRepeatType } from '../../../assets/data/options';
|
import {
|
||||||
|
battleEventHotTime,
|
||||||
|
battleEventRoundCount,
|
||||||
|
battleEventStatus,
|
||||||
|
battleRepeatType,
|
||||||
|
} from '../../../assets/data/options';
|
||||||
import DatePickerComponent from '../../common/Date/DatePickerComponent';
|
import DatePickerComponent from '../../common/Date/DatePickerComponent';
|
||||||
import { BattleEventModify, BattleEventSingleRegist } from '../../../apis/Battle';
|
import { BattleEventModify, BattleEventSingleRegist } from '../../../apis/Battle';
|
||||||
import { battleEventStatusType } from '../../../assets/data/types';
|
import { battleEventStatusType } from '../../../assets/data/types';
|
||||||
@@ -341,7 +346,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
|||||||
</SelectInput>
|
</SelectInput>
|
||||||
<FormLabel>라운드 수</FormLabel>
|
<FormLabel>라운드 수</FormLabel>
|
||||||
<SelectInput value={resultData.round_count} onChange={e => setResultData({ ...resultData, round_count: e.target.value })} disabled={!isView('round')} width="100px">
|
<SelectInput value={resultData.round_count} onChange={e => setResultData({ ...resultData, round_count: e.target.value })} disabled={!isView('round')} width="100px">
|
||||||
{[1,2,3,4,8,12,16].map((data, index) => (
|
{battleEventRoundCount.map((data, index) => (
|
||||||
<option key={index} value={data}>
|
<option key={index} value={data}>
|
||||||
{data}
|
{data}
|
||||||
</option>
|
</option>
|
||||||
@@ -359,7 +364,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
|||||||
</SelectInput>
|
</SelectInput>
|
||||||
<FormLabel>핫타임</FormLabel>
|
<FormLabel>핫타임</FormLabel>
|
||||||
<SelectInput value={resultData.hot_time} onChange={e => setResultData({ ...resultData, hot_time: e.target.value })} disabled={!isView('hot')} width="100px">
|
<SelectInput value={resultData.hot_time} onChange={e => setResultData({ ...resultData, hot_time: e.target.value })} disabled={!isView('hot')} width="100px">
|
||||||
{[1,2,3,4,5,6,7,8].map((data, index) => (
|
{battleEventHotTime.map((data, index) => (
|
||||||
<option key={index} value={data}>
|
<option key={index} value={data}>
|
||||||
{data}배
|
{data}배
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@@ -2,19 +2,27 @@ import { TextInput, BtnWrapper, InputLabel, SelectInput, InputGroup } from '../.
|
|||||||
import Button from '../../common/button/Button';
|
import Button from '../../common/button/Button';
|
||||||
import { SearchBarLayout, SearchPeriod } from '../../common/SearchBar';
|
import { SearchBarLayout, SearchPeriod } from '../../common/SearchBar';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { landAuctionStatus, landSearchType, landSize, userSearchType } from '../../../assets/data';
|
|
||||||
import { BattleEventView } from '../../../apis/Battle';
|
import { BattleEventView } from '../../../apis/Battle';
|
||||||
|
import {
|
||||||
|
battleEventHotTime,
|
||||||
|
battleEventRoundCount,
|
||||||
|
battleEventStatus,
|
||||||
|
battleRepeatType,
|
||||||
|
eventSearchType,
|
||||||
|
} from '../../../assets/data/options';
|
||||||
|
|
||||||
export const useBattleEventSearch = (token, initialPageSize) => {
|
export const useBattleEventSearch = (token, initialPageSize) => {
|
||||||
const [searchParams, setSearchParams] = useState({
|
const [searchParams, setSearchParams] = useState({
|
||||||
landType: 'ID',
|
searchType: 'ID',
|
||||||
landData: '',
|
searchData: '',
|
||||||
userType: 'GUID',
|
configId: 'ALL',
|
||||||
userData: '',
|
rewardId: 'ALL',
|
||||||
landSize: 'ALL',
|
repeatType: 'ALL',
|
||||||
status: 'ALL',
|
status: 'ALL',
|
||||||
auctionStartDate: '',
|
roundCount: 'ALL',
|
||||||
auctionEndDate: '',
|
hotTime: 'ALL',
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
orderBy: 'DESC',
|
orderBy: 'DESC',
|
||||||
pageSize: initialPageSize,
|
pageSize: initialPageSize,
|
||||||
currentPage: 1
|
currentPage: 1
|
||||||
@@ -32,14 +40,16 @@ export const useBattleEventSearch = (token, initialPageSize) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await BattleEventView(
|
const result = await BattleEventView(
|
||||||
token,
|
token,
|
||||||
params.landType,
|
params.searchType,
|
||||||
params.landData,
|
params.searchData,
|
||||||
params.userType,
|
params.configId,
|
||||||
params.userData,
|
params.rewardId,
|
||||||
params.landSize,
|
params.repeatType,
|
||||||
params.status,
|
params.status,
|
||||||
params.auctionStartDate && new Date(params.auctionStartDate).toISOString(),
|
params.roundCount,
|
||||||
params.auctionEndDate && new Date(params.auctionEndDate).toISOString(),
|
params.hotTime,
|
||||||
|
params.startDate && new Date(params.startDate).toISOString(),
|
||||||
|
params.endDate && new Date(params.endDate).toISOString(),
|
||||||
params.orderBy,
|
params.orderBy,
|
||||||
params.pageSize,
|
params.pageSize,
|
||||||
params.currentPage
|
params.currentPage
|
||||||
@@ -73,14 +83,16 @@ export const useBattleEventSearch = (token, initialPageSize) => {
|
|||||||
|
|
||||||
const handleReset = useCallback(async () => {
|
const handleReset = useCallback(async () => {
|
||||||
const resetParams = {
|
const resetParams = {
|
||||||
landType: 'ID',
|
searchType: 'ID',
|
||||||
landData: '',
|
searchData: '',
|
||||||
userType: 'GUID',
|
configId: 'ALL',
|
||||||
userData: '',
|
rewardId: 'ALL',
|
||||||
landSize: 'ALL',
|
repeatType: 'ALL',
|
||||||
status: 'ALL',
|
status: 'ALL',
|
||||||
auctionStartDate: '',
|
roundCount: 'ALL',
|
||||||
auctionEndDate: '',
|
hotTime: 'ALL',
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
orderBy: 'DESC',
|
orderBy: 'DESC',
|
||||||
pageSize: initialPageSize,
|
pageSize: initialPageSize,
|
||||||
currentPage: 1
|
currentPage: 1
|
||||||
@@ -114,7 +126,7 @@ export const useBattleEventSearch = (token, initialPageSize) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
|
const BattleEventSearchBar = ({ searchParams, onSearch, onReset, configData, rewardData }) => {
|
||||||
const handleSubmit = event => {
|
const handleSubmit = event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@@ -124,8 +136,8 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
|
|||||||
const searchList = [
|
const searchList = [
|
||||||
<>
|
<>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<SelectInput value={searchParams.landType} onChange={e => onSearch({landType: e.target.value })}>
|
<SelectInput value={searchParams.searchType} onChange={e => onSearch({searchType: e.target.value })}>
|
||||||
{landSearchType.map((data, index) => (
|
{eventSearchType.map((data, index) => (
|
||||||
<option key={index} value={data.value}>
|
<option key={index} value={data.value}>
|
||||||
{data.name}
|
{data.name}
|
||||||
</option>
|
</option>
|
||||||
@@ -133,39 +145,55 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
|
|||||||
</SelectInput>
|
</SelectInput>
|
||||||
<TextInput
|
<TextInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={searchParams.landType === 'ID' ? '랜드 ID 입력' : '랜드명 입력'}
|
placeholder={searchParams.searchType === 'ID' ? '이벤트 ID 입력' : '이벤트명 입력'}
|
||||||
value={searchParams.landData}
|
value={searchParams.searchData}
|
||||||
width="300px"
|
width="300px"
|
||||||
onChange={e => onSearch({ landData: e.target.value })}
|
onChange={e => onSearch({ searchData: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</>,
|
</>,
|
||||||
<>
|
<>
|
||||||
<InputLabel>낙찰자</InputLabel>
|
<InputLabel>라운드 시간</InputLabel>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<SelectInput value={searchParams.userType} onChange={e => onSearch({userType: e.target.value })}>
|
<SelectInput value={searchParams.configId} onChange={e => onSearch({ configId: e.target.value })}>
|
||||||
{userSearchType.map((data, index) => (
|
<option value="ALL">전체</option>
|
||||||
|
{configData?.map((data, index) => (
|
||||||
<option key={index} value={data.value}>
|
<option key={index} value={data.value}>
|
||||||
{data.name}
|
{data.name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</SelectInput>
|
</SelectInput>
|
||||||
<TextInput
|
</InputGroup>
|
||||||
type="text"
|
<InputLabel>배정 포드</InputLabel>
|
||||||
placeholder={searchParams.userType === 'GUID' ? 'GUID 입력' : '닉네임 입력'}
|
<InputGroup>
|
||||||
value={searchParams.userData}
|
<SelectInput value={searchParams.rewardId} onChange={e => onSearch({ rewardId: e.target.value })}>
|
||||||
width="300px"
|
<option value='ALL'>전체</option>
|
||||||
onChange={e => onSearch({ userData: e.target.value })}
|
{rewardData?.map((data, index) => (
|
||||||
/>
|
<option key={index} value={data.value}>
|
||||||
|
{data.name}
|
||||||
|
</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>
|
</InputGroup>
|
||||||
</>
|
</>
|
||||||
];
|
];
|
||||||
|
|
||||||
const optionList = [
|
const optionList = [
|
||||||
<>
|
<>
|
||||||
<InputLabel>랜드크기</InputLabel>
|
<InputLabel>반복</InputLabel>
|
||||||
<SelectInput value={searchParams.landSize} onChange={e => onSearch({ landSize: e.target.value }, false)} >
|
<SelectInput value={searchParams.repeatType} onChange={e => onSearch({ repeatType: e.target.value }, false)} >
|
||||||
{landSize.map((data, index) => (
|
{battleRepeatType.map((data, index) => (
|
||||||
<option key={index} value={data.value}>
|
<option key={index} value={data.value}>
|
||||||
{data.name}
|
{data.name}
|
||||||
</option>
|
</option>
|
||||||
@@ -173,9 +201,9 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
|
|||||||
</SelectInput>
|
</SelectInput>
|
||||||
</>,
|
</>,
|
||||||
<>
|
<>
|
||||||
<InputLabel>경매상태</InputLabel>
|
<InputLabel>이벤트상태</InputLabel>
|
||||||
<SelectInput value={searchParams.status} onChange={e => onSearch({ status: e.target.value }, false)}>
|
<SelectInput value={searchParams.status} onChange={e => onSearch({ status: e.target.value }, false)}>
|
||||||
{landAuctionStatus.map((data, index) => (
|
{battleEventStatus.map((data, index) => (
|
||||||
<option key={index} value={data.value}>
|
<option key={index} value={data.value}>
|
||||||
{data.name}
|
{data.name}
|
||||||
</option>
|
</option>
|
||||||
@@ -183,12 +211,23 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
|
|||||||
</SelectInput>
|
</SelectInput>
|
||||||
</>,
|
</>,
|
||||||
<>
|
<>
|
||||||
<InputLabel>경매 일자</InputLabel>
|
<InputLabel>핫타임</InputLabel>
|
||||||
|
<SelectInput value={searchParams.hotTime} onChange={e => onSearch({ hotTime: e.target.value }, false)}>
|
||||||
|
<option value="ALL">전체</option>
|
||||||
|
{battleEventHotTime.map((data, index) => (
|
||||||
|
<option key={index} value={data}>
|
||||||
|
{data}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</SelectInput>
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<InputLabel>이벤트 기간</InputLabel>
|
||||||
<SearchPeriod
|
<SearchPeriod
|
||||||
startDate={searchParams.auctionStartDate}
|
startDate={searchParams.startDate}
|
||||||
handleStartDate={date => onSearch({ auctionStartDate: date }, false)}
|
handleStartDate={date => onSearch({ startDate: date }, false)}
|
||||||
endDate={searchParams.auctionEndDate}
|
endDate={searchParams.endDate}
|
||||||
handleEndDate={date => onSearch({ auctionEndDate: date }, false)}
|
handleEndDate={date => onSearch({ endDate: date }, false)}
|
||||||
/>
|
/>
|
||||||
</>,
|
</>,
|
||||||
<></>,<></>,
|
<></>,<></>,
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ const BattleEvent = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onReset={handleReset}
|
onReset={handleReset}
|
||||||
|
configData={battleConfigData}
|
||||||
|
rewardData={battleRewardData}
|
||||||
/>
|
/>
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
<ViewTableInfo total={dataList?.total} total_all={dataList?.total_all} handleOrderBy={handleOrderByChange} handlePageSize={handlePageSizeChange}>
|
<ViewTableInfo total={dataList?.total} total_all={dataList?.total_all} handleOrderBy={handleOrderByChange} handlePageSize={handlePageSizeChange}>
|
||||||
|
|||||||
Reference in New Issue
Block a user