Q.order, Q.mosubi 자동로그인 추가/session 정보 추가/response 메시지 처리 수정
This commit is contained in:
parent
8ffdf5dca9
commit
82f3af907f
@ -9,3 +9,6 @@ DATABASE_URL="sqlserver://mssql.devgrr.kr:1433;database=qcast;user=qcast;passwor
|
|||||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||||
|
|
||||||
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||||
|
|
||||||
|
NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-local.q-cells.jp:8120/eos/login/autoLogin"
|
||||||
|
NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-local.q-cells.jp:8120/qm/login/autoLogin"
|
||||||
@ -7,3 +7,6 @@ DATABASE_URL=""
|
|||||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||||
|
|
||||||
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||||
|
|
||||||
|
NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-local.q-cells.jp:8120/eos/login/autoLogin"
|
||||||
|
NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-local.q-cells.jp:8120/qm/login/autoLogin"
|
||||||
@ -48,6 +48,8 @@ export default async function RootLayout({ children }) {
|
|||||||
telNo: session.telNo,
|
telNo: session.telNo,
|
||||||
fax: session.fax,
|
fax: session.fax,
|
||||||
email: session.email,
|
email: session.email,
|
||||||
|
storeLvl: session.storeLvl,
|
||||||
|
groupId: session.groupId,
|
||||||
pwdInitYn: session.pwdInitYn,
|
pwdInitYn: session.pwdInitYn,
|
||||||
isLoggedIn: session.isLoggedIn,
|
isLoggedIn: session.isLoggedIn,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,11 +37,11 @@ export default function Join() {
|
|||||||
await promisePost({ url: '/api/login/v1.0/user/join', data: param })
|
await promisePost({ url: '/api/login/v1.0/user/join', data: param })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.result.resultCode == 'S') {
|
if (res.data.result.resultCode == 'S') {
|
||||||
Cookies.set('joinEmail', formData.get('email'), { expires: 1 })
|
Cookies.set('joinEmail', formData.get('email'), { expires: 1 })
|
||||||
router.push('/join/complete')
|
router.push('/join/complete')
|
||||||
} else {
|
} else {
|
||||||
alert(res.result.resultMsg)
|
alert(res.data.result.resultMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -13,7 +13,59 @@ import { useRouter } from 'next/navigation'
|
|||||||
|
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
|
import { useSearchParams } from 'next/navigation'
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 자동 로그인 작업진행중
|
||||||
|
const initParams = useSearchParams()
|
||||||
|
const autoLoginParam = initParams.get('autoLoginParam1')
|
||||||
|
useEffect(() => {
|
||||||
|
if (autoLoginParam) {
|
||||||
|
autoLoginProcess(autoLoginParam)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
const autoLoginProcess = async (autoLoginParam) => {
|
||||||
|
setSession({
|
||||||
|
userId: autoLoginParam,
|
||||||
|
saleStoreId: null,
|
||||||
|
name: null,
|
||||||
|
mail: null,
|
||||||
|
tel: null,
|
||||||
|
storeId: 'TEMP02',
|
||||||
|
userNm: 'ㅇㅇ6610',
|
||||||
|
userNmKana: '신규사용자 16610',
|
||||||
|
category: '인상6610',
|
||||||
|
telNo: '336610',
|
||||||
|
fax: null,
|
||||||
|
email: 't10t@naver.com',
|
||||||
|
pwdInitYn: 'Y',
|
||||||
|
storeLvl: '2',
|
||||||
|
groupId: '70000',
|
||||||
|
})
|
||||||
|
|
||||||
|
setSessionState({
|
||||||
|
userId: autoLoginParam,
|
||||||
|
saleStoreId: null,
|
||||||
|
name: null,
|
||||||
|
mail: null,
|
||||||
|
tel: null,
|
||||||
|
storeId: 'TEMP02',
|
||||||
|
userNm: 'ㅇㅇ6610',
|
||||||
|
userNmKana: '신규사용자 16610',
|
||||||
|
category: '인상6610',
|
||||||
|
telNo: '336610',
|
||||||
|
fax: null,
|
||||||
|
email: 't10t@naver.com',
|
||||||
|
pwdInitYn: 'Y',
|
||||||
|
storeLvl: '2',
|
||||||
|
groupId: '70000',
|
||||||
|
})
|
||||||
|
|
||||||
|
router.push('/')
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const [userId, setUserId] = useState('')
|
const [userId, setUserId] = useState('')
|
||||||
const [checkId, setCheckId] = useState('')
|
const [checkId, setCheckId] = useState('')
|
||||||
const [checkEmail, setCheckEmail] = useState('')
|
const [checkEmail, setCheckEmail] = useState('')
|
||||||
@ -55,6 +107,8 @@ export default function Login() {
|
|||||||
fax: null,
|
fax: null,
|
||||||
email: 't10t@naver.com',
|
email: 't10t@naver.com',
|
||||||
pwdInitYn: 'Y',
|
pwdInitYn: 'Y',
|
||||||
|
storeLvl: '1',
|
||||||
|
groupId: '60000',
|
||||||
})
|
})
|
||||||
|
|
||||||
setSessionState({
|
setSessionState({
|
||||||
@ -71,6 +125,8 @@ export default function Login() {
|
|||||||
fax: null,
|
fax: null,
|
||||||
email: 't10t@naver.com',
|
email: 't10t@naver.com',
|
||||||
pwdInitYn: 'Y',
|
pwdInitYn: 'Y',
|
||||||
|
storeLvl: '1',
|
||||||
|
groupId: '60000',
|
||||||
})
|
})
|
||||||
|
|
||||||
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
||||||
@ -91,9 +147,9 @@ export default function Login() {
|
|||||||
// await promisePost({ url: '/api/login/v1.0/login', data: param })
|
// await promisePost({ url: '/api/login/v1.0/login', data: param })
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
// if (res) {
|
// if (res) {
|
||||||
// if (res.result.resultCode == 'S') {
|
// if (res.data.result.resultCode === 'S') {
|
||||||
// setSession(res.data)
|
// setSession(res.data.data)
|
||||||
// setSessionState(res.data)
|
// setSessionState(res.data.data)
|
||||||
// // ID SAVE 체크되어 있는 경우, 쿠키 저장
|
// // ID SAVE 체크되어 있는 경우, 쿠키 저장
|
||||||
// if (chkLoginId) {
|
// if (chkLoginId) {
|
||||||
// Cookies.set('chkLoginId', formData.get('id'), { expires: 7 })
|
// Cookies.set('chkLoginId', formData.get('id'), { expires: 7 })
|
||||||
@ -102,7 +158,7 @@ export default function Login() {
|
|||||||
// }
|
// }
|
||||||
// router.push('/')
|
// router.push('/')
|
||||||
// } else {
|
// } else {
|
||||||
// alert(res.result.resultMsg)
|
// alert(res.data.result.resultMsg)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
@ -124,13 +180,13 @@ export default function Login() {
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.result.resultCode == 'S') {
|
if (res.data.result.resultCode == 'S') {
|
||||||
alert(getMessage('login.init_password.complete_message'))
|
alert(getMessage('login.init_password.complete_message'))
|
||||||
setCheckId('')
|
setCheckId('')
|
||||||
setCheckEmail('')
|
setCheckEmail('')
|
||||||
setPasswordReset(1)
|
setPasswordReset(1)
|
||||||
} else {
|
} else {
|
||||||
alert(res.result.resultMsg)
|
alert(res.data.result.resultMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export default function ArchiveTable({ clsCode }) {
|
|||||||
// 목록 조회
|
// 목록 조회
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/board/list`
|
const url = `/api/board/list`
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
schNoticeTpCd: 'QC',
|
schNoticeTpCd: 'QC',
|
||||||
schNoticeClsCd: clsCode,
|
schNoticeClsCd: clsCode,
|
||||||
@ -49,7 +49,7 @@ export default function ArchiveTable({ clsCode }) {
|
|||||||
|
|
||||||
// 상세 파일 목록 조회
|
// 상세 파일 목록 조회
|
||||||
const handleDetailFileListDown = async (noticeNo) => {
|
const handleDetailFileListDown = async (noticeNo) => {
|
||||||
const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/board/detail`
|
const url = `/api/board/detail`
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
noticeNo: noticeNo,
|
noticeNo: noticeNo,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="modal-popup community">
|
<div key={noticeNo} className="modal-popup community">
|
||||||
<div className="modal-dialog">
|
<div className="modal-dialog">
|
||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
<div className="modal-header">
|
<div className="modal-header">
|
||||||
@ -57,7 +57,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
|
|||||||
<dl className="community_detail-file-wrap">
|
<dl className="community_detail-file-wrap">
|
||||||
<dt>첨부파일 목록</dt>
|
<dt>첨부파일 목록</dt>
|
||||||
{boardDetail.listFile.map((boardFile) => (
|
{boardDetail.listFile.map((boardFile) => (
|
||||||
<dd key={boardFile}>
|
<dd key={boardFile.encodeFileNo}>
|
||||||
<button type="button" className="down" onClick={() => handleFileDown(boardFile)}>
|
<button type="button" className="down" onClick={() => handleFileDown(boardFile)}>
|
||||||
{boardFile.srcFileNm}
|
{boardFile.srcFileNm}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import { logout } from '@/lib/authActions'
|
|||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
|
||||||
import UserInfoModal from '@/components/myInfo/UserInfoModal'
|
import UserInfoModal from '@/components/myInfo/UserInfoModal'
|
||||||
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
|
|
||||||
export const ToggleonMouse = (e, act, target) => {
|
export const ToggleonMouse = (e, act, target) => {
|
||||||
const listWrap = e.target.closest(target)
|
const listWrap = e.target.closest(target)
|
||||||
@ -44,12 +46,42 @@ export default function Header(props) {
|
|||||||
const dimmedState = useRecoilValue(dimmedStore)
|
const dimmedState = useRecoilValue(dimmedStore)
|
||||||
const isDimmed = dimmedState ? 'opacity-50 bg-black' : ''
|
const isDimmed = dimmedState ? 'opacity-50 bg-black' : ''
|
||||||
|
|
||||||
const SelectOptions = [
|
// Link 이동 자동 로그인
|
||||||
{ id: 0, name: 'オンライン保証シ', link: '' },
|
const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore)
|
||||||
{ id: 1, name: 'ステム', link: '' },
|
const { promisePost } = useAxios(globalLocaleState)
|
||||||
{ id: 2, name: 'TEST1', link: 'https://www.weather.go.kr/w/index.do' },
|
|
||||||
{ id: 3, name: 'TEST2', link: 'https://www.google.com' },
|
const qOrderUrl = process.env.NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL
|
||||||
]
|
const qMusubiUrl = process.env.NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL
|
||||||
|
|
||||||
|
const [SelectOptions, setSelectOptions] = useState(
|
||||||
|
userSession.groupId === '60000' ? [{ id: 0, name: 'Q.ORDER', link: `${qOrderUrl}` }] : [{ id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}` }],
|
||||||
|
)
|
||||||
|
|
||||||
|
const getAutoLoginParam = async () => {
|
||||||
|
await promisePost({ url: '/api/login/v1.0/user/login/autoLoginEncryptData', data: { loginId: userSession.userId } })
|
||||||
|
.then((res) => {
|
||||||
|
if (res) {
|
||||||
|
setSelectOptions(
|
||||||
|
userSession.groupId === '60000'
|
||||||
|
? [{ id: 0, name: 'Q.ORDER', link: `${qOrderUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }]
|
||||||
|
: [{ id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }],
|
||||||
|
)
|
||||||
|
setSelected(
|
||||||
|
userSession.groupId === '60000'
|
||||||
|
? { id: 0, name: 'Q.ORDER', link: `${qOrderUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }
|
||||||
|
: { id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
alert(error.response.data.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getAutoLoginParam()
|
||||||
|
}, [userSession])
|
||||||
|
|
||||||
const menus = [
|
const menus = [
|
||||||
{ id: 0, name: 'header.menus.home', url: '/', children: [] },
|
{ id: 0, name: 'header.menus.home', url: '/', children: [] },
|
||||||
{
|
{
|
||||||
@ -157,7 +189,7 @@ export default function Header(props) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="select-box">
|
<div className="select-box">
|
||||||
<QSelectBox title={'Q.ORDER'} options={SelectOptions} onChange={onChangeSelect} />
|
<QSelectBox options={SelectOptions} onChange={onChangeSelect} />
|
||||||
</div>
|
</div>
|
||||||
<div className="btn-wrap">
|
<div className="btn-wrap">
|
||||||
<button className="btn-frame small dark" onClick={() => navPage()}>
|
<button className="btn-frame small dark" onClick={() => navPage()}>
|
||||||
|
|||||||
@ -11,7 +11,6 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
|||||||
const { get, promisePatch } = useAxios()
|
const { get, promisePatch } = useAxios()
|
||||||
const [info, setInfo] = useState({
|
const [info, setInfo] = useState({
|
||||||
userId: '',
|
userId: '',
|
||||||
password: '',
|
|
||||||
name: '',
|
name: '',
|
||||||
nameKana: '',
|
nameKana: '',
|
||||||
category: '',
|
category: '',
|
||||||
@ -30,7 +29,7 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/my-info/my-profile`
|
const url = `/api/my-info/my-profile`
|
||||||
const params = new URLSearchParams({ userId: userId })
|
const params = new URLSearchParams({ userId: userId })
|
||||||
|
|
||||||
const apiUrl = `${url}?${params.toString()}`
|
const apiUrl = `${url}?${params.toString()}`
|
||||||
@ -39,7 +38,6 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
|||||||
|
|
||||||
if (resultData) {
|
if (resultData) {
|
||||||
setInfo(resultData)
|
setInfo(resultData)
|
||||||
setPassword(resultData?.password)
|
|
||||||
} else {
|
} else {
|
||||||
alert(getMessage('common.message.no.data'))
|
alert(getMessage('common.message.no.data'))
|
||||||
}
|
}
|
||||||
@ -72,11 +70,11 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
|||||||
await promisePatch({ url: '/api/login/v1.0/user/change-password', data: params })
|
await promisePatch({ url: '/api/login/v1.0/user/change-password', data: params })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.result.resultCode === 'S') {
|
if (res.data.result.resultCode === 'S') {
|
||||||
alert(getMessage('myinfo.message.save'))
|
alert(getMessage('myinfo.message.save'))
|
||||||
setChkChgPwd(false)
|
setChkChgPwd(false)
|
||||||
} else {
|
} else {
|
||||||
alert(res.result.resultMsg)
|
alert(res.data.result.resultMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -49,6 +49,8 @@ export async function setSession(data) {
|
|||||||
session.telNo = data.telNo
|
session.telNo = data.telNo
|
||||||
session.fax = data.fax
|
session.fax = data.fax
|
||||||
session.email = data.email
|
session.email = data.email
|
||||||
|
session.storeLvl = data.storeLvl
|
||||||
|
session.groupId = data.groupId
|
||||||
session.pwdInitYn = data.pwdInitYn
|
session.pwdInitYn = data.pwdInitYn
|
||||||
session.isLoggedIn = true
|
session.isLoggedIn = true
|
||||||
// console.log('session:', session)
|
// console.log('session:', session)
|
||||||
|
|||||||
@ -9,10 +9,10 @@ export const handleFileDown = async (file) => {
|
|||||||
encodeFileNo: file.encodeFileNo,
|
encodeFileNo: file.encodeFileNo,
|
||||||
})
|
})
|
||||||
const apiUrl = `${url}?${params.toString()}`
|
const apiUrl = `${url}?${params.toString()}`
|
||||||
await promiseGet({ url: apiUrl })
|
await promiseGet({ url: apiUrl, responseType: 'blob' })
|
||||||
.then((resultData) => {
|
.then((resultData) => {
|
||||||
if (resultData) {
|
if (resultData) {
|
||||||
const blob = new Blob([resultData])
|
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||||
const fileUrl = window.URL.createObjectURL(blob)
|
const fileUrl = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export const handleFileDown = async (file) => {
|
|||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
window.URL.revokeObjectURL(url)
|
window.URL.revokeObjectURL(fileUrl)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user