panel admin
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class=" divMaster row row d-flex flex-wrap justify-content-center">
|
||||
<b-input-group class="mb-2">
|
||||
<b-input-group-prepend is-text>
|
||||
<b-icon icon="search"></b-icon>
|
||||
</b-input-group-prepend>
|
||||
<b-form-input type="search" placeholder="Buscar" ></b-form-input>
|
||||
</b-input-group>
|
||||
</div>
|
||||
<div class="divMaster row ">
|
||||
<div class=" d-flex flex-wrap " style="justify-content: space-between;">
|
||||
<div v-bind:key="libro.id" v-for="(libro, idx) in Libros" :class="{ active: idx == 0 }">
|
||||
<b-card class="mb-3" style="width: 14rem; height: 22rem;">
|
||||
<b-card-img :src="libro.img" alt="Image" style="max-width: 20rem; height: 15rem;" no-body ></b-card-img>
|
||||
<template #footer>
|
||||
<b-button variant="outline-warning" class="float-left">Editar</b-button>
|
||||
<b-button variant="outline-danger" class="float-right">Eliminar</b-button>
|
||||
</template>
|
||||
|
||||
</b-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import config from "../config/config.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Libros: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async descripcion(idLibro) {
|
||||
//console.log(` Este es el id del libro ${idLibro}`);
|
||||
localStorage.clear();
|
||||
window.localStorage.setItem("idLibro", idLibro);
|
||||
this.$router.push("/desc");
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
let novedades = await axios.get(`${config.api}/librosNovedades`);
|
||||
let path = `${config.api}/libroImagen?idLibro=`;
|
||||
novedades = novedades.data.data;
|
||||
//console.log(`${novedades}`);
|
||||
for (let i = 0; i < novedades.length; i++) {
|
||||
//alert(novedades[i].titulo);
|
||||
//this.Libros[i].title = novedades[i].titulo;
|
||||
let config = {
|
||||
// example url
|
||||
url: `${path}${novedades[i].idLibro}`,
|
||||
method: "GET",
|
||||
responseType: "blob"
|
||||
};
|
||||
try {
|
||||
await axios(config).then(response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: novedades[i].idLibro,
|
||||
title: novedades[i].titulo,
|
||||
img: reader.result
|
||||
});
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(`No existe esa imagen`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Ocurrio un error ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.divMaster {
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user