From 10666d2e08a170e05e02990b6acc32630b6c7dd6 Mon Sep 17 00:00:00 2001 From: Andres2908 Date: Tue, 12 Jan 2021 17:43:42 -0600 Subject: [PATCH 1/3] prueba --- components/admin/inputTableA.vue | 12 ++-- components/responsable/cartaAceptacion.vue | 17 +++--- components/responsable/cartaTermino.vue | 18 ++---- components/responsable/cuestionario.vue | 13 +++-- components/responsable/inputTable.vue | 68 +++++++++------------- 5 files changed, 55 insertions(+), 73 deletions(-) diff --git a/components/admin/inputTableA.vue b/components/admin/inputTableA.vue index df44e2a..de8ca9d 100644 --- a/components/admin/inputTableA.vue +++ b/components/admin/inputTableA.vue @@ -165,7 +165,6 @@ export default { onPageChange(page) { this.page = page; this.obtenerDatos(); - console.log(this.page); }, types(idStatus) { if (idStatus === 1) { @@ -232,7 +231,7 @@ export default { }) .catch((error) => { - error(error.response.data.message); + this.error(error.response.data.message); }) .finally(() => { @@ -249,6 +248,7 @@ export default { this.tipoUsuario = localStorage.getItem("tipoUsuario"); if (this.idTipoUsuario != 1 && this.tipoUsuario != "admin") { + localStorage.clear(); this.$router.push("/"); } }, @@ -256,19 +256,19 @@ export default { let salir = false; switch (msj) { case "invalid signature": - msj = "tu token no es valido, inicia sesión de nuevo"; + 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"; + msj = "Tu sesión ha expirado, inicia sesión de nuevo"; salir = true; break; case "jwt malformed": - msj = "tu token esta mal formado, inicia sesión de nuevo"; + 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"; + msj = "No has enviado tu token, inicia sesión de nuevo"; salir = true; break; } diff --git a/components/responsable/cartaAceptacion.vue b/components/responsable/cartaAceptacion.vue index e1a1800..d12fdcc 100644 --- a/components/responsable/cartaAceptacion.vue +++ b/components/responsable/cartaAceptacion.vue @@ -49,7 +49,7 @@ >Enviar - + @@ -88,9 +88,6 @@ export default { }); }, Enviar() { - const loadingComponent = this.$buefy.loading.open({ - container: this.isFullPage ? null : this.$refs.element.$el, - }); const data = { idServicio: this.idServicio }; const formData = new FormData(); formData.append("data", JSON.stringify(data)); @@ -116,13 +113,13 @@ export default { }); }) .catch((error) => { - error(error.response.data.message); + this.error(error.response.data.message); }) .finally(() => { this.isLoading = false; - this.$router.push("/responsable"); localStorage.removeItem("idServicio"); localStorage.removeItem("cartaAceptacion"); + this.$router.push("/responsable"); }); }, getIdLocal() { @@ -137,19 +134,19 @@ export default { let salir = false; switch (msj) { case "invalid signature": - msj = "tu token no es valido, inicia sesión de nuevo"; + 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"; + msj = "Tu sesión ha expirado, inicia sesión de nuevo"; salir = true; break; case "jwt malformed": - msj = "tu token esta mal formado, inicia sesión de nuevo"; + 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"; + msj = "No has enviado tu token, inicia sesión de nuevo"; salir = true; break; } diff --git a/components/responsable/cartaTermino.vue b/components/responsable/cartaTermino.vue index e57fa27..1eb2d65 100644 --- a/components/responsable/cartaTermino.vue +++ b/components/responsable/cartaTermino.vue @@ -89,9 +89,6 @@ export default { }); }, Enviar() { - const loadingComponent = this.$buefy.loading.open({ - container: this.isFullPage ? null : this.$refs.element.$el, - }); const data = { idServicio: this.idServicio }; const formData = new FormData(); formData.append("data", JSON.stringify(data)); @@ -105,9 +102,6 @@ export default { }, }) .then((res) => { - console.log(res.data); - - loadingComponent.close(); this.$buefy.dialog.alert({ title: "Success", message: "Se enviaron los datos correctamente", @@ -120,13 +114,13 @@ export default { }); }) .catch((error) => { - error(error.response.data.message); + this.error(error.response.data.message); }) .finally(() => { this.isLoading = false; - this.$router.push("/responsable"); localStorage.removeItem("idServicio"); localStorage.removeItem("cartaTermino"); + this.$router.push("/responsable"); }); }, getIdLocal() { @@ -141,19 +135,19 @@ export default { let salir = false; switch (msj) { case "invalid signature": - msj = "tu token no es valido, inicia sesión de nuevo"; + 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"; + msj = "Tu sesión ha expirado, inicia sesión de nuevo"; salir = true; break; case "jwt malformed": - msj = "tu token esta mal formado, inicia sesión de nuevo"; + 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"; + msj = "No has enviado tu token, inicia sesión de nuevo"; salir = true; break; } diff --git a/components/responsable/cuestionario.vue b/components/responsable/cuestionario.vue index f77807e..446a76f 100644 --- a/components/responsable/cuestionario.vue +++ b/components/responsable/cuestionario.vue @@ -193,6 +193,7 @@ export default { methods: { enviarCuestionario() { const data = { + idServicio: this.idServicio, actividad1: this.actividad1, actividad2: this.actividad2, actividad3: this.actividad3, @@ -220,14 +221,14 @@ export default { }) .catch((error) => { - error(error.response.data.message); + this.error(error.response.data.message); }) .finally(() => { this.isLoading = false; - this.$router.push("/responsable"); localStorage.removeItem("idServicio"); localStorage.removeItem("cuestionario"); + this.$router.push("/responsable"); }); }, getIdLocal() { @@ -242,19 +243,19 @@ export default { let salir = false; switch (msj) { case "invalid signature": - msj = "tu token no es valido, inicia sesión de nuevo"; + 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"; + msj = "Tu sesión ha expirado, inicia sesión de nuevo"; salir = true; break; case "jwt malformed": - msj = "tu token esta mal formado, inicia sesión de nuevo"; + 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"; + msj = "No has enviado tu token, inicia sesión de nuevo"; salir = true; break; } diff --git a/components/responsable/inputTable.vue b/components/responsable/inputTable.vue index bf3b9c7..c7c7c25 100644 --- a/components/responsable/inputTable.vue +++ b/components/responsable/inputTable.vue @@ -157,12 +157,7 @@ centered v-if="idTipoUsuario == 2" > -
+
-
+
{ - error(error.response.data.message); + this.error(error.response.data.message); }) .finally(() => { @@ -367,29 +357,30 @@ export default { this.tipoUsuario = localStorage.getItem("tipoUsuario"); if (this.idTipoUsuario != 2 && this.tipoUsuario != "responsable") { + localStorage.clear(); this.$router.push("/"); } }, - 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 '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; - } + 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 "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({ title: "Error", @@ -400,12 +391,11 @@ export default { iconPack: "mdi", ariaRole: "alertdialog", ariaModal: true, - }); - if (salir == true) { - localStorage.clear() - this.$router.push(`/`) - } - + }); + if (salir == true) { + localStorage.clear(); + this.$router.push(`/`); + } }, }, created() { From bfad136d77dc705a4b93e59634ef07fb4930c292 Mon Sep 17 00:00:00 2001 From: Andres2908 Date: Tue, 12 Jan 2021 17:47:05 -0600 Subject: [PATCH 2/3] prueba2 --- pages/alumno/index.vue | 139 +++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 67 deletions(-) diff --git a/pages/alumno/index.vue b/pages/alumno/index.vue index 3680918..8c8ade3 100644 --- a/pages/alumno/index.vue +++ b/pages/alumno/index.vue @@ -9,37 +9,37 @@ v-model="activeStep" >
@@ -253,8 +253,8 @@
-
{{$data}}
- +
{{ $data }}
+ @@ -267,12 +267,12 @@ export default { data() { return { token: { - headers:{ - token: window.localStorage.getItem('token') - } + headers: { + token: window.localStorage.getItem("token"), + }, }, activeStep: "", - status:'', + status: "", isLoading: false, file: [], nacimiento: [], @@ -328,12 +328,14 @@ export default { }, { 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" + mensaje: "servicio cancelado", }, ], }; @@ -345,26 +347,26 @@ export default { this.telefono = ""; this.direccion = ""; }, - 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 '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; - } + 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 "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({ title: "Error", @@ -375,20 +377,24 @@ export default { iconPack: "mdi", ariaRole: "alertdialog", ariaModal: true, - }); - if (salir == true) { - localStorage.clear() - this.$router.push(`/`) - } - + }); + if (salir == true) { + localStorage.clear(); + this.$router.push(`/`); + } }, getData() { axios - .get(`${process.env.api}/servicio/alumno?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 +5; - this.status = resp.data.Status.idStatus ; + this.activeStep = resp.data.Status.idStatus - 1; + this.status = resp.data.Status.idStatus; this.programa.programa = resp.data.Programa.programa; this.programa.dependencia = resp.data.Programa.dependencia; @@ -414,15 +420,18 @@ export default { this.alumno.nombre = localStorage.getItem("nombre"); this.alumno.cuenta = localStorage.getItem("usuario"); - window.localStorage.setItem("idCuestionarioAlumno",resp.data.idCuestionarioAlumno); + window.localStorage.setItem( + "idCuestionarioAlumno", + resp.data.idCuestionarioAlumno + ); window.localStorage.setItem("idServicio", resp.data.idServicio); }) .catch((error) => { - this.error(error.response.data.message) + this.error(error.response.data.message); }); }, enviarRegistro() { - this.isLoading=true + this.isLoading = true; const data = { idServicio: this.alumno.idServicio, direccion: this.direccion, @@ -433,7 +442,6 @@ export default { axios .put(`${process.env.api}/servicio/registro_validado`, data, this.token) .then((res) => { - this.$buefy.dialog.alert({ title: "Success", message: "Se enviaron los datos correctamente", @@ -449,14 +457,14 @@ export default { this.getData(); }) .catch((error) => { - this.error(error.response.data.message) - }) - .finally(()=>{ - this.isLoading=false + this.error(error.response.data.message); }) + .finally(() => { + this.isLoading = false; + }); }, enviarInforme() { - this.isLoading = true + this.isLoading = true; const data = { idServicio: this.alumno.idServicio, }; @@ -469,11 +477,10 @@ export default { .put(`${process.env.api}/servicio/informe_global`, formData, { headers: { "Content-Type": "multipart/form-data", - token: this.token.headers.token + token: this.token.headers.token, }, }) .then((res) => { - this.$buefy.dialog.alert({ title: "Success", message: "Se enviaron los datos correctamente", @@ -489,12 +496,11 @@ export default { this.getData(); }) .catch((error) => { - this.error(error.response.data.message) - }) - .finally(()=>{ - this.isLoading= false - }) - + this.error(error.response.data.message); + }) + .finally(() => { + this.isLoading = false; + }); }, fecha(date) { const fecha = moment(date); @@ -554,5 +560,4 @@ export default { display: flex; align-content: center !important; } - From 9d6ea050a38e83a8ae1c844078c5fc6208804d63 Mon Sep 17 00:00:00 2001 From: Andres2908 Date: Tue, 12 Jan 2021 20:22:41 -0600 Subject: [PATCH 3/3] cartaCuestionario --- components/responsable/cuestionario.vue | 2 +- components/responsable/inputTable.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/responsable/cuestionario.vue b/components/responsable/cuestionario.vue index 1a39a4e..57bd666 100644 --- a/components/responsable/cuestionario.vue +++ b/components/responsable/cuestionario.vue @@ -149,7 +149,7 @@ actividad3 == '' || actividad4 == '' || actividad5 == '' || - retroalimentacion == '' || + retroalimentacion.length < 5 || p6 == '' || p7 == '' " diff --git a/components/responsable/inputTable.vue b/components/responsable/inputTable.vue index 76f89a2..7f95ab6 100644 --- a/components/responsable/inputTable.vue +++ b/components/responsable/inputTable.vue @@ -157,7 +157,7 @@ centered v-if="idTipoUsuario == 2" > -
+
-
+