index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="login-container w100 h100">
  3. <div class="login-content">
  4. <div class="login-content-main">
  5. <Motion>
  6. <h4 class="login-content-title">{{ getThemeConfig.globalViceTitle }}</h4>
  7. </Motion>
  8. <Motion>
  9. <!-- <div v-if="!state.isScan">-->
  10. <!-- <el-tabs v-model="state.tabsActiveName">
  11. <el-tab-pane label="账号登录" name="account">-->
  12. <account />
  13. <!-- </el-tab-pane>
  14. <el-tab-pane label="手机号登录" name="mobile">
  15. <Mobile />
  16. </el-tab-pane>
  17. </el-tabs>-->
  18. <!-- </div>-->
  19. </Motion>
  20. <!-- <Scan v-if="state.isScan" />
  21. <div class="login-content-main-scan" @click="state.isScan = !state.isScan">
  22. <i class="iconfont" :class="state.isScan ? 'icon-diannao1' : 'icon-barcode-qr'"></i>
  23. <div class="login-content-main-scan-delta"></div>
  24. </div>-->
  25. </div>
  26. </div>
  27. <LayoutFooter v-if="isFooter" class="login-footer" :underline="false" />
  28. </div>
  29. </template>
  30. <script setup lang="ts" name="loginIndex">
  31. import { defineAsyncComponent, reactive, onMounted, computed } from 'vue';
  32. import { storeToRefs } from 'pinia';
  33. import { useThemeConfig } from '@/stores/themeConfig';
  34. import { NextLoading } from '@/utils/loading';
  35. import { getImageUrl } from '@/utils/tools';
  36. import Motion from '@/utils/motion';
  37. import { getCurrentCityConfig } from '@/utils/appConfig';
  38. // 定义接口来定义对象的类型
  39. interface LoginState {
  40. tabsActiveName: string;
  41. isScan: boolean;
  42. }
  43. // 引入组件
  44. const Account = defineAsyncComponent(() => import('@/views/login/component/Account.vue'));
  45. const Mobile = defineAsyncComponent(() => import('@/views/login/component/Mobile.vue'));
  46. const Scan = defineAsyncComponent(() => import('@/views/login/component/Scan.vue'));
  47. const LayoutFooter = defineAsyncComponent(() => import('@/layout/footer/index.vue'));
  48. const storesThemeConfig = useThemeConfig();
  49. const { themeConfig } = storeToRefs(storesThemeConfig);
  50. const state = reactive<LoginState>({
  51. tabsActiveName: 'account', // 默认显示账号密码登录
  52. isScan: false, // 是否显示扫码登录
  53. });
  54. const { loginBg } = getCurrentCityConfig();
  55. // 设置 footer 显示/隐藏
  56. const isFooter = computed(() => {
  57. return themeConfig.value.isFooter;
  58. });
  59. // let bgImg = themeConfig.value.loginImage ?? `url(${getImageUrl('login/login_bg.png')})`;
  60. const bgImg = `url(${getImageUrl(loginBg)}`;
  61. // 获取布局配置信息
  62. const getThemeConfig = computed(() => {
  63. return themeConfig.value;
  64. });
  65. // 页面加载时
  66. onMounted(async () => {
  67. NextLoading.done();
  68. });
  69. </script>
  70. <style scoped lang="scss">
  71. :deep(.el-tabs__item) {
  72. font-size: var(--el-font-size-medium);
  73. }
  74. .login-footer {
  75. width: 100%;
  76. position: absolute;
  77. bottom: 0;
  78. z-index: 10;
  79. color: var(--el-border-color-light) !important;
  80. &-warp {
  81. margin: auto;
  82. text-align: center;
  83. animation: error-num 0.3s ease;
  84. }
  85. :deep(.el-link){
  86. color: var(--el-border-color-light) !important;
  87. }
  88. }
  89. .login-container {
  90. position: relative;
  91. background-image: v-bind(bgImg);
  92. background-repeat: no-repeat;
  93. background-size: calc(100vw + 1px) calc(100vh + 1px);
  94. .login-content {
  95. width: 500px;
  96. padding: 40px 40px 30px;
  97. position: absolute;
  98. right: calc(25% - 250px);
  99. top: 50vh;
  100. transform: translateY(-50%) translate3d(0, 0, 0);
  101. background-color: var(--el-color-white);
  102. border-radius: 20px;
  103. overflow: hidden;
  104. z-index: 1;
  105. box-shadow: 0 0 20px 0 rgba(26, 64, 144, 0.46);
  106. .login-content-main {
  107. margin: 0 auto;
  108. .login-content-title {
  109. color: var(--el-color-primary);
  110. font-size: 28px;
  111. font-weight: 500;
  112. line-height: 48px;
  113. text-align: center;
  114. letter-spacing: 4px;
  115. white-space: nowrap;
  116. z-index: 5;
  117. position: relative;
  118. transition: all 0.3s ease;
  119. }
  120. }
  121. .login-content-main-scan {
  122. position: absolute;
  123. top: 0;
  124. right: 0;
  125. width: 50px;
  126. height: 50px;
  127. overflow: hidden;
  128. cursor: pointer;
  129. transition: all ease 0.3s;
  130. color: var(--el-text-color-primary);
  131. &-delta {
  132. position: absolute;
  133. width: 35px;
  134. height: 70px;
  135. z-index: 2;
  136. top: 2px;
  137. right: 21px;
  138. background: var(--el-color-white);
  139. transform: rotate(-45deg);
  140. }
  141. &:hover {
  142. opacity: 1;
  143. transition: all ease 0.3s;
  144. color: var(--el-color-primary) !important;
  145. }
  146. i {
  147. width: 47px;
  148. height: 50px;
  149. display: inline-block;
  150. font-size: 48px;
  151. position: absolute;
  152. right: 2px;
  153. top: -1px;
  154. }
  155. }
  156. }
  157. }
  158. </style>