Cambios acerca de visualizaciones administrativas añadidas

This commit is contained in:
alfredojl
2020-08-25 21:08:19 -05:00
parent 30550e58f8
commit 1c5769016d
3 changed files with 35 additions and 22 deletions
+9 -3
View File
@@ -12,14 +12,20 @@ const routes = [{
},
{
path: '/',
component: Login,
name: 'start'
name: 'root',
redirect: 'login'
},
{
path: '/login',
component: Login,
name: 'login',
meta: { isPublic: true },
beforeEnter: (to, from, next) => {
if (isAuthenticated())
next('/user');
else
next();
}
},
{
path: '/user',
@@ -30,7 +36,7 @@ const routes = [{
if (isAuthenticated())
next(true);
else
next('/login');
next(false);
}
},
{
+7 -7
View File
@@ -12,6 +12,7 @@
</div>
<input
type="email"
v-on:keyup.enter="onLogin()"
v-model="name"
class="form-control input-login-form shadow-none py-4"
placeholder="Usuario"
@@ -51,7 +52,7 @@
id="alertErr"
role="alert"
>
Usuario o contraseña invalidos
Usuario o contraseña incorrectos.
</div>
<!-- <div
@@ -103,15 +104,14 @@ import axios from "axios";
.then(res => {
if (res.status == 200) {
localStorage.setItem('isAdmin', res.data.user.isAdmin)
localStorage.setItem('token', res.data.token)
localStorage.setItem('user', res.data.user.name)
localStorage.setItem('isAdmin', res.data.user.isAdmin);
localStorage.setItem('token', res.data.token);
localStorage.setItem('user', res.data.user.userName);
localStorage.setItem(
'idAdmin',
res.data.user.idAdmin
)
console.log(res.data.user.name);
this.$router.replace('/user')
);
this.$router.replace('/user');
}
})
+19 -12
View File
@@ -25,18 +25,15 @@
</div>
<div v-if="pcView" class="table-responsive table-fixed text-nowrap justify-content-md-center"
style="max-height: 350px;">
<table class="table table-sm table-hover text-center" style="font-size:14px">
<table v-bind:class="['table', 'table-sm', 'text-center', { 'table-hover': admin(), 't-hov': admin() }]" style="font-size:14px">
<thead class="thead-light text-uppercase">
<tr>
<th v-for="pcHead in pcHeads" class="sticky-top">{{ pcHead }}</th>
</tr>
</thead>
<tbody class="overflow-auto t-hov" v-for="item in inventory">
<tbody class="overflow-auto thov" v-for="item in inventory">
<tr @click="watchRow()">
<td>
<a href="#">{{ item.noInventario }}</a>
</td>
<td>{{ item.noInventario }}</td>
<td>{{ item.tipo }}</td>
<td>{{ item.modelo }}</td>
<td>{{ item.marca }}</td>
@@ -61,17 +58,15 @@
<div v-else class="table-responsive table-fixed text-nowrap justify-content-md-center"
id="myTableStyle">
<table class="table table-sm table-hover text-center">
<table :class="['table', 'table-sm', 'text-center', { 't-hov': admin(), 'table-hover': admin()}]">
<thead class="thead-light text-uppercase">
<tr>
<th v-for="printerHead in printerHeads" class="sticky-top">{{ printerHead }}</th>
</tr>
</thead>
<tbody class="overflow-auto t-hov" v-for="item in inventory">
<tbody v-for="item in inventory">
<tr @click="watchRow()">
<td>
<a href="#">{{ item.noInventario }}</a>
</td>
<td>{{ item.noInventario }}</td>
<td>{{ item.tipo }}</td>
<td>{{ item.modelo }}</td>
<td>{{ item.marca }}</td>
@@ -193,7 +188,8 @@ export default {
}
},
watchRow() {
this.$router.push('./updateEquip')
if(JSON.parse(window.localStorage.isAdmin))
this.$router.push('./updateEquip')
},
changeView() {
if (this.pcView) {
@@ -205,6 +201,9 @@ export default {
this.fillInventory();
}
},
admin() {
return JSON.parse(window.localStorage.isAdmin);
}
},
}
@@ -242,4 +241,12 @@ footer {
max-height: 350px;
font-size: 14px;
}
.black {
background-color: black;
}
.red {
background-color: red;
}
</style>