From 384c1ae5e0771c30fd265bd8de1b65676cc843f4 Mon Sep 17 00:00:00 2001 From: Serin-Kim Date: Tue, 10 Aug 2021 12:46:08 +0900 Subject: [PATCH 1/2] test --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test \ No newline at end of file From ecf5f52d1a87cca886b386d4e2d9faf2fb3b98b5 Mon Sep 17 00:00:00 2001 From: Sae-byeol Date: Thu, 12 Aug 2021 07:10:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?mypage=20=ED=9A=8C=EC=9B=90=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 4 ++ src/EditMyPage.css | 65 ++++++++++++++++++++++++++++++ src/MyPage.css | 65 ++++++++++++++++++++++++++++++ src/component/EditMyPage.js | 80 +++++++++++++++++++++++++++++++++++++ src/component/Home.js | 2 + src/component/MyPage.js | 67 +++++++++++++++++++++++++++++++ 6 files changed, 283 insertions(+) create mode 100644 src/EditMyPage.css create mode 100644 src/MyPage.css create mode 100644 src/component/EditMyPage.js create mode 100644 src/component/MyPage.js diff --git a/src/App.js b/src/App.js index ddf0dfb..1e0861a 100644 --- a/src/App.js +++ b/src/App.js @@ -7,6 +7,8 @@ import Todo from './component/Todo'; import Dday from './component/Dday'; import Search from './component/Search'; import Dailynote from './component/Dailynote'; +import MyPage from './component/MyPage'; +import EditMyPage from './component/EditMyPage'; function App() { return ( @@ -19,6 +21,8 @@ function App() { + + ); diff --git a/src/EditMyPage.css b/src/EditMyPage.css new file mode 100644 index 0000000..3beaf42 --- /dev/null +++ b/src/EditMyPage.css @@ -0,0 +1,65 @@ +.EditMyPageTitle h1{ + color: #456268; + font-weight: bold; + font-size: 38px; +} +.EditMyPage{ + display: flex; + flex-direction: column; + align-items: center; + margin-top: 100px; +} + +.EditMyPageUser{ + display: flex; + flex-direction: row; + margin-top: 45px; + font-size: 18px; +} +.EditMyPageContent { + display: flex; + flex-direction: column; + margin-left: 40px; +} +.EditMyPageCont{ + margin-bottom: 43px; +} +.EditMyPageInputBtn input{ + padding: 10px; + border-radius: 4px; + border: 1px solid #dee2e6; + outline: none; + font-size: 15px; + width: 250px; +} + +.EditMyPageContentTitle{ + font-size: 20px; + font-weight: bold; + margin-right: 40px; + +} +.EditMyPageContentTitle div{ + margin-bottom: 40px; +} + +.EditMyPageEditBtn{ + color: #456268; + background-color: transparent; + width: 40px; + height: 40px; + font-size: 25px; + border: none; + outline: none; + position: relative; + margin-left: 20px; +} + +.EditMyPageEditBtn :hover { + opacity: 0.5; +} +.EditMyPageInputBtn{ + display: flex; + flex-direction: row; + margin-bottom: 25px; +} diff --git a/src/MyPage.css b/src/MyPage.css new file mode 100644 index 0000000..ad80b69 --- /dev/null +++ b/src/MyPage.css @@ -0,0 +1,65 @@ +.MyPage{ +} +.MyPageContent{ + display: flex; + flex-direction: column; + align-items: center; + margin-top: 30px; +} +.MyPageTitle h1{ + color: #456268; + font-weight: bold; + font-size: 38px; +} +.MyPageImage{ + width: 170px; + height: 170px; + border-radius: 70%; + background-color: white; + overflow: hidden; + margin-top: 45px; +} +.MyPageUser{ + display: flex; + flex-direction: row; + margin-top: 25px; +} +.MyPageUserContent{ + display: flex; + flex-direction: column; + font-size: 18px; + +} +.MyPageUserContent div{ + margin-bottom: 4px; +} + +.MyPageUserContentTitle{ + font-size: 20px; + font-weight: bold; + margin-right: 15px; +} +.MyPageBtns{ + margin-top: 40px; +} +.MyPageBtn { + color:#FCF8EC; + background-color:#456268; + border-color:#456268; + padding: 1rem 1.75rem; + font-size: 1.25rem; + margin-right: 1rem; + display: inline-block; + font-weight: 400; + line-height: 1.5; + text-align: center; + text-decoration: none; + vertical-align: middle; + cursor: pointer; + background-color: #456268; + border: 0.125rem solid transparent; + padding: 0.375rem 0.75rem; + font-size: 1rem; + border-radius: 0.5rem; + } + \ No newline at end of file diff --git a/src/component/EditMyPage.js b/src/component/EditMyPage.js new file mode 100644 index 0000000..de84f43 --- /dev/null +++ b/src/component/EditMyPage.js @@ -0,0 +1,80 @@ +import "../EditMyPage.css" +import React , {useState, useEffect,useCallback} from 'react'; +import axios from "axios"; +import { RiEdit2Fill } from "react-icons/ri"; + +export default function EditMyPage({location}){ + + const id=location.state.id; + const name=location.state.name; + const pw=location.state.pw; + const email=location.state.email; + const major=location.state.major; + + const [newEmail, setNewEmail]=useState(email); + const [newMajor, setNewMajor]=useState(major); + + const changeEmail=useCallback( + (e) => { + setNewEmail(e.target.value); + }, + [] + ); + const changeMajor=useCallback( + (e) => { + setNewMajor(e.target.value); + }, + [] + ); + + const editEmail=(id, {data})=>{ + console.log(data); + axios.post('/mypage/changeEmail',{ + id:id, + newEmail:data, + }) + + + } + const editMajor=(id, {data})=>{ + + axios.post('/mypage/changeMajor',{ + id:id, + newMajor:data, + }) + } + + return( +
+
+

회원정보 수정

+
+
+
+
이름
+
아이디
+
비밀번호
+
이메일
+
전공
+
+
+
{name}
+
{id}
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ ) +} \ No newline at end of file diff --git a/src/component/Home.js b/src/component/Home.js index 4032319..52e168d 100644 --- a/src/component/Home.js +++ b/src/component/Home.js @@ -97,9 +97,11 @@ function Home() {
+ +
{!isLoggedIn ? ( diff --git a/src/component/MyPage.js b/src/component/MyPage.js new file mode 100644 index 0000000..b794bb5 --- /dev/null +++ b/src/component/MyPage.js @@ -0,0 +1,67 @@ +import "../MyPage.css" +import Navbr from "./Navbar"; +import React , {useState, useEffect} from 'react'; +import Axios from 'axios'; +import {Link} from 'react-router-dom'; + +export default function MyPage(){ + const [user,setUser]=useState([]); + + useEffect(() => { + Axios.get("/mypage/info") + .then(res => { + console.log(res.data.data[0]); + setUser(res.data.data[0]); + }) + }, []) + + return( +
+
+ +
+
+
+

My Page

+
+
+ +
+
+
+
이름
+
아이디
+
이메일
+
전공
+
+ +
+
{user.name}
+
{user.id}
+
{user.email}
+
{user.major}
+
+
+ +
+ + + + + + + +
+
+
+ ) +}