tamaño archico, mas data, reload

This commit is contained in:
casnet1
2020-12-08 20:10:52 -06:00
parent 308b49d448
commit 66dfae4dd8
2 changed files with 57 additions and 3 deletions
+40 -1
View File
@@ -71,7 +71,11 @@
<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[1]}}{{ alumno.creditos[2]}}<span v-if="alumno.creditos">%</span></p>
<p><strong> Correo: </strong> {{ alumno.correo }}</p>
<p><strong> Fecha de inicio: </strong> {{ fecha(alumno.registro) }}</p>
<p><strong> Fecha de finalización: </strong> {{ fecha(alumno.inicio) }}</p>
<p><strong> Fecha de registro: </strong> {{ fecha(alumno.fin) }}</p>
<div class="mt-4 info-extra" v-if="activeStep >= 2">
<p><strong> Direccion: </strong> {{ alumno.direccion }}</p>
@@ -173,6 +177,7 @@
"Arrastra aquí tu archivo o da click para buscar"
}}
</p>
<p>Tamaño máximo 20MB</p>
</div>
</section>
</b-upload>
@@ -217,6 +222,7 @@ export default {
alumno: {
carrera: '',
creditos: '',
nombre: '',
cuenta: '',
correo: '',
@@ -229,7 +235,8 @@ export default {
idCarrera: '',
idServicio: '',
inicio: [],
fin: []
fin: [],
registro: []
},
programa: {
programa: '',
@@ -267,6 +274,12 @@ export default {
}
},
methods: {
reset () {
this.file = []
this.nacimiento = []
this.telefono = ''
this.direccion = ''
},
enviarRegistro () {
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el
@@ -295,6 +308,7 @@ export default {
})
this.reset()
location.reload()
})
.catch((error) => {
loadingComponent.close()
@@ -342,6 +356,7 @@ export default {
})
this.reset()
location.reload()
})
.catch((error) => {
loadingComponent.close()
@@ -356,6 +371,10 @@ export default {
ariaModal: true
})
})
},
fecha (date) {
const fecha = moment(date)
return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`
}
},
computed: {
@@ -383,11 +402,13 @@ export default {
this.programa.acatlan = resp.data.Programa.acatlan
this.programa.programaInterno = resp.data.programaInterno
this.alumno.creditos = resp.data.creditos
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
@@ -400,6 +421,24 @@ export default {
.catch((error) => {
console.log(error.message)
})
},
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 = []
}
}
}
}
</script>
+17 -2
View File
@@ -135,6 +135,7 @@
<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>
@@ -155,7 +156,7 @@
</b-button>
<b-field class="derecha" >
<button :disabled='file == "" || noCuenta == "" || alumno.correo == "" || alumno.inicio == "" || alumno.fin == ""'
<button :disabled='file == "" || noCuenta == "" || alumno.correo == "" || alumno.inicio == "" || alumno.fin == "" '
class="button enviar is-success is-medium"
@click="Enviar()"
>
@@ -183,6 +184,7 @@ export default {
return {
isFullPage: true,
noCuenta: '',
sizeOk: '',
searched: false,
minDate: new Date('2020-01-01'),
programaSelectedID: '',
@@ -376,7 +378,20 @@ export default {
}
},
file () {
console.log(this.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 = []
}
},
'alumno.inicio' () {
this.alumno.fin = []