errorNuxt

This commit is contained in:
Andres2908
2021-01-06 16:03:37 -06:00
13 changed files with 1096 additions and 662 deletions
+69 -9
View File
@@ -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,59 @@ 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";
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",
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,
});
},
},
};
</script>
+49 -2
View File
@@ -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,42 @@ 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";
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",
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));
@@ -36,10 +36,16 @@
</template>
<script>
import axios from "axios";
export default {
data() {
return {
csv: {},
token: {
headers: {
token: window.localStorage.getItem("token"),
},
},
isLoading: false,
toastType: null,
toastMessage: null,
@@ -79,7 +85,12 @@ export default {
formData.append("cartaAceptacion", this.cartaAceptacion);
}
axios
.put(`${process.env.api}/programa/carga_masiva`, formData)
.put(`${process.env.api}/programa/carga_masiva`, formData, {
headers: {
"Content-Type": "multipart/form-data",
token: this.token.headers.token,
},
})
.then((res) => {
this.isLoading = false;
this.toastType = "is-success";
@@ -88,11 +99,46 @@ export default {
})
.catch((err) => {
this.isLoading = false;
this.toastType = "is-danger";
this.toastMessage = err.response.data.message;
this.toast();
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";
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",
message: msj,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
if (salir == true) {
localStorage.clear();
this.$router.push(`/`);
}
},
},
};
</script>
@@ -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,47 @@ 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";
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",
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");
},
+58 -35
View File
@@ -65,22 +65,20 @@
</p>
</div>
<div id="acciones" class="my-5">
<div class="confimar mb-5">
<b-button
class="is-success"
@click="confirmarDialog(1)"
v-if="mostrarConfirmar1()"
>
Confirmar
</b-button>
<b-button
class="is-success"
@click="confirmarDialog(2)"
v-if="mostrarConfirmar2()"
>
Confirmar
</b-button>
</div>
<b-button
class="is-success"
@click="confirmarDialog(1)"
v-if="mostrarConfirmar1()"
>
Confirmar
</b-button>
<b-button
class="is-success"
@click="confirmarDialog(2)"
v-if="mostrarConfirmar2()"
>
Confirmar
</b-button>
<b-button class="is-danger" @click="enviarCancel = !enviarCancel">
Cancelar
</b-button>
@@ -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,17 @@ 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 +253,17 @@ 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 aprobado");
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,30 +275,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";
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",
message: "Ha ocurrido un <b>error</b>, 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() {
-495
View File
@@ -1,495 +0,0 @@
<template>
<section>
<div class="container px-3">
<div class="progressBar my-6">
<b-steps
type="is-success"
size="is-large"
:has-navigation="false"
v-model="activeStep"
>
<b-step-item
:clickable="false"
label="Pre Registro"
icon="account-plus"
></b-step-item>
<b-step-item
:clickable="false"
label="Pre Registro validado"
icon="account-clock"
></b-step-item>
<b-step-item
:clickable="false"
label="Registro"
icon="account"
></b-step-item>
<b-step-item
:clickable="false"
label="Pre Termino"
icon="account-details"
></b-step-item>
<b-step-item
:clickable="false"
label="Termino"
icon="account-clock"
></b-step-item>
<b-step-item
:clickable="false"
label="Liberacion"
icon="account-check"
></b-step-item>
</b-steps>
</div>
<div class="mensajeDiv" v-for="mensaje in mensajes" :key="mensaje.status">
<div v-if="mensaje.mensaje != '' && mensaje.status == activeStep">
<p class="mensaje has-text-justified">
<span class="block is-size-5">Estimado alumno(a): </span
><br /><br />
{{ mensaje.mensaje }}
</p>
</div>
</div>
<div class="info">
<div class="info-programa">
<h3 class="title is-3">Información del programa</h3>
<p><strong> Programa: </strong> {{ programa.programa }}</p>
<p><strong> Institución: </strong> {{ programa.institucion }}</p>
<p><strong> Dependencia: </strong> {{ programa.dependencia }}</p>
<p><strong> Clave del programa: </strong> {{ programa.clave }}</p>
<div v-if="programa.acatlan == true">
<p>
<strong> Programa Interno: </strong>
{{ programa.programaInterno }}
</p>
<p><strong> Profesor: </strong> {{ programa.profesor }}</p>
</div>
</div>
<div class="info-alumno mt-6">
<h3 class="title is-3">Información del alumno</h3>
<p><strong> Nombre: </strong> {{ alumno.nombre }}</p>
<p><strong> Número de cuenta: </strong> {{ alumno.cuenta }}</p>
<p><strong> Carrera: </strong> {{ alumno.carrera }}</p>
<p>
<strong> Créditos: </strong>{{ alumno.creditos
}}<span v-if="alumno.creditos">%</span>
</p>
<p><strong> Correo del alumno: </strong> {{ alumno.correo }}</p>
<p><strong> Fecha de inicio: </strong> {{ fecha(alumno.inicio) }}</p>
<p>
<strong> Fecha de finalización: </strong> {{ fecha(alumno.fin) }}
</p>
<p>
<strong> Fecha de registro: </strong> {{ fecha(alumno.registro) }}
</p>
<div class="mt-4 info-extra" v-if="activeStep >= 2">
<p><strong> Direccion: </strong> {{ alumno.direccion }}</p>
<p><strong> Telefono: </strong> {{ alumno.telefono }}</p>
<p>
<strong> Fecha de nacimiento: </strong>
{{ fecha(alumno.nacimiento) }}
</p>
</div>
</div>
</div>
<div class="registro" v-if="activeStep == 1">
<h3 class="title is-3 my-5">Formulario Pre-registro</h3>
<form>
<b-field label="Fecha de nacimiento">
<b-datepicker
placeholder="Fecha de nacimiento"
icon="calendar-today"
v-model="nacimiento"
:min-date="minDate"
:max-date="maxDate"
>
</b-datepicker>
</b-field>
<b-field label="Telefono">
<b-input
placeholder="Telefono"
maxlength="10"
v-model="telefono"
type="tel"
>
</b-input>
</b-field>
<b-field label="Direccion">
<b-input
maxlength="200 "
placeholder="Direccion"
type="textarea"
v-model="direccion"
></b-input>
</b-field>
</form>
<div class="my-4 mb-6">
<b-field>
<button
:disabled="nacimiento == '' || telefono == '' || direccion == ''"
class="button is-success is-medium"
@click="enviarRegistro()"
>
Enviar
</button>
</b-field>
</div>
</div>
<div class="registro-validado" v-if="activeStep == 2"></div>
<div class="pre-termino" v-if="activeStep == 3 || activeStep == 9">
<h3 class="title is-4 mt-6">
Cuestionario de evaluación del programa de servicio social
</h3>
<div class="my-6" v-if="alumno.idCuestionario == null">
<b-button
tag="router-link"
to="/alumno/cuestionario"
type="is-info is-light "
icon-left="book-open"
class="border-info"
size="is-medium"
>
cuestionario
</b-button>
</div>
<div class="is-flex" v-else>
<p class="block is-size-5">Cuestionario contestado</p>
<b-icon icon="check-bold" size="is-small" type="is-success"> </b-icon>
</div>
<h3 class="title is-4 mt-6">
Informe global de actividades (en formato .PDF. No se aceptan fotos).
</h3>
<div v-if="alumno.informeGlobal == null">
<b-field type="black">
<b-upload
v-model="file"
type="black"
drag-drop
expanded
accept="application/pdf"
>
<section class="section">
<div class="content has-text-centered">
<p>
<b-icon icon="upload" size="is-large"></b-icon>
</p>
<p>
{{
file.name ||
"Arrastra aquí tu archivo o da click para buscar"
}}
</p>
<p>Tamaño máximo 20MB</p>
</div>
</section>
</b-upload>
</b-field>
<b-field class="derecha">
<button
:disabled="file == ''"
class="button is-success is-medium mb-4"
@click="enviarInforme()"
>
Enviar
</button>
</b-field>
</div>
<div class="is-flex" v-else>
<p class="block is-size-5">Informe Global enviado.</p>
<b-icon icon="check-bold" size="is-small" type="is-success"> </b-icon>
</div>
</div>
<div class="termino" v-if="activeStep == 4"></div>
<div class="Liberacion" v-if="activeStep == 5"></div>
</div>
<div class="container px-3"></div>
</section>
</template>
<script>
import "buefy/dist/buefy.css";
import moment from "moment";
import axios from "axios";
export default {
data() {
return {
activeStep: "",
isFullPage: true,
file: [],
nacimiento: [],
minDate: new Date(),
maxDate: new Date(),
telefono: "",
direccion: "",
alumno: {
carrera: "",
creditos: "",
nombre: "",
cuenta: "",
correo: "",
direccion: "",
nacimiento: "",
telefono: "",
idCuestionario: "",
informeGlobal: "",
idAlumno: "",
idCarrera: "",
idServicio: "",
inicio: [],
fin: [],
registro: [],
},
programa: {
programa: "",
institucion: "",
dependencia: "",
clave: "",
acatlan: "",
programaInterno: "",
profesor: "",
},
mensajes: [
{ status: 0, mensaje: "" },
{ status: 1, mensaje: "" },
{
status: 2,
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:
"Espera a que tus documentos sean validados por el Departamento de Servicio Social y Bolsa de Trabajo",
},
{
status: 5,
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: 9,
mensaje:
"Informe global de actividades rechazado. Por favor reenvia el informe correctamente",
},
],
};
},
methods: {
reset() {
this.file = [];
this.nacimiento = [];
this.telefono = "";
this.direccion = "";
},
getData() {
axios
.get(`${process.env.api}/servicio/alumno`, {
params: {
idUsuario: localStorage.getItem("idUsuario"),
},
})
.then((resp) => {
console.log(resp.data);
this.activeStep = resp.data.Status.idStatus - 1;
this.programa.programa = resp.data.Programa.programa;
this.programa.dependencia = resp.data.Programa.dependencia;
this.programa.institucion = resp.data.Programa.institucion;
this.programa.clave = resp.data.Programa.clavePrograma;
this.programa.profesor = resp.data.profesor;
this.programa.acatlan = resp.data.Programa.acatlan;
this.programa.programaInterno = resp.data.programaInterno;
this.alumno.creditos = parseInt(resp.data.creditos, 10);
this.alumno.carrera = resp.data.Carrera.carrera;
this.alumno.idCarrera = resp.data.Carrera.idCarrera;
this.alumno.correo = resp.data.correo;
this.alumno.inicio = resp.data.fechaInicio;
this.alumno.fin = resp.data.fechaFin;
this.alumno.registro = resp.data.createdAt;
this.alumno.direccion = resp.data.direccion;
this.alumno.nacimiento = resp.data.fechaNacimiento;
this.alumno.telefono = resp.data.telefono;
this.alumno.idServicio = resp.data.idServicio;
this.alumno.idCuestionario = resp.data.idCuestionarioAlumno;
this.alumno.informeGlobal = resp.data.informeGlobal;
this.alumno.nombre = localStorage.getItem("nombre");
this.alumno.cuenta = localStorage.getItem("usuario");
window.localStorage.setItem(
"idCuestionarioAlumno",
resp.data.idCuestionarioAlumno
);
window.localStorage.setItem("idServicio", resp.data.idServicio);
})
.catch((error) => {
console.log(error.message);
});
},
enviarRegistro() {
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el,
});
const data = {
idServicio: this.alumno.idServicio,
direccion: this.direccion,
telefono: this.telefono,
fechaNacimiento: moment(this.nacimiento),
};
axios
.put(`${process.env.api}/servicio/registro_validado`, data)
.then((res) => {
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
type: "is-success",
hasIcon: true,
icon: "checkbox-marked-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.reset();
this.getData();
})
.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,
});
});
},
enviarInforme() {
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el,
});
const data = {
idServicio: this.alumno.idServicio,
};
const formData = new FormData();
console.log(data);
formData.append("data", JSON.stringify(data));
formData.append("informeGlobal", this.file);
axios
.put(`${process.env.api}/servicio/informe_global`, formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((res) => {
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
type: "is-success",
hasIcon: true,
icon: "checkbox-marked-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.reset();
this.getData();
})
.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,
});
});
},
fecha(date) {
const fecha = moment(date);
return `${fecha.year()}/${fecha.month() + 1}/${fecha.date()}`;
},
},
computed: {
steps() {
const steps = [...this.baseSteps];
return steps;
},
},
created() {
this.getData();
},
watch: {
file() {
console.log(this.file.size);
if (this.file.size >= 20000000) {
this.$buefy.dialog.alert({
title: "Error",
message: "El tamaño del archivo exede los 20MB",
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.file = [];
}
},
},
mounted() {
let i = new Date().getFullYear() - 80; // hoy - 80 años fecha minima
let j = new Date().getFullYear() - 10; //hoy - 10 años
this.minDate.setFullYear(i);
this.maxDate.setFullYear(j);
},
};
</script>
<style scoped>
.border-info {
border: 1px solid #167df0;
}
.info-alumno p {
margin-bottom: 0.8rem;
}
.info-programa p {
margin-bottom: 0.8rem;
}
.mensaje {
margin: 3.5rem 0;
}
.else {
display: flex;
align-content: center !important;
}
</style>
+1 -1
View File
@@ -46,7 +46,7 @@ export default {
// Build Configuration (https://go.nuxtjs.dev/config-build)
build: {},
env: {
// api: "http://localhost:3000",
// 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'
+37 -7
View File
@@ -65,33 +65,63 @@ 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";
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",
message: "Ha ocurrido un <b>error</b>, 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() {
@@ -24,7 +24,7 @@
<b-loading
:is-full-page="true"
v-model="isLoading"
:can-cancel="true"
:can-cancel="false"
></b-loading>
</div>
</template>
@@ -32,7 +32,7 @@
<script>
import validator from "validator";
import botonRegresar from "../../../../../components/botonRegresar";
//import axios from 'axios'
import axios from "axios";
export default {
components: {
@@ -50,7 +50,11 @@ export default {
correo: "",
},
idServicio: localStorage.getItem("idServicio"),
token: localStorage.getItem("token"),
token: {
headers: {
token: window.localStorage.getItem("token"),
},
},
isLoading: false,
};
},
@@ -67,6 +71,70 @@ export default {
return true;
}
},
actualizar() {
this.isLoading = true;
const data = {};
if (this.nuevo.correo) {
data.correoUpdate = this.nuevo.correo;
}
if (this.nuevo.nombre) {
data.nombreUpdate = this.nuevo.nombre;
}
axios
.put(`${process.env.api}/usuario/responsable/update`, data, this.token)
.then((res) => {
this.isLoading = false;
this.toast();
this.$router.push("/admin/programa/infoResponsable");
})
.catch((err) => {
this.isLoading = false;
this.error(err.response.data.message);
console.log(err.response.data.message);
});
},
toast() {
this.$buefy.toast.open({
message: "Se han actualizado los datos del responsable",
type: "is-success",
});
},
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",
message: msj,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
if (salir == true) {
localStorage.clear();
this.$router.push(`/`);
}
},
},
beforeCreate() {
if (!localStorage.getItem("idResponsable")) {
+86 -42
View File
@@ -765,10 +765,12 @@
<div v-else class="vh ">
<h1>Ya has contestado tu cuestionario :)</h1>
</div>
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</section>
</template>
<script>
import Buefy from 'buefy';
import "buefy/dist/buefy.css";
import moment from "moment";
import axios from "axios";
@@ -776,7 +778,13 @@ import axios from "axios";
export default {
data() {
return {
token: {
headers:{
token: window.localStorage.getItem('token')
}
},
maxCheckbox: 0,
isLoading: false,
current: 1,
idCuestionario: "",
answers: {
@@ -1014,8 +1022,47 @@ export default {
// activar boton
else return true;
},
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",
message: msj,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
if (salir == true) {
localStorage.clear()
this.$router.push(`/`)
}
},
enviarCuestionario() {
this.isLoading=true
if (this.answers.p3Otro != "" && this.maxCheckbox < 3) {
console.log("agregarotro");
this.answers.p3.push(this.answers.p3Otro);
@@ -1027,42 +1074,43 @@ export default {
sexo: this.answers.sexo,
edad: this.answers.edad,
servicioMedico: this.answers.servicioMedico,
pUno: this.answers.p1,
pDos: this.answers.p2,
pTres: this.answers.p3,
pCuatro: this.answers.p4,
pCinco: this.answers.p5,
pSeis: this.answers.p6,
pSiete: this.answers.p7,
pOcho: this.answers.p8,
pNueve: this.answers.p9,
pDiez: this.answers.p10,
pOnce: this.answers.p11,
pDoce: this.answers.p12,
pTrece: this.answers.p13,
pCatorce: this.answers.p14,
pQuince: this.answers.p15,
pDieciseis: this.answers.p16,
pDiecisiete: this.answers.p17,
pDieciocho: this.answers.p18,
pDiecinueve: this.answers.p19,
pVeinte: this.answers.p20,
pVeintiuno: this.answers.p21,
pVeintidos: this.answers.p22,
pVeintitres: this.answers.p23,
pVeinticuatro: this.answers.p24,
pVeinticinco: this.answers.p25,
pVeintiseis: this.answers.p26,
pVeintisiete: this.answers.p27,
pVeintiocho: this.answers.p28,
pVeintinueve: this.answers.p29,
pTreinta: this.answers.p30,
p1: this.answers.p1,
p2: this.answers.p2,
p3: this.answers.p3,
p4: this.answers.p4,
p5: this.answers.p5,
p6: this.answers.p6,
p7: this.answers.p7,
p8: this.answers.p8,
p9: this.answers.p9,
p10: this.answers.p10,
p11: this.answers.p11,
p12: this.answers.p12,
p13: this.answers.p13,
p14: this.answers.p14,
p15: this.answers.p15,
p16: this.answers.p16,
p17: this.answers.p17,
p18: this.answers.p18,
p19: this.answers.p19,
p20: this.answers.p20,
p21: this.answers.p21,
p22: this.answers.p22,
p23: this.answers.p23,
p24: this.answers.p24,
p25: this.answers.p25,
p26: this.answers.p26,
p27: this.answers.p27,
p28: this.answers.p28,
p29: this.answers.p29,
p30: this.answers.p30,
};
console.log(data);
axios
.post(`${process.env.api}/cuestionario_alumno`, data)
.post(`${process.env.api}/cuestionario_alumno`, data, this.token)
.then((res) => {
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
@@ -1075,20 +1123,15 @@ export default {
});
//this.reset()
localStorage.removeItem("idCuestionarioAlumno");
this.$router.push("/alumno");
})
.catch((error) => {
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
})
},
},
mounted() {
@@ -1106,6 +1149,7 @@ export default {
},
};
</script>
<style scoped>
.SINO * {
margin: 0.5rem 0 !important;
+549 -3
View File
@@ -1,12 +1,558 @@
<template>
<section>
<DataAlumno />
<div class="container px-3">
<div class="progressBar my-6">
<b-steps
type="is-success"
size="is-large"
:has-navigation="false"
v-model="activeStep"
>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Pre Registro"
icon="account-plus"
></b-step-item>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Pre Registro Validado"
icon="account-clock"
></b-step-item>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Registro"
icon="account"
></b-step-item>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Pre Termino"
icon="account-details"
></b-step-item>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Termino"
icon="account-clock"
></b-step-item>
<b-step-item
:visible="activeStep < 6"
:clickable="false"
label="Liberacion"
icon="account-check"
></b-step-item>
<b-step-item
:clickable="false"
:visible="activeStep == 6"
label="Carta Aceptación Rechazada"
class="bad"
icon="file"
type= "is-danger"
></b-step-item>
<b-step-item
:clickable="false"
:visible="activeStep == 7"
label="Carta Termino Rechazada"
icon="file"
class="bad"
type= "is-danger "
></b-step-item>
<b-step-item
:clickable="false"
:visible="activeStep == 8"
label="Informe Global Rechazado"
icon="file"
class="bad"
type= "is-danger"
></b-step-item>
<b-step-item
:clickable="false"
:visible="activeStep == 9"
label="Cancelado"
icon="account-cancel"
class="bad"
type= "is-danger bad"
></b-step-item>
</b-steps>
</div>
<div class="mensajeDiv" v-for="mensaje in mensajes" :key="mensaje.status">
<div v-if="mensaje.mensaje != '' && mensaje.status == status">
<p class="mensaje has-text-justified">
<span class="block is-size-5">Estimado alumno(a): </span
><br /><br />
{{ mensaje.mensaje }}
</p>
</div>
</div>
<div class="info">
<div class="info-programa">
<h3 class="title is-3">Información del programa</h3>
<p><strong> Programa: </strong> {{ programa.programa }}</p>
<p><strong> Institución: </strong> {{ programa.institucion }}</p>
<p><strong> Dependencia: </strong> {{ programa.dependencia }}</p>
<p><strong> Clave del programa: </strong> {{ programa.clave }}</p>
<div v-if="programa.acatlan == true">
<p>
<strong> Programa Interno: </strong>
{{ programa.programaInterno }}
</p>
<p><strong> Profesor: </strong> {{ programa.profesor }}</p>
</div>
</div>
<div class="info-alumno mt-6">
<h3 class="title is-3">Información del alumno</h3>
<p><strong> Nombre: </strong> {{ alumno.nombre }}</p>
<p><strong> Número de cuenta: </strong> {{ alumno.cuenta }}</p>
<p><strong> Carrera: </strong> {{ alumno.carrera }}</p>
<p>
<strong> Créditos: </strong>{{ alumno.creditos
}}<span v-if="alumno.creditos">%</span>
</p>
<p><strong> Correo del alumno: </strong> {{ alumno.correo }}</p>
<p><strong> Fecha de inicio: </strong> {{ fecha(alumno.inicio) }}</p>
<p>
<strong> Fecha de finalización: </strong> {{ fecha(alumno.fin) }}
</p>
<p>
<strong> Fecha de registro: </strong> {{ fecha(alumno.registro) }}
</p>
<div class="mt-4 info-extra" v-if="status >= 3">
<p><strong> Direccion: </strong> {{ alumno.direccion }}</p>
<p><strong> Telefono: </strong> {{ alumno.telefono }}</p>
<p>
<strong> Fecha de nacimiento: </strong>
{{ fecha(alumno.nacimiento) }}
</p>
</div>
</div>
</div>
<div class="pre-registro-validado" v-if="status == 2">
<h3 class="title is-3 my-5">Formulario Pre-registro</h3>
<form>
<b-field label="Fecha de nacimiento">
<b-datepicker
placeholder="Fecha de nacimiento"
icon="calendar-today"
v-model="nacimiento"
:min-date="minDate"
:max-date="maxDate"
>
</b-datepicker>
</b-field>
<b-field label="Telefono">
<b-input
placeholder="Telefono"
maxlength="10"
v-model="telefono"
type="tel"
>
</b-input>
</b-field>
<b-field label="Direccion">
<b-input
maxlength="200 "
placeholder="Direccion"
type="textarea"
v-model="direccion"
></b-input>
</b-field>
</form>
<div class="my-4 mb-6">
<b-field>
<button
:disabled="nacimiento == '' || telefono == '' || direccion == ''"
class="button is-success is-medium"
@click="enviarRegistro()"
>
Enviar
</button>
</b-field>
</div>
</div>
<div class="registro" v-if="status == 3"></div>
<div class="pre-termino" v-if="status == 4 || status == 9">
<h3 class="title is-4 mt-6">
Cuestionario de evaluación del programa de servicio social
</h3>
<div class="my-6" v-if="alumno.idCuestionario == null">
<b-button
tag="router-link"
to="/alumno/cuestionario"
type="is-info is-light "
icon-left="book-open"
class="border-info"
size="is-medium"
>
cuestionario
</b-button>
</div>
<div class="is-flex" v-else>
<p class="block is-size-5">Cuestionario contestado</p>
<b-icon icon="check-bold" size="is-small" type="is-success"> </b-icon>
</div>
<h3 class="title is-4 mt-6">
Informe global de actividades (en formato .PDF. No se aceptan fotos).
</h3>
<div v-if="alumno.informeGlobal == null">
<b-field type="black">
<b-upload
v-model="file"
type="black"
drag-drop
expanded
accept="application/pdf"
>
<section class="section">
<div class="content has-text-centered">
<p>
<b-icon icon="upload" size="is-large"></b-icon>
</p>
<p>
{{
file.name ||
"Arrastra aquí tu archivo o da click para buscar"
}}
</p>
<p>Tamaño máximo 20MB</p>
</div>
</section>
</b-upload>
</b-field>
<b-field class="derecha">
<button
:disabled="file == ''"
class="button is-success is-medium mb-4"
@click="enviarInforme()"
>
Enviar
</button>
</b-field>
</div>
<div class="is-flex" v-else>
<p class="block is-size-5">Informe Global enviado.</p>
<b-icon icon="check-bold" size="is-small" type="is-success"> </b-icon>
</div>
</div>
<div class="termino" v-if="status == 5"></div>
<div class="Liberacion" v-if="status == 6"></div>
</div>
<div class="container px-3"></div>
<pre>{{$data}}</pre>
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</section>
</template>
<script>
import DataAlumno from "../../components/alumno/DataAlumno";
import "buefy/dist/buefy.css";
import moment from "moment";
import axios from "axios";
export default {
components: { DataAlumno },
data() {
return {
token: {
headers:{
token: window.localStorage.getItem('token')
}
},
activeStep: "",
status:'',
isLoading: false,
file: [],
nacimiento: [],
minDate: new Date(),
maxDate: new Date(),
telefono: "",
direccion: "",
alumno: {
carrera: "",
creditos: "",
nombre: "",
cuenta: "",
correo: "",
direccion: "",
nacimiento: "",
telefono: "",
idCuestionario: "",
informeGlobal: "",
idAlumno: "",
idCarrera: "",
idServicio: "",
inicio: [],
fin: [],
registro: [],
},
programa: {
programa: "",
institucion: "",
dependencia: "",
clave: "",
acatlan: "",
programaInterno: "",
profesor: "",
},
mensajes: [
{ status: 1, mensaje: "" },
{ status: 2, mensaje: "" },
{
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: 4, mensaje: "" },
{
status: 5,
mensaje:
"Espera a que tus documentos sean validados por el Departamento de Servicio Social y Bolsa de Trabajo",
},
{
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: 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: 10,
mensaje: "servicio cancelado"
},
],
};
},
methods: {
reset() {
this.file = [];
this.nacimiento = [];
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;
}
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(`/`)
}
},
getData() {
axios
.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.programa.programa = resp.data.Programa.programa;
this.programa.dependencia = resp.data.Programa.dependencia;
this.programa.institucion = resp.data.Programa.institucion;
this.programa.clave = resp.data.Programa.clavePrograma;
this.programa.profesor = resp.data.profesor;
this.programa.acatlan = resp.data.Programa.acatlan;
this.programa.programaInterno = resp.data.programaInterno;
this.alumno.creditos = parseInt(resp.data.creditos, 10);
this.alumno.carrera = resp.data.Carrera.carrera;
this.alumno.idCarrera = resp.data.Carrera.idCarrera;
this.alumno.correo = resp.data.correo;
this.alumno.inicio = resp.data.fechaInicio;
this.alumno.fin = resp.data.fechaFin;
this.alumno.registro = resp.data.createdAt;
this.alumno.direccion = resp.data.direccion;
this.alumno.nacimiento = resp.data.fechaNacimiento;
this.alumno.telefono = resp.data.telefono;
this.alumno.idServicio = resp.data.idServicio;
this.alumno.idCuestionario = resp.data.idCuestionarioAlumno;
this.alumno.informeGlobal = resp.data.informeGlobal;
this.alumno.nombre = localStorage.getItem("nombre");
this.alumno.cuenta = localStorage.getItem("usuario");
window.localStorage.setItem("idCuestionarioAlumno",resp.data.idCuestionarioAlumno);
window.localStorage.setItem("idServicio", resp.data.idServicio);
})
.catch((error) => {
this.error(error.response.data.message)
});
},
enviarRegistro() {
this.isLoading=true
const data = {
idServicio: this.alumno.idServicio,
direccion: this.direccion,
telefono: this.telefono,
fechaNacimiento: moment(this.nacimiento),
};
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",
type: "is-success",
hasIcon: true,
icon: "checkbox-marked-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.reset();
this.getData();
})
.catch((error) => {
this.error(error.response.data.message)
})
.finally(()=>{
this.isLoading=false
})
},
enviarInforme() {
this.isLoading = true
const data = {
idServicio: this.alumno.idServicio,
};
const formData = new FormData();
console.log(data);
formData.append("data", JSON.stringify(data));
formData.append("informeGlobal", this.file);
axios
.put(`${process.env.api}/servicio/informe_global`, formData, {
headers: {
"Content-Type": "multipart/form-data",
token: this.token.headers.token
},
})
.then((res) => {
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
type: "is-success",
hasIcon: true,
icon: "checkbox-marked-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.reset();
this.getData();
})
.catch((error) => {
this.error(error.response.data.message)
})
.finally(()=>{
this.isLoading= false
})
},
fecha(date) {
const fecha = moment(date);
return `${fecha.year()}/${fecha.month() + 1}/${fecha.date()}`;
},
},
computed: {
steps() {
const steps = [...this.baseSteps];
return steps;
},
},
created() {
this.getData();
},
watch: {
file() {
console.log(this.file.size);
if (this.file.size >= 20000000) {
this.$buefy.dialog.alert({
title: "Error",
message: "El tamaño del archivo exede los 20MB",
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
this.file = [];
}
},
},
mounted() {
let i = new Date().getFullYear() - 80; // hoy - 80 años fecha minima
let j = new Date().getFullYear() - 10; //hoy - 10 años
this.minDate.setFullYear(i);
this.maxDate.setFullYear(j);
},
};
</script>
<style scoped>
.border-info {
border: 1px solid #167df0;
}
.info-alumno p {
margin-bottom: 0.8rem;
}
.info-programa p {
margin-bottom: 0.8rem;
}
.mensaje {
margin: 3.5rem 0;
}
.else {
display: flex;
align-content: center !important;
}
</style>
+2 -8
View File
@@ -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}`);
})
+79 -51
View File
@@ -213,6 +213,7 @@
</section>
</div>
</div>
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</div>
</template>
@@ -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,48 @@ export default {
return "";
}
},
buscarAlumno() {
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el,
});
axios
.get(`${process.env.api}/usuario/escolares`, {
params: {
numeroCuenta: this.noCuenta,
},
})
.then((resp) => {
loadingComponent.close();
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",
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() {
this.isLoading=true
axios
.get(`${process.env.api}/usuario/escolares?numeroCuenta=${this.noCuenta}`,this.token)
.then((resp) => {
console.log(resp.data);
this.alumno.cuenta = this.noCuenta;
this.alumno.nombre = resp.data.nombre;
@@ -350,27 +385,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 +407,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",
@@ -409,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
});
},
},
@@ -451,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);
@@ -475,18 +507,14 @@ export default {
mounted() {
console.log(localStorage.getItem("idUsuario"));
axios
.get(`${process.env.api}/programa`, {
params: {
idUsuario: localStorage.getItem("idUsuario"),
},
})
.get(`${process.env.api}/programa?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: {