Sfoglia il codice sorgente

slide survey added and working

tags/0.0.1
diaseu 4 anni fa
parent
commit
dd88eb738c

+ 5
- 2
frontend/src/components/form.vue Vedi File

@@ -36,13 +36,14 @@
36 36
                         v-model='answers[makeKebob(prompt.question)]')
37 37
                     label(:for='response') {{ response }}
38 38
             //- TODO: Slider from -3 to 0 to +3 (increments of 1)
39
-            .response-wrapper(v-if='prompt.type === "slider"')
39
+            .response-wrapper(v-else-if='prompt.type === "slide"')
40 40
                 label {{ prompt.type }}
41 41
                 input(
42 42
                     type='range'
43 43
                     min='-3'
44 44
                     max='3'
45 45
                     v-model='answers[makeKebob(prompt.question)]')
46
+                span {{ answers[makeKebob(prompt.question)] }}
46 47
 
47 48
     footer.f-row.w-full
48 49
         button.p-1(:disabled='state.step == 1' @click='back') back
@@ -55,7 +56,9 @@
55 56
 <script setup>
56 57
 import Joi from 'joi'
57 58
 import { validatorMapping, makeKebob } from '@/utils'
58
-import { defineProps, reactive } from 'vue'
59
+import { defineProps, reactive, ref } from 'vue'
60
+
61
+const slidevalue = ref('')
59 62
 
60 63
 const props = defineProps({
61 64
     form: {

+ 10
- 2
frontend/src/services/survey.service.js Vedi File

@@ -38,11 +38,19 @@ const fetchSurveyByProfileId = profileId => {
38 38
         [
39 39
             {
40 40
                 id: 4,
41
-                type: 'slider',
42
-                question: 'whats your favorite number',
41
+                type: 'slide',
42
+                question: 'choose a num',
43 43
                 responses: null,
44 44
             },
45 45
         ],
46
+        [
47
+            {
48
+                id: 5,
49
+                type: 'checklist',
50
+                question: 'pick a status',
51
+                responses: ['cry', 'sad', 'mad', 'numb'],
52
+            },
53
+        ],
46 54
     ]
47 55
     const mysurvey = new Survey(myquestions)
48 56
     return mysurvey

+ 2
- 0
frontend/src/utils/index.js Vedi File

@@ -6,6 +6,8 @@ const api = new Connector('kittens')
6 6
 const validatorMapping = {
7 7
     'input-string': Joi.string(),
8 8
     'tag-cloud': Joi.string(),
9
+    'checklist': Joi.string(),
10
+    'slide': Joi.string(),
9 11
 }
10 12
 
11 13
 const makeKebob = input => {

+ 3
- 0
frontend/src/views/Survey.vue Vedi File

@@ -57,4 +57,7 @@ article
57 57
             > h3
58 58
                 text-transform: capitalize
59 59
                 padding: 1vh 0
60
+            > div > span
61
+                display: block
62
+                text-align: center
60 63
 </style>

Loading…
Annulla
Salva