mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 01:04:20 +09:00
로그인 수정
This commit is contained in:
@@ -96,8 +96,7 @@ export default {
|
||||
var dimmed = document.getElementsByClassName('modal01');
|
||||
for(var i = 0; i < dimmed.length; i++){
|
||||
dimmed[i].style.display = 'none';
|
||||
}
|
||||
console.log(this.callFnc)
|
||||
}
|
||||
if(this.callFnc !== ''){
|
||||
this.$parent.alertCalbackFnc(this.callFnc);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import httpClient from '@/common/http-client';
|
||||
|
||||
const login = (params) => {
|
||||
return httpClient.post('api/v1/bo/login/login', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false });
|
||||
return httpClient.post('/api/v1/bo/login/login', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false });
|
||||
};
|
||||
|
||||
const chgpwd = (params) => {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<div class="wbox">
|
||||
<h3 class="title">2차 휴대폰 문자 인증</h3>
|
||||
<p class="desc">아이디에 등록된 휴대폰번호를 입력해 주세요.</p>
|
||||
<!-- <form action=""> -->
|
||||
<ul class="pw-form">
|
||||
<div>
|
||||
<li><input type="text"
|
||||
ref="_phone"
|
||||
placeholder="휴대폰번호를 입력하세요 (숫자만 입력하세요.)"
|
||||
v-model="mdn"
|
||||
:maxlength="11"
|
||||
@@ -32,11 +32,9 @@
|
||||
<button class="btn-pcolor" v-on:click="ajaxAuth">확인</button>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- </form> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<login-popup ref="LoginPopup"> </login-popup>
|
||||
</div>
|
||||
<common-modal ref="commmonModal"></common-modal>
|
||||
</div>
|
||||
|
||||
@@ -45,9 +43,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import api from '../service/api';
|
||||
// import tokenSvc from '@/common/token-service';
|
||||
import { utils_mixin, chkPattern2 } from '../service/mixins';
|
||||
import LoginPopup from '@/components/LoginPopup.vue'
|
||||
import commonModal from "../components/commonModal";
|
||||
|
||||
export default {
|
||||
@@ -66,6 +62,7 @@ export default {
|
||||
mdn: '',
|
||||
confirmNum: '',
|
||||
// userId: '',
|
||||
oprtrId : '',
|
||||
isAuthNum: false,
|
||||
isLogin: false,
|
||||
isAuth: false,
|
||||
@@ -78,33 +75,24 @@ export default {
|
||||
tempList: []
|
||||
};
|
||||
},
|
||||
components: {
|
||||
LoginPopup : LoginPopup
|
||||
,commonModal
|
||||
components: {
|
||||
commonModal
|
||||
},
|
||||
created() {
|
||||
const historyUrl = this.$router.options.history.state.back;
|
||||
console.log(historyUrl);
|
||||
console.log('>>>>1111>>>>'+this.getLogin);
|
||||
created() {
|
||||
if(!this.getLogin){
|
||||
this.$router.push({ path: '/login' });
|
||||
}
|
||||
// if(!!tokenSvc.getToken()){
|
||||
// this.$store.commit("login/isLogin", true);
|
||||
// this.$store.commit("login/isAuthChk", true);
|
||||
// this.$router.push({ path: '/' });
|
||||
// }else{
|
||||
// if(!this.getLogin){
|
||||
// this.$router.push({ path: '/login' });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (localStorage.hubwebUserId) {
|
||||
this.userId = localStorage.hubwebUserId;
|
||||
this.oprtrId = localStorage.hubwebUserId;
|
||||
}
|
||||
this.isLogin = this.getLogin;
|
||||
this.pwd = this.getPwd;
|
||||
this.$store.commit("login/isLogin", false);
|
||||
|
||||
this.isLogin = this.getLogin;
|
||||
this.pwd = this.getPwd;
|
||||
this.ajaxlogin();
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
@@ -140,6 +128,36 @@ export default {
|
||||
cont.classList.remove("bg-wrap");
|
||||
},
|
||||
methods: {
|
||||
// 1차 인증
|
||||
async ajaxlogin() {
|
||||
var vm = this;
|
||||
vm.errors = null;
|
||||
|
||||
if (!this.oprtrId){
|
||||
this.$router.push({ path: '/login' });
|
||||
}
|
||||
if (!this.pwd){
|
||||
this.$router.push({ path: '/login' });
|
||||
}
|
||||
var params = {
|
||||
"oprtrId": this.oprtrId,
|
||||
"oprtrPw": this.pwd,
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await api.login(params);
|
||||
const rsp = response.data;
|
||||
if(rsp.retCode == '0000'){
|
||||
vm.$store.commit("login/isLogin", true);
|
||||
} else {
|
||||
vm.$store.commit("login/isLogin", false);
|
||||
this.$router.push({ path: '/login' });
|
||||
}
|
||||
} catch(err) {
|
||||
this.$router.push({ path: '/login' });
|
||||
}
|
||||
},
|
||||
|
||||
// 2차 인증번호 요청
|
||||
async authNum(){
|
||||
var vm = this;
|
||||
@@ -177,7 +195,6 @@ export default {
|
||||
}
|
||||
try {
|
||||
const response = await api.authNum(params)
|
||||
console.log(response);
|
||||
var rsp = response.data;
|
||||
if(rsp.retCode == '0000') {
|
||||
this.timerStop(this.timer);
|
||||
@@ -265,18 +282,14 @@ export default {
|
||||
//인증번호 확인
|
||||
try {
|
||||
const response = await api.confirmNum(params)
|
||||
const rsp = response.data;
|
||||
console.log("LOGIN ßRESUßLT_CODE : "+rsp.retCode);
|
||||
console.log(rsp);
|
||||
const rsp = response.data;
|
||||
if(rsp.retCode == '0000'){
|
||||
vm.$store.commit("login/isLogin", true);
|
||||
vm.$store.commit("login/isAuthChk", true);
|
||||
vm.$store.commit("login/userId", rsp.data.userId)
|
||||
vm.$store.commit("login/userNm", rsp.data.userNm)
|
||||
var rootUrl = rsp.data.nextUrl;
|
||||
console.log('rootUrl : '+rootUrl);
|
||||
vm.$store.commit("login/rootUrl", rsp.data.nextUrl);
|
||||
console.log(vm.$store.getters);
|
||||
vm.$router.push({ path: rootUrl});
|
||||
}else if (rsp.retCode == '4008'){
|
||||
this.row.title = '휴대폰번호 확인';
|
||||
@@ -332,11 +345,9 @@ export default {
|
||||
this.$router.push({
|
||||
path: link
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
ModalOpen: function(target){
|
||||
this.$refs.LoginPopup.ModalOpen(target);
|
||||
},
|
||||
|
||||
timerStart: function() {
|
||||
// 1초에 한번씩 start 호출
|
||||
this.timeCounter = 180;
|
||||
@@ -372,7 +383,6 @@ export default {
|
||||
);
|
||||
},
|
||||
alertCalbackFnc(callFnc){
|
||||
console.log(callFnc)
|
||||
if(callFnc === 'login'){
|
||||
this.$router.push({ path: '/'});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<div class="wbox">
|
||||
<div class="logo"></div>
|
||||
<h3 class="title">관리자 로그인</h3>
|
||||
<!-- <form action=""> -->
|
||||
<div class="login-form">
|
||||
<li><input type="text" placeholder="아이디" v-model="userId"></li>
|
||||
<li><input type="password" placeholder="비밀번호" v-model="userPwd" @keyup.enter="ajaxlogin"></li>
|
||||
@@ -15,7 +14,6 @@
|
||||
</li>
|
||||
<li><button class="btn-pcolor" @click="ajaxlogin">로그인</button></li>
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
<div class="login-notice">
|
||||
<div>
|
||||
<li>비밀번호 분실 시 비밀번호 초기화를 이용해주세요.</li>
|
||||
@@ -24,8 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<login-popup ref="LoginPopup"> </login-popup>
|
||||
</div>
|
||||
<common-modal ref="commonModal"></common-modal>
|
||||
|
||||
</div>
|
||||
@@ -33,7 +30,6 @@
|
||||
|
||||
<script>
|
||||
import api from '../service/api';
|
||||
//import LoginPopup from '@/components/LoginPopup.vue';
|
||||
import tokenSvc from '@/common/token-service';
|
||||
import commonModal from "../components/commonModal";
|
||||
|
||||
@@ -70,8 +66,7 @@ export default {
|
||||
let cont = document.querySelector(".wrap");
|
||||
cont.classList.remove("login-wrap");
|
||||
},
|
||||
components: {
|
||||
// LoginPopup : LoginPopup,
|
||||
components: {
|
||||
commonModal,
|
||||
},
|
||||
methods: {
|
||||
@@ -90,8 +85,7 @@ export default {
|
||||
var vm = this;
|
||||
vm.errmsg = null;
|
||||
this.row = {}
|
||||
// if (!vm.formCheck()) return false;
|
||||
console.log(this.userId)
|
||||
|
||||
if (!this.userId){
|
||||
this.row.title = '로그인 실패';
|
||||
this.row.msg1 = '아이디,비밀번호를 확인해주세요.';
|
||||
@@ -117,20 +111,17 @@ export default {
|
||||
//로그인버튼을 누를시 상황
|
||||
try {
|
||||
const response = await api.login(params)
|
||||
const rsp = response.data;
|
||||
console.log(rsp);
|
||||
const rsp = response.data;
|
||||
|
||||
if(rsp.retCode == '0000'){
|
||||
var path = rsp.data.nextUrl;
|
||||
console.log(path);
|
||||
console.log(rsp.data);
|
||||
|
||||
vm.chgChkUserId();
|
||||
vm.$store.commit("login/isLogin", true);
|
||||
vm.$store.commit("login/savePwd", oprtrPw);
|
||||
vm.$router.push({ name: 'loginAuth',params: {userId : oprtrId}});
|
||||
} else if(rsp.retCode == '1001'){ // 비밀번호 변경
|
||||
console.log(this.userId);
|
||||
vm.chgChkUserId();
|
||||
this.$store.commit("login/isLogin", true);
|
||||
this.$router.push({ name: 'updatePassword',params: {userId : this.userId}});
|
||||
}else if(rsp.retCode == '4003') { // ID 조회 없음.
|
||||
this.row.title = '로그인 실패';
|
||||
@@ -147,7 +138,6 @@ export default {
|
||||
this.row.msg1 = '로그인 5회 실패하였습니다.';
|
||||
this.row.msg2 = '비밀번호 초기화 후 비밀번호를 변경해 주세요.';
|
||||
this.row.callFnc = 'resetPassword'
|
||||
console.log(this.row)
|
||||
this.$refs.commonModal.alertModalOpen(this.row);
|
||||
} else if(rsp.retCode == '4006') {
|
||||
// msg = '비밀번호를 변경하신지 90일이 지났습니다.\n비밀번호 변경 화면으로 이동합니다.';
|
||||
@@ -156,7 +146,6 @@ export default {
|
||||
this.row.msg2 = '지났습니다. 비밀번호를 변경하여';
|
||||
this.row.msg3 = '이용 부탁드립니다.';
|
||||
this.row.callFnc = 'updatePassword'
|
||||
//vm.$store.commit("login/isLogin", true);
|
||||
this.$refs.commonModal.alertModalOpen(this.row);
|
||||
} else if(rsp.retCode == '4007') {
|
||||
this.row.title = '로그인 실패';
|
||||
@@ -168,7 +157,6 @@ export default {
|
||||
return;
|
||||
}
|
||||
} catch(err) {
|
||||
//alert("실패 하였습니다.");
|
||||
this.row.title = '로그인';
|
||||
this.row.msg1 = '실패 하였습니다.';
|
||||
this.$refs.commmonModal.alertModalOpen(this.row);
|
||||
@@ -183,17 +171,11 @@ export default {
|
||||
path: link
|
||||
});
|
||||
},
|
||||
ModalOpen: function(target){
|
||||
// this.$refs.LoginPopup.ModalOpen(target);
|
||||
},
|
||||
|
||||
alertCalbackFnc(callFnc){
|
||||
console.log(callFnc)
|
||||
if(callFnc === 'resetPassword'){
|
||||
this.$router.push({ name: 'resetPassword',params: {}});
|
||||
}else if(callFnc === 'updatePassword'){
|
||||
// this.$router.push({ name: 'updatePassword', params: {}}).catch(()=>{});
|
||||
// this.$router.push({ name: 'updatePassword', params: {userId : this.userId} });
|
||||
// this.$router.push({ path: '/view/login/updatePassword', params: {userId : this.userId}});
|
||||
this.$store.commit("login/isLogin", true);
|
||||
this.$store.commit("login/isAuthChk", false);
|
||||
this.$router.push({ name: 'updatePassword',params: {userId : this.userId}});
|
||||
|
||||
Reference in New Issue
Block a user