Files
cooloquio_front/src/components/Login.vue
T

95 lines
2.5 KiB
Vue
Raw Normal View History

2020-02-14 21:33:52 -06:00
<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
2020-02-17 21:52:49 -06:00
input#email.form-control(type="email" v-model="correo")
2020-02-14 21:33:52 -06:00
.form-group.left
label(for="email") Contraseña
2020-02-17 21:52:49 -06:00
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
2020-02-14 21:33:52 -06:00
br
br
br
br
</template>
<script>
import webMenu from '../estetica/menu.vue'
2020-02-18 19:11:42 -06:00
import Swal from 'sweetalert2'
2020-02-17 21:52:49 -06:00
import axios from 'axios'
2020-02-14 21:33:52 -06:00
export default {
2020-02-17 21:52:49 -06:00
data() {
return {
correo: '',
password: '',
}
},
2020-02-14 21:33:52 -06:00
components: {
appMenu: webMenu,
},
2020-02-17 21:52:49 -06:00
methods: {
login: function() {
axios
.post(
'https://venus.acatlan.unam.mx/coloquioeducacion/loggin_persona',
{
correo: this.correo,
password: this.password,
}
)
.then(response => {
// eslint-disable-next-line
console.log(response.data)
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)
2020-02-18 19:11:42 -06:00
Swal.fire({
text: 'Hay un error con el Usuario o contraseña',
icon: 'error',
})
2020-02-17 21:52:49 -06:00
})
},
},
2020-02-14 21:33:52 -06:00
}
</script>
<style scoped>
.left {
text-align: left;
}
2020-02-17 21:52:49 -06:00
.right {
text-align: right;
}
2020-02-14 21:33:52 -06:00
</style>