Commit 368e8dbe authored by Spark's avatar Spark
Browse files

doe_array using form as=select

parent 4527d9d2
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
"react-use": "^17.2.4", "react-use": "^17.2.4",
"sass": "^1.35.1", "sass": "^1.35.1",
"sequelize": "^6.6.5", "sequelize": "^6.6.5",
"sweetalert2": "^11.0.19",
"web-vitals": "^1.1.2" "web-vitals": "^1.1.2"
} }
}, },
...@@ -20778,6 +20779,14 @@ ...@@ -20778,6 +20779,14 @@
"boolbase": "~1.0.0" "boolbase": "~1.0.0"
} }
}, },
"node_modules/sweetalert2": {
"version": "11.0.19",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.0.19.tgz",
"integrity": "sha512-fJkiIhvOjDux8Ns08uWNdWPcLql5tpMpiuc78sYLjY9zTBvkj7rvmPHHckdkAZLKVGUmOfy8ckDZ1ElS0lLpjw==",
"funding": {
"url": "https://sweetalert2.github.io/#donations"
}
},
"node_modules/symbol-tree": { "node_modules/symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
...@@ -39678,6 +39687,11 @@ ...@@ -39678,6 +39687,11 @@
} }
} }
}, },
"sweetalert2": {
"version": "11.0.19",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.0.19.tgz",
"integrity": "sha512-fJkiIhvOjDux8Ns08uWNdWPcLql5tpMpiuc78sYLjY9zTBvkj7rvmPHHckdkAZLKVGUmOfy8ckDZ1ElS0lLpjw=="
},
"symbol-tree": { "symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"react-use": "^17.2.4", "react-use": "^17.2.4",
"sass": "^1.35.1", "sass": "^1.35.1",
"sequelize": "^6.6.5", "sequelize": "^6.6.5",
"sweetalert2": "^11.0.19",
"web-vitals": "^1.1.2" "web-vitals": "^1.1.2"
}, },
"scripts": { "scripts": {
......
import React from 'react' import React, { useEffect, useState } from 'react'
import '../App.css' import '../App.css'
import { Form, Button, Row, Col, Card, DropdownButton, Dropdown, ButtonGroup } from 'react-bootstrap'; import { Form, Button, Row, Col, Card, DropdownButton, Dropdown, ButtonGroup } from 'react-bootstrap';
import { useState } from 'react';
import axios from 'axios'; import axios from 'axios';
// import { doeCode } from '../utils/Auth';
function LocCodeChange() { function LocCodeChange() {
...@@ -28,7 +26,6 @@ function LocCodeChange() { ...@@ -28,7 +26,6 @@ function LocCodeChange() {
padding: '10px' padding: '10px'
} }
const btnstyled2 = { const btnstyled2 = {
background: 'white', background: 'white',
margin: '1px', margin: '1px',
...@@ -47,34 +44,32 @@ function LocCodeChange() { ...@@ -47,34 +44,32 @@ function LocCodeChange() {
auth.style.visibility = 'visible' auth.style.visibility = 'visible'
} }
// console.log(typeof (locCode())) const [does, setDoes] = useState([])
// console.log(locCode()) const [sggs, setSggs] = useState([])
// const [ddoe, setDdoe] = useState([]) // const [emds, setEmds] = useState([])
// async function DoeCode() { const does_array = []
// await doeCode().then((res) => { const sggs_array = []
// // // // for (let i = 0; i < res.length; i++) { // const emds_array = []
// // // console.log(res[0]['code_doe']) does.map((doesObj) => does_array.push(doesObj['name_doe']))
// // // console.log(0, res[0]['name_doe']) sggs.map((sggsObj) => console.log(sggsObj['sgg']))
// ddoe.push(res[0]['name_doe']) console.log('does :: ', does)
// ddoe.push(res[1]['name_doe']) console.log('does_array:::', does_array)
// console.log(ddoe)
// console.log(typeof(ddoe)) async function getLocCode() {
// // // } const res = await axios.get("http://localhost:4500/api/data/loccode")
// }) const local_codes = res.data.locCodes
// } console.log('local_codes::: ', local_codes)
setDoes(local_codes.DOE)
const res = axios.get("localhost:4500/d/loccode"); setSggs(local_codes.SGG)
// const does = res.data["locCodes"]["DOE"] // object }
useEffect(() => {
getLocCode()
}, [])
return ( return (
<Row className='text-center w-100 my-2'> <Row className='text-center w-100 my-2'>
{/* {DoeCode()} */}
{/* {data} */}
asd
<Card style={cardstyled}> <Card style={cardstyled}>
<Card.Title id='impactTitle'> <Card.Title id='impactTitle'>
Local Code Local Code
...@@ -84,22 +79,34 @@ function LocCodeChange() { ...@@ -84,22 +79,34 @@ function LocCodeChange() {
</Card.Subtitle> </Card.Subtitle>
<hr /> <hr />
<Card.Text> <Card.Text>
<Form style={inboxstyled}> <Form style={inboxstyled}>
<Row className='m-auto w-100 d-flex justify-content-center'> <Row className='m-auto w-100 d-flex justify-content-center'>
<Col md={12} xs={12} style={{ padding: '0', display: 'flex', justifyContent: 'center', width: '100%' }}> <Col md={12} xs={12} style={{ padding: '0', display: 'flex', justifyContent: 'center', width: '100%' }}>
{['', '시군구', '읍면동'].map((localname) => ( <Form.Group style={btnstyled2}>
<DropdownButton <Form.Control as='select' aria-label="Floating label select example">
variant='light' <option></option>
style={btnstyled2} {does.map((doe) => (
title='지역코드' <option value={`${doe["code_doe"]}`}>
as={ButtonGroup} {`${doe["name_doe"]}`}</option>
title={` ${localname} `}> ))}
</Form.Control>
<Dropdown.Item></Dropdown.Item> <Form.Control as='select' aria-label="Floating label select example">
<Dropdown.Item>Another action</Dropdown.Item> <option>시군구</option>
<Dropdown.Item>Something else here</Dropdown.Item> {does.map((doe) => (
</DropdownButton> <option value={`${doe["code_doe"]}`}>
))} {`${doe["name_doe"]}`}</option>
))}
</Form.Control>
<Form.Control as='select' aria-label="Floating label select example">
<option>읍면동</option>
{does.map((doe) => (
<option value={`${doe["code_doe"]}`}>
{`${doe["name_doe"]}`}</option>
))}
</Form.Control>
</Form.Group>
<Button variant='light' style={btnstyled2} onClick={!locCodeShow && handleClickLoc}>확인</Button> <Button variant='light' style={btnstyled2} onClick={!locCodeShow && handleClickLoc}>확인</Button>
</Col> </Col>
<Col md={6} xs={4} id='loc-code' style={{ <Col md={6} xs={4} id='loc-code' style={{
...@@ -109,8 +116,8 @@ function LocCodeChange() { ...@@ -109,8 +116,8 @@ function LocCodeChange() {
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
padding: '2px', padding: '2px',
visibility: 'hidden', // visibility: 'hidden',
transition: 'all 4s' transition: 'all 2s'
}}> }}>
지역코드 지역코드
</Col> </Col>
......
...@@ -31,7 +31,15 @@ function LoginComp() { ...@@ -31,7 +31,15 @@ function LoginComp() {
function CheckEmailSend() { function CheckEmailSend() {
setEmailSent(!emailSent) setEmailSent(!emailSent)
}
function addressUrl() {
localStorage.setItem('Email-Address', emailAddress) localStorage.setItem('Email-Address', emailAddress)
const afterAt = localStorage.getItem('Email-Address').split('@')[1]
console.log(afterAt)
const newLink = 'https://www.' + afterAt;
window.open(newLink);
} }
const [emailAddress, setEmailAddress] = useState('') const [emailAddress, setEmailAddress] = useState('')
...@@ -41,7 +49,6 @@ function LoginComp() { ...@@ -41,7 +49,6 @@ function LoginComp() {
console.log(emailAddress) console.log(emailAddress)
} }
const
return ( return (
<Row className='text-center w-100 my-2'> <Row className='text-center w-100 my-2'>
<Card style={cardstyled}> <Card style={cardstyled}>
...@@ -59,7 +66,7 @@ function LoginComp() { ...@@ -59,7 +66,7 @@ function LoginComp() {
<Col> <Col>
😍 이메일 전송이 완료 되었습니다. 😍 이메일 전송이 완료 되었습니다.
</Col> </Col>
<Alert.Link href='/' target='_blank' style={{ fontSize: '0.8em' }}> <Alert.Link href="" onClick={addressUrl} target='_blank' style={{ fontSize: '0.8em' }}>
이메일 확인 하러가기 이메일 확인 하러가기
</Alert.Link> </Alert.Link>
</Alert> </Alert>
...@@ -68,6 +75,9 @@ function LoginComp() { ...@@ -68,6 +75,9 @@ function LoginComp() {
<Col> <Col>
😭 이메일을 정확하게 적어주세요. 😭 이메일을 정확하게 적어주세요.
</Col> </Col>
<Alert.Link href="/signup" target='_blank' style={{ fontSize: '0.8em' }}>
회원가입 하러가기
</Alert.Link>
</Alert> </Alert>
} }
<Button onClick={() => setAlertShow(true)}>보여주고</Button> <Button onClick={() => setAlertShow(true)}>보여주고</Button>
...@@ -77,7 +87,8 @@ function LoginComp() { ...@@ -77,7 +87,8 @@ function LoginComp() {
<Form.Group controlId="formBasicEmail"> <Form.Group controlId="formBasicEmail">
<Form.Control type="email" placeholder="Email" onChange={handleChange} /> <Form.Control type="email" placeholder="Email" onChange={handleChange} />
</Form.Group> </Form.Group>
<Button variant='light' type="submit" id='formbtn' onClick={CheckEmailSend}> <Button variant='light' id='formbtn' onClick={CheckEmailSend}>
LOGIN LOGIN
</Button> </Button>
......
...@@ -38,6 +38,7 @@ function MainLayer() { ...@@ -38,6 +38,7 @@ function MainLayer() {
return ( return (
<> <>
<Row className='d-flex align-items-center m-auto w-100'> <Row className='d-flex align-items-center m-auto w-100'>
<Link to='/' className=' m-auto'> <Link to='/' className=' m-auto'>
<Image src='/images/EUE11.jpg' alt='EUE' style={boxstyled} /> <Image src='/images/EUE11.jpg' alt='EUE' style={boxstyled} />
......
...@@ -109,7 +109,7 @@ function SignupComp() { ...@@ -109,7 +109,7 @@ function SignupComp() {
<Button onClick={() => setAlertShow(true)}>보여주고</Button> <Button onClick={() => setAlertShow(true)}>보여주고</Button>
<Button onClick={() => setAlertShow(false)}>안보여주고</Button> <Button onClick={() => setAlertShow(false)}>안보여주고</Button>
</Row> </Row>
<Form style={inboxstyled} <Form style={inboxstyled}
onSubmit={handleSubmit}> onSubmit={handleSubmit}>
<Form.Group controlId="userEmail"> <Form.Group controlId="userEmail">
...@@ -138,7 +138,8 @@ function SignupComp() { ...@@ -138,7 +138,8 @@ function SignupComp() {
</Row> </Row>
</Form.Group> </Form.Group>
<Button variant='light' className='mt-2' type="submit" id='formbtn' onClick={CheckUserExist}> <Button variant='light' className='mt-2' id='formbtn' onClick={CheckUserExist}>
{/* type="submit" */}
Sign Up Sign Up
</Button> </Button>
</Form> </Form>
......
// # Global Routes
const BASE = "/api";
// # Data Routes
const DATA = "/data";
// Data - Collector
const DATA_INPUT = "/input";
// Data - Consumer
const DATA_USER = "/user";
const DATA_OUTSIDE = "/outside";
// # Local Code Data
const LOCCODE = "/loccode";
// # Auth
const SIGNUP = "/signup";
const LOGIN = "/login";
const CONFIRM = "/confirm";
const EDIT_PROFILE = "/edit-profile";
// # Detail Object
const DETAIL = "/:id";
const routes = {
base: BASE,
data: DATA,
dataInput: DATA_INPUT,
dataUser: DATA_USER,
dataOutside: DATA_OUTSIDE,
locCode: LOCCODE,
signup: SIGNUP,
login: LOGIN,
confirm: CONFIRM,
editProfile: EDIT_PROFILE,
Detail: (id) => {
if (id) {
return `/${id}`;
} else {
return DETAIL;
}
},
};
export default routes;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"main": "init.js", "main": "init.js",
"scripts": { "scripts": {
"dev:server": "nodemon --exec babel-node src/init.js --delay 2", "dev:server": "nodemon --exec babel-node src/init.js --delay 2",
"dev:server_window": "nodemon --exec\"npx babel-node src/init.js\" --delay 2", "dev:server_window": "nodemon --exec \"npx babel-node src/init.js\" --delay 2",
"start": "babel-node src/init.js" "start": "babel-node src/init.js"
}, },
"repository": { "repository": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment