598 lines
15 KiB
Vue
598 lines
15 KiB
Vue
<template>
|
|
|
|
|
|
<div class="container">
|
|
<div style="width: 100%;"><div style="position: relative; padding-bottom: 15%; padding-top: 0; height: 0;"><img width="1500px" height="300px" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; padding-left: 20px; padding-right: 20px;" type="text/html" allowscriptaccess="always" allowfullscreen=true scrolling="yes" allownetworking="all" src="../assets/asinea.png" > </div> </div>
|
|
|
|
<div class="wrapper fadeInDown">
|
|
<div id="formContent">
|
|
|
|
<div class="fadeIn first">
|
|
<h1>Iniciar Sesión</h1>
|
|
</div>
|
|
|
|
|
|
|
|
<form>
|
|
<input type="text" id="login" class="fadeIn second" name="login" placeholder="Correo" v-model="correo">
|
|
<input type="password" id="password" class="fadeIn third" name="login" placeholder="Contraseña" v-model="password">
|
|
<input type="button" class="fadeIn fourth" @click="login()" value="Ingresar">
|
|
</form>
|
|
|
|
<div id="formFooter">
|
|
<!--<router-link to="/registro"><a class="underlineHover" href="#" >Registrate</a></router-link> <br/>-->
|
|
<a class="underlineHover" href="#" v-b-modal.enviarPass >¿ Olvidaste tu Contraseña ?</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<b-modal
|
|
id="enviarPass"
|
|
ref="modal"
|
|
title="Enviar correo con constraseña nueva"
|
|
hide-footer
|
|
>
|
|
|
|
<div class="loader" v-if="enviando">Loading...</div>
|
|
|
|
|
|
<div v-else>
|
|
<form ref="form" @submit.stop.prevent="handleSubmit">
|
|
<b-form-group
|
|
|
|
label="Correo"
|
|
|
|
>
|
|
<b-form-input
|
|
id="name-input"
|
|
v-model="enviarPass"
|
|
style="width: 100%; "
|
|
></b-form-input>
|
|
</b-form-group>
|
|
</form>
|
|
|
|
<b-button class="btn btn-outline-success float-right" @click="enviarPassword()" style="width: 100%; ">Enviar</b-button>
|
|
</div>
|
|
|
|
|
|
</b-modal>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from "axios";
|
|
import config from "../config/config.js";
|
|
import Swal from "sweetalert2";
|
|
|
|
export default {
|
|
name: 'Login',
|
|
data() {
|
|
return {
|
|
correo: "",
|
|
password: "",
|
|
enviarPass: "",
|
|
enviando: false
|
|
};
|
|
},
|
|
methods: {
|
|
async login() {
|
|
try {
|
|
const data ={
|
|
correo: this.correo,
|
|
password: this.password
|
|
}
|
|
let response = await axios.post(
|
|
`${config.api}/loginPersona`, data
|
|
)
|
|
if( typeof (response.data.entro) !== 'undefined'){
|
|
Swal.fire({
|
|
title: "Bienvenido",
|
|
text: response.data.msj || response,
|
|
icon: 'success'
|
|
});
|
|
localStorage.clear();
|
|
window.localStorage.setItem("idPersona", response.data.idPersona);
|
|
this.$router.push("/usuario");
|
|
|
|
}
|
|
else{
|
|
|
|
response = await axios.post(
|
|
`${config.api}/loginAdmin`, data
|
|
)
|
|
|
|
if( typeof (response.data.entro) !== 'undefined'){
|
|
Swal.fire({
|
|
title: "Bienvenido Admin",
|
|
text: response.data.msj || response,
|
|
icon: 'success'
|
|
});
|
|
window.localStorage.setItem("idAdmin", response.data.idAdmin);
|
|
this.$router.push("/admin");
|
|
}
|
|
else{
|
|
Swal.fire({
|
|
title: "¿Aún no tienes cuenta?",
|
|
text: response.data.msj || response,
|
|
icon: 'error'
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
catch(error){
|
|
|
|
Swal.fire({
|
|
title: "Error",
|
|
text: error.response.data.msj || error,
|
|
icon: "error"
|
|
});
|
|
}
|
|
|
|
},
|
|
async enviarPassword(){
|
|
try{
|
|
this.enviando=true;
|
|
let response = await axios.post(
|
|
`${config.api}/enviarPassword`, {correo: this.enviarPass}
|
|
)
|
|
this.enviando=false;
|
|
if( typeof (response.data.enviado) !== 'undefined'){
|
|
await Swal.fire({
|
|
title: "Enviado",
|
|
text: `Se ha enviado la nueva contraseña`,
|
|
icon: 'success'
|
|
});
|
|
location.reload();
|
|
}
|
|
else{
|
|
await Swal.fire({
|
|
title: "Error",
|
|
text: response.data.msj || 'No existe',
|
|
icon: "error"
|
|
});
|
|
}
|
|
}
|
|
catch(error){
|
|
this.enviando=false;
|
|
await Swal.fire({
|
|
title: "Error",
|
|
text: error.response.data.msj || error,
|
|
icon: "error"
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
beforeCreate(){
|
|
localStorage.clear();
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
<style scoped>
|
|
.loader,
|
|
.loader:after {
|
|
border-radius: 50%;
|
|
width: 10em;
|
|
height: 10em;
|
|
}
|
|
.loader {
|
|
margin: 60px auto;
|
|
font-size: 10px;
|
|
position: relative;
|
|
text-indent: -9999em;
|
|
border-top: 1.1em solid rgba(0,44,148, 0.2);
|
|
border-right: 1.1em solid rgba(0,44,148, 0.2);
|
|
border-bottom: 1.1em solid rgba(0,44,148, 0.2);
|
|
border-left: 1.1em solid #002c94;
|
|
-webkit-transform: translateZ(0);
|
|
-ms-transform: translateZ(0);
|
|
transform: translateZ(0);
|
|
-webkit-animation: load8 1.1s infinite linear;
|
|
animation: load8 1.1s infinite linear;
|
|
}
|
|
@-webkit-keyframes load8 {
|
|
0% {
|
|
-webkit-transform: rotate(0deg);
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
-webkit-transform: rotate(360deg);
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
@keyframes load8 {
|
|
0% {
|
|
-webkit-transform: rotate(0deg);
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
-webkit-transform: rotate(360deg);
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
|
|
.banner{
|
|
position: realtive;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
h1{
|
|
margin-top:1.5rem;
|
|
margin-bottom:1.5rem;
|
|
}
|
|
html {
|
|
background-color: #56baed;
|
|
}
|
|
|
|
body {
|
|
font-family: "Poppins", sans-serif;
|
|
height: 100vh;
|
|
}
|
|
|
|
a {
|
|
color: #92badd;
|
|
display:inline-block;
|
|
text-decoration: none;
|
|
font-weight: 400;
|
|
}
|
|
|
|
h2 {
|
|
text-align: center;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
display:inline-block;
|
|
margin: 40px 8px 10px 8px;
|
|
color: #cccccc;
|
|
}
|
|
|
|
|
|
|
|
/* STRUCTURE */
|
|
|
|
.wrapper {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
width: 100%;
|
|
min-height: 100%;
|
|
padding: 20px;
|
|
}
|
|
|
|
#formContent {
|
|
-webkit-border-radius: 10px 10px 10px 10px;
|
|
border-radius: 10px 10px 10px 10px;
|
|
background: #fff;
|
|
padding: 30px;
|
|
width: 90%;
|
|
max-width: 450px;
|
|
position: relative;
|
|
padding: 0px;
|
|
-webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
|
|
box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
|
|
text-align: center;
|
|
}
|
|
|
|
#formFooter {
|
|
background-color: #f6f6f6;
|
|
border-top: 1px solid #dce8f1;
|
|
padding: 25px;
|
|
text-align: center;
|
|
-webkit-border-radius: 0 0 10px 10px;
|
|
border-radius: 0 0 10px 10px;
|
|
}
|
|
|
|
|
|
|
|
/* TABS */
|
|
|
|
h2.inactive {
|
|
color: #cccccc;
|
|
}
|
|
|
|
h2.active {
|
|
color: #0d0d0d;
|
|
border-bottom: 2px solid #5fbae9;
|
|
}
|
|
|
|
|
|
|
|
/* FORM TYPOGRAPHY*/
|
|
|
|
input[type=button], input[type=submit], input[type=reset] {
|
|
background-color: #56baed;
|
|
border: none;
|
|
color: white;
|
|
padding: 15px 80px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
text-transform: uppercase;
|
|
font-size: 13px;
|
|
-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
|
box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
|
-webkit-border-radius: 5px 5px 5px 5px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
margin: 5px 20px 40px 20px;
|
|
-webkit-transition: all 0.3s ease-in-out;
|
|
-moz-transition: all 0.3s ease-in-out;
|
|
-ms-transition: all 0.3s ease-in-out;
|
|
-o-transition: all 0.3s ease-in-out;
|
|
transition: all 0.3s ease-in-out;
|
|
}
|
|
|
|
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
|
background-color: #39ace7;
|
|
}
|
|
|
|
input[type=button]:active, input[type=submit]:active, input[type=reset]:active {
|
|
-moz-transform: scale(0.95);
|
|
-webkit-transform: scale(0.95);
|
|
-o-transform: scale(0.95);
|
|
-ms-transform: scale(0.95);
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
input[type=text], input[type=password] {
|
|
background-color: #f6f6f6;
|
|
border: none;
|
|
color: #0d0d0d;
|
|
padding: 15px 32px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 16px;
|
|
margin: 5px;
|
|
width: 85%;
|
|
border: 2px solid #f6f6f6;
|
|
-webkit-transition: all 0.5s ease-in-out;
|
|
-moz-transition: all 0.5s ease-in-out;
|
|
-ms-transition: all 0.5s ease-in-out;
|
|
-o-transition: all 0.5s ease-in-out;
|
|
transition: all 0.5s ease-in-out;
|
|
-webkit-border-radius: 5px 5px 5px 5px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
}
|
|
|
|
input[type=text]:focus {
|
|
background-color: #fff;
|
|
border-bottom: 2px solid #5fbae9;
|
|
}
|
|
|
|
input[type=text]:placeholder {
|
|
color: #cccccc;
|
|
}
|
|
|
|
|
|
|
|
/* ANIMATIONS */
|
|
|
|
/* Simple CSS3 Fade-in-down Animation */
|
|
.fadeInDown {
|
|
-webkit-animation-name: fadeInDown;
|
|
animation-name: fadeInDown;
|
|
-webkit-animation-duration: 1s;
|
|
animation-duration: 1s;
|
|
-webkit-animation-fill-mode: both;
|
|
animation-fill-mode: both;
|
|
}
|
|
|
|
@-webkit-keyframes fadeInDown {
|
|
0% {
|
|
opacity: 0;
|
|
-webkit-transform: translate3d(0, -100%, 0);
|
|
transform: translate3d(0, -100%, 0);
|
|
}
|
|
100% {
|
|
opacity: 1;
|
|
-webkit-transform: none;
|
|
transform: none;
|
|
}
|
|
}
|
|
|
|
@keyframes fadeInDown {
|
|
0% {
|
|
opacity: 0;
|
|
-webkit-transform: translate3d(0, -100%, 0);
|
|
transform: translate3d(0, -100%, 0);
|
|
}
|
|
100% {
|
|
opacity: 1;
|
|
-webkit-transform: none;
|
|
transform: none;
|
|
}
|
|
}
|
|
|
|
/* Simple CSS3 Fade-in Animation */
|
|
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
|
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
|
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
|
|
|
.fadeIn {
|
|
opacity:0;
|
|
-webkit-animation:fadeIn ease-in 1;
|
|
-moz-animation:fadeIn ease-in 1;
|
|
animation:fadeIn ease-in 1;
|
|
|
|
-webkit-animation-fill-mode:forwards;
|
|
-moz-animation-fill-mode:forwards;
|
|
animation-fill-mode:forwards;
|
|
|
|
-webkit-animation-duration:1s;
|
|
-moz-animation-duration:1s;
|
|
animation-duration:1s;
|
|
}
|
|
|
|
.fadeIn.first {
|
|
-webkit-animation-delay: 0.4s;
|
|
-moz-animation-delay: 0.4s;
|
|
animation-delay: 0.4s;
|
|
}
|
|
|
|
.fadeIn.second {
|
|
-webkit-animation-delay: 0.6s;
|
|
-moz-animation-delay: 0.6s;
|
|
animation-delay: 0.6s;
|
|
}
|
|
|
|
.fadeIn.third {
|
|
-webkit-animation-delay: 0.8s;
|
|
-moz-animation-delay: 0.8s;
|
|
animation-delay: 0.8s;
|
|
}
|
|
|
|
.fadeIn.fourth {
|
|
-webkit-animation-delay: 1s;
|
|
-moz-animation-delay: 1s;
|
|
animation-delay: 1s;
|
|
}
|
|
|
|
/* Simple CSS3 Fade-in Animation */
|
|
.underlineHover:after {
|
|
display: block;
|
|
left: 0;
|
|
bottom: -10px;
|
|
width: 0;
|
|
height: 2px;
|
|
background-color: #56baed;
|
|
content: "";
|
|
transition: width 0.2s;
|
|
}
|
|
|
|
.underlineHover:hover {
|
|
color: #0d0d0d;
|
|
}
|
|
|
|
.underlineHover:hover:after{
|
|
width: 100%;
|
|
}
|
|
|
|
|
|
|
|
/* OTHERS */
|
|
|
|
*:focus {
|
|
outline: none;
|
|
}
|
|
|
|
#icon {
|
|
width:60%;
|
|
}
|
|
|
|
@media (max-width: 500px) {
|
|
th{
|
|
font-size: .5rem;
|
|
}
|
|
td{
|
|
font-size: .5rem;
|
|
}
|
|
.principal{
|
|
padding: .1rem;
|
|
}
|
|
input[type=button], input[type=submit], input[type=reset] {
|
|
background-color: #56baed;
|
|
border: none;
|
|
color: white;
|
|
padding: 15px 60px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
text-transform: uppercase;
|
|
font-size: 12px;
|
|
-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
|
box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
|
-webkit-border-radius: 5px 5px 5px 5px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
margin: 5px 20px 40px 20px;
|
|
-webkit-transition: all 0.3s ease-in-out;
|
|
-moz-transition: all 0.3s ease-in-out;
|
|
-ms-transition: all 0.3s ease-in-out;
|
|
-o-transition: all 0.3s ease-in-out;
|
|
transition: all 0.3s ease-in-out;
|
|
}
|
|
|
|
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
|
background-color: #39ace7;
|
|
}
|
|
|
|
input[type=button]:active, input[type=submit]:active, input[type=reset]:active {
|
|
-moz-transform: scale(0.95);
|
|
-webkit-transform: scale(0.95);
|
|
-o-transform: scale(0.95);
|
|
-ms-transform: scale(0.95);
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
input[type=text], input[type=password], input[type=number]{
|
|
background-color: #f6f6f6;
|
|
border: none;
|
|
color: #0d0d0d;
|
|
padding: 15px 32px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 12px;
|
|
margin-top: 3px;
|
|
margin-bottom: 3px;
|
|
margin-left:3px;
|
|
|
|
|
|
width: 90%;
|
|
border: 2px solid #f6f6f6;
|
|
-webkit-transition: all 0.5s ease-in-out;
|
|
-moz-transition: all 0.5s ease-in-out;
|
|
-ms-transition: all 0.5s ease-in-out;
|
|
-o-transition: all 0.5s ease-in-out;
|
|
transition: all 0.5s ease-in-out;
|
|
-webkit-border-radius: 5px 5px 5px 5px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
}
|
|
select[type=text] {
|
|
background-color: #f6f6f6;
|
|
border: none;
|
|
color: #0d0d0d;
|
|
padding: 15px 2px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 9px;
|
|
margin-top: 3px;
|
|
margin-bottom: 3px;
|
|
margin-left:3px;
|
|
width: 90%;
|
|
border: 2px solid #f6f6f6;
|
|
-webkit-transition: all 0.5s ease-in-out;
|
|
-moz-transition: all 0.5s ease-in-out;
|
|
-ms-transition: all 0.5s ease-in-out;
|
|
-o-transition: all 0.5s ease-in-out;
|
|
transition: all 0.5s ease-in-out;
|
|
-webkit-border-radius: 5px 5px 5px 5px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
}
|
|
.wrapperRow {
|
|
display: flex;
|
|
justify-content: center;
|
|
width: 100%;
|
|
min-height: 100%;
|
|
|
|
margin: 3px;
|
|
|
|
}
|
|
h1{
|
|
font-size: 2rem;
|
|
}
|
|
}
|
|
</style>
|