From bfad136d77dc705a4b93e59634ef07fb4930c292 Mon Sep 17 00:00:00 2001 From: Andres2908 Date: Tue, 12 Jan 2021 17:47:05 -0600 Subject: [PATCH] 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; } -