Browse Source

회원 관련 주석

pull/1/head
박상현 9 months ago
parent
commit
9453db3f9f
  1. 3
      src/components/account/find/AccountFindPassword.js
  2. 3
      src/components/account/find/AccountFindTab.js
  3. 6
      src/components/account/find/AccountFindUserId.js
  4. 7
      src/components/account/login/AccountLogin.js
  5. 12
      src/components/account/mypage/AccountMypagePwForm.js
  6. 6
      src/components/account/register/AccountRegister.js
  7. 1
      src/components/account/register/AccountRegisterComplete.js
  8. 17
      src/components/account/register/AccountRegisterForm.js
  9. 10
      src/components/account/register/AccountRegisterTerm.js
  10. 19
      src/containers/account/find/AccounFindTabContainer.js

3
src/components/account/find/AccountFindPassword.js

@ -22,13 +22,16 @@ import { updatePwAction } from '../../../modules/account/find/actions/findAction
export const AccountFindPassword = props => { export const AccountFindPassword = props => {
const dispatch = useDispatch(); const dispatch = useDispatch();
// 탭 상태
const [activeTab, setActiveTab] = useState('2'); const [activeTab, setActiveTab] = useState('2');
// ** Function to toggle tabs // ** Function to toggle tabs
const toggle = tab => setActiveTab(tab); const toggle = tab => setActiveTab(tab);
//modal //modal
const [confirmModal, setConfirmModal] = useState(false); const [confirmModal, setConfirmModal] = useState(false);
// 비밀번호 변경 모달
const [saveModal, setSaveModal] = useState(false); const [saveModal, setSaveModal] = useState(false);
// 모달 관련 설정
const [modal, setModal] = useState({ const [modal, setModal] = useState({
isOpen: false, isOpen: false,
title: '', title: '',

3
src/components/account/find/AccountFindTab.js

@ -16,15 +16,18 @@ import { AccountFindPasswordContainer } from '../../../containers/account/find/A
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
export const AccountFindTab = props => { export const AccountFindTab = props => {
// 탭 상태
const [activeTab, setActiveTab] = useState('2'); const [activeTab, setActiveTab] = useState('2');
const history = useHistory(); const history = useHistory();
// 탭 변경 헨들러
const toggle = tab => setActiveTab(tab); const toggle = tab => setActiveTab(tab);
// const toggle = tab => { // const toggle = tab => {
// if (activeTab !== tab) setActiveTab(tab); // if (activeTab !== tab) setActiveTab(tab);
// }; // };
// 닫기 버튼 헨들러
const handlerClose = () => { const handlerClose = () => {
history.push(`/account/login`); history.push(`/account/login`);
}; };

6
src/components/account/find/AccountFindUserId.js

@ -23,6 +23,7 @@ import { findAPI } from '../../../modules/account/find/apis/findApi';
export const AccountFindUserId = props => { export const AccountFindUserId = props => {
const dispatch = useDispatch(); const dispatch = useDispatch();
// 탭 상태
const [activeTab, setActiveTab] = useState('2'); const [activeTab, setActiveTab] = useState('2');
// ** Function to toggle tabs // ** Function to toggle tabs
@ -30,6 +31,7 @@ export const AccountFindUserId = props => {
//modal //modal
const [confirmModal, setConfirmModal] = useState(false); const [confirmModal, setConfirmModal] = useState(false);
// 모달 관련 설정
const [modal, setModal] = useState({ const [modal, setModal] = useState({
isOpen: false, isOpen: false,
title: '', title: '',
@ -55,6 +57,7 @@ export const AccountFindUserId = props => {
const [sendCount, setSendCount] = useState(0); const [sendCount, setSendCount] = useState(0);
const [isCrtfy, setIsCrtfy] = useState(false); const [isCrtfy, setIsCrtfy] = useState(false);
// 타이머 시작 && 언마운트 종료
useEffect(() => { useEffect(() => {
setIsRunning(true); setIsRunning(true);
if (isRunning) clearInterval(timer); if (isRunning) clearInterval(timer);
@ -64,6 +67,7 @@ export const AccountFindUserId = props => {
}; };
}, []); }, []);
// 인증번호 발송 헨들러
const handlerSend = async () => { const handlerSend = async () => {
if (!inputName) { if (!inputName) {
setModal({ setModal({
@ -126,6 +130,7 @@ export const AccountFindUserId = props => {
} }
}; };
// 타이머 시작
const timeStart = () => { const timeStart = () => {
if (isRunning) { if (isRunning) {
clearInterval(timer); clearInterval(timer);
@ -138,6 +143,7 @@ export const AccountFindUserId = props => {
timerStart(180); timerStart(180);
}; };
// 타이머 시작 헨들러
const timerStart = count => { const timerStart = count => {
let minutes, seconds; let minutes, seconds;

7
src/components/account/login/AccountLogin.js

@ -18,8 +18,10 @@ import kacLogo from '../../../assets/images/logo/kac_logo.svg';
export const AccountLogin = ({ props }) => { export const AccountLogin = ({ props }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
// 로그인 결과
const { isLogin, message } = useSelector(state => state.authState); const { isLogin, message } = useSelector(state => state.authState);
// 로그인 폼
const [loginForm, setLoginForm] = useState({ const [loginForm, setLoginForm] = useState({
userId: 'palnet', userId: 'palnet',
userPswd: '' userPswd: ''
@ -32,6 +34,7 @@ export const AccountLogin = ({ props }) => {
desc: '' desc: ''
}); });
// 로그인 폼 변경 헨들러
const handelrChange = e => { const handelrChange = e => {
const { name, value } = e.target; const { name, value } = e.target;
setLoginForm({ setLoginForm({
@ -40,12 +43,14 @@ export const AccountLogin = ({ props }) => {
}); });
}; };
// 엔터키 이벤트
const onKeyPress = e => { const onKeyPress = e => {
if (e.key == 'Enter') { if (e.key == 'Enter') {
handelrLogin(); handelrLogin();
} }
}; };
// 로그인 버튼 헨들러
const handelrLogin = () => { const handelrLogin = () => {
if (!loginForm.userId) { if (!loginForm.userId) {
setModal({ setModal({
@ -66,6 +71,7 @@ export const AccountLogin = ({ props }) => {
dispatch(Actions.login.request(loginForm)); dispatch(Actions.login.request(loginForm));
}; };
// 로그인 실패 모달
useEffect(() => { useEffect(() => {
if (message) { if (message) {
setModal({ setModal({
@ -76,6 +82,7 @@ export const AccountLogin = ({ props }) => {
} }
}, [message]); }, [message]);
// 로그인 성공시 메인화면으로 이동
useEffect(() => { useEffect(() => {
if (isLogin) { if (isLogin) {
// props.history.push('/'); // props.history.push('/');

12
src/components/account/mypage/AccountMypagePwForm.js

@ -22,22 +22,30 @@ import { useHistory } from 'react-router-dom';
import { ErrorModal } from '../../modal/ErrorModal'; import { ErrorModal } from '../../modal/ErrorModal';
const AccountMypagePwForm = ({ activeTab }) => { const AccountMypagePwForm = ({ activeTab }) => {
// 비밀번호 확인 결과
const { result } = useSelector(state => state.UserPageState); const { result } = useSelector(state => state.UserPageState);
// 기존 비밀번호
const [userPswd, setuserPswd] = useState(''); const [userPswd, setuserPswd] = useState('');
// 새로운 비밀번호
const [inputs, setInputs] = useState({ const [inputs, setInputs] = useState({
newPswd: '', newPswd: '',
newPswdConfirm: '' newPswdConfirm: ''
}); });
// 새로운 비밀번호 구조 분해 할당
const { newPswd, newPswdConfirm } = inputs; const { newPswd, newPswdConfirm } = inputs;
// 결과 확인 상태
const [resultOk, setresultOk] = useState(true); const [resultOk, setresultOk] = useState(true);
// 버튼 확인 상태
const [btnOk, setbtnOk] = useState(false); const [btnOk, setbtnOk] = useState(false);
// 모달 상태
const [modal, setModal] = useState({ const [modal, setModal] = useState({
isOpen: false, isOpen: false,
title: '', title: '',
desc: '' desc: ''
}); });
// 비밀번호 확인 결과 헨들러
useEffect(() => { useEffect(() => {
if (result) { if (result) {
if (result.errorCode) { if (result.errorCode) {
@ -50,6 +58,7 @@ const AccountMypagePwForm = ({ activeTab }) => {
} }
}, [result]); }, [result]);
// 탭 변경시 초기화
useEffect(() => { useEffect(() => {
setresultOk(true); setresultOk(true);
setbtnOk(false); setbtnOk(false);
@ -59,15 +68,18 @@ const AccountMypagePwForm = ({ activeTab }) => {
const history = useHistory(); const history = useHistory();
// 기존 비밀번호 변경 헨들러
const onChange = e => { const onChange = e => {
setuserPswd(e.target.value); setuserPswd(e.target.value);
}; };
// 엔터키 이벤트
const onKeyPress = e => { const onKeyPress = e => {
if (e.key == 'Enter') { if (e.key == 'Enter') {
pwok(); pwok();
} }
}; };
// 인풋 변경 이벤트
const onChanges = e => { const onChanges = e => {
const { value, name } = e.target; const { value, name } = e.target;
setInputs({ setInputs({

6
src/components/account/register/AccountRegister.js

@ -7,13 +7,19 @@ import '../../../assets/css/custom.css';
import { AccountRegisterComplete } from './AccountRegisterComplete'; import { AccountRegisterComplete } from './AccountRegisterComplete';
export const AccountRegister = ({ props }) => { export const AccountRegister = ({ props }) => {
// step
const [stepper, setStepper] = useState(null); const [stepper, setStepper] = useState(null);
// 회원명
const [memberName, setMemberName] = useState(); const [memberName, setMemberName] = useState();
// 참조값
const ref = useRef(null); const ref = useRef(null);
// 페이지 이동
const movePage = url => { const movePage = url => {
props.history.push(url); props.history.push(url);
}; };
// 약관 동의
const steps = [ const steps = [
{ {
id: 'account-term', id: 'account-term',

1
src/components/account/register/AccountRegisterComplete.js

@ -8,6 +8,7 @@ export const AccountRegisterComplete = ({
movePage, movePage,
memberName memberName
}) => { }) => {
// 페이지 이동
const handlerLogin = () => { const handlerLogin = () => {
movePage('/account/login'); movePage('/account/login');
}; };

17
src/components/account/register/AccountRegisterForm.js

@ -28,13 +28,21 @@ export const AccountRegisterForm = ({
testName, testName,
setMemberName setMemberName
}) => { }) => {
// 약관동의 내용
const { agreeTerms } = useSelector(state => state.accountState); const { agreeTerms } = useSelector(state => state.accountState);
// 분단위 카운터
const [minutes_Counter, setMinutes_Counter] = useState('03'); const [minutes_Counter, setMinutes_Counter] = useState('03');
// 초단위 카운터
const [seconds_Counter, setSeconds_Counter] = useState('00'); const [seconds_Counter, setSeconds_Counter] = useState('00');
// 타이머
const [timer, setTimer] = useState(null); const [timer, setTimer] = useState(null);
// 타이머 시작 여부
const [isRunning, setIsRunning] = useState(false); const [isRunning, setIsRunning] = useState(false);
// 인증번호 발송 횟수
const [sendCount, setSendCount] = useState(0); const [sendCount, setSendCount] = useState(0);
// 인증번호 발송 여부
const [isCrtfy, setIsCrtfy] = useState(false); const [isCrtfy, setIsCrtfy] = useState(false);
// 모달 상태
const [modal, setModal] = useState({ const [modal, setModal] = useState({
isOpen: false, isOpen: false,
title: '', title: '',
@ -42,6 +50,7 @@ export const AccountRegisterForm = ({
}); });
const dispatch = useDispatch(); const dispatch = useDispatch();
// 타이머 시작
const timerStart = count => { const timerStart = count => {
let minutes, seconds; let minutes, seconds;
@ -70,6 +79,7 @@ export const AccountRegisterForm = ({
}; };
}; };
// 인증번호 발송하기 헨들러
const handlerSmsSend = async () => { const handlerSmsSend = async () => {
const vData = getValues(); const vData = getValues();
@ -132,6 +142,7 @@ export const AccountRegisterForm = ({
// handlerSmsSend(); // handlerSmsSend();
}; };
// 인증번호 인증 헨들러
useEffect(() => { useEffect(() => {
if (isRunning) { if (isRunning) {
clearInterval(timer); clearInterval(timer);
@ -144,6 +155,7 @@ export const AccountRegisterForm = ({
}; };
}, []); }, []);
// 회원가입 폼 유효성 검사
const SignupSchema = yup.object().shape({ const SignupSchema = yup.object().shape({
userId: yup.string().trim().required('ID를 입력해 주세요.'), userId: yup.string().trim().required('ID를 입력해 주세요.'),
// .matches( // .matches(
@ -206,10 +218,12 @@ export const AccountRegisterForm = ({
resolver: yupResolver(SignupSchema) resolver: yupResolver(SignupSchema)
}); });
// 취소 헨들러
const handlerCancel = async () => { const handlerCancel = async () => {
movePage('/account/login'); movePage('/account/login');
}; };
// 회원가입 버튼 헨들러
const onSubmit = async data => { const onSubmit = async data => {
if (isObjEmpty(errors)) { if (isObjEmpty(errors)) {
if (!isCrtfy) { if (!isCrtfy) {
@ -250,6 +264,7 @@ export const AccountRegisterForm = ({
} }
}; };
// 인증번호 인증 헨들러
const handlerSmsConfirm = async () => { const handlerSmsConfirm = async () => {
const vData = getValues(); const vData = getValues();
@ -288,6 +303,8 @@ export const AccountRegisterForm = ({
let hpno = ''; let hpno = '';
let brthdyDate = ''; let brthdyDate = '';
let trmnlId = ''; let trmnlId = '';
// 회원가입 폼 변경 헨들러
const onChangeHandler = e => { const onChangeHandler = e => {
const { name, value } = e.target; const { name, value } = e.target;

10
src/components/account/register/AccountRegisterTerm.js

@ -14,8 +14,9 @@ import { useDispatch, useSelector } from 'react-redux';
import * as Actions from '../../../modules/account/register/actions/accountAction'; import * as Actions from '../../../modules/account/register/actions/accountAction';
export const AccountRegisterTerm = ({ stepper, type, movePage }) => { export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
// 약관 목록
const { termsList } = useSelector(state => state.accountState); const { termsList } = useSelector(state => state.accountState);
// 약관 동의 데이터
const [termChecked, setTermCheckd] = useState({ const [termChecked, setTermCheckd] = useState({
privacy: false, privacy: false,
privacyId: '', privacyId: '',
@ -23,14 +24,18 @@ export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
serviceId: '', serviceId: '',
all: false all: false
}); });
// 모달 상태
const [openModal, setOpenModal] = useState(false); const [openModal, setOpenModal] = useState(false);
const dispatch = useDispatch(); const dispatch = useDispatch();
// 약관 동의
const [terms, setTerms] = useState({}); const [terms, setTerms] = useState({});
// 취소 버튼 헨들러
const handlerCancel = () => { const handlerCancel = () => {
movePage('/account/login'); movePage('/account/login');
}; };
// 약관 목록 조회
useEffect(() => { useEffect(() => {
dispatch( dispatch(
Actions.termsList.request({ Actions.termsList.request({
@ -41,6 +46,7 @@ export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
); );
}, []); }, []);
// 약관 목록 조회 결과
useEffect(() => { useEffect(() => {
if (termsList?.length > 0) { if (termsList?.length > 0) {
let termObject = { let termObject = {
@ -67,6 +73,7 @@ export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
} }
}, [termsList]); }, [termsList]);
// 다음 버튼 헨들러
const handlerNext = () => { const handlerNext = () => {
let agreeTerms = []; let agreeTerms = [];
if (!termChecked.privacy || !termChecked.service) { if (!termChecked.privacy || !termChecked.service) {
@ -101,6 +108,7 @@ export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
stepper.next(); stepper.next();
}; };
// 약관 동의 체크
const handlerChecked = type => { const handlerChecked = type => {
if (type === 'all') { if (type === 'all') {
const checked = !termChecked.all; const checked = !termChecked.all;

19
src/containers/account/find/AccounFindTabContainer.js

@ -1,16 +1,17 @@
import { AccountFindTab } from "../../../components/account/find/AccountFindTab"; import { AccountFindTab } from '../../../components/account/find/AccountFindTab';
import loginImg from '../../../assets/images/login01.png'; import loginImg from '../../../assets/images/login01.png';
import { Button } from 'reactstrap' import { Button } from 'reactstrap';
import '../../../assets/css/custom.css'; import '../../../assets/css/custom.css';
import { useHistory } from 'react-router-dom' import { useHistory } from 'react-router-dom';
import kacLogo from '../../../assets/images/logo/kac_logo.svg'; import kacLogo from '../../../assets/images/logo/kac_logo.svg';
export const AccountFindTabContainer = () => { export const AccountFindTabContainer = () => {
const history = useHistory(); const history = useHistory();
// 회원가입 바로가기
const handlerRegister = () => { const handlerRegister = () => {
history.push(`/account/register`) history.push(`/account/register`);
} };
return ( return (
<> <>
@ -23,19 +24,15 @@ export const AccountFindTabContainer = () => {
</div> */} </div> */}
<div className='login-form info-search'> <div className='login-form info-search'>
<div className='pal-card'> <div className='pal-card'>
<AccountFindTab /> <AccountFindTab />
</div> </div>
<div className='user-search-link'> <div className='user-search-link'>
<Button.Ripple <Button.Ripple color='flat-warning' onClick={handlerRegister}>
color='flat-warning'
onClick={handlerRegister}
>
회원가입 바로가기 회원가입 바로가기
</Button.Ripple> </Button.Ripple>
</div> </div>
</div> </div>
</div> </div>
</> </>
); );
}; };

Loading…
Cancel
Save