From a9fdd4b80dcdeac89f5fa21534c5cc83c69fc5c5 Mon Sep 17 00:00:00 2001 From: eithan Date: Tue, 5 Jan 2021 23:04:49 -0600 Subject: [PATCH 1/4] tokens, funcion error sin probar, cambiar los loading de js a html --- components/alumno/DataAlumno.vue | 495 --------------------------- nuxt.config.js | 4 +- pages/alumno/cuestionario/index.vue | 123 ++++--- pages/alumno/index.vue | 507 +++++++++++++++++++++++++++- pages/index.vue | 10 +- pages/responsable/nuevo/index.vue | 115 ++++--- 6 files changed, 662 insertions(+), 592 deletions(-) delete mode 100644 components/alumno/DataAlumno.vue diff --git a/components/alumno/DataAlumno.vue b/components/alumno/DataAlumno.vue deleted file mode 100644 index 3789d88..0000000 --- a/components/alumno/DataAlumno.vue +++ /dev/null @@ -1,495 +0,0 @@ - - - - - diff --git a/nuxt.config.js b/nuxt.config.js index 03f4513..39db939 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -46,8 +46,8 @@ export default { // Build Configuration (https://go.nuxtjs.dev/config-build) build: {}, env: { - api: "http://localhost:3000", - // api: "https://venus.acatlan.unam.mx/ss-pruebas", + //api: "http://localhost:3000", + api: "https://venus.acatlan.unam.mx/ss-pruebas", // api: "https://890af9d598a4.ngrok.io" // api: 'https//venus.acatlan.unam.mx/pruebas_pcpuma' }, diff --git a/pages/alumno/cuestionario/index.vue b/pages/alumno/cuestionario/index.vue index 372ae36..5b06655 100644 --- a/pages/alumno/cuestionario/index.vue +++ b/pages/alumno/cuestionario/index.vue @@ -765,10 +765,12 @@

Ya has contestado tu cuestionario :)

+ + diff --git a/pages/index.vue b/pages/index.vue index 4decf5d..11a8412 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -84,14 +84,8 @@ export default { window.localStorage.setItem("idUsuario", resp.data.Usuario.idUsuario); window.localStorage.setItem("token", resp.data.token); window.localStorage.setItem("nombre", resp.data.Usuario.nombre); - window.localStorage.setItem( - "idTipoUsuario", - resp.data.Usuario.TipoUsuario.idTipoUsuario - ); - window.localStorage.setItem( - "tipoUsuario", - resp.data.Usuario.TipoUsuario.tipoUsuario - ); + window.localStorage.setItem("idTipoUsuario", resp.data.Usuario.TipoUsuario.idTipoUsuario); + window.localStorage.setItem("tipoUsuario", resp.data.Usuario.TipoUsuario.tipoUsuario); window.localStorage.setItem("usuario", resp.data.Usuario.usuario); this.$router.push(`/${resp.data.Usuario.TipoUsuario.tipoUsuario}`); }) diff --git a/pages/responsable/nuevo/index.vue b/pages/responsable/nuevo/index.vue index 0564b9d..353d5af 100644 --- a/pages/responsable/nuevo/index.vue +++ b/pages/responsable/nuevo/index.vue @@ -213,6 +213,7 @@ + @@ -225,7 +226,12 @@ import moment from "moment"; export default { data() { return { - isFullPage: true, + token: { + headers:{ + token: window.localStorage.getItem('token') + } + }, + isLoading:false, noCuenta: "", sizeOk: "", searched: false, @@ -330,19 +336,47 @@ export default { return ""; } }, + error(msj){ + let salir =false; + switch(msj){ + case 'invalid signature': + msj= "tu token no es valido, inicia sesión de nuevo" + break; + case 'jwt expired': + msj= "tu sesión ha expirado, inicia sesión de nuevo" + break; + case 'no hay token': + msj= "no has enviado tu token, inicia sesión de nuevo" + break; + default: + salir=true + } + + this.$buefy.dialog.alert({ + title: "Error", + message: msj, + type: "is-danger", + hasIcon: true, + icon: "alert-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + if (salir === true) { + localStorage.clear() + this.$router.push(`/`) + } + + }, buscarAlumno() { - const loadingComponent = this.$buefy.loading.open({ - container: this.isFullPage ? null : this.$refs.element.$el, - }); + this.isLoading=true axios .get(`${process.env.api}/usuario/escolares`, { params: { numeroCuenta: this.noCuenta, }, - }) + },this.token) .then((resp) => { - loadingComponent.close(); - console.log(resp.data); this.alumno.cuenta = this.noCuenta; this.alumno.nombre = resp.data.nombre; @@ -350,27 +384,17 @@ export default { this.alumno.creditos = parseInt(resp.data.creditos, 10); this.alumno.idCarrera = resp.data.idCarrera; this.alumno.idAlumno = resp.data.idUsuario; - this.searched = true; }) .catch((error) => { - loadingComponent.close(); - this.$buefy.dialog.alert({ - title: "Error", - message: error.response.data.message, - type: "is-danger", - hasIcon: true, - icon: "alert-circle", - iconPack: "mdi", - ariaRole: "alertdialog", - ariaModal: true, - }); + this.error(error.response.data.message) + }) + .finally(()=>{ + this.isLoading = false }); }, Enviar() { - const loadingComponent = this.$buefy.loading.open({ - container: this.isFullPage ? null : this.$refs.element.$el, - }); + this.isLoading=true const data = { idUsuario: this.alumno.idAlumno, idPrograma: this.programaSelected.idPrograma, @@ -382,20 +406,20 @@ export default { profesor: this.programaSelected.profesor, fechaInicio: moment(this.alumno.inicio), fechaFin: moment(this.alumno.fin), - }; - const formData = new FormData(); - console.log(data); - formData.append("alumno", JSON.stringify(data)); - formData.append("cartaAceptacion", this.file); + }; + const formData = new FormData(); + console.log(data); + formData.append("alumno", JSON.stringify(data)); + formData.append("cartaAceptacion", this.file); axios .post(`${process.env.api}/servicio/nuevo`, formData, { headers: { "Content-Type": "multipart/form-data", + token:this.token.headers.token }, }) .then((res) => { - loadingComponent.close(); this.$buefy.dialog.alert({ title: "Success", message: "Se enviaron los datos correctamente", @@ -410,17 +434,10 @@ export default { this.reset(); }) .catch((error) => { - loadingComponent.close(); - this.$buefy.dialog.alert({ - title: "Error", - message: error.response.data.message, - type: "is-danger", - hasIcon: true, - icon: "alert-circle", - iconPack: "mdi", - ariaRole: "alertdialog", - ariaModal: true, - }); + this.error(error.response.data.message) + }) + .finally(()=>{ + this.isLoading = false }); }, }, @@ -452,6 +469,20 @@ export default { } } } + else{ + + this.programaSelected.institucion = ""; + this.programaSelected.dependencia = ""; + this.programaSelected.programa = ""; + this.programaSelected.clavePrograma = ""; + this.programaSelected.acatlan = ""; + this.programaSelected.activo = ""; + //this.programaSelected.idUsuario = ""; + this.programaSelected.programaInterno = ""; + this.programaSelected.profesor = ""; + + + } }, file() { console.log(this.file.size); @@ -479,15 +510,15 @@ export default { .get(`${process.env.api}/programa`, { params: { idUsuario: localStorage.getItem("idUsuario"), - }, - }) + } + },this.token) .then((resp) => { console.log(resp.data); this.programas = resp.data; console.log(this.programas); }) .catch((error) => { - console.log(error.response.data.message); + this.error(error.response.data.message) }); }, computed: { From 34773defe027bb34c78b542765130a2ee7c14aa0 Mon Sep 17 00:00:00 2001 From: mxrco Date: Wed, 6 Jan 2021 00:10:12 -0600 Subject: [PATCH 2/4] token --- components/admin/servicio/documento.vue | 74 +++++++++-- components/admin/servicio/modificar/form.vue | 46 ++++++- .../admin/servicio/programa/cargaMasiva.vue | 59 +++++++-- .../servicio/programa/tablaResponsables.vue | 42 +++++- components/admin/servicio/vistaServicio.vue | 102 +++++++++------ .../admin/programa/infoResponsable/index.vue | 42 ++++-- .../infoResponsable/modificar/index.vue | 120 +++++++++++++----- 7 files changed, 388 insertions(+), 97 deletions(-) diff --git a/components/admin/servicio/documento.vue b/components/admin/servicio/documento.vue index 47cf331..e64b7a1 100644 --- a/components/admin/servicio/documento.vue +++ b/components/admin/servicio/documento.vue @@ -52,6 +52,11 @@ export default { mensajeBool: false, idServicio: localStorage.getItem("idServicio"), isLoading: false, + token: { + headers: { + token: window.localStorage.getItem("token"), + }, + }, }; }, methods: { @@ -97,7 +102,11 @@ export default { idServicio: this.idServicio, }; axios - .put(`${process.env.api}/servicio/rechazar_aceptacion`, data) + .put( + `${process.env.api}/servicio/rechazar_aceptacion`, + data, + this.token + ) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("Se ha rechazado el documento"); @@ -105,8 +114,9 @@ export default { }) .catch((err) => { this.isLoading = false; - this.error(); - console.log(err); + this.error(err.response.data.message); + console.log(err.response.data.message); + this.errorDoc(); }); }, rechazarCartaTermino() { @@ -116,7 +126,7 @@ export default { idServicio: this.idServicio, }; axios - .put(`${process.env.api}/servicio/rechazar_termino`, data) + .put(`${process.env.api}/servicio/rechazar_termino`, data, this.token) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("Se ha rechazado el documento"); @@ -124,8 +134,9 @@ export default { }) .catch((err) => { this.isLoading = false; - this.error(); - console.log(err); + this.error(err.response.data.message); + console.log(err.response.data.message); + this.errorDoc(); }); }, rechazarInformeGlobal() { @@ -135,7 +146,7 @@ export default { idServicio: this.idServicio, }; axios - .put(`${process.env.api}/servicio/rechazar_informe`, data) + .put(`${process.env.api}/servicio/rechazar_informe`, data, this.token) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("Se ha rechazado el documento"); @@ -143,10 +154,55 @@ export default { }) .catch((err) => { this.isLoading = false; - this.error(); - console.log(err); + this.error(err.response.data.message); + console.log(err.response.data.message); + this.errorDoc(); }); }, + error(msj) { + let salir = false; + switch (msj) { + case "invalid signature": + msj = "tu token no es valido, inicia sesión de nuevo"; + break; + case "jwt expired": + msj = "tu sesión ha expirado, inicia sesión de nuevo"; + break; + case "no hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + break; + default: + salir = true; + } + + this.$buefy.dialog.alert({ + title: "Error", + message: msj, + type: "is-danger", + hasIcon: true, + icon: "alert-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + if (salir === true) { + localStorage.clear(); + this.$router.push(`/`); + } + }, + errorDoc() { + this.$buefy.dialog.alert({ + title: "Error", + message: + "Ha ocurrido un error al rechazar el documento", + type: "is-danger", + hasIcon: true, + icon: "times-circle", + iconPack: "fa", + ariaRole: "alertdialog", + ariaModal: true, + }); + }, }, }; diff --git a/components/admin/servicio/modificar/form.vue b/components/admin/servicio/modificar/form.vue index 4680302..7739fe6 100644 --- a/components/admin/servicio/modificar/form.vue +++ b/components/admin/servicio/modificar/form.vue @@ -179,6 +179,11 @@ export default { fechaNacimiento: [], fechaInicio: [], fechaFin: [], + token: { + headers: { + token: window.localStorage.getItem("token"), + }, + }, minDate1: new Date("2020-01-01"), isLoading: false, }; @@ -291,14 +296,20 @@ export default { formData.append("data", JSON.stringify(data)); } axios - .put(`${process.env.api}/servicio/update`, formData) + .put(`${process.env.api}/servicio/update`, formData, { + headers: { + "Content-Type": "multipart/form-data", + token: this.token.headers.token, + }, + }) .then((res) => { this.isLoading = false; - this.$router.push("./"); this.toast(); + this.$router.push("/admin/servicio/modificar"); }) .catch((err) => { this.isLoading = false; + this.error(err.response.data.message); console.log(err.response.data.message); }); }, @@ -313,6 +324,37 @@ export default { onConfirm: () => this.actualizar(), }); }, + error(msj) { + let salir = false; + switch (msj) { + case "invalid signature": + msj = "tu token no es valido, inicia sesión de nuevo"; + break; + case "jwt expired": + msj = "tu sesión ha expirado, inicia sesión de nuevo"; + break; + case "no hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + break; + default: + salir = true; + } + + this.$buefy.dialog.alert({ + title: "Error", + message: msj, + type: "is-danger", + hasIcon: true, + icon: "alert-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + if (salir === true) { + localStorage.clear(); + this.$router.push(`/`); + } + }, fecha(date) { if (date) { const fecha = moment(date.substr(0, 10)); diff --git a/components/admin/servicio/programa/cargaMasiva.vue b/components/admin/servicio/programa/cargaMasiva.vue index 06ac9eb..272ed13 100644 --- a/components/admin/servicio/programa/cargaMasiva.vue +++ b/components/admin/servicio/programa/cargaMasiva.vue @@ -36,10 +36,16 @@ diff --git a/components/admin/servicio/programa/tablaResponsables.vue b/components/admin/servicio/programa/tablaResponsables.vue index 5d1ff85..50bc161 100644 --- a/components/admin/servicio/programa/tablaResponsables.vue +++ b/components/admin/servicio/programa/tablaResponsables.vue @@ -74,6 +74,11 @@ export default { correo: "", nombre: "", idStatus: 1, + token: { + headers: { + token: window.localStorage.getItem("token"), + }, + } }; }, methods: { @@ -87,7 +92,8 @@ export default { this.data = []; axios .get( - `${process.env.api}/usuario/responsable?pagina=${this.page}&nombre=${this.nombre}&correo=${this.correo}` + `${process.env.api}/usuario/responsable?pagina=${this.page}&nombre=${this.nombre}&correo=${this.correo}`, + this.token ) .then((res) => { const servicios = res.data.servicios; @@ -110,10 +116,42 @@ export default { this.loading = false; }) .catch((err) => { - console.log(err.response.data.message); this.loading = false; + this.error(err.response.data.message); + console.log(err.response.data.message); }); }, + error(msj){ + let salir =false; + switch(msj){ + case 'invalid signature': + msj= "tu token no es valido, inicia sesión de nuevo" + break; + case 'jwt expired': + msj= "tu sesión ha expirado, inicia sesión de nuevo" + break; + case 'no hay token': + msj= "no has enviado tu token, inicia sesión de nuevo" + break; + default: + salir=true + } + + this.$buefy.dialog.alert({ + title: "Error", + message: msj, + type: "is-danger", + hasIcon: true, + icon: "alert-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + if (salir === true) { + localStorage.clear() + this.$router.push(`/`) + } + }, insertIdLocal() { this.idUsuario = localStorage.getItem("idUsuario"); }, diff --git a/components/admin/servicio/vistaServicio.vue b/components/admin/servicio/vistaServicio.vue index 346a382..4b811e3 100644 --- a/components/admin/servicio/vistaServicio.vue +++ b/components/admin/servicio/vistaServicio.vue @@ -65,22 +65,20 @@

-
- - Confirmar - - - Confirmar - -
+ + Confirmar + + + Confirmar + Cancelar @@ -175,8 +173,8 @@ export default { this.isLoading = true; return axios .get( - `${process.env.api}/servicio/admin?idServicio=${this.idServicio}` //, - // this.token + `${process.env.api}/servicio/admin?idServicio=${this.idServicio}`, + this.token ) .then((res) => { this.isLoading = false; @@ -194,7 +192,8 @@ export default { }) .catch((err) => { this.isLoading = false; - console.log(err.response); + this.error(err.response.data.message); + console.log(err.response.data.message); }); }, cancelarDialog() { @@ -235,17 +234,21 @@ export default { mensaje: this.mensajeCancel, }; axios - .put(`${process.env.api}/servicio/cancelar`, data) + .put( + `${process.env.api}/servicio/cancelar`, + data, + this.token + ) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("El servicio ha sido cancelado con éxito"); localStorage.removeItem("idServicio"); - this.$router.push("./"); + this.$router.push("/admin"); }) .catch((err) => { this.isLoading = false; - this.error(); - console.log(err); + this.error(err.response.data.message); + console.log(err.response.data.message); }); }, confirmarRegistro() { @@ -254,17 +257,21 @@ export default { idServicio: this.idServicio, }; axios - .put(`${process.env.api}/servicio/registro`, data) + .put( + `${process.env.api}/servicio/registro`, + data, + this.token + ) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("El servicio ha sido aprovado"); localStorage.removeItem("idServicio"); this.$router.push("/admin"); }) - .catch((e) => { + .catch((err) => { this.isLoading = false; - console.log(e); - this.error(); + this.error(err.response.data.message); + console.log(err.response.data.message); }); }, confirmarLiberacion() { @@ -276,31 +283,54 @@ export default { data.vistoBueno = this.alumno.vistoBueno; } axios - .put(`${process.env.api}/servicio/liberacion`, data) + .put( + `${process.env.api}/servicio/liberacion`, + data, + this.token + ) .then((res) => { this.isLoading = false; this.$buefy.dialog.alert("El servicio ha sido liberado"); localStorage.removeItem("idServicio"); this.$router.push("/admin"); }) - .catch((e) => { + .catch((err) => { this.isLoading = false; - console.log(e); - this.error(); + this.error(err.response.data.message); + console.log(err.response.data.message); }); }, - error() { + error(msj) { + let salir = false; + switch (msj) { + case "invalid signature": + msj = "tu token no es valido, inicia sesión de nuevo"; + break; + case "jwt expired": + msj = "tu sesión ha expirado, inicia sesión de nuevo"; + break; + case "no hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + break; + default: + salir = true; + } + this.$buefy.dialog.alert({ title: "Error", - message: "Ha ocurrido un error, inténtalo de nuevo más tarde", + message: msj, type: "is-danger", hasIcon: true, - icon: "times-circle", - iconPack: "fa", + icon: "alert-circle", + iconPack: "mdi", ariaRole: "alertdialog", ariaModal: true, }); - } + if (salir === true) { + localStorage.clear(); + this.$router.push(`/`); + } + }, }, async created() { await this.obtenerRegistro(); diff --git a/pages/admin/programa/infoResponsable/index.vue b/pages/admin/programa/infoResponsable/index.vue index 45a3f6e..19e2acd 100644 --- a/pages/admin/programa/infoResponsable/index.vue +++ b/pages/admin/programa/infoResponsable/index.vue @@ -53,34 +53,58 @@ export default { nombre: localStorage.getItem('nombre'), programas: [], selected: {}, + token: { + headers: { + token: window.localStorage.getItem("token") + } + } }; }, methods: { obtenerProgramas () { return axios .get( - `${process.env.api}/programa?idUsuario=${this.idResponsable}` //,this.token + `${process.env.api}/programa?idUsuario=${this.idResponsable}`,this.token ) .then((res) => { this.programas = res.data }) .catch((err) => { - this.error(); - console.log(err.response); + this.errorToken(err.response.data.message); + console.log(err.response.data.message); }); }, - error() { + errorToken(msj){ + let salir =false; + switch(msj){ + case 'invalid signature': + msj= "tu token no es valido, inicia sesión de nuevo" + break; + case 'jwt expired': + msj= "tu sesión ha expirado, inicia sesión de nuevo" + break; + case 'no hay token': + msj= "no has enviado tu token, inicia sesión de nuevo" + break; + default: + salir=true + } + this.$buefy.dialog.alert({ title: "Error", - message: "Ha ocurrido un error, inténtalo de nuevo más tarde", + message: msj, type: "is-danger", hasIcon: true, - icon: "times-circle", - iconPack: "fa", + icon: "alert-circle", + iconPack: "mdi", ariaRole: "alertdialog", ariaModal: true, - }); - } + }); + if (salir === true) { + localStorage.clear() + this.$router.push(`/`) + } + }, }, created () { this.obtenerProgramas() diff --git a/pages/admin/programa/infoResponsable/modificar/index.vue b/pages/admin/programa/infoResponsable/modificar/index.vue index ccbe3e2..5e8ac90 100644 --- a/pages/admin/programa/infoResponsable/modificar/index.vue +++ b/pages/admin/programa/infoResponsable/modificar/index.vue @@ -1,8 +1,6 @@ From dee659a204e3f547ceb41ae58af167459c1cd029 Mon Sep 17 00:00:00 2001 From: eithan Date: Wed, 6 Jan 2021 06:33:28 -0600 Subject: [PATCH 3/4] peticiones con tokens correctas, status de vistas de alumnos correctos --- pages/alumno/cuestionario/index.vue | 17 +++-- pages/alumno/index.vue | 109 ++++++++++++++++++++-------- pages/responsable/nuevo/index.vue | 25 +++---- 3 files changed, 99 insertions(+), 52 deletions(-) diff --git a/pages/alumno/cuestionario/index.vue b/pages/alumno/cuestionario/index.vue index 5b06655..4ca5637 100644 --- a/pages/alumno/cuestionario/index.vue +++ b/pages/alumno/cuestionario/index.vue @@ -780,7 +780,7 @@ export default { return { token: { headers:{ - taken: window.localStorage.getItem('token') + token: window.localStorage.getItem('token') } }, maxCheckbox: 0, @@ -1022,20 +1022,25 @@ export default { // activar boton else return true; }, - error(msj){ + error(msj){ let salir =false; switch(msj){ case 'invalid signature': msj= "tu token no es valido, inicia sesión de nuevo" + salir=true break; case 'jwt expired': msj= "tu sesión ha expirado, inicia sesión de nuevo" + salir=true break; - case 'no hay token': + case 'jwt malformed': + msj= "tu token esta mal formado, inicia sesión de nuevo" + salir=true + break; + case 'No hay token': msj= "no has enviado tu token, inicia sesión de nuevo" + salir=true break; - default: - salir=true } this.$buefy.dialog.alert({ @@ -1048,7 +1053,7 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear() this.$router.push(`/`) } diff --git a/pages/alumno/index.vue b/pages/alumno/index.vue index a913fc1..3680918 100644 --- a/pages/alumno/index.vue +++ b/pages/alumno/index.vue @@ -9,40 +9,79 @@ v-model="activeStep" > + + + + +
-
+

Estimado alumno(a):

@@ -84,7 +123,7 @@ Fecha de registro: {{ fecha(alumno.registro) }}

-
+

Direccion: {{ alumno.direccion }}

Telefono: {{ alumno.telefono }}

@@ -95,7 +134,7 @@

-
+

Formulario Pre-registro

@@ -141,9 +180,9 @@
-
+
-
+

Cuestionario de evaluación del programa de servicio social

@@ -208,12 +247,13 @@
-
+
-
+
+
{{$data}}
@@ -228,10 +268,11 @@ export default { return { token: { headers:{ - taken: window.localStorage.getItem('token') + token: window.localStorage.getItem('token') } }, activeStep: "", + status:'', isLoading: false, file: [], nacimiento: [], @@ -267,31 +308,32 @@ export default { profesor: "", }, mensajes: [ - { status: 0, mensaje: "" }, { status: 1, mensaje: "" }, + { status: 2, mensaje: "" }, { - status: 2, + status: 3, mensaje: "Te informamos que el Área de Registro y Control de Servicio Social ha validado tu solicitud de registro de servicio social por lo que el siguiente trámite lo realizarás hasta que concluyas 480 horas en un periodo de mínimo 6 meses y obtengas tu carta de término por parte de la institución, quien se encargará de subir dicho archivo a este sistema, además de responder un cuestionario sobre tu desempeño. A su vez, deberás responder el siguiente cuestionario de evaluación del programa de servicio social en donde participaste y enviar el informe global de actividades elaborado por ti, con firma y sello de visto bueno de tu jefe inmediato. En cuanto el Área de Registro y Control de Servicio Social valide tu solicitud, podrás revisar las indicaciones del siguiente paso en el panel llamado “Liberación” Cualquier duda puedes acudir al área de Registro y Control de Servicio Social en COESI de lunes a viernes de 10:00 a 14:00 hrs. y de 16:00 a 20:00 hrs. o bien, comunicarte al 5623 1686 o al correo registross@acatlan.unam.mx", }, - { status: 3, mensaje: "" }, + { status: 4, mensaje: "" }, { - status: 4, + status: 5, mensaje: "Espera a que tus documentos sean validados por el Departamento de Servicio Social y Bolsa de Trabajo", }, { - status: 5, + status: 6, mensaje: "Te confirmamos que has concluido con los trámites necesarios para la liberación de tu servicio social por lo que ahora sólo queda esperar a que en máximo 15 días hábiles se te notifique por correo electrónico a partir de cuándo puedes recoger la copia de tu carta de liberación en las ventanillas del Área de Registro y Control de Servicio Social. Cualquier duda puedes acudir al área de Registro y Control de Servicio Social en COESI de lunes a viernes de 10:00 a 13:00 hrs. y de 16:00 a 19:00 hrs. o bien, comunicarte al 5623 1686 o al correo registross@apolo.acatlan.unam.mx", }, - { status: 6, mensaje: "" }, - { status: 7, mensaje: "" }, - { status: 8, mensaje: "" }, + { status: 7, mensaje: "carta de aceptacion rechazada" }, + { status: 8, mensaje: "carta de termino rechazada" }, + { status: 9, mensaje: + "Informe global de actividades rechazado. Por favor reenvia el informe correctamente", +}, { - status: 9, - mensaje: - "Informe global de actividades rechazado. Por favor reenvia el informe correctamente", + status: 10, + mensaje: "servicio cancelado" }, ], }; @@ -303,20 +345,25 @@ export default { this.telefono = ""; this.direccion = ""; }, - error(msj){ + error(msj){ let salir =false; switch(msj){ case 'invalid signature': msj= "tu token no es valido, inicia sesión de nuevo" + salir=true break; case 'jwt expired': msj= "tu sesión ha expirado, inicia sesión de nuevo" + salir=true break; - case 'no hay token': + case 'jwt malformed': + msj= "tu token esta mal formado, inicia sesión de nuevo" + salir=true + break; + case 'No hay token': msj= "no has enviado tu token, inicia sesión de nuevo" + salir=true break; - default: - salir=true } this.$buefy.dialog.alert({ @@ -329,22 +376,19 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear() - this.$router.push(`/`) + this.$router.push(`/`) } }, getData() { axios - .get(`${process.env.api}/servicio/alumno`, { - params: { - idUsuario: localStorage.getItem("idUsuario"), - }, - }, this.token) + .get(`${process.env.api}/servicio/alumno?idUsuario=${localStorage.getItem("idUsuario")}`, this.token) .then((resp) => { console.log(resp.data); - this.activeStep = resp.data.Status.idStatus - 1; + this.activeStep = resp.data.Status.idStatus +5; + this.status = resp.data.Status.idStatus ; this.programa.programa = resp.data.Programa.programa; this.programa.dependencia = resp.data.Programa.dependencia; @@ -510,4 +554,5 @@ export default { display: flex; align-content: center !important; } + diff --git a/pages/responsable/nuevo/index.vue b/pages/responsable/nuevo/index.vue index 3ce5ade..5c0c35e 100644 --- a/pages/responsable/nuevo/index.vue +++ b/pages/responsable/nuevo/index.vue @@ -341,15 +341,20 @@ export default { switch(msj){ case 'invalid signature': msj= "tu token no es valido, inicia sesión de nuevo" + salir=true break; case 'jwt expired': msj= "tu sesión ha expirado, inicia sesión de nuevo" + salir=true break; - case 'no hay token': + case 'jwt malformed': + msj= "tu token esta mal formado, inicia sesión de nuevo" + salir=true + break; + case 'No hay token': msj= "no has enviado tu token, inicia sesión de nuevo" + salir=true break; - default: - salir=true } this.$buefy.dialog.alert({ @@ -362,7 +367,7 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear() this.$router.push(`/`) } @@ -371,11 +376,7 @@ export default { buscarAlumno() { this.isLoading=true axios - .get(`${process.env.api}/usuario/escolares`, { - params: { - numeroCuenta: this.noCuenta, - }, - },this.token) + .get(`${process.env.api}/usuario/escolares?numeroCuenta=${this.noCuenta}`,this.token) .then((resp) => { console.log(resp.data); this.alumno.cuenta = this.noCuenta; @@ -506,11 +507,7 @@ export default { mounted() { console.log(localStorage.getItem("idUsuario")); axios - .get(`${process.env.api}/programa`, { - params: { - idUsuario: localStorage.getItem("idUsuario"), - } - },this.token) + .get(`${process.env.api}/programa?idUsuario=${localStorage.getItem("idUsuario")}`, this.token) .then((resp) => { console.log(resp.data); this.programas = resp.data; From ea9ea756f3b77a92639bfd551d895648ae593813 Mon Sep 17 00:00:00 2001 From: mxrco Date: Wed, 6 Jan 2021 15:27:23 -0600 Subject: [PATCH 4/4] Funcion error --- components/admin/servicio/documento.vue | 20 +-- components/admin/servicio/modificar/form.vue | 17 ++- .../admin/servicio/programa/cargaMasiva.vue | 47 ++++--- .../servicio/programa/tablaResponsables.vue | 47 ++++--- components/admin/servicio/vistaServicio.vue | 47 +++---- .../admin/programa/infoResponsable/index.vue | 121 ++++++++++-------- .../infoResponsable/modificar/index.vue | 17 ++- 7 files changed, 175 insertions(+), 141 deletions(-) diff --git a/components/admin/servicio/documento.vue b/components/admin/servicio/documento.vue index e64b7a1..5f9a950 100644 --- a/components/admin/servicio/documento.vue +++ b/components/admin/servicio/documento.vue @@ -164,15 +164,20 @@ export default { switch (msj) { case "invalid signature": msj = "tu token no es valido, inicia sesión de nuevo"; + salir = true; break; case "jwt expired": msj = "tu sesión ha expirado, inicia sesión de nuevo"; - break; - case "no hay token": - msj = "no has enviado tu token, inicia sesión de nuevo"; - break; - default: salir = true; + break; + case "jwt malformed": + msj = "tu token esta mal formado, inicia sesión de nuevo"; + salir = true; + break; + case "No hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + salir = true; + break; } this.$buefy.dialog.alert({ @@ -185,7 +190,7 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear(); this.$router.push(`/`); } @@ -193,8 +198,7 @@ export default { errorDoc() { this.$buefy.dialog.alert({ title: "Error", - message: - "Ha ocurrido un error al rechazar el documento", + message: "Ha ocurrido un error al rechazar el documento", type: "is-danger", hasIcon: true, icon: "times-circle", diff --git a/components/admin/servicio/modificar/form.vue b/components/admin/servicio/modificar/form.vue index 7739fe6..94e6727 100644 --- a/components/admin/servicio/modificar/form.vue +++ b/components/admin/servicio/modificar/form.vue @@ -329,15 +329,20 @@ export default { switch (msj) { case "invalid signature": msj = "tu token no es valido, inicia sesión de nuevo"; + salir = true; break; case "jwt expired": msj = "tu sesión ha expirado, inicia sesión de nuevo"; - break; - case "no hay token": - msj = "no has enviado tu token, inicia sesión de nuevo"; - break; - default: salir = true; + break; + case "jwt malformed": + msj = "tu token esta mal formado, inicia sesión de nuevo"; + salir = true; + break; + case "No hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + salir = true; + break; } this.$buefy.dialog.alert({ @@ -350,7 +355,7 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear(); this.$router.push(`/`); } diff --git a/components/admin/servicio/programa/cargaMasiva.vue b/components/admin/servicio/programa/cargaMasiva.vue index 272ed13..9fda34f 100644 --- a/components/admin/servicio/programa/cargaMasiva.vue +++ b/components/admin/servicio/programa/cargaMasiva.vue @@ -36,7 +36,7 @@ diff --git a/pages/admin/programa/infoResponsable/modificar/index.vue b/pages/admin/programa/infoResponsable/modificar/index.vue index 5e8ac90..6a188c0 100644 --- a/pages/admin/programa/infoResponsable/modificar/index.vue +++ b/pages/admin/programa/infoResponsable/modificar/index.vue @@ -104,15 +104,20 @@ export default { switch (msj) { case "invalid signature": msj = "tu token no es valido, inicia sesión de nuevo"; + salir = true; break; case "jwt expired": msj = "tu sesión ha expirado, inicia sesión de nuevo"; - break; - case "no hay token": - msj = "no has enviado tu token, inicia sesión de nuevo"; - break; - default: salir = true; + break; + case "jwt malformed": + msj = "tu token esta mal formado, inicia sesión de nuevo"; + salir = true; + break; + case "No hay token": + msj = "no has enviado tu token, inicia sesión de nuevo"; + salir = true; + break; } this.$buefy.dialog.alert({ @@ -125,7 +130,7 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); - if (salir === true) { + if (salir == true) { localStorage.clear(); this.$router.push(`/`); }