From 577ae5722d72351b9c5cf02934a4b3001b970326 Mon Sep 17 00:00:00 2001 From: thilo Date: Sat, 21 Mar 2020 18:57:15 +0100 Subject: [PATCH] updated questionmaire --- src/components/Question.vue | 51 ++++++++++++++++++++++++++++++-- src/store/index.js | 58 ++++++++++++++++++++++--------------- src/views/Questionnaire.vue | 6 ++-- 3 files changed, 88 insertions(+), 27 deletions(-) diff --git a/src/components/Question.vue b/src/components/Question.vue index d056ca7..23a9992 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -1,7 +1,17 @@ @@ -10,12 +20,49 @@ export default { name: "Question", props: { + type: String, question: String, answers: Array - } + }, + data() { + return { + selection: 0 + } + }, } diff --git a/src/store/index.js b/src/store/index.js index 650df02..d84038e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3,29 +3,41 @@ import Vuex from 'vuex' Vue.use(Vuex) -export default new Vuex.Store({ - state: { - currentQuestion: 0, - answers: [], - questions: [{ - question: "Test", - answers: ["Answer 1", "Answer 2", "Answer 3"] - }] - }, - mutations: { - nextQuestion() { - if(this.state.currentQuestion <= - this.state.questions.length - 1) - this.state.currentQuestion += 1 +const preQuestions = [ + { + type: "slider", + question: "Wie alt sind Sie?" }, - previousQuestion() { - if(this.state.currentQuestion > 0) { - this.state.currentQuestion -= 1 - } + { + illustration: "", + type: "choice", + question: "Haben Sie sich in letzter Zeit in einem Risikogebiet aufgehalten?" + }, + { + illustration: "", + type: "choice", + question: "Hatten Sie Kontakt zu Personen, die positiv auf COVID-19 getestet wurden?" } - }, - actions: { - }, - modules: { - } +] + +export default new Vuex.Store({ + state: { + currentQuestion: 0, + answers: [], + questions: preQuestions + }, + mutations: { + nextQuestion() { + if (this.state.currentQuestion <= + this.state.questions.length - 1) + this.state.currentQuestion += 1 + }, + previousQuestion() { + if (this.state.currentQuestion > 0) { + this.state.currentQuestion -= 1 + } + } + }, + actions: {}, + modules: {} }) diff --git a/src/views/Questionnaire.vue b/src/views/Questionnaire.vue index ab7c33a..3d7853d 100644 --- a/src/views/Questionnaire.vue +++ b/src/views/Questionnaire.vue @@ -1,7 +1,9 @@