From 88a42dc276f9fd68e59cfc8602c79249b6be635e Mon Sep 17 00:00:00 2001 From: eithan Date: Tue, 12 Jan 2021 09:34:36 -0600 Subject: [PATCH] fecha minima nuevo registro y limpiar login --- components/responsable/formServicioSocial.vue | 6 ++++- pages/index.vue | 22 +++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/components/responsable/formServicioSocial.vue b/components/responsable/formServicioSocial.vue index edd8776..b286679 100644 --- a/components/responsable/formServicioSocial.vue +++ b/components/responsable/formServicioSocial.vue @@ -190,7 +190,7 @@ export default { noCuenta: "", sizeOk: "", searched: false, - minDate: new Date("2020-12-20"), + minDate: new Date(), programaSelectedID: "", file: [], programas: [], @@ -468,6 +468,10 @@ export default { .catch((error) => { this.error(error.response.data.message); }); + + (this.minDate).setDate( (this.minDate).getDate() - 16) + + }, computed: { minDate2() { diff --git a/pages/index.vue b/pages/index.vue index 4decf5d..c913127 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -12,8 +12,6 @@ - @@ -28,6 +26,7 @@ + @@ -41,36 +40,28 @@ export default { usuario: "", password: "", error: false, - isFullPage: true, + isLoading: false, }; }, methods: { usuarioValido() { if (!this.usuario) { - console.log("esta vacio"); - // return '' this.error = true; } if (validator.isNumeric(this.usuario, { no_symbols: true })) { if (this.usuario.length === 10) { - console.log("es numero de cuenta"); } return ""; } else if (validator.isEmail(this.usuario)) { - console.log("es correo"); return ""; } else if (validator.isAlpha(this.usuario)) { - console.log("es texto"); return ""; } - // return 'is-danger' this.error = true; }, enviar() { - const loadingComponent = this.$buefy.loading.open({ - container: this.isFullPage ? null : this.$refs.element.$el, - }); + this.isLoading=true const data = { usuario: this.usuario.trim(), @@ -79,7 +70,7 @@ export default { axios .post(`${process.env.api}/usuario/login`, data) .then((resp) => { - loadingComponent.close(); + window.localStorage.setItem("idUsuario", resp.data.Usuario.idUsuario); window.localStorage.setItem("token", resp.data.token); @@ -96,7 +87,7 @@ export default { this.$router.push(`/${resp.data.Usuario.TipoUsuario.tipoUsuario}`); }) .catch((error) => { - loadingComponent.close(); + this.$buefy.dialog.alert({ title: "Error", message: error.response.data.message, @@ -107,6 +98,9 @@ export default { ariaRole: "alertdialog", ariaModal: true, }); + }) + .finally(()=>{ + this.isLoading =false }); }, },