Login.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div
  3. :class="prefixCls"
  4. class="h-[100%] relative lt-xl:bg-[var(--login-bg-color)] lt-sm:px-10px lt-xl:px-10px lt-md:px-10px"
  5. >
  6. <div class="relative h-full flex mx-auto">
  7. <div
  8. :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden`"
  9. >
  10. <!-- 左上角的 logo + 系统标题 -->
  11. <div class="flex items-center relative text-white">
  12. <img alt="" class="w-48px h-48px mr-10px" src="@/assets/imgs/logo.png" />
  13. <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
  14. </div>
  15. <!-- 左边的背景图 + 欢迎语 -->
  16. <div class="flex justify-center items-center h-[calc(100%-60px)]">
  17. <TransitionGroup
  18. appear
  19. enter-active-class="animate__animated animate__bounceInLeft"
  20. tag="div"
  21. >
  22. <img key="1" alt="" class="w-350px" src="@/assets/svgs/login-box-bg.svg" />
  23. <div key="2" class="text-3xl text-white">{{ t('login.welcome') }}</div>
  24. <div key="3" class="mt-5 font-normal text-white text-14px">
  25. {{ t('login.message') }}
  26. </div>
  27. </TransitionGroup>
  28. </div>
  29. </div>
  30. <div class="flex-1 p-30px lt-sm:p-10px dark:bg-[var(--login-bg-color)] relative">
  31. <!-- 右上角的主题、语言选择 -->
  32. <div
  33. class="flex justify-between items-center text-white at-2xl:justify-end at-xl:justify-end"
  34. >
  35. <div class="flex items-center at-2xl:hidden at-xl:hidden">
  36. <img alt="" class="w-48px h-48px mr-10px" src="@/assets/imgs/logo.png" />
  37. <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
  38. </div>
  39. <div class="flex justify-end items-center space-x-10px">
  40. <ThemeSwitch />
  41. <LocaleDropdown class="lt-xl:text-white dark:text-white" />
  42. </div>
  43. </div>
  44. <!-- 右边的登录界面 -->
  45. <Transition appear enter-active-class="animate__animated animate__bounceInRight">
  46. <div
  47. class="h-full flex items-center m-auto w-[100%] at-2xl:max-w-500px at-xl:max-w-500px at-md:max-w-500px at-lg:max-w-500px"
  48. >
  49. <!-- 账号登录 -->
  50. <LoginForm class="p-20px h-auto m-auto lt-xl:(rounded-3xl light:bg-white)" />
  51. <!-- 手机登录 -->
  52. <MobileForm class="p-20px h-auto m-auto lt-xl:(rounded-3xl light:bg-white)" />
  53. <!-- 二维码登录 -->
  54. <QrCodeForm class="p-20px h-auto m-auto lt-xl:(rounded-3xl light:bg-white)" />
  55. <!-- 注册 -->
  56. <RegisterForm class="p-20px h-auto m-auto lt-xl:(rounded-3xl light:bg-white)" />
  57. <!-- 三方登录 -->
  58. <SSOLoginVue class="p-20px h-auto m-auto lt-xl:(rounded-3xl light:bg-white)" />
  59. </div>
  60. </Transition>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script lang="ts" setup>
  66. import { underlineToHump } from '@/utils'
  67. import { useDesign } from '@/hooks/web/useDesign'
  68. import { useAppStore } from '@/store/modules/app'
  69. import { ThemeSwitch } from '@/layout/components/ThemeSwitch'
  70. import { LocaleDropdown } from '@/layout/components/LocaleDropdown'
  71. import { LoginForm, MobileForm, QrCodeForm, RegisterForm, SSOLoginVue } from './components'
  72. defineOptions({ name: 'Login' })
  73. const { t } = useI18n()
  74. const appStore = useAppStore()
  75. const { getPrefixCls } = useDesign()
  76. const prefixCls = getPrefixCls('login')
  77. </script>
  78. <style lang="scss" scoped>
  79. $prefix-cls: #{$namespace}-login;
  80. .#{$prefix-cls} {
  81. overflow: auto;
  82. &__left {
  83. &::before {
  84. position: absolute;
  85. top: 0;
  86. left: 0;
  87. z-index: -1;
  88. width: 100%;
  89. height: 100%;
  90. background-image: url('@/assets/svgs/login-bg.svg');
  91. background-position: center;
  92. background-repeat: no-repeat;
  93. content: '';
  94. }
  95. }
  96. }
  97. </style>