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
0
Issues
0
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
Raphaël PEIM
projet-cdaw
Commits
cde037db
Commit
cde037db
authored
Dec 02, 2020
by
raphael.peim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Profile.vue and fix bugs
parent
0f65bcd2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
109 additions
and
42 deletions
+109
-42
UserController.class.php
frontend/public/api/controller/UserController.class.php
+23
-3
chat.png
frontend/src/assets/img/chat.png
+0
-0
form.jpg
frontend/src/assets/img/form.jpg
+0
-0
game.png
frontend/src/assets/img/game.png
+0
-0
Input.vue
frontend/src/components/Input.vue
+1
-0
index.js
frontend/src/router/index.js
+6
-0
Game.vue
frontend/src/views/Game.vue
+14
-19
GameCreate.vue
frontend/src/views/GameCreate.vue
+1
-1
Index.vue
frontend/src/views/Index.vue
+2
-3
Profile.vue
frontend/src/views/Profile.vue
+30
-14
Waiting.vue
frontend/src/views/Waiting.vue
+32
-2
No files found.
frontend/public/api/controller/UserController.class.php
View file @
cde037db
...
@@ -20,10 +20,19 @@
...
@@ -20,10 +20,19 @@
return
$this
->
createUser
(
$post
);
return
$this
->
createUser
(
$post
);
break
;
break
;
case
'GET'
:
case
'GET'
:
if
(
empty
(
$this
->
request
->
getUriParameters
()))
if
(
empty
(
$this
->
request
->
getUriParameters
()))
{
return
$this
->
getAllUsers
();
return
$this
->
getAllUsers
();
else
}
return
$this
->
getUserById
(
$this
->
request
->
getUriParameters
()[
0
]);
else
{
$parameters
=
$this
->
request
->
getUriParameters
();
if
(
is_numeric
(
$parameters
[
0
]))
{
return
$this
->
getUserById
(
$this
->
request
->
getUriParameters
()[
0
]);
}
else
{
return
$this
->
getUserByLogin
(
$this
->
request
->
getUriParameters
()[
0
]);
}
}
break
;
break
;
case
'PUT'
:
case
'PUT'
:
$put
=
json_decode
(
file_get_contents
(
"php://input"
));
$put
=
json_decode
(
file_get_contents
(
"php://input"
));
...
@@ -78,6 +87,17 @@
...
@@ -78,6 +87,17 @@
return
$response
;
return
$response
;
}
}
protected
function
getUserByLogin
(
$login
)
{
$user
=
User
::
getWithLogin
(
$login
);
if
(
!
empty
(
$user
))
$response
=
Response
::
okResponse
(
json_encode
(
$user
));
else
$response
=
Response
::
notFoundResponse
(
"Aucune réponse"
);
return
$response
;
}
protected
function
updateUser
(
$put
,
$id
)
{
protected
function
updateUser
(
$put
,
$id
)
{
$user
=
User
::
getWithId
(
$id
);
$user
=
User
::
getWithId
(
$id
);
...
...
frontend/src/assets/img/chat.png
deleted
100644 → 0
View file @
0f65bcd2
44 KB
frontend/src/assets/img/form.jpg
deleted
100644 → 0
View file @
0f65bcd2
48.8 KB
frontend/src/assets/img/game.png
View replaced file @
0f65bcd2
View file @
cde037db
516 KB
|
W:
|
H:
384 KB
|
W:
|
H:
2-up
Swipe
Onion skin
frontend/src/components/Input.vue
View file @
cde037db
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
:type=
"information.type"
:type=
"information.type"
:id=
"information.id"
:id=
"information.id"
:placeholder=
"information.placeholder"
:placeholder=
"information.placeholder"
:value=
"information.value"
autocomplete=
"off"
autocomplete=
"off"
required
>
required
>
<!-- :pattern="information.pattern" -->
<!-- :pattern="information.pattern" -->
...
...
frontend/src/router/index.js
View file @
cde037db
...
@@ -7,6 +7,7 @@ import Rules from '../views/Rules'
...
@@ -7,6 +7,7 @@ import Rules from '../views/Rules'
import
GameChoice
from
'../views/GameChoice'
import
GameChoice
from
'../views/GameChoice'
import
GameCreate
from
'../views/GameCreate'
import
GameCreate
from
'../views/GameCreate'
import
GameJoin
from
'../views/GameJoin'
import
GameJoin
from
'../views/GameJoin'
import
Waiting
from
'../views/Waiting'
import
Game
from
'../views/Game'
import
Game
from
'../views/Game'
import
Profile
from
'../views/Profile'
import
Profile
from
'../views/Profile'
...
@@ -48,6 +49,11 @@ const routes = [
...
@@ -48,6 +49,11 @@ const routes = [
name
:
'GameJoin'
,
name
:
'GameJoin'
,
component
:
GameJoin
component
:
GameJoin
},
},
{
path
:
'/waiting'
,
name
:
'Waiting'
,
component
:
Waiting
},
{
{
path
:
'/game'
,
path
:
'/game'
,
name
:
'Game'
,
name
:
'Game'
,
...
...
frontend/src/views/Game.vue
View file @
cde037db
<
template
>
<
template
>
<div
class=
"body position-absolute h-100 w-100"
>
<div
class=
"body position-absolute h-100 w-100"
>
<Navbar/>
<Navbar/>
<div
class=
"container h-75"
>
<div
id=
"game"
class=
"container h-75"
>
<div
class=
"row h-100"
>
<div
class=
"row h-100"
>
<div
class=
"col-3 h-100"
style=
"border: 1px solid black;"
>
<div
id=
"chat"
class=
"col-3 h-100"
style=
"border: 1px solid black;"
>
<div
id=
"chat"
class=
"row h-75"
style=
"border: 1px solid black;"
>
<div
class=
"row h-75"
style=
"border: 1px solid black;"
>
<div
class=
"col w-100 h-100"
style=
"border: 1px solid black;"
>
<div
class=
"col w-100 h-100"
style=
"border: 1px solid black;"
>
</div>
</div>
</div>
<div
id=
"form"
class=
"row h-25 pt-4"
style=
"border: 1px solid black;"
>
</div
>
<div
class=
"col w-100 h-75
"
>
<div
class=
"row h-25"
style=
"border: 1px solid black;
"
>
<form
@
submit=
"onSubmit
"
>
<div
class=
"col w-100 h-75 pt-4
"
>
<Input
:information=
"input"
/
>
<form
@
submit=
"onSubmit"
>
<
/form
>
<
Input
:information=
"input"
/
>
</
div
>
</
form
>
</div>
</div>
</div>
</div>
</div>
<div
id=
"game"
class=
"col-9 h-100"
style=
"border: 1px solid black;"
>
<div
class=
"col-9 h-100"
style=
"border: 1px solid black;"
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -48,14 +48,9 @@
...
@@ -48,14 +48,9 @@
<
style
>
<
style
>
#chat
{
#chat
{
background-image
:
url('../assets/img/chat.png')
;
background
:
linear-gradient
(
rgb
(
10
,
50
,
20
),
rgb
(
30
,
120
,
60
),
rgb
(
10
,
50
,
20
));
}
#form
{
background-image
:
url('../assets/img/form.jpg')
;
}
}
#game
{
#game
{
background-image
:
url('../assets/img/game.png')
;
background
:
linear-gradient
(
rgb
(
10
,
50
,
20
),
rgb
(
20
,
85
,
40
),
rgb
(
10
,
50
,
20
));
background-repeat
:
no-repeat
;
background-size
:
100%
;
}
}
</
style
>
</
style
>
\ No newline at end of file
frontend/src/views/GameCreate.vue
View file @
cde037db
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<div
class=
"card shadow mb-4"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
Créer une partie
</h5>
<h5
class=
"card-header text-primary"
>
Créer une partie
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
<div
class=
"card-body"
style=
"width : 500px;"
>
<router-link
to=
"/
game
"
>
<router-link
to=
"/
waiting
"
>
<button
type=
"button"
class=
"btn btn-primary btn-block"
>
Commencer
</button>
<button
type=
"button"
class=
"btn btn-primary btn-block"
>
Commencer
</button>
</router-link>
</router-link>
</div>
</div>
...
...
frontend/src/views/Index.vue
View file @
cde037db
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
});
});
},
},
getToken
(
login
,
password
)
{
getToken
(
login
,
password
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
)
=>
{
fetch
(
this
.
$apiUrl
+
'/login'
,
{
fetch
(
this
.
$apiUrl
+
'/login'
,
{
method
:
'POST'
,
method
:
'POST'
,
body
:
JSON
.
stringify
({
login
:
login
,
password
:
password
})
body
:
JSON
.
stringify
({
login
:
login
,
password
:
password
})
...
@@ -113,8 +113,7 @@
...
@@ -113,8 +113,7 @@
resolve
(
data
.
jwt_token
)
resolve
(
data
.
jwt_token
)
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
error
(
error
)
console
.
error
(
error
)
console
.
error
(
reject
)
})
});
})
})
}
}
}
}
...
...
frontend/src/views/Profile.vue
View file @
cde037db
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<div
class=
"container d-flex justify-content-center"
>
<div
class=
"container d-flex justify-content-center"
>
<div
class=
"card shadow mb-4"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
Vos informations
</h5>
<h5
class=
"card-header text-primary"
>
Vos informations
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
<div
id=
"body"
class=
"card-body"
style=
"width : 500px;"
>
</div>
</div>
</div>
</div>
...
@@ -24,25 +24,41 @@
...
@@ -24,25 +24,41 @@
this
.
getData
()
this
.
getData
()
},
},
methods
:
{
methods
:
{
// Récupération des données du
token
// Récupération des données du
user
getData
()
{
getData
()
{
fetch
(
this
.
$apiUrl
+
'/validatetoken'
,
{
fetch
(
this
.
$apiUrl
+
'/user/'
+
localStorage
.
login
,
{
method
:
'GET'
,
method
:
'GET'
headers
:
{
'Authorization'
:
'Bearer '
+
localStorage
.
token
}
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
console
.
log
(
response
.
json
()
)
return
response
.
json
(
)
}
}
// else {
else
{
// window.location.href = '/#/'
throw
new
Error
(
'Something went wrong on api server!'
)
// }
}
})
.
then
(
data
=>
{
const
body
=
document
.
querySelector
(
'#body'
)
for
(
const
[
key
,
value
]
of
Object
.
entries
(
data
))
{
if
(
key
!=
"id"
&&
key
!=
"password"
&&
key
!=
"role"
)
{
let
div
=
document
.
createElement
(
'div'
)
let
input
=
document
.
createElement
(
'input'
)
div
.
className
=
'form-group'
input
.
className
=
'form-control form-control-user'
input
.
type
=
'text'
input
.
id
=
key
input
.
value
=
value
input
.
autocomplete
=
'off'
input
.
required
=
true
div
.
append
(
input
)
body
.
append
(
div
)
}
}
})
})
// .then(tokenData => {
// console.log(tokenData)
// })
}
}
}
}
}
}
...
...
frontend/src/views/Waiting.vue
View file @
cde037db
...
@@ -5,9 +5,34 @@
...
@@ -5,9 +5,34 @@
<div
class=
"card shadow mb-4"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
En attente de joueurs
</h5>
<h5
class=
"card-header text-primary"
>
En attente de joueurs
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
<div
class=
"card-body"
style=
"width : 500px;"
>
<table
class=
"table table-striped table-primary"
>
<thead>
<tr>
<th
scope=
"col"
>
#
</th>
<th
scope=
"col"
>
Login
</th>
</tr>
</thead>
<tbody>
<tr>
<th
scope=
"row"
>
1
</th>
<td>
{{
login
}}
</td>
</tr>
<tr>
<th
scope=
"row"
>
2
</th>
<td></td>
</tr>
<tr>
<th
scope=
"row"
>
3
</th>
<td></td>
</tr>
<tr>
<th
scope=
"row"
>
4
</th>
<td></td>
</tr>
</tbody>
</table>
<router-link
to=
"/game"
>
<router-link
to=
"/game"
>
<button
type=
"button"
class=
"btn btn-primary btn-block"
style=
"margin-top: 20px;"
>
Jouer
</button>
<button
type=
"button"
class=
"btn btn-primary btn-block"
>
Jouer
</button>
</router-link>
</router-link>
</div>
</div>
</div>
</div>
...
@@ -22,6 +47,11 @@
...
@@ -22,6 +47,11 @@
name
:
'GameChoice'
,
name
:
'GameChoice'
,
components
:
{
components
:
{
Navbar
Navbar
},
data
()
{
return
{
login
:
localStorage
.
login
}
}
}
}
}
</
script
>
</
script
>
\ No newline at end of file
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