Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ygonzalezp
sigi
Commits
c5ea461a
Commit
c5ea461a
authored
Aug 06, 2021
by
Yoelvis Gonzalez
Browse files
user interface
parent
6477d38a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
48 deletions
+146
-48
src/axios/auth.js
src/axios/auth.js
+5
-0
src/components/PatientFile.vue
src/components/PatientFile.vue
+1
-1
src/layouts/home/AppBar.vue
src/layouts/home/AppBar.vue
+73
-26
src/store/getters.js
src/store/getters.js
+1
-0
src/store/mutations.js
src/store/mutations.js
+3
-0
src/store/state.js
src/store/state.js
+1
-0
src/views/sections/Login.vue
src/views/sections/Login.vue
+62
-21
No files found.
src/axios/auth.js
View file @
c5ea461a
...
@@ -12,3 +12,8 @@ export async function login (user, pass) {
...
@@ -12,3 +12,8 @@ export async function login (user, pass) {
.
post
(
url
,
user
,
requestDataFormUrlEncoded
())
.
post
(
url
,
user
,
requestDataFormUrlEncoded
())
return
response
return
response
}
}
export
async
function
logout
()
{
const
url
=
`
${
REQUEST_DIR
}
auth/logout`
const
response
=
await
axios
.
post
(
url
,
requestDataFormUrlEncoded
())
return
response
}
src/components/PatientFile.vue
View file @
c5ea461a
...
@@ -416,7 +416,7 @@
...
@@ -416,7 +416,7 @@
<
script
>
<
script
>
import
{
getMunicipalities
,
getHealthAreas
}
from
'
@/axios/nomenclators
'
import
{
getMunicipalities
,
getHealthAreas
}
from
'
@/axios/nomenclators
'
import
{
mapGetters
}
from
'
vuex
'
import
{
mapGetters
}
from
'
vuex
'
export
default
{
export
default
{
name
:
'
PatientFile
'
,
name
:
'
PatientFile
'
,
...
...
src/layouts/home/AppBar.vue
View file @
c5ea461a
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
/>
/>
<v-menu
<v-menu
offset-y
offset-y
max-width=
"
175
"
max-width=
"
200
"
min-width=
"
175
"
min-width=
"
200
"
>
>
<template
v-slot:activator=
"
{ on, attrs }">
<template
v-slot:activator=
"
{ on, attrs }">
<v-btn
<v-btn
...
@@ -58,10 +58,9 @@
...
@@ -58,10 +58,9 @@
color=
"#2D89C5"
color=
"#2D89C5"
v-on=
"on"
v-on=
"on"
>
>
mdi-
google-assista
nt
mdi-
accou
nt
</v-icon>
</v-icon>
<svg
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 36 36"
viewBox=
"0 0 36 36"
height=
"12px"
height=
"12px"
width=
"12px"
width=
"12px"
...
@@ -79,6 +78,19 @@
...
@@ -79,6 +78,19 @@
</v-tooltip>
</v-tooltip>
</v-btn>
</v-btn>
</template>
</template>
<v-lazy>
<v-card>
<v-list
dense
style=
"margin-left: 16px"
>
<v-list-item-title
class=
"h3"
>
<b>
{{ user.name }}
</b>
</v-list-item-title>
<v-list-item-subtitle>
{{ user.role }}
</v-list-item-subtitle>
</v-list>
<v-list
<v-list
dense
dense
>
>
...
@@ -101,6 +113,30 @@
...
@@ -101,6 +113,30 @@
</v-list-item-content>
</v-list-item-content>
</v-list-item>
</v-list-item>
</v-list>
</v-list>
<v-list
dense
>
<v-list-item
v-for=
"item in globalActions"
:key=
"item.title"
@
click=
"getMeOut"
>
<v-list-item-avatar>
<v-avatar
fab
>
<v-icon
color=
"#2D89C5"
>
mdi-logout
</v-icon>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>
Cerrar Sesión
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</v-lazy>
</v-menu>
</v-menu>
</v-app-bar>
</v-app-bar>
...
@@ -112,6 +148,7 @@
...
@@ -112,6 +148,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
export
default
{
export
default
{
name
:
'
HomeAppBar
'
,
name
:
'
HomeAppBar
'
,
...
@@ -121,7 +158,7 @@
...
@@ -121,7 +158,7 @@
data
:
()
=>
({
data
:
()
=>
({
globalActions
:
[
globalActions
:
[
{
link
:
'
lol
'
,
title
:
'
pepe
'
,
icon
:
'
mdi-account
'
},
{
link
:
'
lol
'
,
title
:
'
Registrar Usuario
'
,
icon
:
'
mdi-account
-plus
'
},
],
],
items
:
[
items
:
[
'
Home
'
,
'
Home
'
,
...
@@ -130,7 +167,17 @@
...
@@ -130,7 +167,17 @@
'
Pro
'
,
'
Pro
'
,
],
],
}),
}),
computed
:
{
...
mapGetters
([
'
user
'
]),
},
methods
:
{
methods
:
{
getMeOut
()
{
console
.
log
(
this
.
user
.
name
)
/* this.clearUser()
localStorage.commit('tkn', null)
localStorage.commit('usr', null) */
// Todo: SEND LOGOUT REQUEST
},
showHideDrawer
()
{
showHideDrawer
()
{
this
.
$store
.
commit
(
'
setDrawer
'
)
this
.
$store
.
commit
(
'
setDrawer
'
)
},
},
...
...
src/store/getters.js
View file @
c5ea461a
...
@@ -11,4 +11,5 @@ export default {
...
@@ -11,4 +11,5 @@ export default {
healthStatuses
:
state
=>
state
.
healthStatuses
,
healthStatuses
:
state
=>
state
.
healthStatuses
,
pIndex
:
state
=>
state
.
pIndex
,
pIndex
:
state
=>
state
.
pIndex
,
patient
:
state
=>
state
.
patient
,
patient
:
state
=>
state
.
patient
,
user
:
state
=>
state
.
user
,
}
}
src/store/mutations.js
View file @
c5ea461a
...
@@ -40,4 +40,7 @@ export default {
...
@@ -40,4 +40,7 @@ export default {
clearPatient
(
state
)
{
clearPatient
(
state
)
{
state
.
patient
=
Object
.
assign
({},
DEFAULT_PATIENT
)
state
.
patient
=
Object
.
assign
({},
DEFAULT_PATIENT
)
},
},
setUser
(
state
,
data
)
{
state
.
user
=
Object
.
assign
({},
data
)
},
}
}
src/store/state.js
View file @
c5ea461a
...
@@ -58,4 +58,5 @@ export default {
...
@@ -58,4 +58,5 @@ export default {
tipo_contacto
:
''
,
tipo_contacto
:
''
,
lugar_contacto
:
''
,
lugar_contacto
:
''
,
},
},
user
:
null
,
}
}
src/views/sections/Login.vue
View file @
c5ea461a
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
:src=
"require('@/assets/icon.png')"
:src=
"require('@/assets/icon.png')"
alt=
"SIGI"
alt=
"SIGI"
>
>
</v-avatar>
SIGI / Inicio de sesión
</v-avatar>
SIGI / Inicio de sesión
</v-toolbar-title>
</v-toolbar-title>
</v-toolbar>
</v-toolbar>
<v-card-text>
<v-card-text>
...
@@ -38,8 +38,8 @@
...
@@ -38,8 +38,8 @@
name=
"login"
name=
"login"
label=
"Coreo Electrónico"
label=
"Coreo Electrónico"
required
required
type=
"text"
type=
"text"
@
keydown.native.enter=
"submit"
/>
/>
<v-text-field
<v-text-field
id=
"password"
id=
"password"
...
@@ -57,6 +57,8 @@
...
@@ -57,6 +57,8 @@
<v-card-actions>
<v-card-actions>
<v-spacer
/>
<v-spacer
/>
<v-btn
<v-btn
color=
"green"
dark
:disabled=
"!valid"
:disabled=
"!valid"
submit
submit
:loading=
"tryLogin"
:loading=
"tryLogin"
...
@@ -74,7 +76,7 @@
...
@@ -74,7 +76,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
login
}
from
'
@/axios/auth
'
import
{
login
}
from
'
@/axios/auth
'
import
{
encrypt
,
decrypt
}
from
'
@/utils/enc
'
import
{
mapMutations
}
from
'
vuex
'
export
default
{
export
default
{
name
:
'
Login
'
,
name
:
'
Login
'
,
data
:
()
=>
({
data
:
()
=>
({
...
@@ -94,6 +96,7 @@
...
@@ -94,6 +96,7 @@
checkbox
:
false
,
checkbox
:
false
,
}),
}),
methods
:
{
methods
:
{
...
mapMutations
([
'
setUser
'
]),
async
submit
()
{
async
submit
()
{
this
.
$refs
.
form
.
validate
()
this
.
$refs
.
form
.
validate
()
if
(
this
.
$refs
.
form
.
validate
(
true
))
{
if
(
this
.
$refs
.
form
.
validate
(
true
))
{
...
@@ -101,12 +104,30 @@
...
@@ -101,12 +104,30 @@
try
{
try
{
const
loginResponse
=
await
login
(
this
.
username
,
this
.
password
)
const
loginResponse
=
await
login
(
this
.
username
,
this
.
password
)
const
token
=
loginResponse
.
data
.
token
const
token
=
loginResponse
.
data
.
token
const
role
=
loginResponse
.
data
.
user
.
role
const
user
=
loginResponse
.
data
.
user
localStorage
.
setItem
(
'
role
'
,
role
)
this
.
setUser
(
user
)
const
data
=
encrypt
(
token
)
localStorage
.
setItem
(
'
tkn
'
,
token
)
localStorage
.
setItem
(
'
tkn
'
,
data
)
this
.
$router
.
push
({
name
:
'
Control
'
})
this
.
$router
.
push
({
name
:
'
Control
'
})
}
catch
(
e
)
{
}
catch
(
e
)
{
switch
(
e
.
response
.
status
)
{
case
500
:
{
this
.
$toast
.
error
(
'
Error interno del servidor, inténtelo más tarde
'
,
{
position
:
'
bottom-center
'
,
timeout
:
3000
,
closeOnClick
:
true
,
pauseOnFocusLoss
:
false
,
pauseOnHover
:
true
,
draggable
:
true
,
draggablePercent
:
0.6
,
showCloseButtonOnHover
:
false
,
hideProgressBar
:
true
,
closeButton
:
'
button
'
,
icon
:
true
,
rtl
:
false
,
})
break
}
case
401
:
{
this
.
$toast
.
error
(
'
No autorizado
'
,
{
this
.
$toast
.
error
(
'
No autorizado
'
,
{
position
:
'
bottom-center
'
,
position
:
'
bottom-center
'
,
timeout
:
3000
,
timeout
:
3000
,
...
@@ -121,6 +142,26 @@
...
@@ -121,6 +142,26 @@
icon
:
true
,
icon
:
true
,
rtl
:
false
,
rtl
:
false
,
})
})
break
}
default
:
{
this
.
$toast
.
error
(
'
No autorizado
'
,
{
position
:
'
bottom-center
'
,
timeout
:
3000
,
closeOnClick
:
true
,
pauseOnFocusLoss
:
false
,
pauseOnHover
:
true
,
draggable
:
true
,
draggablePercent
:
0.6
,
showCloseButtonOnHover
:
false
,
hideProgressBar
:
true
,
closeButton
:
'
button
'
,
icon
:
true
,
rtl
:
false
,
})
}
}
console
.
log
(
e
.
response
)
this
.
tryLogin
=
false
this
.
tryLogin
=
false
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment