Преглед изворни кода

:sparkles: Rendering dynamic thank you at survey completion

tabs-content
tomit4 пре 3 година
родитељ
комит
59328d6ae4
2 измењених фајлова са 25 додато и 7 уклоњено
  1. 4
    4
      frontend/src/views/OnboardingView.vue
  2. 21
    3
      frontend/src/views/SurveyCompleteView.vue

+ 4
- 4
frontend/src/views/OnboardingView.vue Прегледај датотеку

2
 main.view--onboarding
2
 main.view--onboarding
3
     article(
3
     article(
4
         style='display: flex; flex-direction: column; align-items: center'
4
         style='display: flex; flex-direction: column; align-items: center'
5
-        v-if='survey'
5
+        v-if='incomplete'
6
     )
6
     )
7
         p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / 7 survey steps
7
         p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / 7 survey steps
8
         .answers(v-for='(value, key) in answered')
8
         .answers(v-for='(value, key) in answered')
20
                 v-if='step && currentStep == i'
20
                 v-if='step && currentStep == i'
21
             )
21
             )
22
     article(v-else)
22
     article(v-else)
23
-        SurveyCompleteView(:answers='answered')
23
+        SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
24
 </template>
24
 </template>
25
 
25
 
26
 <script>
26
 <script>
42
         aspectQuestions: [],
42
         aspectQuestions: [],
43
         currentStep: 0,
43
         currentStep: 0,
44
         survey: null,
44
         survey: null,
45
+        incomplete: true,
45
     }),
46
     }),
46
     async created() {
47
     async created() {
47
         this.survey = await surveyFactory.createSurvey(allSteps['usa'])
48
         this.survey = await surveyFactory.createSurvey(allSteps['usa'])
49
     methods: {
50
     methods: {
50
         onSubmit() {
51
         onSubmit() {
51
             console.log(JSON.stringify(this.answered))
52
             console.log(JSON.stringify(this.answered))
52
-            this.survey = null
53
-            this.goToStep(this.currentStep + 1)
53
+            this.incomplete = null
54
         },
54
         },
55
         goToStep(num) {
55
         goToStep(num) {
56
             this.currentStep = num
56
             this.currentStep = num

+ 21
- 3
frontend/src/views/SurveyCompleteView.vue Прегледај датотеку

4
         h2 Thanks for Completing Our Survey!!
4
         h2 Thanks for Completing Our Survey!!
5
         h1 Please review your answers and let us know if you need to change anything.
5
         h1 Please review your answers and let us know if you need to change anything.
6
         br
6
         br
7
+        h1 Your Profile Info:
7
         div(v-for='(answer, key) in answers')
8
         div(v-for='(answer, key) in answers')
8
-            span(v-if='answer')  Your {{ key }}: {{ answer }}
9
+            span(v-if='answer && key != "aspects"')  Your {{ key }}: {{ answer }}
9
         br
10
         br
11
+        div(v-if="answers.aspects")
12
+            h1 Your Survey Answers:
13
+        div(v-for='(aspect, index) in answers.aspects')
14
+            div(v-if='aspect')
15
+                p {{ surveyObjects[index].response_key_prompt }}
16
+                p You Answered:  {{aspect}}
17
+                br
10
         button(@click="changeAnswers") Change Answers
18
         button(@click="changeAnswers") Change Answers
11
         br
19
         br
12
         button(@click="finalSubmit") Submit Answers
20
         button(@click="finalSubmit") Submit Answers
17
     props: {
25
     props: {
18
         answers: {
26
         answers: {
19
             type: Object,
27
             type: Object,
20
-            default: () => ({})
28
+            default: () => ({}),
21
         },
29
         },
22
-    }
30
+        surveySteps: {
31
+            type: Array,
32
+            default: () => [],
33
+        },
34
+    },
35
+    data: () => ({
36
+        surveyObjects: [],
37
+    }),
38
+    created() {
39
+        this.surveyObjects = this.surveySteps.slice(-6)
40
+    },
23
 }
41
 }
24
 </script>
42
 </script>

Loading…
Откажи
Сачувај