pcpuma_unam_operador/pages/index.vue

105 lines
2.7 KiB
Vue
Raw Normal View History

2022-05-25 03:38:17 +00:00
<template>
<section class="container">
2022-05-30 23:08:35 +00:00
<Login
:imprimirMensaje="imprimirMensaje"
:imprimirWarning="imprimirWarning"
:imprimirError="imprimirError"
:updateIsLoading="updateIsLoading"
/>
2022-05-25 03:38:17 +00:00
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</section>
</template>
<script>
import Login from '@/components/Login'
export default {
components: { Login },
data() {
return {
2022-05-30 23:08:35 +00:00
// admin: '',
2022-05-25 03:38:17 +00:00
isLoading: false,
}
},
methods: {
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('/')
}
},
2022-05-30 23:08:35 +00:00
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(),
})
},
// getLocalhostInfo() {
// this.admin.idUsuario = Number(localStorage.getItem('idUsuario'))
// this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
// this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
// this.admin.token = {
// headers: {
// token: localStorage.getItem('token'),
// },
// }
// },
2022-05-25 03:38:17 +00:00
},
created() {
2022-05-30 23:08:35 +00:00
// this.getLocalhostInfo()
// if (this.admin.idTipoUsuario === 2) this.$router.push('/responsable')
// if (this.admin.idTipoUsuario === 3) this.$router.push('/alumno')
// if (this.admin.idTipoUsuario === 4) this.$router.push('/casoEspecial')
2022-05-25 03:38:17 +00:00
},
layout: 'login',
}
</script>
<style scoped></style>