112 lines
3.4 KiB
Vue
112 lines
3.4 KiB
Vue
<template lang="pug">
|
|
div
|
|
app-menu
|
|
br
|
|
br
|
|
br
|
|
br
|
|
.row
|
|
.col-4.offset-4
|
|
h1 Iniciar Sesión
|
|
br
|
|
br
|
|
form
|
|
.form-group.left
|
|
label(for="email") Email
|
|
input#email.form-control(type="email" v-model="correo")
|
|
.form-group.left
|
|
label(for="email") Contraseña
|
|
input.form-control(type="password" v-model="password")
|
|
div
|
|
.row
|
|
.col-6
|
|
router-link(to="registro") Registro
|
|
.col-6.right
|
|
router-link(to="recuperar") Se olvido tu contraseña?
|
|
button.btn.btn-primary(type="submit" v-on:click="login") Iniciar Sesión
|
|
br
|
|
br
|
|
br
|
|
br
|
|
</template>
|
|
|
|
<script>
|
|
import webMenu from '../estetica/menu.vue'
|
|
import Swal from 'sweetalert2'
|
|
import swal from 'sweetalert';
|
|
import axios from 'axios'
|
|
import config from '../config/config.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
correo: '',
|
|
password: '',
|
|
}
|
|
},
|
|
components: {
|
|
appMenu: webMenu,
|
|
},
|
|
methods: {
|
|
login: function() {
|
|
axios
|
|
.post(
|
|
`${config.api}/loggin_persona`,
|
|
{
|
|
correo: this.correo,
|
|
password: this.password,
|
|
}
|
|
)
|
|
.then(async response => {
|
|
// eslint-disable-next-line
|
|
//console.log(response.data)
|
|
if(response.data.participacion=='Asistente')
|
|
{
|
|
let d=response.data.id_persona[0]
|
|
await swal(`Bienvenido ${d.nombre} ${d.apellido_p} ${d.apellido_m}`,"","success");
|
|
await window.localStorage.setItem('id_persona',`${response.data.id_persona[0].id_persona}`);
|
|
// eslint-disable-next-line
|
|
console.log(response.data.id_persona[0].id_persona)
|
|
this.$router.push( `/registroAsistencia`);
|
|
|
|
// await window.localStorage.setItem('datos',response.data.datos);
|
|
// this.$router.push({
|
|
// path:,
|
|
// });
|
|
return;
|
|
}
|
|
else if (response.data.trabajo) {
|
|
// eslint-disable-next-line
|
|
console.log('trabajo')
|
|
this.$router.push({
|
|
path: `/usuario/${response.data.id_persona[0].id_persona}`,
|
|
})
|
|
} else {
|
|
// eslint-disable-next-line
|
|
console.log('sin trabajo')
|
|
|
|
this.$router.push({
|
|
path: `/ponencia/${response.data.id_persona[0].id_persona}`,
|
|
})
|
|
}
|
|
})
|
|
.catch(error => {
|
|
// eslint-disable-next-line
|
|
console.log(error)
|
|
Swal.fire({
|
|
text: 'Hay un error con el Usuario o contraseña',
|
|
icon: 'error',
|
|
})
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.left {
|
|
text-align: left;
|
|
}
|
|
.right {
|
|
text-align: right;
|
|
}
|
|
</style> |