index.vue 3.4 KB

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