Login.vue 5.3 KB
Newer Older
陈文彬 已提交
1
<template>
V
vben 已提交
2 3 4 5 6
  <div :class="prefixCls" class="relative w-full h-full px-4">
    <AppLocalePicker
      class="absolute top-4 right-4 enter-x text-white xl:text-gray-600"
      :showText="false"
    />
V
Vben 已提交
7
    <AppDarkModeToggle class="absolute top-3 right-7 enter-x" />
V
vben 已提交
8 9 10 11 12

    <span class="-enter-x xl:hidden">
      <AppLogo :alwaysShowTitle="true" />
    </span>

V
vben 已提交
13
    <div class="container relative h-full py-2 mx-auto sm:px-10">
V
vben 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
      <div class="flex h-full">
        <div class="hidden xl:flex xl:flex-col xl:w-6/12 min-h-full mr-4 pl-4">
          <AppLogo class="-enter-x" />
          <div class="my-auto">
            <img
              :alt="title"
              src="../../../assets/svg/login-box-bg.svg"
              class="w-1/2 -mt-16 -enter-x"
            />
            <div class="mt-10 font-medium text-white -enter-x">
              <span class="mt-4 text-3xl inline-block"> {{ t('sys.login.signInTitle') }}</span>
            </div>
            <div class="mt-5 text-md text-white font-normal dark:text-gray-500 -enter-x">
              {{ t('sys.login.signInDesc') }}
            </div>
          </div>
        </div>
        <div class="h-full xl:h-auto flex py-5 xl:py-0 xl:my-0 w-full xl:w-6/12">
          <div
V
Vben 已提交
33
            :class="`${prefixCls}-form`"
V
Vben 已提交
34
            class="my-auto mx-auto xl:ml-20 xl:bg-transparent px-5 py-8 sm:px-8 xl:p-4 rounded-md shadow-md xl:shadow-none w-full sm:w-3/4 lg:w-2/4 xl:w-auto enter-x relative"
V
vben 已提交
35
          >
V
vben 已提交
36 37 38 39 40
            <LoginForm />
            <ForgetPasswordForm />
            <RegisterForm />
            <MobileForm />
            <QrCodeForm />
V
vben 已提交
41
          </div>
陈文彬 已提交
42 43 44 45 46 47
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
V
vben 已提交
48
  import { defineComponent, computed } from 'vue';
49

V
vben 已提交
50
  import { AppLogo } from '/@/components/Application';
V
Vben 已提交
51
  import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
V
vben 已提交
52 53 54 55 56
  import LoginForm from './LoginForm.vue';
  import ForgetPasswordForm from './ForgetPasswordForm.vue';
  import RegisterForm from './RegisterForm.vue';
  import MobileForm from './MobileForm.vue';
  import QrCodeForm from './QrCodeForm.vue';
57

58
  import { useGlobSetting } from '/@/hooks/setting';
V
vben 已提交
59
  import { useI18n } from '/@/hooks/web/useI18n';
V
vben 已提交
60
  import { useDesign } from '/@/hooks/web/useDesign';
V
Vben 已提交
61
  import { useLocaleStore } from '/@/store/modules/locale';
V
vben 已提交
62

陈文彬 已提交
63
  export default defineComponent({
V
vben 已提交
64
    name: 'Login',
65
    components: {
V
vben 已提交
66 67 68 69 70 71
      AppLogo,
      LoginForm,
      ForgetPasswordForm,
      RegisterForm,
      MobileForm,
      QrCodeForm,
V
vben 已提交
72
      AppLocalePicker,
V
Vben 已提交
73
      AppDarkModeToggle,
74
    },
陈文彬 已提交
75
    setup() {
V
vben 已提交
76
      const globSetting = useGlobSetting();
V
vben 已提交
77
      const { prefixCls } = useDesign('login');
V
vben 已提交
78
      const { t } = useI18n();
V
Vben 已提交
79
      const localeStore = useLocaleStore();
陈文彬 已提交
80 81

      return {
V
vben 已提交
82
        t,
V
vben 已提交
83 84
        prefixCls,
        title: computed(() => globSetting?.title ?? ''),
85
        showLocale: localeStore.getShowPicker,
陈文彬 已提交
86 87 88 89
      };
    },
  });
</script>
V
vben 已提交
90
<style lang="less">
V
vben 已提交
91 92 93
  @prefix-cls: ~'@{namespace}-login';
  @logo-prefix-cls: ~'@{namespace}-app-logo';
  @countdown-prefix-cls: ~'@{namespace}-countdown-input';
V
Vben 已提交
94
  @dark-bg: #293146;
V
vben 已提交
95

V
Vben 已提交
96 97
  html[data-theme='dark'] {
    .@{prefix-cls} {
V
Vben 已提交
98
      background-color: @dark-bg;
V
Vben 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111

      &::before {
        background-image: url(/@/assets/svg/login-bg-dark.svg);
      }

      .ant-input,
      .ant-input-password {
        background-color: #232a3b;
      }

      .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
        border: 1px solid #4a5569;
      }
V
Vben 已提交
112 113 114 115

      &-form {
        background: transparent !important;
      }
V
Vben 已提交
116 117 118 119

      .app-iconify {
        color: #fff;
      }
V
Vben 已提交
120 121 122
    }
  }

V
vben 已提交
123
  .@{prefix-cls} {
124
    overflow: hidden;
V
vben 已提交
125
    @media (max-width: @screen-xl) {
V
Vben 已提交
126
      background-color: #293146;
V
Vben 已提交
127 128

      .@{prefix-cls}-form {
V
Vben 已提交
129
        background-color: #fff;
V
Vben 已提交
130
      }
V
vben 已提交
131
    }
陈文彬 已提交
132

V
vben 已提交
133 134 135 136 137
    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
N
nebv 已提交
138
      height: 100%;
V
vben 已提交
139 140 141 142 143 144 145 146 147
      margin-left: -48%;
      background-image: url(/@/assets/svg/login-bg.svg);
      background-position: 100%;
      background-repeat: no-repeat;
      background-size: auto 100%;
      content: '';
      @media (max-width: @screen-xl) {
        display: none;
      }
陈文彬 已提交
148 149
    }

V
vben 已提交
150 151 152 153 154 155 156 157
    .@{logo-prefix-cls} {
      position: absolute;
      top: 12px;
      height: 30px;

      &__title {
        font-size: 16px;
        color: #fff;
V
vben 已提交
158 159
      }

V
vben 已提交
160 161
      img {
        width: 32px;
V
vben 已提交
162
      }
V
vben 已提交
163 164 165 166 167 168 169 170 171 172 173 174
    }

    .container {
      .@{logo-prefix-cls} {
        display: flex;
        width: 60%;
        height: 80px;

        &__title {
          font-size: 24px;
          color: #fff;
        }
V
vben 已提交
175

V
vben 已提交
176 177
        img {
          width: 48px;
N
nebv 已提交
178
        }
V
vben 已提交
179 180 181 182 183 184 185 186
      }
    }

    &-sign-in-way {
      .anticon {
        font-size: 22px;
        color: #888;
        cursor: pointer;
N
nebv 已提交
187

V
vben 已提交
188 189
        &:hover {
          color: @primary-color;
N
nebv 已提交
190 191
        }
      }
陈文彬 已提交
192
    }
V
vben 已提交
193 194 195

    input:not([type='checkbox']) {
      min-width: 360px;
V
Vben 已提交
196

L
Li yao 已提交
197 198 199 200
      @media (max-width: @screen-xl) {
        min-width: 320px;
      }

V
Vben 已提交
201
      @media (max-width: @screen-lg) {
L
Li yao 已提交
202
        min-width: 260px;
V
Vben 已提交
203 204 205
      }

      @media (max-width: @screen-md) {
L
Li yao 已提交
206
        min-width: 240px;
V
Vben 已提交
207 208
      }

V
vben 已提交
209
      @media (max-width: @screen-sm) {
L
Li yao 已提交
210
        min-width: 160px;
V
vben 已提交
211 212
      }
    }
V
Vben 已提交
213

V
vben 已提交
214 215 216 217 218 219 220 221
    .@{countdown-prefix-cls} input {
      min-width: unset;
    }

    .ant-divider-inner-text {
      font-size: 12px;
      color: @text-color-secondary;
    }
陈文彬 已提交
222 223
  }
</style>