AreSameImagesRandom.vue 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <ExperimentBlock
  3. :experiment-name="experimentName"
  4. :scene-name="sceneName"
  5. :loading-message="loadingMessage"
  6. :loading-error-message="loadingErrorMessage"
  7. >
  8. <template v-slot:header></template>
  9. <template v-slot:content>
  10. <v-flex xs12 sm6>
  11. <v-card dark color="primary">
  12. <v-card-text class="px-0">Image 1</v-card-text>
  13. <v-img v-if="image1 && image1.link" :src="image1.link">
  14. <template v-slot:placeholder>
  15. <v-layout fill-height align-center justify-center ma-0>
  16. <v-progress-circular indeterminate color="grey lighten-5" />
  17. </v-layout>
  18. </template>
  19. </v-img>
  20. </v-card>
  21. </v-flex>
  22. <v-flex sm6 xs12>
  23. <v-card dark color="primary">
  24. <v-card-text>Image 2</v-card-text>
  25. <v-img v-if="image2 && image2.link" :src="image2.link" @load="scrollToChoiceButtons">
  26. <template v-slot:placeholder>
  27. <v-layout fill-height align-center justify-center ma-0>
  28. <v-progress-circular indeterminate color="grey lighten-5" />
  29. </v-layout>
  30. </template>
  31. </v-img>
  32. </v-card>
  33. </v-flex>
  34. <!-- Experiment validation button -->
  35. <v-layout justify-center align-content-center>
  36. <div id="choice">
  37. <v-container grid-list-md text-xs-center fluid>
  38. <h2>Test {{ testCount }} / {{ maxTestCount }}</h2>
  39. <v-layout row wrap>
  40. <v-flex sm6 xs12>
  41. <v-btn @click="areTheSameAction(false, getRandomTest)" color="error" large>Images are NOT the same</v-btn>
  42. </v-flex>
  43. <v-flex sm6 xs12>
  44. <v-btn @click="areTheSameAction(true, getRandomTest)" color="success" large>Images are the same</v-btn>
  45. </v-flex>
  46. </v-layout>
  47. </v-container>
  48. </div>
  49. </v-layout>
  50. <!--/ Experiment validation button -->
  51. </template>
  52. </ExperimentBlock>
  53. </template>
  54. <script>
  55. import ExperimentBlock from '@/components/ExperimentBlock.vue'
  56. import ExperimentBaseAreTheSame from '@/mixins/ExperimentBaseAreSameImages'
  57. export default {
  58. name: 'AreSameImagesRandom',
  59. components: {
  60. ExperimentBlock
  61. },
  62. mixins: [ExperimentBaseAreTheSame],
  63. data() {
  64. return {
  65. experimentName: 'AreSameImagesRandom'
  66. }
  67. },
  68. async mounted() {
  69. // Load config for this scene to local state
  70. this.loadConfig()
  71. // Load progress from store into local state
  72. this.loadProgress()
  73. // Load scene data from the API
  74. await this.getQualitiesList()
  75. // Load a test if not already one loaded
  76. if (!this.image1 || !this.image1.link || !this.image2 || !this.image2.link) {
  77. const { image1, image2 } = await this.getRandomTest()
  78. this.image1 = image1
  79. this.image2 = image2
  80. }
  81. this.saveProgress()
  82. },
  83. methods: {}
  84. }
  85. </script>