Login.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div :class="prefixCls" class="relative w-full h-full px-4">
  3. <AppLocalePicker
  4. class="absolute text-white top-4 right-4 enter-x xl:text-gray-600"
  5. :showText="false"
  6. v-if="!sessionTimeout && showLocale"
  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 min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12">
  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="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span>
  24. </div>
  25. <div class="mt-5 font-normal text-white text-md dark:text-gray-500 -enter-x">
  26. {{ t('sys.login.signInDesc') }}
  27. </div>
  28. </div>
  29. </div>
  30. <div class="flex w-full h-full py-5 xl:h-auto xl:py-0 xl:my-0 xl:w-6/12">
  31. <div
  32. :class="`${prefixCls}-form`"
  33. class="
  34. relative
  35. w-full
  36. px-5
  37. py-8
  38. mx-auto
  39. my-auto
  40. rounded-md
  41. shadow-md
  42. xl:ml-16 xl:bg-transparent
  43. sm:px-8
  44. xl:p-4 xl:shadow-none
  45. sm:w-3/4
  46. lg:w-2/4
  47. xl:w-auto
  48. enter-x
  49. "
  50. >
  51. <LoginForm />
  52. <ForgetPasswordForm />
  53. <RegisterForm />
  54. <MobileForm />
  55. <QrCodeForm />
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script lang="ts">
  63. import { defineComponent, computed } from 'vue';
  64. import { AppLogo } from '/@/components/Application';
  65. import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
  66. import LoginForm from './LoginForm.vue';
  67. import ForgetPasswordForm from './ForgetPasswordForm.vue';
  68. import RegisterForm from './RegisterForm.vue';
  69. import MobileForm from './MobileForm.vue';
  70. import QrCodeForm from './QrCodeForm.vue';
  71. import { useGlobSetting } from '/@/hooks/setting';
  72. import { useI18n } from '/@/hooks/web/useI18n';
  73. import { useDesign } from '/@/hooks/web/useDesign';
  74. import { useLocaleStore } from '/@/store/modules/locale';
  75. export default defineComponent({
  76. name: 'Login',
  77. components: {
  78. AppLogo,
  79. LoginForm,
  80. ForgetPasswordForm,
  81. RegisterForm,
  82. MobileForm,
  83. QrCodeForm,
  84. AppLocalePicker,
  85. AppDarkModeToggle,
  86. },
  87. props: {
  88. sessionTimeout: {
  89. type: Boolean,
  90. },
  91. },
  92. setup() {
  93. const globSetting = useGlobSetting();
  94. const { prefixCls } = useDesign('login');
  95. const { t } = useI18n();
  96. const localeStore = useLocaleStore();
  97. return {
  98. t,
  99. prefixCls,
  100. title: computed(() => globSetting?.title ?? ''),
  101. showLocale: localeStore.getShowPicker,
  102. };
  103. },
  104. });
  105. </script>
  106. <style lang="less">
  107. @prefix-cls: ~'@{namespace}-login';
  108. @logo-prefix-cls: ~'@{namespace}-app-logo';
  109. @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  110. @dark-bg: #293146;
  111. html[data-theme='dark'] {
  112. .@{prefix-cls} {
  113. background-color: @dark-bg;
  114. &::before {
  115. background-image: url(/@/assets/svg/login-bg-dark.svg);
  116. }
  117. .ant-input,
  118. .ant-input-password {
  119. background-color: #232a3b;
  120. }
  121. .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
  122. border: 1px solid #4a5569;
  123. }
  124. &-form {
  125. background: transparent !important;
  126. }
  127. .app-iconify {
  128. color: #fff;
  129. }
  130. }
  131. }
  132. .@{prefix-cls} {
  133. min-height: 100%;
  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>