Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
a05dfbe1
Commit
a05dfbe1
authored
Dec 03, 2020
by
quentin.vrel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profile view without edition
parent
038937ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
41 deletions
+104
-41
Profile.vue
frontend/src/views/Profile.vue
+104
-41
No files found.
frontend/src/views/Profile.vue
View file @
a05dfbe1
<
template
>
<
template
>
<div
class=
"profile"
>
<div
class=
"profile"
>
<page-title
pagetitle=
"Profil"
/>
<page-title
pagetitle=
"Profil"
/>
<div
class=
"avatar-area"
>
<div
class=
"profile-top-area"
>
<avatar
size=
250
:avatar=
"this.profile.avatar"
:username=
"this.profile.login"
/>
<avatar
size=
250
:pathToImage=
"this.profile.avatar"
:username=
"this.profile.login"
/>
<svg-button
v-if=
"editable"
id=
"edit-avatar-button"
svg=
"icons/edit.svg"
/>
<div>
</div>
<p
class=
"profile-login"
>
{{
profile
.
login
}}
</p>
<div
class=
"login-area"
>
<p
class=
"profile-mail"
>
{{
profile
.
mail
}}
</p>
<p>
{{
profile
.
login
}}
</p>
</div>
<svg-button
v-if=
"editable"
id=
"edit-login-button"
svg=
"icons/edit.svg"
/>
</div>
<div
class=
"mail-area"
>
<p>
{{
profile
.
mail
}}
</p>
<svg-button
v-if=
"editable"
id=
"edit-mail-button"
svg=
"icons/edit.svg"
/>
</div>
</div>
<div
class=
"firstname-area"
>
<div
class=
"profile-bottom-area"
>
<p
class=
"label"
>
Prénom
</p>
<div
class=
"profile-name"
>
<p>
{{
profile
.
firstname
}}
</p>
<p
class=
"profile-label"
>
Prénom
</p>
<svg-button
v-if=
"editable"
id=
"edit-firstname-button"
svg=
"icons/edit.svg"
/>
<p>
{{
profile
.
firstname
}}
</p>
</div>
<div
class=
"profile-name"
>
<p
class=
"profile-label"
>
Nom
</p>
<p>
{{
profile
.
lastname
}}
</p>
</div>
</div>
</div>
<div
class=
"lastname-area"
>
<p
class=
"label"
>
Nom
</p>
<p>
{{
profile
.
lastname
}}
</p>
<svg-button
v-if=
"editable"
id=
"edit-lastname-button"
svg=
"icons/edit.svg"
/>
</div>
<form
class=
"password-area"
v-if=
"editable"
>
<form
action=
"/"
>
<pwd-input
id=
"password1"
label=
"Nouveau mot de passe"
/>
<pwd-input
id=
"password2"
label=
"Confirmer"
/>
<div
class=
"submit-buttons"
>
<div
class=
"submit-buttons"
>
<svg-button
id=
"validate"
svg=
"/icons/validate.svg"
/>
<svg-button
id=
"back"
svg=
"/icons/back.svg"
/>
<svg-button
id=
"back"
svg=
"/icons/back.svg"
/>
</div>
</div>
</form>
</form>
...
@@ -45,7 +39,6 @@ import Avatar from '../components/Avatar.vue';
...
@@ -45,7 +39,6 @@ import Avatar from '../components/Avatar.vue';
import
PageTitle
from
'../components/PageTitle.vue'
;
import
PageTitle
from
'../components/PageTitle.vue'
;
import
SvgButton
from
'../components/SvgButton.vue'
;
import
SvgButton
from
'../components/SvgButton.vue'
;
import
User
from
'@/model/user.js'
import
User
from
'@/model/user.js'
import
PwdInput
from
'../components/form/PwdInput.vue'
;
// @ is an alias to /src
// @ is an alias to /src
...
@@ -57,8 +50,7 @@ export default {
...
@@ -57,8 +50,7 @@ export default {
components
:
{
components
:
{
PageTitle
,
PageTitle
,
Avatar
,
Avatar
,
SvgButton
,
SvgButton
PwdInput
},
},
methods
:
{
methods
:
{
getUserInfo
:
async
function
(){
getUserInfo
:
async
function
(){
...
@@ -69,26 +61,42 @@ export default {
...
@@ -69,26 +61,42 @@ export default {
this
.
token
=
token
;
this
.
token
=
token
;
},
},
getProfileInfo
:
async
function
(){
getProfileInfo
:
async
function
(){
const
head
=
new
Headers
();
fetch
(
this
.
$apiRoot
+
'/user/'
+
this
.
$route
.
params
.
id
,
{
method
:
'GET'
})
head
.
append
(
'Authorization'
,
this
.
token
);
.
then
(
response
=>
response
.
json
())
await
fetch
(
this
.
$apiRoot
+
'/user/'
+
this
.
$route
.
params
.
id
,
{
method
:
'GET'
})
.
then
(
user
=>
{
.
then
(
res
=>
res
.
json
())
let
userJson
=
user
[
0
];
.
then
(
json
=>
{
let
userJson
=
json
[
0
];
let
userObj
=
new
User
(
userJson
.
ID_USER
,
userJson
.
ID_ROLE
,
userJson
.
LOGIN
,
userJson
.
AVATAR
,
userJson
.
LASTNAME
,
userJson
.
FIRSTNAME
,
userJson
.
MAIL
);
let
userObj
=
new
User
(
userJson
.
ID_USER
,
userJson
.
ID_ROLE
,
userJson
.
LOGIN
,
userJson
.
AVATAR
,
userJson
.
LASTNAME
,
userJson
.
FIRSTNAME
,
userJson
.
MAIL
);
this
.
profile
=
userObj
;
console
.
log
(
userObj
);
console
.
log
(
this
.
profile
);
}).
catch
(
(
err
)
=>
console
.
log
(
err
));
let
props
=
Object
.
getOwnPropertyNames
(
userObj
);
let
areIdentical
=
true
;
for
(
let
i
=
0
;
i
<
props
.
length
;
i
++
)
{
let
propName
=
props
[
i
];
// If values of same property are not equal,
// objects are not equivalent
if
(
userObj
[
propName
]
!==
this
.
profile
[
propName
])
{
areIdentical
=
false
;
}
}
if
(
areIdentical
){
return
;
}
else
{
console
.
log
(
"svp"
)
this
.
profile
=
userObj
}
})
}
}
},
},
computed
:{
computed
:{
editable
()
{
return
this
.
user
.
id_user
==
this
.
$route
.
params
.
id
||
this
.
user
.
id_role
==
2
}
},
},
data
()
{
data
()
{
return
{
return
{
dataLoaded
:
false
,
user
:
new
User
(
0
,
0
,
''
,
''
,
''
,
''
,
''
),
user
:
new
User
(
0
,
0
,
''
,
''
,
''
,
''
,
''
),
token
:
''
,
token
:
''
,
profile
:
new
User
(
0
,
0
,
''
,
''
,
''
,
''
,
''
),
profile
:
new
User
(
0
,
0
,
''
,
''
,
''
,
''
,
''
),
...
@@ -100,12 +108,67 @@ export default {
...
@@ -100,12 +108,67 @@ export default {
this
.
getProfileInfo
();
this
.
getProfileInfo
();
},
},
beforeUpdate
()
{
updated
()
{
console
.
log
(
"aidez moi"
)
this
.
getProfileInfo
();
this
.
getProfileInfo
();
}
}
}
}
</
script
>
</
script
>
<
style
>
<
style
>
.profile
*
{
//
background
:
rgba
(
255
,
255
,
255
,
0.1
);
justify-content
:
center
;
}
.profile
{
color
:
white
;
width
:
80%
;
margin
:
100px
auto
;
}
.profile-top-area
,
.bottom-area
{
display
:
flex
;
text-align
:
left
;
}
.profile-top-area
.profile-login
{
font-family
:
Shojumaru
;
font-style
:
normal
;
font-weight
:
normal
;
font-size
:
96px
;
line-height
:
127px
;
margin
:
0
40px
}
.profile-top-area
.profile-mail
{
font-style
:
normal
;
font-weight
:
normal
;
font-size
:
36px
;
line-height
:
127px
;
margin
:
0
40px
}
.profile-bottom-area
{
display
:
flex
;
justify-content
:
center
;
margin
:
60px
100px
0
100px
}
.profile-bottom-area
.profile-label
{
color
:
black
;
font-weight
:
bold
;
}
.profile-name
{
width
:
100%
;
display
:
flex
;
font-size
:
36px
;
justify-content
:
space-around
;
text-align
:
right
;
}
</
style
>
</
style
>
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