From bf26864f61cbda31c3f4a0ebc0a5d2c0e67ae235 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 11:04:22 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EB=A1=9C=EC=A7=81=20=EB=B0=98=EB=B3=B5=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=90=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.js | 12 ++++++------ src/components/header/Header.jsx | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/layout.js b/src/app/layout.js index 3383aa10..2aa1a30a 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -51,13 +51,13 @@ export default async function RootLayout({ children }) { } } - if (!headerPathname.includes('/login') && !session.isLoggedIn) { - redirect('/login') - } + // if (!headerPathname.includes('/login') && !session.isLoggedIn) { + // redirect('/login') + // } - if (headerPathname === '/login' && session.isLoggedIn) { - redirect('/') - } + // if (headerPathname === '/login' && session.isLoggedIn) { + // redirect('/') + // } return ( diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index b8cfafd2..2e2e98cd 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -85,9 +85,9 @@ export default function Header(props) { }) } - useEffect(() => { - getAutoLoginParam() - }, [userSession]) + // useEffect(() => { + // getAutoLoginParam() + // }, [userSession]) const menus = [ { id: 0, name: 'header.menus.home', url: '/', children: [] }, From c1fb6a08cafaf0d81b5e06c6f46f25b371bf9d16 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 11:20:19 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=8F=84=EB=A9=B4=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20=EB=B2=84=ED=8A=BC=20=EC=95=88=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/Login.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index af50a515..d53bd12d 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -87,6 +87,7 @@ export default function Login() { } await promisePost({ url: '/api/login/v1.0/login', data: param }) .then((res) => { + console.log('🚀 ~ .then ~ res:', res) if (res) { if (res.data.result.resultCode === 'S') { setSession(res.data.data) @@ -97,7 +98,7 @@ export default function Login() { } else { Cookies.remove('chkLoginId') } - router.push('/') + // router.push('/') } else { alert(res.data.result.resultMsg) } @@ -106,6 +107,8 @@ export default function Login() { .catch((error) => { alert(error.response.data.message) }) + + router.push('/') } // 비밀번호 초기화 관련 From 4977abcf35993fb3764000696b618a8b2ac522ab Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 13:18:57 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=B2=98=EB=A6=AC=20=EC=9B=90=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.js | 12 ++++++------ src/components/auth/Login.jsx | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/layout.js b/src/app/layout.js index 2aa1a30a..3383aa10 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -51,13 +51,13 @@ export default async function RootLayout({ children }) { } } - // if (!headerPathname.includes('/login') && !session.isLoggedIn) { - // redirect('/login') - // } + if (!headerPathname.includes('/login') && !session.isLoggedIn) { + redirect('/login') + } - // if (headerPathname === '/login' && session.isLoggedIn) { - // redirect('/') - // } + if (headerPathname === '/login' && session.isLoggedIn) { + redirect('/') + } return ( diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index d53bd12d..98f7a5b6 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -98,7 +98,7 @@ export default function Login() { } else { Cookies.remove('chkLoginId') } - // router.push('/') + router.push('/') } else { alert(res.data.result.resultMsg) } @@ -107,8 +107,6 @@ export default function Login() { .catch((error) => { alert(error.response.data.message) }) - - router.push('/') } // 비밀번호 초기화 관련 From e07d61dc5f846720c9fe2122d5ce8c4cb99b2fa9 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 18 Dec 2024 13:27:05 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EC=A7=80=EB=B6=95=EC=9E=AC=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placementShape/PlacementShapeSetting.jsx | 2 +- .../roofAllocation/RoofAllocationSetting.jsx | 33 ++++++++++----- src/hooks/option/useCanvasSetting.js | 3 ++ .../roofcover/useRoofAllocationSetting.js | 41 ++++++++++++++++--- 4 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 9c2ade43..c508ad37 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -263,7 +263,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set {raftCodes.map((raft, index) => { return ( @@ -157,11 +160,21 @@ export default function RoofAllocationSetting(props) {
- -
diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js index 26b78b51..59cb4eef 100644 --- a/src/hooks/option/useCanvasSetting.js +++ b/src/hooks/option/useCanvasSetting.js @@ -125,6 +125,9 @@ export function useCanvasSetting() { //지붕재 초기세팅 const addRoofMaterials = async () => { + if (roofMaterials.length !== 0) { + return + } const { data } = await getRoofMaterialList() const roofLists = data.map((item, idx) => ({ ...item, diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index ff20c0cb..d2215131 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -1,6 +1,6 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil' import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { useSwal } from '@/hooks/useSwal' import { usePolygon } from '@/hooks/usePolygon' import { basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom' @@ -30,15 +30,12 @@ export function useRoofAllocationSetting(id) { const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) const [basicSetting, setBasicSetting] = useRecoilState(basicSettingState) const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재 - const [roofList, setRoofList] = useState([]) + const [roofList, setRoofList] = useState(basicSetting.roofs) // 배치면 초기설정에서 선택한 지붕재 배열 const [editingLines, setEditingLines] = useState([]) + const isFirstRef = useRef(0) const { setSurfaceShapePattern } = useRoofFn() - useEffect(() => { - setRoofList(basicSetting.roofs) - }, [basicSetting]) - useEffect(() => { const roofBases = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) // roofPolygon.innerLines @@ -211,6 +208,11 @@ export function useRoofAllocationSetting(id) { // 지붕재 변경 const handleChangeRoofMaterial = (value, index) => { + if (isFirstRef.current === 0) { + isFirstRef.current++ + return + } + const selectedRoofMaterial = roofMaterials.find((roof) => roof.roofMatlCd === value.id) const newRoofList = roofList.map((roof, idx) => { if (idx === index) { @@ -231,6 +233,31 @@ export function useRoofAllocationSetting(id) { setRoofList(newRoofList) } + // 서까래 변경 + const handleChangeRaft = (e, index) => { + const raftValue = e.value + + const newRoofList = roofList.map((roof, idx) => { + if (idx === index) { + return { ...roof, raft: raftValue } + } + return roof + }) + + setRoofList(newRoofList) + } + + const handleChangeLayout = (layoutValue, index) => { + const newRoofList = roofList.map((roof, idx) => { + if (idx === index) { + return { ...roof, layout: layoutValue } + } + return roof + }) + + setRoofList(newRoofList) + } + return { handleSave, onAddRoofMaterial, @@ -246,5 +273,7 @@ export function useRoofAllocationSetting(id) { roofList, handleDefaultRoofMaterial, handleChangeRoofMaterial, + handleChangeRaft, + handleChangeLayout, } }