비밀번호변경팝업 & 메인 컨텐츠
This commit is contained in:
parent
f268e96221
commit
591636740f
@ -2,39 +2,32 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||
import { modalContent, modalState, modalProps } from '@/store/modalAtom'
|
||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||
import { sessionStore } from '@/store/commonAtom'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import MainContents from './main/MainContents'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { stuffSearchState } from '@/store/stuffAtom'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import '@/styles/contents.scss'
|
||||
import ChangePasswordPop from './main/ChangePasswordPop'
|
||||
import { searchState } from '@/store/boardAtom'
|
||||
export default function MainPage() {
|
||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||
const sessionState = useRecoilValue(sessionStore)
|
||||
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
|
||||
const { get } = useAxios(globalLocaleState)
|
||||
const { promiseGet } = useAxios(globalLocaleState)
|
||||
const router = useRouter()
|
||||
const { getMessage } = useMessage()
|
||||
|
||||
const [searchTxt, setSearchTxt] = useState('')
|
||||
|
||||
const [searchRadioType, setSearchRadioType] = useState('object')
|
||||
//컨텐츠 관련
|
||||
|
||||
const [saleStoreId, setSaleStoreId] = useState('')
|
||||
const [saleStoreName, setSaleStoreName] = useState('')
|
||||
|
||||
const [objectList, setObjectList] = useState([])
|
||||
const [businessCharger, setBusinessCharger] = useState('')
|
||||
const [businessChargerMail, setBusinessChargerMail] = useState('')
|
||||
const [businessChargerTel, setBusinessChargerTel] = useState('')
|
||||
|
||||
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
||||
|
||||
const [searchForm, setSearchForm] = useRecoilState(searchState)
|
||||
@ -47,17 +40,15 @@ export default function MainPage() {
|
||||
|
||||
const fetchObjectList = async () => {
|
||||
try {
|
||||
// const apiUrl = `/api/main-page/object/X167/list`
|
||||
const apiUrl = `/api/main-page/object/${sessionState?.storeId}/list`
|
||||
const res = await get({ url: apiUrl })
|
||||
if (res) {
|
||||
setSaleStoreId(res.saleStoreId)
|
||||
setSaleStoreName(res.saleStoreName)
|
||||
setObjectList(res.objectList)
|
||||
setBusinessCharger(res.businessCharger)
|
||||
setBusinessChargerMail(res.businessChargerMail)
|
||||
setBusinessChargerTel(res.businessChargerTel)
|
||||
}
|
||||
await promiseGet({
|
||||
url: apiUrl,
|
||||
}).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setSaleStoreId(res.data.saleStoreId)
|
||||
setSaleStoreName(res.data.saleStoreName)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('MAIN API fetching error:', error)
|
||||
}
|
||||
@ -143,12 +134,7 @@ export default function MainPage() {
|
||||
<button className="search-icon" onClick={handleOnSubmit}></button>
|
||||
</div>
|
||||
</div>
|
||||
<MainContents
|
||||
objectList={objectList}
|
||||
businessCharger={businessCharger}
|
||||
businessChargerMail={businessChargerMail}
|
||||
businessChargerTel={businessChargerTel}
|
||||
/>
|
||||
<MainContents />
|
||||
</div>
|
||||
</>
|
||||
)) || (
|
||||
|
||||
@ -70,8 +70,9 @@ export default function ChangePasswordPop() {
|
||||
chgType: 'I',
|
||||
chgPwd: _password1,
|
||||
}
|
||||
|
||||
await patch({ url: '/api/login/v1.0/user/change-password', data: param }).then((res) => {
|
||||
if (res) {
|
||||
if (res.result.code === 200) {
|
||||
if (res.result.resultCode === 'S') {
|
||||
alert(getMessage('main.popup.login.success'))
|
||||
setSessionState({ ...sessionState, pwdInitYn: 'Y' })
|
||||
|
||||
@ -8,11 +8,18 @@ import { useRecoilValue } from 'recoil'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { queryStringFormatter } from '@/util/common-utils'
|
||||
export default function MainContents({ objectList, businessCharger, businessChargerMail, businessChargerTel }) {
|
||||
import { sessionStore } from '@/store/commonAtom'
|
||||
|
||||
export default function MainContents() {
|
||||
const { getMessage } = useMessage()
|
||||
const router = useRouter()
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
const { get } = useAxios(globalLocaleState)
|
||||
const { promiseGet, get } = useAxios(globalLocaleState)
|
||||
|
||||
const sessionState = useRecoilValue(sessionStore)
|
||||
|
||||
//최근 물건
|
||||
const [objectList, setObjectList] = useState([])
|
||||
|
||||
//공지사항
|
||||
const [recentNoticeList, setRecentNoticeList] = useState([])
|
||||
@ -20,10 +27,37 @@ export default function MainContents({ objectList, businessCharger, businessChar
|
||||
//FAQ
|
||||
const [recentFaqList, setRecentFaqList] = useState([])
|
||||
|
||||
//Sales Contact info
|
||||
const [businessCharger, setBusinessCharger] = useState(null)
|
||||
const [businessChargerMail, setBusinessChargerMail] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
fetchObjectList()
|
||||
fetchNoticeList()
|
||||
fetchFaqList()
|
||||
}, [])
|
||||
}, [sessionState])
|
||||
|
||||
//최근 갱신 물건목록 / Sales Contact info 정보
|
||||
const fetchObjectList = async () => {
|
||||
try {
|
||||
const apiUrl = `/api/main-page/object/${sessionState?.storeId}/list`
|
||||
await promiseGet({
|
||||
url: apiUrl,
|
||||
}).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setObjectList(res.data.objectList)
|
||||
setBusinessCharger(res.data.businessCharger)
|
||||
setBusinessChargerMail(res.data.businessChargerMail)
|
||||
} else {
|
||||
setObjectList([])
|
||||
setBusinessCharger(null)
|
||||
setBusinessChargerMail(null)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('MAIN API fetching error:', error)
|
||||
}
|
||||
}
|
||||
|
||||
//공지사항 호출
|
||||
const fetchNoticeList = async () => {
|
||||
@ -35,13 +69,13 @@ export default function MainContents({ objectList, businessCharger, businessChar
|
||||
endRow: 1,
|
||||
}
|
||||
const noticeApiUrl = `api/board/list?${queryStringFormatter(param)}`
|
||||
const res = await get({ url: noticeApiUrl })
|
||||
//console.log('공지res::', res)
|
||||
if (res) {
|
||||
if (res.data.length > 0) {
|
||||
setRecentNoticeList(res.data)
|
||||
await promiseGet({ url: noticeApiUrl }).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setRecentNoticeList(res.data.data)
|
||||
} else {
|
||||
setRecentNoticeList([])
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('NOTICE fetching error:', error)
|
||||
}
|
||||
@ -57,13 +91,15 @@ export default function MainContents({ objectList, businessCharger, businessChar
|
||||
endRow: 3,
|
||||
}
|
||||
const faqApiUrl = `api/board/list?${queryStringFormatter(param)}`
|
||||
const res = await get({ url: faqApiUrl })
|
||||
//console.log('FAQres::', res)
|
||||
if (res) {
|
||||
if (res.data.length > 0) {
|
||||
setRecentFaqList(res.data)
|
||||
await promiseGet({
|
||||
url: faqApiUrl,
|
||||
}).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setRecentFaqList(res.data.data)
|
||||
} else {
|
||||
setRecentFaqList([])
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('FAQ fetching error:', error)
|
||||
}
|
||||
@ -74,38 +110,28 @@ export default function MainContents({ objectList, businessCharger, businessChar
|
||||
<div className="main-product-list">
|
||||
<ProductItem num={1} name={getMessage('main.content.objectList')}>
|
||||
<ul className="recently-list">
|
||||
{objectList?.length > 0 ? (
|
||||
<>
|
||||
{objectList.map((row) => {
|
||||
return (
|
||||
<li
|
||||
key={row.objectNo}
|
||||
className="recently-item"
|
||||
onClick={() => {
|
||||
if (row.objectNo.substring(0, 1) === 'R') {
|
||||
router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`)
|
||||
} else {
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${row.objectNo.toString()}`)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="item-inner">
|
||||
<span className="time">{dayjs(row.lastEditDatetime).format('YYYY.MM.DD HH:mm:ss')}</span>
|
||||
<span>{row.objectNo}</span>
|
||||
<span>{row.objectName}</span>
|
||||
<span>{row.saleStoreName}</span>
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<li>
|
||||
<div className="item-inner">최근 갱신 물건이 없습니다</div>
|
||||
{objectList.map((row) => {
|
||||
return (
|
||||
<li
|
||||
key={row.objectNo}
|
||||
className="recently-item"
|
||||
onClick={() => {
|
||||
if (row.objectNo.substring(0, 1) === 'R') {
|
||||
router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`)
|
||||
} else {
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${row.objectNo.toString()}`)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="item-inner">
|
||||
<span className="time">{dayjs(row.lastEditDatetime).format('YYYY.MM.DD HH:mm:ss')}</span>
|
||||
<span>{row.objectNo}</span>
|
||||
<span>{row.objectName}</span>
|
||||
<span>{row.saleStoreName}</span>
|
||||
</div>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</ProductItem>
|
||||
<ProductItem num={2} name={getMessage('main.content.notice')}>
|
||||
@ -156,13 +182,17 @@ export default function MainContents({ objectList, businessCharger, businessChar
|
||||
<div className="icon-box">
|
||||
<Image src="/static/images/main/user.svg" alt="react" width={20} height={20} />
|
||||
</div>
|
||||
<div className="infor-data">{businessCharger}</div>
|
||||
{(businessCharger && <div className="infor-data">{businessCharger}</div>) || (
|
||||
<div className="infor-data pre">{getMessage('main.content.noBusiness')}</div>
|
||||
)}
|
||||
</li>
|
||||
<li className="info-item">
|
||||
<div className="icon-box">
|
||||
<Image src="/static/images/main/mail.svg" alt="react" width={20} height={20} />
|
||||
</div>
|
||||
<div className="infor-data pre">{businessChargerMail}</div>
|
||||
{(businessChargerMail && <div className="infor-data pre">{businessChargerMail}</div>) || (
|
||||
<div className="infor-data pre">{getMessage('main.content.noBusiness')}</div>
|
||||
)}
|
||||
</li>
|
||||
</ul>
|
||||
</ProductItem>
|
||||
|
||||
@ -588,6 +588,7 @@
|
||||
"main.content.notice": "お知らせ",
|
||||
"main.content.download1": "操作マニュアル",
|
||||
"main.content.download2": "屋根の説明書",
|
||||
"main.content.noBusiness": "Hanwha Japanにお問い合わせください",
|
||||
"main.popup.login.popupTitle": "パスワード変更",
|
||||
"main.popup.login.newPassword1": "新しいパスワードを入力",
|
||||
"main.popup.login.newPassword2": "新規パスワード再入力",
|
||||
|
||||
@ -472,7 +472,7 @@
|
||||
"stuff.addressPopup.btn1": "닫기",
|
||||
"stuff.addressPopup.btn2": "주소적용",
|
||||
"stuff.planReqPopup.title": "설계의뢰 불러오기",
|
||||
"stuff.temp.subTitle" : "물건정보",
|
||||
"stuff.temp.subTitle": "물건정보",
|
||||
"stuff.detail.required": "필수 입력항목",
|
||||
"stuff.detail.planReqNo": "설계의뢰No.",
|
||||
"stuff.detail.dispCompanyName": "담당자",
|
||||
@ -593,12 +593,13 @@
|
||||
"main.content.notice": "공지사항",
|
||||
"main.content.download1": "조작메뉴얼",
|
||||
"main.content.download2": "지붕설명서",
|
||||
"main.content.noBusiness": "Hanwha Japan에 문의하세요",
|
||||
"main.popup.login.popupTitle": "비밀번호변경",
|
||||
"main.popup.login.newPassword1": "새 비밀번호 입력",
|
||||
"main.popup.login.newPassword2": "새 비밀번호 재입력",
|
||||
"main.popup.login.placeholder": "반각 10자 이내",
|
||||
"main.popup.login.guide1": "초기화된 비밀번호로 로그인한 경우 비밀번호를 변경하지 않으면 사이트 이용이 가능합니다.",
|
||||
"main.popup.login.guide2": "비밀번호를 변경하지 않으려면 로그인 화면으로 이동합니다.",
|
||||
"main.popup.login.guide1": "초기화된 비밀번호로 로그인한 경우, 비밀번호를 변경해야 사이트 이용이 가능합니다.",
|
||||
"main.popup.login.guide2": "비밀번호를 변경하지 않을 경우, 로그인 화면으로 이동합니다.",
|
||||
"main.popup.login.btn1": "변경",
|
||||
"main.popup.login.btn2": "변경안함",
|
||||
"main.popup.login.validate1": "입력한 패스워드가 다릅니다.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user