From 7622c01f4bb2a96502db84eeec02d0fba030d7ed Mon Sep 17 00:00:00 2001 From: "gwenael.planchon" Date: Wed, 27 Mar 2024 17:45:50 +0100 Subject: [PATCH] =?UTF-8?q?ajouter=20option=20pour=20filtrer=20par=20th?= =?UTF-8?q?=C3=A9matique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/jeux/pendu/Pendu.vue | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/science-quest/src/components/jeux/pendu/Pendu.vue b/science-quest/src/components/jeux/pendu/Pendu.vue index 14daf06..8398009 100644 --- a/science-quest/src/components/jeux/pendu/Pendu.vue +++ b/science-quest/src/components/jeux/pendu/Pendu.vue @@ -2,6 +2,7 @@ import PenduDessin from './PenduDessin.vue' import { REST_API } from "@/assets/const"; import { Scientifiques } from "@/data/scientifique" +import { Thematiques } from '@/data/thematique'; export default{ data() { @@ -13,6 +14,10 @@ export default{ partieTerminee: true, //plus de lettres a deviner premierePartie: true, //ne pas afficher "Perdu" pour ceux qui viennent de rejoindre lettresDejaDevine: "", + + afficherChoixThematiques:false, + thematiquesDispo:[], + choixThematique:-1, //a recuperer a partir de l'api (prendre nom et prenom d'un scientifique nous meme) motADeviner: "einstein", @@ -27,6 +32,13 @@ export default{ lettresANePasFaireDevinerAuJoueur:"", //meme utilité que lettresDejaDevine mais n'est pas visible au joueur }; }, + watch:{ + afficherChoixThematiques(to){ + if(to && this.thematiquesDispo.length==0){ + Thematiques.getPage(0,999).then(thematiques=>this.thematiquesDispo=thematiques._embedded) + } + } + }, methods: { creerPartie: function () { this.lettresDejaDevine = ""; @@ -34,7 +46,11 @@ export default{ this.progression=""; //appeler l'API - Scientifiques.getPage(this.intAleatoire(this.api_pagesMaximum)).then(json=>{ + Scientifiques.getPage( + this.intAleatoire(this.api_pagesMaximum), + 0, + this.afficherChoixThematiques ? this.choixThematique : -1 + ).then(json=>{ //prendre le scientifique de la requete const arrayScientifique=json._embedded const scientifiqueADeviner=arrayScientifique[this.intAleatoire(arrayScientifique.length)] @@ -139,6 +155,16 @@ export default{ +
+ + +
+ +