tokens
This commit is contained in:
@@ -112,7 +112,11 @@ export default {
|
||||
activa: true
|
||||
}
|
||||
axios
|
||||
.post(`${process.env.api}/Premiacion/nueva`, data)
|
||||
.post(`${process.env.api}/Premiacion/nueva`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.success()
|
||||
|
||||
@@ -77,7 +77,11 @@ export default {
|
||||
fecha: this.fechaNueva,
|
||||
}
|
||||
axios
|
||||
.put(`${process.env.api}/Premiacion/editar`, data)
|
||||
.put(`${process.env.api}/Premiacion/editar`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
let message = 'Se ha editado la premiación con éxito.'
|
||||
@@ -112,7 +116,11 @@ export default {
|
||||
activa: !this.activa,
|
||||
}
|
||||
axios
|
||||
.put(`${process.env.api}/Premiacion/activarDesactivar`, data)
|
||||
.put(`${process.env.api}/Premiacion/activarDesactivar`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
let message =
|
||||
@@ -175,7 +183,7 @@ export default {
|
||||
confirmButtonColor: '#1e3c70',
|
||||
}).then((res) => {
|
||||
if (res.value) {
|
||||
this.$router.push("/admin")
|
||||
this.$router.push('/admin')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -108,7 +108,11 @@ export default {
|
||||
password: this.password,
|
||||
}
|
||||
axios
|
||||
.post(`${process.env.api}/usuario/nuevoOperador`, data)
|
||||
.post(`${process.env.api}/usuario/nuevoOperador`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.success()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<CrearPremiacion :updateIsLoading="updateIsLoading"/>
|
||||
<h2 class="has-text-centered mt-5 is-size-3">Administración de premiaciones</h2>
|
||||
<CrearPremiacion :updateIsLoading="updateIsLoading" />
|
||||
<h2 class="has-text-centered mt-5 is-size-3">
|
||||
Administración de premiaciones
|
||||
</h2>
|
||||
<TablaPremiaciones
|
||||
:data="data"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
@@ -20,14 +22,14 @@ import axios from 'axios'
|
||||
export default {
|
||||
components: {
|
||||
TablaPremiaciones,
|
||||
CrearPremiacion
|
||||
CrearPremiacion,
|
||||
},
|
||||
props: {
|
||||
updateIsLoading: {
|
||||
type: Function,
|
||||
required: true,
|
||||
default: () => {},
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -46,7 +48,12 @@ export default {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/premiacion/premiacionesPaginacion?pagina=${this.page}`
|
||||
`${process.env.api}/premiacion/premiacionesPaginacion?pagina=${this.page}`,
|
||||
{
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
|
||||
@@ -124,12 +124,16 @@ export default {
|
||||
formData.append('file', this.csv)
|
||||
|
||||
axios
|
||||
.post(`${process.env.api}/profesor/cargarDatos?idPremiacion=${this.idPremiacionCSV}`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
// token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.post(
|
||||
`${process.env.api}/profesor/cargarDatos?idPremiacion=${this.idPremiacionCSV}`,
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
this.csv = {}
|
||||
@@ -199,7 +203,12 @@ export default {
|
||||
this.isLoading = true
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/invitado/get?idPremiacion=${this.idPremiacion}`
|
||||
`${process.env.api}/invitado/get?idPremiacion=${this.idPremiacion}`,
|
||||
{
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
@@ -223,7 +232,11 @@ export default {
|
||||
async created() {
|
||||
this.isLoading = true
|
||||
await axios
|
||||
.get(`${process.env.api}/premiacion/get`)
|
||||
.get(`${process.env.api}/premiacion/get`, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
if (res) {
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ export default {
|
||||
axios: {},
|
||||
build: {},
|
||||
env: {
|
||||
// api: "http://localhost:3000",
|
||||
api: "http://localhost:3000",
|
||||
// api: "https://890af9d598a4.ngrok.io"
|
||||
// api: "https://venus.acatlan.unam.mx/premiaciones_test",
|
||||
api: "https://venus.acatlan.unam.mx/premiaciones",
|
||||
// api: "https://venus.acatlan.unam.mx/premiaciones",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<p class="is-size-2">Lector de códigos QR</p>
|
||||
</div>
|
||||
<div v-if="!isReading" class="has-text-centered mb-4">
|
||||
<b-button type="is-info" @click="() => this.isReading = true">
|
||||
<b-button type="is-info" @click="() => (this.isReading = true)">
|
||||
Leer QR
|
||||
</b-button>
|
||||
</div>
|
||||
<Scanner :enviar="enviar" v-if="isReading"/>
|
||||
<Scanner :enviar="enviar" v-if="isReading" />
|
||||
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
||||
</section>
|
||||
</template>
|
||||
@@ -18,7 +18,7 @@ import axios from 'axios'
|
||||
import Scanner from '../../components/operador/Scanner.vue'
|
||||
export default {
|
||||
components: {
|
||||
Scanner
|
||||
Scanner,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -32,7 +32,11 @@ export default {
|
||||
this.isReading = false
|
||||
const data = { idProfesor, idPremiacion }
|
||||
axios
|
||||
.post(`${process.env.api}/profesor/entradaInvitado`, data)
|
||||
.post(`${process.env.api}/profesor/entradaInvitado`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
this.successUpload()
|
||||
@@ -52,7 +56,7 @@ export default {
|
||||
confirmButtonColor: '#1e3c70',
|
||||
})
|
||||
},
|
||||
errorMessage(err){
|
||||
errorMessage(err) {
|
||||
this.$swal({
|
||||
title: err,
|
||||
type: 'error',
|
||||
@@ -60,7 +64,7 @@ export default {
|
||||
confirmButtonText: 'Aceptar',
|
||||
confirmButtonColor: '#1e3c70',
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
layout: 'default',
|
||||
}
|
||||
|
||||
+30
-14
@@ -15,8 +15,12 @@
|
||||
<div v-if="premiaciones.length !== 0" class="box">
|
||||
<div>
|
||||
<p class="is-size-4 block"><b>Nombre:</b> {{ `${Profesor.nombre}` }}</p>
|
||||
<p v-if="alreadyRegistred" class="is-size-3 block has-text-centered">Este profesor ya registró invitados en otro momento.</p>
|
||||
<p v-if="isSent" class="is-size-3 block has-text-centered">¡Gracias por su registro!</p>
|
||||
<p v-if="alreadyRegistred" class="is-size-3 block has-text-centered">
|
||||
Este profesor ya registró invitados en otro momento.
|
||||
</p>
|
||||
<p v-if="isSent" class="is-size-3 block has-text-centered">
|
||||
¡Gracias por su registro!
|
||||
</p>
|
||||
|
||||
<div v-if="!isSent && !alreadyRegistred" class="is-flex block">
|
||||
<p class="is-size-4 block mr-4"><b>Premiacion: </b></p>
|
||||
@@ -35,7 +39,7 @@
|
||||
</b-select>
|
||||
</div>
|
||||
|
||||
<div v-if="!isSent && !alreadyRegistred" class="is-flex">
|
||||
<div v-if="!isSent && !alreadyRegistred" class="is-flex">
|
||||
<p class="is-size-4 block mr-4"><b>Cantidad de invitados: </b></p>
|
||||
<b-select
|
||||
v-model="numeroInvitados"
|
||||
@@ -103,7 +107,9 @@
|
||||
</div>
|
||||
<div v-if="premiaciones.length === 0" class="box">
|
||||
<p class="is-size-4 block"><b>Nombre:</b> {{ `${Profesor.nombre}` }}</p>
|
||||
<p class="is-size-4 block"><b>No hay premiaciones activas para este profesor.</b> </p>
|
||||
<p class="is-size-4 block">
|
||||
<b>No hay premiaciones activas para este profesor.</b>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -128,7 +134,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
enviar() {
|
||||
console.log(this.premiacion)
|
||||
this.isLoading = true
|
||||
this.invitados.forEach((item) => {
|
||||
item.nombreCompleto = `${item.nombre} ${item.apellido}`
|
||||
@@ -138,9 +143,12 @@ export default {
|
||||
idPremiacion: this.premiacion,
|
||||
invitados: this.invitados,
|
||||
}
|
||||
console.log(data)
|
||||
axios
|
||||
.post(`${process.env.api}/invitado/infoInvitados`, data)
|
||||
.post(`${process.env.api}/invitado/infoInvitados`, data, {
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
this.invitados = []
|
||||
@@ -183,11 +191,16 @@ export default {
|
||||
this.isLoading = true
|
||||
await axios
|
||||
.get(
|
||||
`${process.env.api}/profesor/premiaciones?idProfesor=${this.Profesor.idProfesor}`
|
||||
`${process.env.api}/profesor/premiaciones?idProfesor=${this.Profesor.idProfesor}`,
|
||||
{
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
if(res) this.premiaciones = res.data
|
||||
if (res) this.premiaciones = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
@@ -196,14 +209,18 @@ export default {
|
||||
},
|
||||
async yaRegistrado() {
|
||||
this.isLoading = true
|
||||
console.log(this.Profesor.idProfesor, this.premiaciones[0].idPremiacion)
|
||||
await axios
|
||||
.get(
|
||||
`${process.env.api}/profesor/yaRegistro?idProfesor=${this.Profesor.idProfesor}&idPremiacion=${this.premiaciones[0].idPremiacion}`
|
||||
`${process.env.api}/profesor/yaRegistro?idProfesor=${this.Profesor.idProfesor}&idPremiacion=${this.premiaciones[0].idPremiacion}`,
|
||||
{
|
||||
headers: {
|
||||
token: localStorage.getItem('token'),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
if(res) this.alreadyRegistred = res.data
|
||||
if (res) this.alreadyRegistred = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
@@ -217,8 +234,7 @@ export default {
|
||||
this.Profesor.adscripcion = localStorage.getItem('adscripcion')
|
||||
this.Profesor.numeroTrabajador = localStorage.getItem('numeroTrabajador')
|
||||
await this.fetchPremiaciones()
|
||||
console.log(this.premiaciones)
|
||||
if(this.premiaciones.length === 1) {
|
||||
if (this.premiaciones.length === 1) {
|
||||
await this.yaRegistrado()
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user