role.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <form
  3. class="w-full h-full flex flex-col items-center justify-between pt-8 text-foreground animate__animated animate__fadeIn"
  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/teacher.json"
  22. />
  23. </ClientOnly>
  24. </div>
  25. <BaseSelect
  26. id="id"
  27. v-model:selected="isStudent"
  28. :data="userTypes"
  29. name="name"
  30. />
  31. <div />
  32. <button
  33. class="w-full py-2 bg-primary flex gap-3 justify-center items-center group disabled:opacity-50 duration-150"
  34. type="submit"
  35. >
  36. <svg
  37. svg
  38. class="w-6 h-6 opacity-75 rotate-180 group-hover:opacity-100"
  39. width="48"
  40. height="48"
  41. viewBox="0 0 48 48"
  42. fill="none"
  43. xmlns="http://www.w3.org/2000/svg"
  44. >
  45. <path
  46. d="M8 24.0002H40"
  47. stroke="black"
  48. stroke-width="4"
  49. stroke-linecap="round"
  50. stroke-linejoin="round"
  51. />
  52. <path
  53. d="M20 12.0002L8.12502 23.8752C8.05598 23.9442 8.05598 24.0562 8.12502 24.1252L20 36.0002"
  54. stroke="black"
  55. stroke-width="4"
  56. stroke-linecap="round"
  57. stroke-linejoin="round"
  58. />
  59. </svg>
  60. <p
  61. class="text-2xl text-background-100 font-semibold opacity-75 group-hover:opacity-100 duration-150"
  62. v-text="'Далее'"
  63. />
  64. </button>
  65. </form>
  66. </template>
  67. <script setup lang="ts">
  68. import { useUser } from '~/store/useUser'
  69. definePageMeta({
  70. layout: 'none',
  71. middleware: ['user-only'],
  72. })
  73. const router = useRouter()
  74. const user = useUser()
  75. const userTypes = [
  76. {
  77. id: 0,
  78. name: 'Преподаватель',
  79. },
  80. {
  81. id: 1,
  82. name: 'Студент',
  83. },
  84. ]
  85. const isStudent = ref()
  86. delete user.data.teacher_id
  87. delete user.data.group_id
  88. function nextPage() {
  89. if (isStudent.value !== null) {
  90. user.data.is_student = Boolean(isStudent.value)
  91. if (isStudent.value) {
  92. router.push('/timetable/group')
  93. }
  94. else {
  95. router.push('/timetable/teacher')
  96. }
  97. }
  98. else {
  99. alert('Выберите филиал')
  100. }
  101. }
  102. </script>
  103. <style scoped>
  104. @keyframes show {
  105. 0% {
  106. opacity: 0;
  107. }
  108. 100% {
  109. opacity: 1;
  110. }
  111. }
  112. .show {
  113. animation: show ease-in-out 300ms;
  114. }
  115. </style>