From 0c363d6c851d8ba0e35cdd5f3794b927d5ff5452 Mon Sep 17 00:00:00 2001 From: bongsh0112 Date: Wed, 10 Aug 2022 14:11:30 +0900 Subject: [PATCH 1/4] =?UTF-8?q?:fix:=20OrdersPage=20=EB=AC=B4=EB=A3=8C=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B3=B4=EC=99=84,=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EC=9D=BC=EC=8B=9C=20=EC=B6=94=EA=B0=80,?= =?UTF-8?q?=20=20CheckPage=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Tables/OrdersPage/OrdersPage.js | 13 +++++++++++++ src/components/Tickets/CheckPage/CheckEnterPage.js | 9 +-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/Tables/OrdersPage/OrdersPage.js b/src/components/Tables/OrdersPage/OrdersPage.js index ec69b2e..25558dc 100644 --- a/src/components/Tables/OrdersPage/OrdersPage.js +++ b/src/components/Tables/OrdersPage/OrdersPage.js @@ -17,10 +17,12 @@ const { Option } = Select; export default function OrdersPage() { const dispatch = useDispatch(); const { data, pending } = useSelector(state => state.orderListPagination); + console.log(data); const [page, setPage] = useState(1); const [day, setDay] = useState('ALL'); const [isModalVisible, setIsModalVisible] = useState(false); const [id, setID] = useState(''); + const [orderPrice, setOrderPrice] = useState('xx'); const onPageChange = e => { // 페이지네이션 번호 바뀔때 뜸. @@ -60,11 +62,13 @@ export default function OrdersPage() { setIsModalVisible(false); handleSetFreeSelector(id); setID(''); + setOrderPrice('무료'); }; const handleCancel = () => { setIsModalVisible(false); setID(''); + setOrderPrice('유료'); }; useEffect(() => { @@ -113,6 +117,14 @@ export default function OrdersPage() { return moment(element).utc(false).format('MM월 DD일 HH:mm'); }} /> + { + return moment(element).utc(false).format('MM월 DD일 HH:mm'); + }} + /> +
From 8aabeb616c2c120ad83386b55e9f15ae9552a0bc Mon Sep 17 00:00:00 2001 From: bongsh0112 Date: Wed, 10 Aug 2022 15:38:36 +0900 Subject: [PATCH 2/4] =?UTF-8?q?:fix:=20feat(CheckPage)=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=20=EC=9A=94=EC=B2=AD=20=EB=B0=A9=EC=A7=80=20=EC=A4=91?= =?UTF-8?q?=EA=B0=84=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tickets/CheckPage/CheckEnterPage.js | 3 +- src/components/Tickets/CheckPage/CheckPage.js | 53 +++++++++++++++---- src/state/actions-creators/CheckPage.js | 15 ++++-- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/components/Tickets/CheckPage/CheckEnterPage.js b/src/components/Tickets/CheckPage/CheckEnterPage.js index a2b1f49..2f362d7 100644 --- a/src/components/Tickets/CheckPage/CheckEnterPage.js +++ b/src/components/Tickets/CheckPage/CheckEnterPage.js @@ -1,11 +1,10 @@ import React, { useState } from 'react'; import history from '../../../history'; import { Navigate, useNavigate } from 'react-router-dom'; -import { Button, Radio } from 'antd'; +import { Button } from 'antd'; export default function CheckEnterPage() { let navigate = useNavigate(); - const [size, setSize] = useState('large'); const obRearCam = () => { // navigate('/tickets/check', { diff --git a/src/components/Tickets/CheckPage/CheckPage.js b/src/components/Tickets/CheckPage/CheckPage.js index f0a0fd9..2e7ddd1 100644 --- a/src/components/Tickets/CheckPage/CheckPage.js +++ b/src/components/Tickets/CheckPage/CheckPage.js @@ -6,33 +6,46 @@ import { checkPage } from '../../../state/actions-creators/CheckPage'; import './video.css'; import { ReactComponent as Scanner } from './scanner.svg'; import history from '../../../history'; +import { message } from 'antd'; function CheckPage() { const dispatch = useDispatch(); const location = useLocation(); - const [isOldOrYoung, setIsOldOrYoung] = useState(''); - const [isFrontOrRear, setIsFrontOrRear] = useState(''); const { data, pending } = useSelector(state => state.checkPage); + const [count, setCount] = useState(0); useEffect(() => { if (!history.location.state) { history.push('ticket/checkenter'); } + console.log(count); // console.log('history.location.state:', history.location.state); //result: '{date: 'OB', cam: 'environment'}' // console.log('location:', location); //result: '{pathname: '/tickets/check', search: '', hash: '', state: {…}, key: 'xf82gqmb'}' - setIsOldOrYoung(history.location.state.date); - setIsFrontOrRear(history.location.state.cam); //정상작동! - }, [location]); + }, [location, count]); + + const addCount = () => { + setCount(count + 1); + }; const handleScan = (result, error) => { - if (!!result) { + // console.log('result:', result); + addCount(); + if (result && count >= 4) { console.log('result:', result); - + setCount(count + 1); dispatch( - checkPage({ uuid: result.text }, { date: history.location.state.date }) + checkPage( + { uuid: result.text }, + { date: history.location.state.date }, + message, + () => { + setCount(0); + } + ) ); } + console.log('count:', count); }; // const handleClick = () => { @@ -43,9 +56,27 @@ function CheckPage() { <> {/* // history.location.state.cam 확인용 버튼 */} { + // console.log('result:', result); + addCount(); + if (result && count >= 4) { + console.log('result:', result); + setCount(count + 1); + dispatch( + checkPage( + { uuid: result.text }, + { date: history.location.state.date }, + message, + () => { + setCount(0); + } + ) + ); + } + console.log('count:', count); + }} + constraints={{ facingMode: `${history.location.state.cam}` }} videoStyle={{}} videoContainerStyle={{ display: 'block', diff --git a/src/state/actions-creators/CheckPage.js b/src/state/actions-creators/CheckPage.js index e9a6740..04f1154 100644 --- a/src/state/actions-creators/CheckPage.js +++ b/src/state/actions-creators/CheckPage.js @@ -6,7 +6,7 @@ import { } from '../action-types/checkPage.js'; export const checkPage = - ({ uuid }, { date }, callback) => + ({ uuid }, { date }, message, callback) => async dispatch => { try { dispatch({ type: CHECKING_PENDING }); @@ -20,13 +20,18 @@ export const checkPage = console.log('서버 응답?', response); console.log('uuid, date: ', uuid, ',,,,', date); + message.success('조회에 성공했습니다. 입장이 가능합니다.'); dispatch({ type: CHECKING_SUCCESS, payload: '조회 성공' }); // 자동으로 피쳐로 넘어가게끔 - // callback(); + callback(); } catch (e) { - //400 ~ - dispatch({ type: CHECKING_ERROR, payload: '조회 실패' }); - console.log(e); + //400 ~ 에러 타입에 따라서 경고메세지 다르게 표시 + // dispatch({ type: CHECKING_ERROR, payload: error }); + // console.log('ERROR: ', error.response.data.error.message); + const ERROR = e.response.data.error.message; + console.log('ERROR:', ERROR); + message.warn(`${ERROR}`); + dispatch({ type: CHECKING_ERROR, payload: e }); } }; From 6c338669dad5219042e44a8620325d1eb50d24cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=8E=E1=85=A1=E1=86=AB=E1=84=8C?= =?UTF-8?q?=E1=85=B5=E1=86=AB?= Date: Wed, 10 Aug 2022 16:02:47 +0900 Subject: [PATCH 3/4] =?UTF-8?q?:hammer:=20fix(checkPage)=20:=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B9=B4=EB=A9=94?= =?UTF-8?q?=EB=9D=BC=ED=99=95=EC=9D=B8=20=EC=B9=B4=EC=9A=B4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Tickets/CheckPage/CheckPage.js | 60 ++++++------------- src/state/action-types/checkPage.js | 2 + src/state/actions-creators/CheckPage.js | 56 ++++++++++------- src/state/reducers/CheckPage.js | 24 ++++++-- 4 files changed, 72 insertions(+), 70 deletions(-) diff --git a/src/components/Tickets/CheckPage/CheckPage.js b/src/components/Tickets/CheckPage/CheckPage.js index 2e7ddd1..bc1cc61 100644 --- a/src/components/Tickets/CheckPage/CheckPage.js +++ b/src/components/Tickets/CheckPage/CheckPage.js @@ -2,7 +2,10 @@ import React, { useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { useSelector, useDispatch } from 'react-redux'; import { QrReader } from 'react-qr-reader'; -import { checkPage } from '../../../state/actions-creators/CheckPage'; +import { + checkCount, + checkPage +} from '../../../state/actions-creators/CheckPage'; import './video.css'; import { ReactComponent as Scanner } from './scanner.svg'; import history from '../../../history'; @@ -12,8 +15,7 @@ function CheckPage() { const dispatch = useDispatch(); const location = useLocation(); - const { data, pending } = useSelector(state => state.checkPage); - const [count, setCount] = useState(0); + const { data, pending, count } = useSelector(state => state.checkPage); useEffect(() => { if (!history.location.state) { @@ -24,28 +26,17 @@ function CheckPage() { // console.log('location:', location); //result: '{pathname: '/tickets/check', search: '', hash: '', state: {…}, key: 'xf82gqmb'}' }, [location, count]); - const addCount = () => { - setCount(count + 1); - }; - const handleScan = (result, error) => { - // console.log('result:', result); - addCount(); - if (result && count >= 4) { - console.log('result:', result); - setCount(count + 1); - dispatch( - checkPage( - { uuid: result.text }, - { date: history.location.state.date }, - message, - () => { - setCount(0); - } - ) - ); - } - console.log('count:', count); + dispatch( + checkPage( + { uuid: result ? result.text : null }, + { date: history.location.state.date }, + message + ) + ); + + dispatch(checkCount()); + // console.log('count:', count); }; // const handleClick = () => { @@ -57,25 +48,7 @@ function CheckPage() { {/* // history.location.state.cam 확인용 버튼 */} { - // console.log('result:', result); - addCount(); - if (result && count >= 4) { - console.log('result:', result); - setCount(count + 1); - dispatch( - checkPage( - { uuid: result.text }, - { date: history.location.state.date }, - message, - () => { - setCount(0); - } - ) - ); - } - console.log('count:', count); - }} + onResult={handleScan} constraints={{ facingMode: `${history.location.state.cam}` }} videoStyle={{}} videoContainerStyle={{ @@ -86,6 +59,7 @@ function CheckPage() { paddingTop: '0' }} /> + {count}
{/* */} diff --git a/src/state/action-types/checkPage.js b/src/state/action-types/checkPage.js index 2abcc4c..9025cf7 100644 --- a/src/state/action-types/checkPage.js +++ b/src/state/action-types/checkPage.js @@ -1,4 +1,6 @@ export const CHECKING_PENDING = 'CHECKING_PENDING'; export const CHECKING_SUCCESS = 'CHECKING_SUCCESS'; export const CHECKING_ERROR = 'CHECKING_ERROR'; +export const CHECKING_COUNT = 'CHECKING_COUNT'; + //checkPage 대소문자 수정 diff --git a/src/state/actions-creators/CheckPage.js b/src/state/actions-creators/CheckPage.js index 04f1154..65e0ca4 100644 --- a/src/state/actions-creators/CheckPage.js +++ b/src/state/actions-creators/CheckPage.js @@ -2,36 +2,46 @@ import axios from 'axios'; import { CHECKING_PENDING, CHECKING_SUCCESS, - CHECKING_ERROR + CHECKING_ERROR, + CHECKING_COUNT } from '../action-types/checkPage.js'; +import { store } from '../storeSetting.js'; export const checkPage = ({ uuid }, { date }, message, callback) => async dispatch => { - try { - dispatch({ type: CHECKING_PENDING }); + const { checkPage } = store.getState(); + // console.log(); + if (uuid && checkPage.count > 4) { + try { + dispatch({ type: CHECKING_PENDING }); - const response = await axios.post( - `https://api.gosrock.band/v1/tickets/${uuid}/enter`, - { - date: `${date}` - } - ); - console.log('서버 응답?', response); - console.log('uuid, date: ', uuid, ',,,,', date); + const response = await axios.post( + `https://api.gosrock.band/v1/tickets/${uuid}/enter`, + { + date: `${date}` + } + ); + console.log('서버 응답?', response); + console.log('uuid, date: ', uuid, ',,,,', date); - message.success('조회에 성공했습니다. 입장이 가능합니다.'); - dispatch({ type: CHECKING_SUCCESS, payload: '조회 성공' }); + message.success('조회에 성공했습니다. 입장이 가능합니다.'); + dispatch({ type: CHECKING_SUCCESS, payload: '조회 성공' }); - // 자동으로 피쳐로 넘어가게끔 - callback(); - } catch (e) { - //400 ~ 에러 타입에 따라서 경고메세지 다르게 표시 - // dispatch({ type: CHECKING_ERROR, payload: error }); - // console.log('ERROR: ', error.response.data.error.message); - const ERROR = e.response.data.error.message; - console.log('ERROR:', ERROR); - message.warn(`${ERROR}`); - dispatch({ type: CHECKING_ERROR, payload: e }); + // 자동으로 피쳐로 넘어가게끔 + callback(); + } catch (e) { + //400 ~ 에러 타입에 따라서 경고메세지 다르게 표시 + // dispatch({ type: CHECKING_ERROR, payload: error }); + // console.log('ERROR: ', error.response.data.error.message); + const ERROR = e.response.data.error.message; + console.log('ERROR:', ERROR); + message.warn(`${ERROR}`); + dispatch({ type: CHECKING_ERROR, payload: e }); + } } }; + +export const checkCount = () => async dispatch => { + dispatch({ type: CHECKING_COUNT }); +}; diff --git a/src/state/reducers/CheckPage.js b/src/state/reducers/CheckPage.js index bcecb2d..d5c39b0 100644 --- a/src/state/reducers/CheckPage.js +++ b/src/state/reducers/CheckPage.js @@ -2,7 +2,8 @@ import { CHECKING_PENDING, CHECKING_SUCCESS, - CHECKING_ERROR + CHECKING_ERROR, + CHECKING_COUNT } from '../action-types/checkPage.js'; export default function ( @@ -11,7 +12,8 @@ export default function ( userUuid: '' }, error: null, - pending: false + pending: false, + count: 0 }, action ) { @@ -19,9 +21,23 @@ export default function ( case CHECKING_PENDING: return { ...state, data: action.payload, error: null, pending: true }; case CHECKING_SUCCESS: - return { ...state, data: action.payload, error: null, pending: false }; + return { + ...state, + data: action.payload, + error: null, + count: 0, + pending: false + }; case CHECKING_ERROR: - return { ...state, data: [], error: action.payload, pending: false }; + return { + ...state, + data: [], + error: action.payload, + count: 0, + pending: false + }; + case CHECKING_COUNT: + return { ...state, count: state.count + 1 }; default: return state; } From dc75781f67d984891b699f04aa296fd39411e403 Mon Sep 17 00:00:00 2001 From: bongsh0112 Date: Wed, 10 Aug 2022 16:10:58 +0900 Subject: [PATCH 4/4] =?UTF-8?q?:fix:=20CheckPage=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EC=99=84=EB=A3=8C=20#29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Tickets/CheckPage/CheckPage.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Tickets/CheckPage/CheckPage.js b/src/components/Tickets/CheckPage/CheckPage.js index bc1cc61..a85a5bb 100644 --- a/src/components/Tickets/CheckPage/CheckPage.js +++ b/src/components/Tickets/CheckPage/CheckPage.js @@ -21,10 +21,9 @@ function CheckPage() { if (!history.location.state) { history.push('ticket/checkenter'); } - console.log(count); // console.log('history.location.state:', history.location.state); //result: '{date: 'OB', cam: 'environment'}' // console.log('location:', location); //result: '{pathname: '/tickets/check', search: '', hash: '', state: {…}, key: 'xf82gqmb'}' - }, [location, count]); + }, [location]); const handleScan = (result, error) => { dispatch( @@ -59,7 +58,6 @@ function CheckPage() { paddingTop: '0' }} /> - {count}
{/* */}