Login.vue 5.6 KB

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