logalstorage validado
This commit is contained in:
parent
57fc9c42af
commit
94d21decb6
@ -86,7 +86,13 @@ export default {
|
||||
.post(`${process.env.api}/auth/login-operador`, data)
|
||||
.then((res) => {
|
||||
const info = JSON.stringify(res.data)
|
||||
const token = res.data.token
|
||||
const operador = JSON.stringify(res.data.operador)
|
||||
|
||||
localStorage.setItem('operador', operador)
|
||||
localStorage.setItem('token', token)
|
||||
localStorage.setItem('usuario', info)
|
||||
localStorage.setItem('idModulo', this.idModulo)
|
||||
this.updateIsLoading(false)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
})
|
||||
|
@ -63,8 +63,12 @@ export default {
|
||||
)
|
||||
.then((res) => {
|
||||
const info = JSON.stringify(res.data)
|
||||
const token = res.data.token
|
||||
const operador = JSON.stringify(res.data.operador)
|
||||
|
||||
localStorage.setItem('usuario', info)
|
||||
localStorage.setItem('token', res.data.token)
|
||||
localStorage.setItem('operador', operador)
|
||||
localStorage.setItem('token', token)
|
||||
this.updateIsLoading(false)
|
||||
if (res.data.operador.tipoUsuario.id_tipo_usuario === 3)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
|
@ -377,6 +377,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
open: false,
|
||||
operador: {},
|
||||
token: '',
|
||||
idTipoUsuario: '',
|
||||
}
|
||||
},
|
||||
@ -395,10 +397,27 @@ export default {
|
||||
icono(ruta) {
|
||||
return this.activo(ruta) ? 'square' : 'crop-square'
|
||||
},
|
||||
validarLocalStorage() {
|
||||
this.operador = JSON.parse(localStorage.getItem('operador'))
|
||||
this.token = localStorage.getItem('token')
|
||||
if (
|
||||
!this.token ||
|
||||
!this.operador ||
|
||||
!this.operador.id_operador ||
|
||||
!this.operador.tipoUsuario.id_tipo_usuario ||
|
||||
!this.operador.id_operador ||
|
||||
(this.operador.tipoUsuario.id_tipo_usuario != 2 &&
|
||||
!this.operador.institucion)
|
||||
)
|
||||
this.$router.push('/')
|
||||
},
|
||||
},
|
||||
created() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.idTipoUsuario = objeto.operador.tipoUsuario.id_tipo_usuario
|
||||
this.validarLocalStorage()
|
||||
this.idTipoUsuario = this.operador.tipoUsuario.id_tipo_usuario
|
||||
},
|
||||
updated() {
|
||||
this.validarLocalStorage()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -39,6 +39,7 @@
|
||||
:page="page"
|
||||
columnaActivo
|
||||
columnaInstitucion
|
||||
columnaPasswordChange
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -26,20 +26,20 @@ export default {
|
||||
sockets: [
|
||||
{
|
||||
name: 'main',
|
||||
// url: 'http://localhost:3000',
|
||||
url: 'https://venus.acatlan.unam.mx',
|
||||
url: 'http://localhost:3000',
|
||||
// url: 'https://venus.acatlan.unam.mx',
|
||||
// url: 'https://pmodulospcpuma.unam.mx',
|
||||
// url: 'https://modulospcpuma.unam.mx',
|
||||
},
|
||||
],
|
||||
},
|
||||
env: {
|
||||
// api: 'http://localhost:3000',
|
||||
api: 'https://venus.acatlan.unam.mx/pcpumaUnam_test',
|
||||
api: 'http://localhost:3000',
|
||||
// api: 'https://venus.acatlan.unam.mx/pcpumaUnam_test',
|
||||
// api: 'https://pmodulospcpuma.unam.mx/pcpumaUnam_test',
|
||||
// api: 'https://modulospcpuma.unam.mx/',
|
||||
// path: '/socket.io/',
|
||||
path: '/pcpumaUnam_test/socket.io/',
|
||||
path: '/socket.io/',
|
||||
// path: '/pcpumaUnam_test/socket.io/',
|
||||
// path: '/pcpumaUnam/socket.io/',
|
||||
},
|
||||
}
|
||||
|
@ -24,13 +24,9 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 2)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
},
|
||||
|
@ -27,18 +27,17 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 3
|
||||
)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -16,26 +16,25 @@ export default {
|
||||
components: { Modulos, Title },
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
admin: {},
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 3
|
||||
)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -20,29 +20,24 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
actualizarTabla: false,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateActualizarTabla(valorBooleano) {
|
||||
this.actualizarTabla = valorBooleano
|
||||
},
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 3
|
||||
)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -1,53 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<Title title="Reportes" :operador="admin" />
|
||||
|
||||
<section>
|
||||
<b-tabs position="is-centered" type="is-boxed">
|
||||
<b-tab-item label="Prestamos" icon="calendar"> </b-tab-item>
|
||||
|
||||
<b-tab-item
|
||||
label="Total de préstamos por módulo"
|
||||
icon="storefront-outline"
|
||||
></b-tab-item>
|
||||
|
||||
<b-tab-item
|
||||
label="Cantidad de prestamos por horario"
|
||||
icon="calendar-check"
|
||||
></b-tab-item>
|
||||
|
||||
<b-tab-item label="Informe general" icon="chart-box">
|
||||
<InformeGeneral :admin="admin" :updateIsLoading="updateIsLoading" />
|
||||
</b-tab-item>
|
||||
</b-tabs>
|
||||
</section>
|
||||
|
||||
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Title from '@/components/layouts/Title'
|
||||
import InformeGeneral from '@/components/admin/InformeGeneral'
|
||||
|
||||
export default {
|
||||
components: { Title, InformeGeneral },
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
},
|
||||
}
|
||||
</script>
|
@ -20,26 +20,24 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
actualizarTabla: false,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateActualizarTabla(valorBooleano) {
|
||||
this.actualizarTabla = valorBooleano
|
||||
},
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -16,22 +16,19 @@ export default {
|
||||
components: { CrearCatalogos, Title },
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
admin: {},
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 2)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -23,26 +23,24 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
actualizarTabla: false,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateActualizarTabla(valorBooleano) {
|
||||
this.actualizarTabla = valorBooleano
|
||||
},
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -27,15 +27,17 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -27,15 +27,17 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -27,15 +27,17 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -30,15 +30,17 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 3) {
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 4)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -20,10 +20,7 @@ import Title from '@/components/layouts/Title'
|
||||
import Institucion from '@/components/admin/Institucion'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Title,
|
||||
Institucion,
|
||||
},
|
||||
components: { Institucion, Title },
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
@ -34,13 +31,14 @@ export default {
|
||||
updateIsLoading(valorBooleano) {
|
||||
this.isLoading = valorBooleano
|
||||
},
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 2 &&
|
||||
this.admin.tipoUsuario.id_tipo_usuario != 3
|
||||
)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -13,18 +13,12 @@ import Instituciones from '@/components/super_admin/Instituciones'
|
||||
export default {
|
||||
components: { Instituciones, Title },
|
||||
data() {
|
||||
return {
|
||||
admin: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
localStorageData() {
|
||||
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||||
this.admin = objeto.operador
|
||||
},
|
||||
return { admin: {} }
|
||||
},
|
||||
created() {
|
||||
this.localStorageData()
|
||||
this.admin = JSON.parse(localStorage.getItem('operador'))
|
||||
if (this.admin.tipoUsuario.id_tipo_usuario != 2)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user