From bbd037dcb4875e1c3fccd32c615fcc6e554787ff Mon Sep 17 00:00:00 2001 From: leonard Date: Thu, 24 Jul 2025 14:45:30 +0700 Subject: [PATCH] update code --- middleware/middleRouter.js | 3 ++- nuxt.config.js | 18 +++++++-------- pages/comm/auth/MenuRoleMngPage.vue | 9 +++++--- pages/login/index.vue | 34 +++++++++++++++++++++++++++-- plugins/axios.js | 1 + 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/middleware/middleRouter.js b/middleware/middleRouter.js index 37f1d44..d841be6 100644 --- a/middleware/middleRouter.js +++ b/middleware/middleRouter.js @@ -2,7 +2,8 @@ import $cookie from 'vue-cookie'; export default async function({ store, route, redirect }) { // const menuId = route.query.menuId; - const FEMS_SESSION = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjM0NTYiLCJyb2xlIjoiYWRtaW4ifQ.sflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'; + // const FEMS_SESSION = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjM0NTYiLCJyb2xlIjoiYWRtaW4ifQ.sflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'; + const FEMS_SESSION = $cookie.get('FEMS_SESSION'); if (!FEMS_SESSION) { if (route.name !== 'login') redirect('/login'); } else { diff --git a/nuxt.config.js b/nuxt.config.js index 6031688..d517910 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -61,15 +61,15 @@ module.exports = { styleResources: { scss: ['./assets/scss/*.scss'], }, - // proxy: { - // "/api/": { - // target: "http://0.0.0.0:9999/", - // //target: "http://192.168.0.152:8082/", - // pathRewrite: { - // "^/api/": "" - // } - // } - // }, + proxy: { + "/api/": { + target: "http://0.0.0.0:9999/", + //target: "http://192.168.0.152:8082/", + pathRewrite: { + "^/api/": "" + } + } + }, axios: { //baseURL: "http://dotest.kfems.kr:9997", proxy: true, diff --git a/pages/comm/auth/MenuRoleMngPage.vue b/pages/comm/auth/MenuRoleMngPage.vue index 8227a74..1721950 100644 --- a/pages/comm/auth/MenuRoleMngPage.vue +++ b/pages/comm/auth/MenuRoleMngPage.vue @@ -3,13 +3,14 @@ - + @@ -18,17 +19,19 @@ label="역할명" valueNm="roleNm" :searchOption="true" + customClass="input-large" /> - + - + + diff --git a/pages/login/index.vue b/pages/login/index.vue index fadf0d0..e6dfcc2 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -147,6 +147,26 @@ export default { // } await this.loginChk(); }, + // async loginChk() { + // const DOMAIN = ''; + // const apiUrl = 'loginChk'; + // const params = { + // local: 'ko', + // comId: this.userComId, // 요청 comId는 클라우드 서비스시는 입력 값으로 처리 되어야 할수 있음. + // userId: this.userId, + // userPswd: this.userPw, + // }; + // const res = await this.$axios.post(DOMAIN + apiUrl, { params: params }); + // const femsSessionCookie = 3434; + // const FEMS_SESSION = femsSessionCookie; + // $cookie.set('FEMS_SESSION', FEMS_SESSION); + // this.setUserInfo(res.data.dataset.userInfo); + // // alert("임시로 로그인 처리 되었습니다. dashboard 페이지로 이동합니다."); + // // console.log('res.data.dataset.userInfo: ', res.data.dataset.userInfo); + // // return; + // this.$router.push({ path: this.myHome.root }); + + // }, async loginChk() { const DOMAIN = ''; const apiUrl = 'loginChk'; @@ -156,15 +176,25 @@ export default { userId: this.userId, userPswd: this.userPw, }; + console.log('asdasd' + JSON.stringify( DOMAIN) + params) const res = await this.$axios.post(DOMAIN + apiUrl, { params: params }); - const femsSessionCookie = 3434; + if (res.data.retnCd === -9001) { + alert(res.data.retnMsg); + return {}; + } else { + const femsSessionCookie = res.data.dataset.FEMS_SESSION; const FEMS_SESSION = femsSessionCookie; $cookie.set('FEMS_SESSION', FEMS_SESSION); this.setUserInfo(res.data.dataset.userInfo); + + console.log('FEMS_SESSION', FEMS_SESSION); + console.log('$cookie.get', $cookie.get('FEMS_SESSION')); + console.log('userInfo', JSON.stringify(res.data.dataset.userInfo)); + // alert("임시로 로그인 처리 되었습니다. dashboard 페이지로 이동합니다."); this.$router.push({ path: this.myHome.root }); - + } }, }, }; diff --git a/plugins/axios.js b/plugins/axios.js index 0ec754b..36f455b 100644 --- a/plugins/axios.js +++ b/plugins/axios.js @@ -1,5 +1,6 @@ import $cookie from 'vue-cookie'; export default ({ $axios, res }) => { + $axios.defaults.baseURL = '/api/'; $axios.onRequest(config => { config.headers.common['AUTHENTICATION_FEMS_SESSION'] = `${$cookie.get( 'FEMS_SESSION',