Login.vue 4.1 KB

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