change routes to update and create lib
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/png href=assets/icono.png><title>Portal Editorial Acatlán</title><link href=css/app.4b287322.css rel=preload as=style><link href=css/chunk-vendors.138628b4.css rel=preload as=style><link href=js/app.67d6f3a9.js rel=preload as=script><link href=js/chunk-vendors.f7c3b5b9.js rel=preload as=script><link href=css/chunk-vendors.138628b4.css rel=stylesheet><link href=css/app.4b287322.css rel=stylesheet></head><body><noscript><strong>We're sorry but portal doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.f7c3b5b9.js></script><script src=js/app.67d6f3a9.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/png href=assets/icono.png><title>Portal Editorial Acatlán</title><link href=css/app.5e1fdc87.css rel=preload as=style><link href=css/chunk-vendors.138628b4.css rel=preload as=style><link href=js/app.9ff39dfe.js rel=preload as=script><link href=js/chunk-vendors.67046eec.js rel=preload as=script><link href=css/chunk-vendors.138628b4.css rel=stylesheet><link href=css/app.5e1fdc87.css rel=stylesheet></head><body><noscript><strong>We're sorry but portal doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.67046eec.js></script><script src=js/app.9ff39dfe.js></script></body></html>
|
||||
Vendored
-2
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+96
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Vendored
-96
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
@@ -86,8 +86,7 @@
|
||||
<b-row class="mb-2">
|
||||
<b-col>
|
||||
<b-form-file
|
||||
id="pdf"
|
||||
v-model="pdf"
|
||||
id="pdfNuevo"
|
||||
placeholder="Seleccione el PDF o arrastre..."
|
||||
accept=".pdf"
|
||||
></b-form-file>
|
||||
@@ -95,10 +94,9 @@
|
||||
|
||||
<b-col>
|
||||
<b-form-file
|
||||
id="imagen"
|
||||
v-model="imagen"
|
||||
id="imagenNuevo"
|
||||
placeholder="Seleccione la imagen o arrastre..."
|
||||
accept=".png"
|
||||
accept=".png, .jpg"
|
||||
></b-form-file>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@@ -155,8 +153,6 @@ export default {
|
||||
version:"",
|
||||
descripcion:"",
|
||||
year:"",
|
||||
imagen: null,
|
||||
pdf: null
|
||||
|
||||
};
|
||||
},
|
||||
@@ -173,8 +169,8 @@ export default {
|
||||
|
||||
|
||||
var formData = new FormData();
|
||||
var imagen = document.querySelector('#imagen');
|
||||
var pdf = document.querySelector('#pdf');
|
||||
var imagen = document.querySelector('#imagenNuevo');
|
||||
var pdf = document.querySelector('#pdfNuevo');
|
||||
if(this.isbn !== "") formData.append("isbn", this.isbn); else return this.faltaCampo("ISBN");
|
||||
if(this.titulo !== "") formData.append("titulo", this.titulo); else return this.faltaCampo("Titulo");
|
||||
if(this.categoria !== "Categoria") formData.append("categoria", this.categoria); else return this.faltaCampo("Categoria");
|
||||
@@ -187,15 +183,15 @@ export default {
|
||||
if(this.year !== "") formData.append("year", this.year); else return this.faltaCampo("Año de publicación");
|
||||
if(imagen.files.length > 0) formData.append("imagen", imagen.files[0]); else return this.faltaCampo("Imagen");
|
||||
if(pdf.files.length > 0) formData.append("pdf", pdf.files[0]); else return this.faltaCampo("Pdf");
|
||||
|
||||
await axios.post( `${config.api}/agregarLibro`, formData ,{ headers: { 'Content-Type': 'multipart/form-data' } });
|
||||
formData.append("type", 'addLibro');
|
||||
await axios.post( `${config.api}/actualizarLibro`, formData ,{ headers: { 'Content-Type': 'multipart/form-data' } });
|
||||
await Swal.fire(
|
||||
'Libro agregada con exito',
|
||||
'Libro agregado con exito',
|
||||
'',
|
||||
'success'
|
||||
);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
catch(error){
|
||||
console.log(error);
|
||||
Swal.fire({
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
id="nuevaImagenBanner"
|
||||
block
|
||||
placeholder="Seleccione la imagen o arrastre aqui..."
|
||||
accept=".png"
|
||||
accept=".png, .jpg"
|
||||
></b-form-file>
|
||||
</b-col>
|
||||
<b-col>
|
||||
@@ -18,12 +18,12 @@
|
||||
</b-row>
|
||||
</div>
|
||||
<h1 class="mb-4" style="text-align:left;">Eliminar Imagen</h1>
|
||||
<div class="divMaster row ">
|
||||
<div class=" d-flex flex-wrap " style="justify-content: space-between;">
|
||||
<div v-bind:key="libro.id" v-for="libro in imagenesBanner" >
|
||||
<b-card class="mb-3" style="width: 28rem;">
|
||||
<b-card-img :src="libro.img" alt="Image" ></b-card-img>
|
||||
<b-card-footer><b-button variant="danger" @click="eliminarImagen(libro.nombreImagen)">Eliminar</b-button></b-card-footer>
|
||||
<div class=" row ">
|
||||
<div class="d-flex flex-wrap" style="justify-content: space-between;">
|
||||
<div v-bind:key="imagenBanner.id" v-for="imagenBanner in imagenesBanner" >
|
||||
<b-card class="m-3" style="width: 28rem;">
|
||||
<b-card-img :src="imagenBanner.img" alt="Image" ></b-card-img>
|
||||
<b-card-footer><b-button variant="danger" @click="eliminarImagen(imagenBanner.nombreImagen)">Eliminar</b-button></b-card-footer>
|
||||
</b-card>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,7 +40,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
imagenesBanner: [],
|
||||
nuevaImagenBanner: "",
|
||||
nuevaImagenBanner: null,
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<b-container class="mt-5">
|
||||
<div class=" divMaster row row d-flex flex-wrap justify-content-center mb-3">
|
||||
<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" v-model="searchLibro" ></b-form-input>
|
||||
</b-input-group>
|
||||
<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" v-model="searchLibro" ></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 in listaLibroFiltrada" >
|
||||
<b-card class="mb-3" style="width: 14rem; height: 25rem;">
|
||||
<b-card class="mb-3" style="width: 14rem; height: 25rem;">
|
||||
<b-card-img :src="libro.img" alt="Image" style="max-width: 20rem; height: 15rem;" ></b-card-img>
|
||||
<p class="mt-1" style="text-align: left; font-size: 15px;">{{nombreLibro(libro.titulo)}}</p>
|
||||
<template #footer>
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ModalEditar v-bind:libro="libroSelect" value="valueCampo" />
|
||||
<ModalEditar v-bind:libro="libroSelect" />
|
||||
</b-container>
|
||||
</template>
|
||||
|
||||
@@ -88,11 +88,6 @@ export default {
|
||||
return nombreLibro;
|
||||
return `${nombreLibro.substring(0, maxLengthtitulo)}...`;
|
||||
|
||||
},
|
||||
async descripcion(idLibro) {
|
||||
localStorage.clear();
|
||||
window.localStorage.setItem("idLibro", idLibro);
|
||||
this.$router.push("/desc");
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
@@ -107,9 +102,9 @@ export default {
|
||||
responseType: "blob"
|
||||
};
|
||||
try {
|
||||
axios(config).then(response => {
|
||||
axios(config).then( async response => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(response.data);
|
||||
await reader.readAsDataURL(response.data);
|
||||
reader.onload = () => {
|
||||
this.Libros.push({
|
||||
id: todosLibros[i].idLibro,
|
||||
@@ -128,6 +123,7 @@ export default {
|
||||
});
|
||||
};
|
||||
}).catch(() =>{
|
||||
|
||||
this.Libros.push({
|
||||
id: todosLibros[i].idLibro,
|
||||
titulo: todosLibros[i].titulo,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<b-modal size="lg" id="modalEditarLibro" hide-footer title="Editar Libro">
|
||||
<b-container fluid>
|
||||
<b-container fluid v-if="libro!=null">
|
||||
<b-row class="mb-2">
|
||||
<b-col >
|
||||
<h2 style="text-align:left;"> {{libro.titulo}}</h2>
|
||||
@@ -183,9 +183,8 @@
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<b-form-file
|
||||
|
||||
placeholder="Seleccione la imagen o arrastre..."
|
||||
accept=".png"
|
||||
accept=".png, .jpg"
|
||||
id="imagen"
|
||||
></b-form-file>
|
||||
</b-col>
|
||||
@@ -198,7 +197,6 @@
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<b-form-file
|
||||
|
||||
placeholder="Seleccione el PDF o arrastre..."
|
||||
id="pdf"
|
||||
accept=".pdf"
|
||||
@@ -225,7 +223,6 @@ import Swal from 'sweetalert2'
|
||||
export default {
|
||||
props: {
|
||||
libro: Object,
|
||||
value: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -279,7 +276,8 @@ export default {
|
||||
if(this.isActiveDescripcion) formData.append("descripcion", this.descripcion);
|
||||
if(this.isActiveYear) formData.append("year", this.year);
|
||||
formData.append("idLibro", idLibro);
|
||||
await axios.post( `${config.api}/actualizarLibro`, formData ,{ headers: { 'Content-Type': 'multipart/form-data' } });
|
||||
formData.append("type", 'editarLibro');
|
||||
await axios.post( `${config.api}/actualizarLibro`, formData ,{ headers: { 'Content-Type': 'multipart/form-data' } });
|
||||
await Swal.fire(
|
||||
'Libro actualizado con exito',
|
||||
'',
|
||||
|
||||
+27
-4
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<Header />
|
||||
<h1 class="my-5">Inicia Sesion</h1>
|
||||
<h1 class="my-5">Inicia Sesión</h1>
|
||||
<div class="row d-flex justify-content-center">
|
||||
<div class="col-12 col-md-8 col-lg-6 col-xl-6">
|
||||
<form class="row d-flex justify-content-center">
|
||||
@@ -35,7 +35,9 @@
|
||||
|
||||
<script>
|
||||
import Header from "./../components/header.vue";
|
||||
|
||||
import axios from "axios";
|
||||
import config from "../config/config.js";
|
||||
import Swal from 'sweetalert2'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -47,12 +49,33 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
alert(this.data.email);
|
||||
const data = {
|
||||
usuario: this.email,
|
||||
password: this.password
|
||||
}
|
||||
axios.post( `${config.api}/loginAdmin`, data ).then(async response =>{
|
||||
localStorage.setItem('tokenPortal', response.data.token);
|
||||
localStorage.setItem('userNamePortal', response.data.user);
|
||||
await Swal.fire(
|
||||
'Bienvenido',
|
||||
'',
|
||||
'success'
|
||||
);
|
||||
this.$router.replace('/portalAdmin');
|
||||
|
||||
}).catch(() =>{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'El usuario o la contraseña es incorrecta',
|
||||
text: `Intentalo de nuevo.`,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Header
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ import EditarLibro from './../components/editarLibro.vue';
|
||||
import EditarBanner from './../components/editarBanner.vue';
|
||||
import AgregarLibro from './../components/agregarLibro.vue';
|
||||
import NavAdmin from './../components/navAdmin.vue';
|
||||
/*import axios from "axios";
|
||||
import config from "../config/config.js";
|
||||
import Swal from 'sweetalert2'*/
|
||||
export default {
|
||||
name: "panelAdmin",
|
||||
components: {
|
||||
@@ -40,6 +43,18 @@ export default {
|
||||
EditarBanner,
|
||||
AgregarLibro
|
||||
},
|
||||
/*beforeCreate(){
|
||||
let token = localStorage.getItem('tokenPortal');
|
||||
if(token === null) this.$router.replace('/login');
|
||||
axios.post( `${config.api}/checkToken`, {token: token} ).catch(async () =>{
|
||||
await Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'La sesión ha expirado',
|
||||
text: `Ingrese de nuevo.`,
|
||||
});
|
||||
this.$router.replace('/login')
|
||||
});
|
||||
}*/
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user