Login.vue 3.6 KB

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