Files
2026-08-06 11:22:15 -06:00

126 lines
3.1 KiB
Vue

<template>
<section class="container">
<RegistroProfesor ></RegistroProfesor>
<LoginUser
v-if="type === 'User'"
:imprimirMensaje="imprimirMensaje"
:imprimirWarning="imprimirWarning"
:imprimirError="imprimirError"
:updateIsLoading="updateIsLoading"
/>
<LoginAdmin
v-if="type === 'Admin'"
:imprimirMensaje="imprimirMensaje"
:imprimirWarning="imprimirWarning"
:imprimirError="imprimirError"
:updateIsLoading="updateIsLoading"
/>
<div class="has-text-centered">
<b-button @click="types()">{{ type }}</b-button>
</div>
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</section>
</template>
<script>
import LoginUser from '@/components/Login'
import LoginAdmin from '@/components/admin/login'
import RegistroProfesor from '@/pages/profesor/registro-profesor.vue'
export default {
components: { LoginUser, LoginAdmin },
data() {
return {
isLoading: false,
type: 'User',
}
},
methods: {
types() {
this.type == 'Admin' ? (this.type = 'User') : (this.type = 'Admin')
},
updateIsLoading(booleanValue) {
this.isLoading = booleanValue
},
imprimirError(err = {}, title = '¡Hubo un error!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-danger',
title,
message: err.message,
confirmText: 'Entendido',
hasIcon: true,
iconPack: 'mdi',
icon: 'alert-octagon',
onConfirm: () => onConfirm(),
})
if (err.err && err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
imprimirMensaje(message, title = '¡Felicidades!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-success',
title,
message,
confirmText: 'Ok',
hasIcon: true,
iconPack: 'mdi',
icon: 'check-circle',
onConfirm: () => onConfirm(),
})
},
imprimirWarning(
message,
onConfirm = () => {},
title = '¡Espera un minuto!',
onCancel = () => {}
) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-warning',
title,
message,
confirmText: 'Confirmar',
canCancel: true,
cancelText: 'Cancelar',
hasIcon: true,
iconPack: 'mdi',
icon: 'help-circle',
onConfirm: () => onConfirm(),
onCancel: () => onCancel(),
})
},
},
// created() {
// if (
// localStorage.getItem('token') &&
// localStorage.getItem('idUsuario') &&
// localStorage.getItem('nombre') &&
// localStorage.getItem('numeroCuenta') &&
// localStorage.getItem('idCarrera') &&
// localStorage.getItem('carrera')
// )
// this.$router.push('/registro')
// else localStorage.clear()
// },
layout: 'login',
}
</script>
<style scoped></style>