fix(customer-vue): login 페이지 수정

- login 페이지 수정
This commit is contained in:
hoon7566
2022-03-15 18:36:12 +09:00
parent 170ddfa9f8
commit 203f5c62f0
2 changed files with 105 additions and 83 deletions

View File

@@ -23,7 +23,7 @@ const authCheck = async function (to, from, next) {
await auth.requestCheckAccessToken(); await auth.requestCheckAccessToken();
} }
} catch (error) { } catch (error) {
await router.replace("/login"); await router.push("/login");
} }
next(); next();
}; };
@@ -60,11 +60,6 @@ const routes = [
name: 'notification', name: 'notification',
component: () => import('../views/NotificationView') component: () => import('../views/NotificationView')
}, },
{
path: '/login',
name: 'login',
component: () => import('../views/LoginPage')
},
{ {
path: "/item/:itemId", path: "/item/:itemId",
name: 'itemDetail', name: 'itemDetail',
@@ -77,6 +72,11 @@ const routes = [
}, },
] ]
}, },
{
path: '/login',
component: () => import('../views/LoginPage'),
},
{ {
path: '/store', path: '/store',
redirect: 'store', redirect: 'store',

View File

@@ -1,77 +1,84 @@
<template> <template>
<v-container <v-app>
fill-height <v-main>
> <v-container class="px-8 py-8">
<v-row> <v-container
<v-col> fill-height
<div align="center" ><v-img >
max-height="150" <v-row>
max-width="250" <v-col>
:src="logo"></v-img></div> <div align="center" ><v-img
</v-col> max-height="150"
</v-row> max-width="250"
<v-row :src="logo"></v-img></div>
justify="center" </v-col>
> </v-row>
<v-col class="align-content-center"> <v-row
<v-form ref="form" lazy-validation> justify="center"
<v-text-field >
:rules="[v => /.+@.+\..+/.test(v) || 'E-mail must be valid', v => !!v || '이메일은 필수 값입니다']" <v-col class="align-content-center">
label="이메일" <v-form ref="form" lazy-validation>
prepend-icon="mdi-account-circle" <v-text-field
></v-text-field> :rules="[v => /.+@.+\..+/.test(v) || 'E-mail must be valid', v => !!v || '이메일은 필수 값입니다']"
<v-text-field label="이메일"
:rules="[v => !!v || '비밀번호는 필수 값입니다']" prepend-icon="mdi-account-circle"
label="비밀번호" ></v-text-field>
type="Password" <v-text-field
prepend-icon="mdi-lock" :rules="[v => !!v || '비밀번호는 필수 값입니다']"
append-icon="mdi-eye-off" label="비밀번호"
></v-text-field> type="Password"
<v-btn prepend-icon="mdi-lock"
block append-icon="mdi-eye-off"
> ></v-text-field>
Login
</v-btn>
<div class="d-block my-7" align="center">
<v-subheader class="d-inline" >소셜 아이디로 로그인해보세요!</v-subheader>
</div>
<div class="d-block " align="center">
<v-btn <v-btn
class="mx-2" block
fab
small
> >
<v-img Login
class="d-inline-block align-lg-center mx-5"
style=""
max-width="38"
max-height="38"
:src="logo_naver"
@click="login_auth('naver')"
/>
</v-btn>
<v-btn
class="mx-2"
fab
small
>
<v-img
class="d-inline-block mx-5"
max-width="38"
max-height="38"
min-width="38"
min-height="38"
:src="logo_google"
@click="login_auth('google')"
/>
</v-btn> </v-btn>
<div class="d-block my-7" align="center">
<v-subheader class="d-inline" >소셜 아이디로 로그인해보세요!</v-subheader>
</div>
<div class="d-block " align="center">
<v-btn
class="mx-2"
fab
small
>
<v-img
class="d-inline-block align-lg-center mx-5"
style=""
max-width="38"
max-height="38"
:src="logo_naver"
@click="login_auth('naver')"
/>
</v-btn>
<v-btn
class="mx-2"
fab
small
>
<v-img
class="d-inline-block mx-5"
max-width="38"
max-height="38"
min-width="38"
min-height="38"
:src="logo_google"
@click="login_auth('google')"
/>
</v-btn>
</div> </div>
</v-form>
</v-col>
</v-row>
</v-container>
</v-container>
</v-main>
</v-app>
</v-form>
</v-col>
</v-row>
</v-container>
</template> </template>
@@ -79,29 +86,31 @@
import logo from '@/assets/justLogo.png' import logo from '@/assets/justLogo.png'
import logo_naver from '@/assets/logo_naver.svg' import logo_naver from '@/assets/logo_naver.svg'
import logo_google from '@/assets/logo_google.png' import logo_google from '@/assets/logo_google.png'
import jwt from "@/common/jwt";
import router from "@/router/router";
export default { export default {
name: "LoginPage", name: "LoginPage",
data (){ data() {
return { return {
logo : logo, logo: logo,
logo_naver: logo_naver, logo_naver: logo_naver,
logo_google : logo_google, logo_google: logo_google,
auth_popup: null, auth_popup: null,
} }
}, },
watch: { watch: {
auth_popup : function () { auth_popup: function () {
this.auth_popup.addEventListener('beforeunload', function() { this.auth_popup.addEventListener('beforeunload', function () {
window.location.href=process.env.VUE_APP_BASEURL; window.location.href = process.env.VUE_APP_BASEURL;
}); });
} }
}, },
methods: { methods: {
login_auth: async function(target) { login_auth: async function (target) {
const _url = process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL+'/user-service/oauth2/authorization/'+target const _url = process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL + '/user-service/oauth2/authorization/' + target
this.auth_popup = window.open( this.auth_popup = window.open(
_url, _url,
"", "",
@@ -110,9 +119,22 @@ export default {
}, },
}, },
async mounted() {
if (!jwt.isExpired())
await router.push("/");
}
} }
</script> </script>
<style scoped> <style scoped>
.container {
max-width: 768px;
background-color: white;
height: 100%;
}
main {
background-color: #f2f2f2!important;
}
</style> </style>