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: {