@@ -60,13 +60,16 @@ export default defineComponent({
6060 userAttempts: number
6161 answersRevealed: boolean
6262 isLoading: boolean
63+ trigger: number
6364 } {
6465 return {
6566 currentTaskIndex: 0 ,
6667 results: {},
6768 userAttempts: 0 ,
6869 answersRevealed: false ,
6970 isLoading: false ,
71+ trigger: 0 ,
72+ taskId: undefined ,
7073 }
7174 },
7275 computed: {
@@ -77,9 +80,6 @@ export default defineComponent({
7780 currentScreen() {
7881 return this .tutorial ?.screens [this .currentTaskIndex ]
7982 },
80- task() {
81- return this .tasks ?.[this .currentTaskIndex ]
82- },
8383 hasTasks() {
8484 return this .tasks .length !== 0
8585 },
@@ -100,8 +100,8 @@ export default defineComponent({
100100 return true
101101 }
102102
103- const result = this .results [this .task ?. taskId ]
104- return isDefined (result ) && result === this .task ? .referenceAnswer
103+ const result = this .results [this .taskId ]
104+ return isDefined (result ) && result === this .tasks ?.[ this . currentTaskIndex ] .referenceAnswer
105105 },
106106 alertContent() {
107107 if (! this .currentScreen ) {
@@ -150,22 +150,26 @@ export default defineComponent({
150150 nextTask() {
151151 if (! this .hasCompletedAllTasks ) {
152152 this .currentTaskIndex += 1
153+ this .taskId = this .tasks [this .currentTaskIndex ]?.taskId
153154 this .userAttempts = 0
154155 this .answersRevealed = false
155156 }
156157 },
157158 addResult(value : number ) {
158159 if (! this .answersRevealed ) {
159160 this .userAttempts += 1
160- this .results [this .task . taskId ] = value
161+ this .results [this .taskId ] = value
161162 }
162163 },
163164 showAnswer() {
164165 this .answersRevealed = true
165- this .results [this .task . taskId ] = this .task ? .referenceAnswer
166+ this .results [this .taskId ] = this .tasks ?.[ this . currentTaskIndex ] .referenceAnswer
166167 },
167168 },
168169 emits: [' tutorialComplete' ],
170+ mounted() {
171+ this .taskId = this .tasks ?.[this .currentTaskIndex ].taskId
172+ },
169173})
170174 </script >
171175
@@ -212,9 +216,9 @@ export default defineComponent({
212216 <v-row justify =" center" >
213217 <v-col >
214218 <street-project-task
215- v-if =" tasks[currentTaskIndex] && tutorial"
216- :key =" task. taskId"
217- :taskId =" task. taskId"
219+ v-if =" taskId && tutorial"
220+ :key =" taskId"
221+ :taskId =" taskId"
218222 :containerId =" 'mapillary_tutorial'"
219223 @dataloading =" (e) => (isLoading = e.loading)"
220224 style =" position : relative ; height : calc (100vh - 425px )"
@@ -224,11 +228,11 @@ export default defineComponent({
224228 <v-row v-if =" options" >
225229 <v-col >
226230 <option-buttons
227- v-if =" task?. taskId"
231+ v-if =" taskId"
228232 :disabled =" isLoading"
229233 :options =" options"
230- :result =" results[task. taskId]"
231- :taskId =" task. taskId"
234+ :result =" results[taskId]"
235+ :taskId =" taskId"
232236 @addResult =" addResult"
233237 />
234238 </v-col >
0 commit comments