branch.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <form
  3. class="w-full h-full flex flex-col items-center justify-between pt-8 text-white"
  4. @submit.prevent="nextPage"
  5. >
  6. <div class="flex flex-col justify-center items-center">
  7. <h1 class="text-4xl font-bold text-center">
  8. Филиал
  9. </h1>
  10. <p class="opacity-50">
  11. Где именно вы находитесь?
  12. </p>
  13. </div>
  14. <div>
  15. <ClientOnly>
  16. <lottie-player
  17. class="w-[200px] h-[200px]"
  18. autoplay
  19. loop
  20. mode="normal"
  21. src="/lottie/student.json"
  22. />
  23. </ClientOnly>
  24. </div>
  25. <div
  26. v-if="branches"
  27. class="mx-10"
  28. >
  29. <BaseSelect
  30. id="id"
  31. v-model:selected="selectedBranch"
  32. name="title"
  33. :data="branches"
  34. />
  35. </div>
  36. <Icon
  37. v-else
  38. name="svg-spinners:ring-resize"
  39. class="show w-20 h-20 text-white"
  40. />
  41. <div />
  42. <button
  43. class="w-full py-2 bg-primary flex gap-3 justify-center items-center group disabled:opacity-50 duration-150"
  44. type="submit"
  45. >
  46. <svg
  47. class="w-6 h-6 opacity-75 rotate-180 group-hover:opacity-100"
  48. width="48"
  49. height="48"
  50. viewBox="0 0 48 48"
  51. fill="none"
  52. xmlns="http://www.w3.org/2000/svg"
  53. >
  54. <path
  55. d="M8 24.0002H40"
  56. stroke="black"
  57. stroke-width="4"
  58. stroke-linecap="round"
  59. stroke-linejoin="round"
  60. />
  61. <path
  62. d="M20 12.0002L8.12502 23.8752C8.05598 23.9442 8.05598 24.0562 8.12502 24.1252L20 36.0002"
  63. stroke="black"
  64. stroke-width="4"
  65. stroke-linecap="round"
  66. stroke-linejoin="round"
  67. />
  68. </svg>
  69. <p
  70. class="text-2xl text-background-100 font-semibold opacity-75 group-hover:opacity-100 duration-150"
  71. v-text="'Далее'"
  72. />
  73. </button>
  74. </form>
  75. </template>
  76. <script setup lang="ts">
  77. definePageMeta({
  78. layout: 'none',
  79. middleware: ['user-only'],
  80. })
  81. const selectedBranch = ref()
  82. const api = useApi()
  83. const router = useRouter()
  84. const branches = await api.get('/branches', {
  85. squeeze: true,
  86. })
  87. function nextPage() {
  88. if (selectedBranch.value !== null) {
  89. router.push('/setup/role')
  90. }
  91. else {
  92. alert('Выберите филиал')
  93. }
  94. }
  95. </script>
  96. <style scoped>
  97. @keyframes show {
  98. 0% {
  99. opacity: 0;
  100. }
  101. 100% {
  102. opacity: 1;
  103. }
  104. }
  105. .show {
  106. animation: show ease-in-out 300ms;
  107. }
  108. </style>