agregar idLibros originales
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="divMaster row ">
|
||||
<div class="col-10 offset-1 d-flex flex-wrap justify-content-center mb-5">
|
||||
<div class="divMaster row mb-5">
|
||||
<div class="col-10 offset-1 d-flex flex-wrap justify-content-center">
|
||||
<div
|
||||
class="card m-3"
|
||||
style="width: 12rem;"
|
||||
@@ -49,21 +49,25 @@ export default {
|
||||
//this.Libros[i].title = novedades[i].titulo;
|
||||
let config = {
|
||||
// example url
|
||||
url: `${path}${(i % 3) + 1}`,
|
||||
url: `${path}${novedades[i].idLibro}`,
|
||||
method: "GET",
|
||||
responseType: "blob"
|
||||
};
|
||||
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
|
||||
});
|
||||
};
|
||||
});
|
||||
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}`);
|
||||
|
||||
@@ -135,7 +135,6 @@ export default {
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
this.idLibro = 1;
|
||||
|
||||
try {
|
||||
let config = {
|
||||
@@ -163,22 +162,27 @@ export default {
|
||||
for (let i = 0; i < similares.length; i++) {
|
||||
let config = {
|
||||
// example url
|
||||
url: `${path}/libroImagen?idLibro=${i + 2}`,
|
||||
url: `${path}/libroImagen?idLibro=${similares[i].idLibro}`,
|
||||
method: "GET",
|
||||
responseType: "blob"
|
||||
};
|
||||
await axios(config).then(response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: similares[i].idLibro,
|
||||
title: similares[i].titulo,
|
||||
img: reader.result
|
||||
});
|
||||
//this.Libros[i].img = reader.result;
|
||||
};
|
||||
});
|
||||
try{
|
||||
await axios(config).then(response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: similares[i].idLibro,
|
||||
title: similares[i].titulo,
|
||||
img: reader.result
|
||||
});
|
||||
//this.Libros[i].img = reader.result;
|
||||
};
|
||||
});
|
||||
}
|
||||
catch(error){
|
||||
console.log(`Este libro no se encuentra: ${error}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Ocurrio un error ${error}`);
|
||||
|
||||
@@ -52,22 +52,27 @@ export default {
|
||||
for (let i = 0; i < similares.length; i++) {
|
||||
let config = {
|
||||
// example url
|
||||
url: `${path}/libroImagen?idLibro=${(i % 4) + 1}`,
|
||||
url: `${path}/libroImagen?idLibro=${similares[i].idLibro}`,
|
||||
method: "GET",
|
||||
responseType: "blob"
|
||||
};
|
||||
await axios(config).then(response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: similares[i].idLibro,
|
||||
title: similares[i].titulo,
|
||||
img: reader.result
|
||||
});
|
||||
//this.Libros[i].img = reader.result;
|
||||
};
|
||||
});
|
||||
try{
|
||||
await axios(config).then(response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: similares[i].idLibro,
|
||||
title: similares[i].titulo,
|
||||
img: reader.result
|
||||
});
|
||||
//this.Libros[i].img = reader.result;
|
||||
};
|
||||
});
|
||||
}
|
||||
catch(error){
|
||||
console.log(`Ocurrio un error con la imagen desc: ${error}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Ocurrio un error ${error}`);
|
||||
|
||||
Reference in New Issue
Block a user