diff --git a/package-lock.json b/package-lock.json index f2c0d4f..07a4241 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "react-to-pdf": "^2.0.0", "sass": "^1.87.0", "swiper": "^11.2.6", + "usehooks-ts": "^3.1.1", "zustand": "^5.0.3" }, "devDependencies": { @@ -3293,6 +3294,12 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "license": "MIT" + }, "node_modules/lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", @@ -4068,6 +4075,21 @@ "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", "license": "MIT" }, + "node_modules/usehooks-ts": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/usehooks-ts/-/usehooks-ts-3.1.1.tgz", + "integrity": "sha512-I4diPp9Cq6ieSUH2wu+fDAVQO43xwtulo+fKEidHUwZPnYImbtkTjzIJYcDcJqxgmX31GVqNFURodvcgHcW0pA==", + "license": "MIT", + "dependencies": { + "lodash.debounce": "^4.0.8" + }, + "engines": { + "node": ">=16.15.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18 || ^19 || ^19.0.0-rc" + } + }, "node_modules/utrie": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", diff --git a/package.json b/package.json index f10433c..519fd8a 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "react-to-pdf": "^2.0.0", "sass": "^1.87.0", "swiper": "^11.2.6", + "usehooks-ts": "^3.1.1", "zustand": "^5.0.3" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf1540d..b1875d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: swiper: specifier: ^11.2.6 version: 11.2.6 + usehooks-ts: + specifier: ^3.1.1 + version: 3.1.1(react@19.1.0) zustand: specifier: ^5.0.3 version: 5.0.3(@types/react@19.0.12)(react@19.1.0) @@ -1085,6 +1088,9 @@ packages: resolution: {integrity: sha512-6b6gd/RUXKaw5keVdSEtqFVdzWnU5jMxTUjA2bVcMNPLwSQ08Sv/UodBVtETLCn7k4S1Ibxwh7k68IwLZPgKaA==} engines: {node: '>= 12.0.0'} + lodash.debounce@4.0.8: + resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + lodash.includes@4.3.0: resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} @@ -1355,6 +1361,12 @@ packages: undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + usehooks-ts@3.1.1: + resolution: {integrity: sha512-I4diPp9Cq6ieSUH2wu+fDAVQO43xwtulo+fKEidHUwZPnYImbtkTjzIJYcDcJqxgmX31GVqNFURodvcgHcW0pA==} + engines: {node: '>=16.15.0'} + peerDependencies: + react: ^16.8.0 || ^17 || ^18 || ^19 || ^19.0.0-rc + utrie@1.0.2: resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==} @@ -2318,6 +2330,8 @@ snapshots: lightningcss-win32-arm64-msvc: 1.29.2 lightningcss-win32-x64-msvc: 1.29.2 + lodash.debounce@4.0.8: {} + lodash.includes@4.3.0: {} lodash.isboolean@3.0.3: {} @@ -2589,6 +2603,11 @@ snapshots: undici-types@6.19.8: {} + usehooks-ts@3.1.1(react@19.1.0): + dependencies: + lodash.debounce: 4.0.8 + react: 19.1.0 + utrie@1.0.2: dependencies: base64-arraybuffer: 1.0.2 diff --git a/src/api/auth.ts b/src/api/auth.ts new file mode 100644 index 0000000..00a415e --- /dev/null +++ b/src/api/auth.ts @@ -0,0 +1,22 @@ +'use server' + +import { sessionOptions } from '@/libs/session' +import type { SessionData } from '@/types/Auth' +import { getIronSession } from 'iron-session' +import { cookies } from 'next/headers' +import { redirect } from 'next/navigation' + +export const logout = async () => { + const cookieStore = await cookies() + const session = await getIronSession(cookieStore, sessionOptions) + + session.destroy() + return redirect('/login') +} + +export const getSession = async () => { + const cookieStore = await cookies() + const session = await getIronSession(cookieStore, sessionOptions) + + return session +} diff --git a/src/api/suitable.ts b/src/api/suitable.ts new file mode 100644 index 0000000..952f956 --- /dev/null +++ b/src/api/suitable.ts @@ -0,0 +1,107 @@ +import { database } from '@/data' +import { axiosInstance } from '@/libs/axios' + +export interface Suitable { + id?: number + product_name: string + manufacturer: string + roof_material: string + shape: string + support_roof_tile: string + support_roof_tile_memo: string + support_roof_bracket: string + support_roof_bracket_memo: string + yg_anchor: string + yg_anchor_memo: string + rg_roof_tile_part: string + rg_roof_tile_part_memo: string + dido_hunt_support_tile_2: string + dido_hunt_support_tile_2_memo: string + takashima_power_base: string + takashima_power_base_memo: string + takashima_tile_bracket: string + takashima_tile_bracket_memo: string + slate_bracket_4: string + slate_bracket_4_memo: string + slate_single_metal_bracket: string + slate_single_metal_bracket_memo: string + dido_hunt_short_rack_4: string + dido_hunt_short_rack_4_memo: string + takashima_slate_bracket_slate_single: string + takashima_slate_bracket_slate_single_memo: string + df_metal_bracket: string + df_metal_bracket_memo: string + slate_metal_bracket: string + slate_metal_bracket_memo: string + takashima_slate_bracket_metal_roof: string + takashima_slate_bracket_metal_roof_memo: string +} + +export const suitableApi = { + // getList: async (category?: string, keyword?: string): Promise => { + // let condition: any = {} + // if (category) { + // condition['category'] = category + // } + // if (keyword) { + // condition['keyword'] = { + // contains: keyword, + // } + // } + // console.log('🚀 ~ getList: ~ condition:', condition) + // const response = await axiosInstance(null).get('/api/suitable/list', { params: condition }) + // console.log('🚀 ~ getList: ~ response:', response) + // return response.data + // }, + // getCategory: async (): Promise => { + // const response = await axiosInstance(null).get('/api/suitable/category') + // console.log('🚀 ~ getCategory: ~ response:', response) + // return response.data + // }, + // getDetails: async (roofMaterial: string): Promise => { + // const response = await axiosInstance(null).get(`/api/suitable/details?roof-material=${roofMaterial}`) + // console.log('🚀 ~ getDetails: ~ response:', response) + // return response.data + // }, + // create: async () => { + // const suitableData: Suitable[] = [] + // database.forEach((item) => { + // suitableData.push({ + // product_name: item[0], + // manufacturer: item[1], + // roof_material: item[2], + // shape: item[3], + // support_roof_tile: item[4], + // support_roof_tile_memo: item[5], + // support_roof_bracket: item[6], + // support_roof_bracket_memo: item[7], + // yg_anchor: item[8], + // yg_anchor_memo: item[9], + // rg_roof_tile_part: item[10], + // rg_roof_tile_part_memo: item[11], + // dido_hunt_support_tile_2: item[12], + // dido_hunt_support_tile_2_memo: item[13], + // takashima_power_base: item[14], + // takashima_power_base_memo: item[15], + // takashima_tile_bracket: item[16], + // takashima_tile_bracket_memo: item[17], + // slate_bracket_4: item[18], + // slate_bracket_4_memo: item[19], + // slate_single_metal_bracket: item[20], + // slate_single_metal_bracket_memo: item[21], + // dido_hunt_short_rack_4: item[22], + // dido_hunt_short_rack_4_memo: item[23], + // takashima_slate_bracket_slate_single: item[24], + // takashima_slate_bracket_slate_single_memo: item[25], + // df_metal_bracket: item[26], + // df_metal_bracket_memo: item[27], + // slate_metal_bracket: item[28], + // slate_metal_bracket_memo: item[29], + // takashima_slate_bracket_metal_roof: item[30], + // takashima_slate_bracket_metal_roof_memo: item[31], + // }) + // }) + // const response = await axiosInstance(null).post('/api/suitable', suitableData) + // return response.data + // }, +} diff --git a/src/api/surveySales.ts b/src/api/surveySales.ts new file mode 100644 index 0000000..b17f053 --- /dev/null +++ b/src/api/surveySales.ts @@ -0,0 +1,127 @@ +import { axiosInstance } from '@/libs/axios' + +export interface SurveySalesBasicInfo { + id?: number + representative: string + store: string | null + construction_point: string | null + investigation_date: string | null + building_name: string | null + customer_name: string | null + post_code: string | null + address: string | null + address_detail: string | null + submission_status: boolean + submission_date?: string | null + detail_info?: SurveySalesDetailInfo | null +} + +export interface SurveySalesDetailInfo { + id?: number + contract_capacity: string | null + retail_company: string | null + supplementary_facilities: number | null + supplementary_facilities_etc: string | null + installation_system: number | null + installation_system_etc: string | null + construction_year: number | null + construction_year_etc: string | null + roof_material: number | null + roof_material_etc: string | null + roof_shape: number | null + roof_shape_etc: string | null + roof_slope: string | null + house_structure: number | null + house_structure_etc: string | null + rafter_material: number | null + rafter_material_etc: string | null + rafter_size: number | null + rafter_size_etc: string | null + rafter_pitch: number | null + rafter_pitch_etc: string | null + rafter_direction: number | null + open_field_plate_kind: number | null + open_field_plate_kind_etc: string | null + open_field_plate_thickness: string | null + leak_trace: boolean | null + waterproof_material: number | null + waterproof_material_etc: string | null + insulation_presence: number | null + insulation_presence_etc: string | null + structure_order: number | null + structure_order_etc: string | null + installation_availability: number | null + installation_availability_etc: string | null + memo: string | null +} + +export const surveySalesApi = { + create: async (data: SurveySalesBasicInfo): Promise => { + try { + const response = await axiosInstance(null).post('/api/survey-sales', data) + return response.data.id ?? 0 + } catch (error) { + console.error(error) + return 0 + } + }, + getList: async (): Promise => { + try { + const response = await axiosInstance(null).get('/api/survey-sales') + return response.data + } catch (error) { + console.error(error) + return [] + } + }, + getDetail: async (id: number): Promise => { + try { + const response = await axiosInstance(null).get(`/api/survey-sales/${id}`) + return response.data + } catch (error) { + console.error(error) + return null + } + }, + update: async (id: number, data: SurveySalesBasicInfo): Promise => { + try { + const response = await axiosInstance(null).put(`/api/survey-sales/${id}`, data) + return response.data + } catch (error) { + console.error(error) + return null + } + }, + delete: async (id: number, isDetail: boolean = false): Promise => { + try { + await axiosInstance(null).delete(`/api/survey-sales/${id}`, { + params: { + detail_id: isDetail ? id : undefined, + }, + }) + return true + } catch (error) { + throw error + } + }, + createDetail: async (surveyId: number, data: SurveySalesDetailInfo): Promise => { + try { + await axiosInstance(null).post(`/api/survey-sales/${surveyId}`, data) + return true + } catch (error) { + throw error + } + }, + confirm: async (id: number): Promise => { + try { + await axiosInstance(null).patch(`/api/survey-sales/${id}`) + return true + } catch (error) { + throw error + } + }, + // update: async (data: SurveySalesBasicInfo): Promise => { + // const response = await axiosInstance.put(`/api/survey-sales`, data) + // return response.data + // }, +} diff --git a/src/api/user.ts b/src/api/user.ts new file mode 100644 index 0000000..6b39cf0 --- /dev/null +++ b/src/api/user.ts @@ -0,0 +1,37 @@ +import { axiosInstance } from '@/libs/axios' + +export interface UserData { + username: string + email: string + password: string +} + +export interface User { + id: number + username: string + email: string + created_at: string + updated_at: string +} + +export interface LoginData { + username: string + password: string +} + +export const userApi = { + create: async (data: UserData): Promise => { + const response = await axiosInstance(null).post('/api/user/create', data) + return response.data + }, + + getList: async (): Promise => { + const response = await axiosInstance(null).get('/api/user/list') + return response.data + }, + + getUser: async (data: LoginData): Promise => { + const response = await axiosInstance(null).post(`/api/user`, data) + return response.data + }, +} diff --git a/src/app/api/auth/chg-pwd/route.ts b/src/app/api/auth/chg-pwd/route.ts new file mode 100644 index 0000000..436f101 --- /dev/null +++ b/src/app/api/auth/chg-pwd/route.ts @@ -0,0 +1,22 @@ +import { NextResponse } from 'next/server' + +import { axiosInstance } from '@/libs/axios' + +export async function POST(req: Request) { + const { loginId, email, pwd, chgPwd } = await req.json() + console.log('🚀 ~ POST ~ loginId:', loginId) + console.log('🚀 ~ POST ~ email:', email) + console.log('🚀 ~ POST ~ pwd:', pwd) + console.log('🚀 ~ POST ~ chgPwd:', chgPwd) + + const result = await axiosInstance(`${process.env.NEXT_PUBLIC_QSP_API_URL}`).post(`/api/user/userPwdChg`, { + loginId, + chgType: 'C', + email, + pwd, + chgPwd, + }) + console.log('🚀 ~ result ~ result:', result) + + return NextResponse.json({ code: 200, data: result.data }) +} diff --git a/src/app/api/user/route.ts b/src/app/api/user/route.ts index b637bc0..0249fd6 100644 --- a/src/app/api/user/route.ts +++ b/src/app/api/user/route.ts @@ -26,8 +26,8 @@ export async function POST(request: Request) { const cookieStore = await cookies() const session = await getIronSession(cookieStore, sessionOptions) console.log('start session edit!') - session.userNm = user.username! - session.email = user.email! + // session.username = user.username! + // session.email = user.email! session.isLoggedIn = true console.log('end session edit!') await session.save() diff --git a/src/components/Login.tsx b/src/components/Login.tsx index 13b4cc8..5f086af 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -3,7 +3,10 @@ import type { SessionData } from '@/types/Auth' import { useEffect, useReducer, useState } from 'react' import { useRouter } from 'next/navigation' + +import { useLocalStorage } from 'usehooks-ts' import { useQuery } from '@tanstack/react-query' + import { axiosInstance } from '@/libs/axios' import { useSessionStore } from '@/store/session' @@ -24,6 +27,7 @@ export default function Login() { const [isLogin, setIsLogin] = useState(false) const { session, setSession } = useSessionStore() + const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' }) const reducer = (state: AccountState, newState: Partial) => ({ ...state, ...newState }) const [account, setAccount] = useReducer(reducer, { @@ -48,7 +52,6 @@ export default function Login() { loginId: account.loginId, pwd: account.pwd, }) - // router.push('/') return data }, @@ -60,6 +63,11 @@ export default function Login() { useEffect(() => { setIsLogin(false) if (loginData?.code === 200) { + // 유저 정보 저장 + setValue({ + indivisualData: account.pwd, + }) + // 세션 정보 저장 setSession({ ...session, ...loginData?.result, diff --git a/src/components/inquiry/Answer.tsx b/src/components/inquiry/Answer.tsx index c1a5ec9..4eaa9a0 100644 --- a/src/components/inquiry/Answer.tsx +++ b/src/components/inquiry/Answer.tsx @@ -11,7 +11,7 @@ export default function Answer() {
-
回答
+
回答
一次側接続は, 自動切替開閉器と住宅分電盤昼間遮断器との間に蓄電システム遮断器を配線する方法です. 二次側接続は, 住宅分電盤週間ブレーカの二次側に蓄電システムブレーカを接続する diff --git a/src/components/inquiry/Detail.tsx b/src/components/inquiry/Detail.tsx index d41d5a0..3dcb625 100644 --- a/src/components/inquiry/Detail.tsx +++ b/src/components/inquiry/Detail.tsx @@ -7,7 +7,7 @@ export default function Detail() { //todo: 답변 완료 표시를 위해 임시로 추가 해 놓은 state // 추후에 api 작업 완료후 삭제 // 답변 완료 클래스 & 하단 답변내용 출력도 - const [inquiry, setInquiry] = useState(false) + const [inquiry, setInquiry] = useState(true) return ( <> @@ -31,6 +31,14 @@ export default function Detail() { 作者 Hong gi + + 名前 + Kim + + + 番号 + 070-1234-5678 + 販売店 interplug @@ -47,7 +55,11 @@ export default function Detail() {
-
屋根適合
+
+ 屋根 + 適合性 + 屋根材 +
屋根材適合性確認依頼
入力した内容が表示されます. diff --git a/src/components/inquiry/ListTable.tsx b/src/components/inquiry/ListTable.tsx index a2ac091..d65fa85 100644 --- a/src/components/inquiry/ListTable.tsx +++ b/src/components/inquiry/ListTable.tsx @@ -70,18 +70,59 @@ export default function ListTable() { 合計 98
    - {inquiryList.map((inquiry) => ( -
  • -
    -
    {inquiry.category}
    -
    {inquiry.title}
    -
    {inquiry.date}
    -
    badge.id === inquiry.status)?.color}`}> - {badgeStyle.find((badge) => badge.id === inquiry.status)?.label} -
    +
  • +
    +
    + 屋根 + 適合性 + 屋根材
    -
  • - ))} +
    屋根材適合性確認依頼
    +
    2025.04.02
    +
    回答待ち
    +
+ +
  • +
    +
    + 屋根 + 適合性 + 屋根材 +
    +
    設置可能ですか?
    +
    2025.04.02
    +
    回答完了
    +
    +
  • +
  • +
    +
    + 屋根 + 適合性 + 屋根材 +
    +
    屋根材適合性確認依頼屋根材適合性確認依頼屋根材適合性確認依頼屋根材適合性確認依頼
    +
    2025.04.02
    +
    回答待ち
    +
    +
  • +
  • +
    +
    + 屋根 + 適合性 + 屋根材 +
    +
    設置可能ですか?
    +
    2025.04.02
    +
    回答完了
    +
    +
  • +
  • +
    +
    조회된 데이터가 없습니다
    +
    +
  • setOffset(offset + 10)} /> diff --git a/src/components/inquiry/RegistForm.tsx b/src/components/inquiry/RegistForm.tsx index ea27aa8..fc55a63 100644 --- a/src/components/inquiry/RegistForm.tsx +++ b/src/components/inquiry/RegistForm.tsx @@ -17,19 +17,45 @@ export default function RegistForm() {
    +
    + +
    +
    + +
    +
    +
    +
    + 名前 * +
    +
    + +
    +
    +
    +
    電話番号
    +
    + +
    お問い合わせタイトル *
    - +
    diff --git a/src/components/pw-reset/PwResetForm.tsx b/src/components/pw-reset/PwResetForm.tsx index 1dd3d85..b332de4 100644 --- a/src/components/pw-reset/PwResetForm.tsx +++ b/src/components/pw-reset/PwResetForm.tsx @@ -3,11 +3,50 @@ import { useState } from 'react' import { useRouter } from 'next/navigation' +import { useLocalStorage } from 'usehooks-ts' + +import { axiosInstance } from '@/libs/axios' +import { useSessionStore } from '@/store/session' + export default function PwResetForm() { - const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기 - const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기 + const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기 + const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기 + + const [pwd01, setPwd01] = useState('') + const [pwd02, setPwd02] = useState('') + const router = useRouter() + const { session } = useSessionStore() + const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' }) + + const validatePwd = () => { + if (pwd01 !== pwd02) { + alert('비밀번호가 일치하지 않습니다.') + return false + } + return true + } + + const handleReset = async () => { + if (validatePwd()) { + const { data } = await axiosInstance(null).post(`/api/auth/chg-pwd`, { + loginId: session.userId, + email: session.email, + pwd: value.indivisualData, + chgPwd: pwd01, + }) + + if (data.data.result.resultCode === 'S') { + setValue({ indivisualData: pwd01 }) + } + + window.neoAlert(data.data.result.resultMsg, () => { + router.back() + }) + } + } + return ( <>
    @@ -18,7 +57,12 @@ export default function PwResetForm() {
    - + setPwd01(e.target.value)} + /> @@ -32,7 +76,12 @@ export default function PwResetForm() {
    - + setPwd02(e.target.value)} + /> @@ -48,7 +97,7 @@ export default function PwResetForm() {
    -
    diff --git a/src/components/ui/common/Header.tsx b/src/components/ui/common/Header.tsx index eb365b8..da3cf49 100644 --- a/src/components/ui/common/Header.tsx +++ b/src/components/ui/common/Header.tsx @@ -3,22 +3,25 @@ import Link from 'next/link' import { usePathname, useRouter } from 'next/navigation' -import { Swiper, SwiperSlide } from 'swiper/react' +import { useLocalStorage } from 'usehooks-ts' import { useQueryClient } from '@tanstack/react-query' +import { Swiper, SwiperSlide } from 'swiper/react' import { useSideNavState } from '@/store/sideNavState' import { useHeaderStore } from '@/store/header' import { useSessionStore } from '@/store/session' +import { usePopupController } from '@/store/popupController' + import { useTitle } from '@/hooks/useTitle' import { axiosInstance } from '@/libs/axios' import 'swiper/css' -import { usePopupController } from '@/store/popupController' export default function Header() { const router = useRouter() const pathname = usePathname() + const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' }) const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState() const { backBtn } = useHeaderStore() const { getTitle } = useTitle() @@ -34,6 +37,7 @@ export default function Header() { const handleLogout = async () => { reset() + removeValue() const { data } = await axiosInstance(null).get('/api/auth/logout') if (data.code === 200) { queryClient.clear() diff --git a/src/hooks/useSuitable.ts b/src/hooks/useSuitable.ts index 62f00e2..c3f0dde 100644 --- a/src/hooks/useSuitable.ts +++ b/src/hooks/useSuitable.ts @@ -3,7 +3,7 @@ import { suitableApi } from '@/api/suitable' export function useSuitable() { const getCategories = async () => { try { - return await suitableApi.getCategory() + // return await suitableApi.getCategory() } catch (error) { console.error('카테고리 데이터 로드 실패:', error) return [] @@ -12,7 +12,7 @@ export function useSuitable() { const getSuitables = async () => { try { - return await suitableApi.getList() + // return await suitableApi.getList() } catch (error) { console.error('지붕재 데이터 로드 실패:', error) } @@ -20,7 +20,7 @@ export function useSuitable() { const updateSearchResults = async (selectedCategory: string | undefined, searchValue: string | undefined) => { try { - return await suitableApi.getList(selectedCategory, searchValue) + // return await suitableApi.getList(selectedCategory, searchValue) } catch (error) { console.error('지붕재 데이터 검색 실패:', error) } diff --git a/src/libs/session.ts b/src/libs/session.ts index 21a0479..5036e4e 100644 --- a/src/libs/session.ts +++ b/src/libs/session.ts @@ -25,6 +25,7 @@ export const defaultSession: SessionData = { compCd: null, agencyStoreId: null, storeId: null, + storeNm: null, userId: null, category: null, userNm: null, @@ -45,6 +46,7 @@ export const defaultSession: SessionData = { custCd: null, builderNo: null, isLoggedIn: false, + role: null, } export const getSession = async () => { diff --git a/src/providers/EdgeProvider.tsx b/src/providers/EdgeProvider.tsx index 424ab2d..4cfd67e 100644 --- a/src/providers/EdgeProvider.tsx +++ b/src/providers/EdgeProvider.tsx @@ -1,14 +1,16 @@ 'use client' +import { useEffect } from 'react' +import { usePathname } from 'next/navigation' + import { useHeaderStore } from '@/store/header' import { usePopupController } from '@/store/popupController' import { useSideNavState } from '@/store/sideNavState' -import { usePathname } from 'next/navigation' -import { useEffect } from 'react' import { useSessionStore } from '@/store/session' declare global { interface Window { + neoAlert: (msg?: string, alertBtn?: Function) => void neoConfirm: (msg?: string, alertBtn2Yes?: Function, alertBtn2No?: Function) => boolean } } @@ -55,6 +57,10 @@ export default function EdgeProvider({ children, sessionData }: EdgeProviderProp window.alert = function (msg, alertBtn = () => setAlert(false)) { alertFunc(msg, alertBtn) } + window.neoAlert = function (msg?: string, alertBtn = () => setAlert(false)) { + if (!msg) return + alertFunc(msg, alertBtn) + } // confirm 함수 변경해서 바인딩 window.neoConfirm = function (msg: string | undefined, alertBtn2Yes?: Function, alertBtn2No?: Function) { if (!msg) return false diff --git a/src/styles/base/_check-radio.scss b/src/styles/base/_check-radio.scss index 3df63fa..d4d2904 100644 --- a/src/styles/base/_check-radio.scss +++ b/src/styles/base/_check-radio.scss @@ -3,7 +3,9 @@ // check radio 공통 .check-form-box input[type="checkbox"], .radio-form-box input[type="radio"]{ - position: static; + position: absolute; + top: 0; + left: 0; margin-left:0; opacity: 0; z-index: 1; @@ -44,20 +46,24 @@ border: 1px solid #A8B6C7; border-radius: 4px; background-color: #fff; - transition: border 0.15s ease-in-out, color 0.15s ease-in-out; + transition: border 0.15s ease-in-out, color 0.15s ease-in-out, background-color 0.15s ease-in-out; cursor: pointer; } &::after{ content: ""; display: inline-block; position: absolute; - width: 20px; - height: 20px; - top: 0px; - left: 0; - margin-left: 0; - border-color: #fff; + top: -1px; + left: -1px; + width: 7px; + height: 9px; + border: 2px solid transparent; + border-left: none; + border-top: none; + transform: translate(7.75px,4.5px) rotate(45deg); + -ms-transform: translate(7.75px,4.5px) rotate(45deg); cursor: pointer; + transition: border 0.15s ease-in-out, color 0.15s ease-in-out; } } input[type="checkbox"]:checked + label::before{ @@ -66,17 +72,7 @@ } input[type="checkbox"]:checked + label::after{ content: ""; - display: inline-block; - position: absolute; - top: -1px; - left: -1px; - width: 7px; - height: 9px; - border: 2px solid #fff; - border-left: none; - border-top: none; - transform: translate(7.75px,4.5px) rotate(45deg); - -ms-transform: translate(7.75px,4.5px) rotate(45deg); + border-color: #fff; } input[type="checkbox"]:disabled + label{ opacity: 0.7; diff --git a/src/styles/components/_sub.scss b/src/styles/components/_sub.scss index 6e6a5fb..ebcb374 100644 --- a/src/styles/components/_sub.scss +++ b/src/styles/components/_sub.scss @@ -529,24 +529,7 @@ // 지붕재 적합성 .compliance-icon{ - display: block; - width: 22px; - height: 22px; - background-size: cover; - background-repeat: no-repeat; - background-position: center; - &.check{ - background-image: url(/assets/images/sub/compliance_check_icon.svg); - } - &.x{ - background-image: url(/assets/images/sub/compliance_x_icon.svg); - } - &.quest{ - background-image: url(/assets/images/sub/compliance_quest_icon.svg); - } - &.tip{ - background-image: url(/assets/images/sub/compliance_tip_icon.svg); - } + display: flex; } .compliance-check-wrap{ padding-top: 10px; @@ -576,6 +559,7 @@ @include defaultFont($font-s-13, $font-w-500, $font-c); } .check-name-btn{ + padding-left: 5px; margin-left: auto; .bx-btn{ display: block; @@ -621,13 +605,13 @@ } .check-item-wrap{ - display: flex; + @include flex(0px); align-items: center; } .compliance-icon-wrap{ margin-left: auto; min-width: 44px; - display: flex; + @include flex(0px); align-items: center; }