agregar idLibros originales

This commit is contained in:
2020-08-26 00:26:05 -05:00
parent ac4187e317
commit 03718594c6
9 changed files with 59 additions and 46 deletions
+18 -14
View File
@@ -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}`);
+18 -14
View File
@@ -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}`);
+18 -13
View File
@@ -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}`);