Login.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div :class="prefixCls" class="relative w-full h-full px-4">
  3. <AppLocalePicker
  4. class="absolute top-4 right-4 enter-x text-white xl:text-gray-600"
  5. :showText="false"
  6. v-if="!sessionTimeout"
  7. />
  8. <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" />
  9. <span class="-enter-x xl:hidden">
  10. <AppLogo :alwaysShowTitle="true" />
  11. </span>
  12. <div class="container relative h-full py-2 mx-auto sm:px-10">
  13. <div class="flex h-full">
  14. <div class="hidden xl:flex xl:flex-col xl:w-6/12 min-h-full mr-4 pl-4">
  15. <AppLogo class="-enter-x" />
  16. <div class="my-auto">
  17. <img
  18. :alt="title"
  19. src="../../../assets/svg/login-box-bg.svg"
  20. class="w-1/2 -mt-16 -enter-x"
  21. />
  22. <div class="mt-10 font-medium text-white -enter-x">
  23. <span class="mt-4 text-3xl inline-block"> {{ t('sys.login.signInTitle') }}</span>
  24. </div>
  25. <div class="mt-5 text-md text-white font-normal dark:text-gray-500 -enter-x">
  26. {{ t('sys.login.signInDesc') }}
  27. </div>
  28. </div>
  29. </div>
  30. <div class="h-full xl:h-auto flex py-5 xl:py-0 xl:my-0 w-full xl:w-6/12">
  31. <div
  32. :class="`${prefixCls}-form`"
  33. class="
  34. my-auto
  35. mx-auto
  36. xl:ml-20 xl:bg-transparent
  37. px-5
  38. py-8
  39. sm:px-8
  40. xl:p-4
  41. rounded-md
  42. shadow-md
  43. xl:shadow-none
  44. w-full
  45. sm:w-3/4
  46. lg:w-2/4
  47. xl:w-auto
  48. enter-x
  49. relative
  50. "
  51. >
  52. <LoginForm />
  53. <ForgetPasswordForm />
  54. <RegisterForm />
  55. <MobileForm />
  56. <QrCodeForm />
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script lang="ts">
  64. import { defineComponent, computed } from 'vue';
  65. import { AppLogo } from '/@/components/Application';
  66. import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
  67. import LoginForm from './LoginForm.vue';
  68. import ForgetPasswordForm from './ForgetPasswordForm.vue';
  69. import RegisterForm from './RegisterForm.vue';
  70. import MobileForm from './MobileForm.vue';
  71. import QrCodeForm from './QrCodeForm.vue';
  72. import { useGlobSetting } from '/@/hooks/setting';
  73. import { useI18n } from '/@/hooks/web/useI18n';
  74. import { useDesign } from '/@/hooks/web/useDesign';
  75. import { useLocaleStore } from '/@/store/modules/locale';
  76. export default defineComponent({
  77. name: 'Login',
  78. components: {
  79. AppLogo,
  80. LoginForm,
  81. ForgetPasswordForm,
  82. RegisterForm,
  83. MobileForm,
  84. QrCodeForm,
  85. AppLocalePicker,
  86. AppDarkModeToggle,
  87. },
  88. props: {
  89. sessionTimeout: {
  90. type: Boolean,
  91. },
  92. },
  93. setup() {
  94. const globSetting = useGlobSetting();
  95. const { prefixCls } = useDesign('login');
  96. const { t } = useI18n();
  97. const localeStore = useLocaleStore();
  98. return {
  99. t,
  100. prefixCls,
  101. title: computed(() => globSetting?.title ?? ''),
  102. showLocale: localeStore.getShowPicker,
  103. };
  104. },
  105. });
  106. </script>
  107. <style lang="less">
  108. @prefix-cls: ~'@{namespace}-login';
  109. @logo-prefix-cls: ~'@{namespace}-app-logo';
  110. @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  111. @dark-bg: #293146;
  112. html[data-theme='dark'] {
  113. .@{prefix-cls} {
  114. background-color: @dark-bg;
  115. &::before {
  116. background-image: url(/@/assets/svg/login-bg-dark.svg);
  117. }
  118. .ant-input,
  119. .ant-input-password {
  120. background-color: #232a3b;
  121. }
  122. .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
  123. border: 1px solid #4a5569;
  124. }
  125. &-form {
  126. background: transparent !important;
  127. }
  128. .app-iconify {
  129. color: #fff;
  130. }
  131. }
  132. }
  133. .@{prefix-cls} {
  134. overflow: hidden;
  135. @media (max-width: @screen-xl) {
  136. background-color: #293146;
  137. .@{prefix-cls}-form {
  138. background-color: #fff;
  139. }
  140. }
  141. &::before {
  142. position: absolute;
  143. top: 0;
  144. left: 0;
  145. width: 100%;
  146. height: 100%;
  147. margin-left: -48%;
  148. background-image: url(/@/assets/svg/login-bg.svg);
  149. background-position: 100%;
  150. background-repeat: no-repeat;
  151. background-size: auto 100%;
  152. content: '';
  153. @media (max-width: @screen-xl) {
  154. display: none;
  155. }
  156. }
  157. .@{logo-prefix-cls} {
  158. position: absolute;
  159. top: 12px;
  160. height: 30px;
  161. &__title {
  162. font-size: 16px;
  163. color: #fff;
  164. }
  165. img {
  166. width: 32px;
  167. }
  168. }
  169. .container {
  170. .@{logo-prefix-cls} {
  171. display: flex;
  172. width: 60%;
  173. height: 80px;
  174. &__title {
  175. font-size: 24px;
  176. color: #fff;
  177. }
  178. img {
  179. width: 48px;
  180. }
  181. }
  182. }
  183. &-sign-in-way {
  184. .anticon {
  185. font-size: 22px;
  186. color: #888;
  187. cursor: pointer;
  188. &:hover {
  189. color: @primary-color;
  190. }
  191. }
  192. }
  193. input:not([type='checkbox']) {
  194. min-width: 360px;
  195. @media (max-width: @screen-xl) {
  196. min-width: 320px;
  197. }
  198. @media (max-width: @screen-lg) {
  199. min-width: 260px;
  200. }
  201. @media (max-width: @screen-md) {
  202. min-width: 240px;
  203. }
  204. @media (max-width: @screen-sm) {
  205. min-width: 160px;
  206. }
  207. }
  208. .@{countdown-prefix-cls} input {
  209. min-width: unset;
  210. }
  211. .ant-divider-inner-text {
  212. font-size: 12px;
  213. color: @text-color-secondary;
  214. }
  215. }
  216. </style>