Просмотр исходного кода

:sparkles: Rendering dynamic thank you at survey completion

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

+ 21
- 3
frontend/src/views/SurveyCompleteView.vue Просмотреть файл

@@ -4,9 +4,17 @@ main.view--surveycomplete
4 4
         h2 Thanks for Completing Our Survey!!
5 5
         h1 Please review your answers and let us know if you need to change anything.
6 6
         br
7
+        h1 Your Profile Info:
7 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 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 18
         button(@click="changeAnswers") Change Answers
11 19
         br
12 20
         button(@click="finalSubmit") Submit Answers
@@ -17,8 +25,18 @@ export default {
17 25
     props: {
18 26
         answers: {
19 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 42
 </script>

Загрузка…
Отмена
Сохранить