IdCard.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <v-card class="id-card">
  3. <div
  4. v-if="!appStore.altchaPayload"
  5. class="skeleton-container"
  6. >
  7. <div class="skeleton">
  8. <v-skeleton-loader
  9. type="image"
  10. :max-height="110"
  11. boilerplate
  12. />
  13. <v-skeleton-loader
  14. type="article"
  15. :max-height="110"
  16. boilerplate
  17. />
  18. </div>
  19. <v-btn flat class="btn-show" @click="onClick">
  20. <v-icon class="fas fa-eye" />
  21. </v-btn>
  22. <AltchaValidation
  23. v-if="showCaptcha"
  24. @verified="onVerified"
  25. />
  26. </div>
  27. <div v-else>
  28. </div>
  29. </v-card>
  30. </template>
  31. <script setup lang="ts">
  32. import type { Ref } from '@vue/reactivity'
  33. import type { ComputedRef } from 'vue'
  34. const appStore = useAppStore()
  35. const downloadRequested: Ref<boolean> = ref(false)
  36. const showCaptcha: ComputedRef<boolean> = computed(() => {
  37. return downloadRequested.value && !appStore.altchaPayload
  38. })
  39. const onClick = () => {
  40. if (appStore.altchaPayload) {
  41. submit()
  42. } else {
  43. downloadRequested.value = true
  44. }
  45. }
  46. const onVerified = () => {
  47. if (!downloadRequested.value) {
  48. return
  49. }
  50. downloadRequested.value = false
  51. setTimeout(() => {
  52. submit()
  53. }, 100)
  54. }
  55. const submit = async () => {
  56. const url = 'https://api.ogene.fr/api/download-cv?payload=' + (appStore.altchaPayload ?? '');
  57. window.open(url, '_blank');
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .id-card {
  62. width: 280px;
  63. height: 140px;
  64. max-width: 280px;
  65. max-height: 140px;
  66. min-width: 280px;
  67. min-height: 140px;
  68. padding: 15px;
  69. }
  70. .skeleton {
  71. display: flex;
  72. flex-direction: row;
  73. .v-skeleton-loader:first-child {
  74. width: 40%;
  75. }
  76. .v-skeleton-loader {
  77. width: 70%;
  78. :deep(.v-skeleton-loader__image) {
  79. max-height: 100%;
  80. }
  81. :deep(.v-skeleton-loader__article) {
  82. max-height: 100%;
  83. }
  84. :deep(.v-skeleton-loader__heading) {
  85. margin: 6px 16px;
  86. }
  87. }
  88. }
  89. .skeleton-container {
  90. position: relative;
  91. height: 100%;
  92. }
  93. .btn-show {
  94. position: absolute;
  95. top: 0;
  96. left: 0;
  97. width: 100%;
  98. height: 100% !important;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. opacity: 0.5;
  103. :deep(.v-icon) {
  104. font-size: 28px;
  105. }
  106. }
  107. altcha-widget {
  108. position: absolute;
  109. top: 15px; /* Ajustez cette valeur en fonction de la hauteur de votre bouton */
  110. left: 30px;
  111. background: rgb(var(--v-theme-surface));
  112. border-radius: 4px;
  113. z-index: 10;
  114. }
  115. </style>