index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <script setup lang="ts" name="loginIndex">
  2. import { defineAsyncComponent, onMounted, reactive, computed } from 'vue';
  3. import { storeToRefs } from 'pinia';
  4. import { useThemeConfig } from '/@/stores/themeConfig';
  5. import { NextLoading } from '/@/utils/loading';
  6. import AnsjerImg from '/@/assets/logo.png';
  7. import backgroundImg from '/@/assets/background.png';
  8. import logoMini from '/@/assets/logo-mini.svg';
  9. import loginMain from '/@/assets/login-main.svg';
  10. import loginBg from '/@/assets/login-bg.svg';
  11. import { SystemConfigStore } from '/@/stores/systemConfig'
  12. import { getBaseURL } from "/@/utils/baseUrl";
  13. // 引入组件
  14. const Account = defineAsyncComponent(() => import('/@/views/system/login/component/account.vue'));
  15. const Mobile = defineAsyncComponent(() => import('/@/views/system/login/component/mobile.vue'));
  16. const Scan = defineAsyncComponent(() => import('/@/views/system/login/component/scan.vue'));
  17. import _ from "lodash-es";
  18. // 定义变量内容
  19. const storesThemeConfig = useThemeConfig();
  20. const { themeConfig } = storeToRefs(storesThemeConfig);
  21. const state = reactive({
  22. tabsActiveName: 'account',
  23. isScan: false,
  24. });
  25. // 获取布局配置信息
  26. const getThemeConfig = computed(() => {
  27. return themeConfig.value;
  28. });
  29. const systemConfigStore = SystemConfigStore()
  30. const { systemConfig } = storeToRefs(systemConfigStore)
  31. const getSystemConfig = computed(() => {
  32. return systemConfig.value
  33. })
  34. const siteLogo = computed(() => {
  35. // if (!_.isEmpty(getSystemConfig.value['login.site_logo'])) {
  36. // return getSystemConfig.value['login.site_logo']
  37. // }
  38. return AnsjerImg
  39. });
  40. // const siteBg = computed(() => {
  41. // if (!_.isEmpty(getSystemConfig.value['login.login_background'])) {
  42. // return getSystemConfig.value['login.login_background']
  43. // }
  44. // });
  45. function showScan() {
  46. state.isScan = !state.isScan;
  47. }
  48. // 页面加载时
  49. onMounted(() => {
  50. NextLoading.done();
  51. });
  52. </script>
  53. <template>
  54. <div class="login-container flex z-10">
  55. <div class="login-left">
  56. <div class="login-left-logo">
  57. <img :src="siteLogo" />
  58. <div class="login-left-logo-text">
  59. <span>{{ getSystemConfig['login.site_title'] || getThemeConfig.globalViceTitle }}</span>
  60. <span class="login-left-logo-text-msg">{{
  61. getSystemConfig['login.site_name'] || getThemeConfig.globalViceTitleMsg }}</span>
  62. </div>
  63. </div>
  64. <!-- <div class="login-left-img">-->
  65. <!-- <img :src="loginMain" />-->
  66. <!-- </div>-->
  67. <!-- <img :src="loginBg" class="login-left-waves" />-->
  68. </div>
  69. <div class="login-right flex z-10">
  70. <div class="login-right-warp flex-margin">
  71. <span class="login-right-warp-one"></span>
  72. <span class="login-right-warp-two"></span>
  73. <div class="login-right-warp-mian">
  74. <div class="login-right-warp-main-title">{{ getSystemConfig['login.site_title'] ||
  75. getThemeConfig.globalTitle }} 欢迎您!</div>
  76. <div class="login-right-warp-main-form">
  77. <div v-if="!state.isScan">
  78. <el-tabs v-model="state.tabsActiveName">
  79. <el-tab-pane :label="$t('message.label.one1')" name="account">
  80. <Account />
  81. </el-tab-pane>
  82. <!-- TODO 手机号码登录未接入,展示隐藏 -->
  83. <!-- <el-tab-pane :label="$t('message.label.two2')" name="mobile">
  84. <Mobile />
  85. </el-tab-pane> -->
  86. </el-tabs>
  87. </div>
  88. <Scan v-if="state.isScan" :isScan="state.isScan" />
  89. <div class="login-content-main-sacn" @click="showScan">
  90. <i :class="state.isScan ? 'icon-diannao1' : 'icon-barcode-qr'" class="iconfont"></i>
  91. <div class="login-content-main-sacn-delta"></div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="login-authorization z-10">
  98. <p>Copyright © {{ getSystemConfig['login.copyright'] || '2021-2024 django-vue-admin.com' }} 版权所有</p>
  99. <p class="la-other">
  100. <a href="https://beian.miit.gov.cn" target="_blank">{{ getSystemConfig['login.keep_record'] ||
  101. '晋ICP备18005113号-3' }}</a>
  102. |
  103. <a :href="getSystemConfig['login.help_url'] ? getSystemConfig['login.help_url'] : 'https://django-vue-admin.com'"
  104. target="_blank">帮助</a>
  105. |
  106. <a
  107. :href="getSystemConfig['login.privacy_url'] ? getBaseURL(getSystemConfig['login.privacy_url']) : '#'">隐私</a>
  108. |
  109. <a
  110. :href="getSystemConfig['login.clause_url'] ? getBaseURL(getSystemConfig['login.clause_url']) : '#'">条款</a>
  111. </p>
  112. </div>
  113. </div>
  114. <!-- <div v-if="siteBg">-->
  115. <div><img :src="backgroundImg" class="fixed inset-0 z-1 w-full h-full" /></div>
  116. </template>
  117. <style scoped lang="scss">
  118. .login-container {
  119. height: 100%;
  120. background: var(--el-color-white);
  121. .login-left {
  122. flex: 1;
  123. position: relative;
  124. background-color: rgba(211, 239, 255, 1);
  125. margin-right: 100px;
  126. .login-left-logo {
  127. display: flex;
  128. align-items: center;
  129. position: absolute;
  130. top: 50px;
  131. left: 80px;
  132. z-index: 1;
  133. animation: logoAnimation 0.3s ease;
  134. img {
  135. width: 52px;
  136. height: 52px;
  137. }
  138. .login-left-logo-text {
  139. display: flex;
  140. flex-direction: column;
  141. span {
  142. margin-left: 10px;
  143. font-size: 16px;
  144. color: var(--el-color-primary);
  145. }
  146. .login-left-logo-text-msg {
  147. font-size: 12px;
  148. color: var(--el-color-primary);
  149. }
  150. }
  151. }
  152. .login-left-img {
  153. position: absolute;
  154. top: 50%;
  155. left: 50%;
  156. transform: translate(-50%, -50%);
  157. width: 100%;
  158. height: 52%;
  159. img {
  160. width: 100%;
  161. height: 100%;
  162. animation: error-num 0.6s ease;
  163. }
  164. }
  165. .login-left-waves {
  166. position: absolute;
  167. top: 0;
  168. right: -100px;
  169. }
  170. }
  171. .login-right {
  172. width: 700px;
  173. .login-right-warp {
  174. border: 1px solid var(--el-color-primary-light-3);
  175. border-radius: 3px;
  176. width: 500px;
  177. height: 500px;
  178. position: relative;
  179. overflow: hidden;
  180. background-color: var(--el-color-white);
  181. .login-right-warp-one,
  182. .login-right-warp-two {
  183. position: absolute;
  184. display: block;
  185. width: inherit;
  186. height: inherit;
  187. &::before,
  188. &::after {
  189. content: '';
  190. position: absolute;
  191. z-index: 1;
  192. }
  193. }
  194. .login-right-warp-one {
  195. &::before {
  196. filter: hue-rotate(0deg);
  197. top: 0px;
  198. left: 0;
  199. width: 100%;
  200. height: 3px;
  201. background: linear-gradient(90deg, transparent, var(--el-color-primary));
  202. animation: loginLeft 3s linear infinite;
  203. }
  204. &::after {
  205. filter: hue-rotate(60deg);
  206. top: -100%;
  207. right: 2px;
  208. width: 3px;
  209. height: 100%;
  210. background: linear-gradient(180deg, transparent, var(--el-color-primary));
  211. animation: loginTop 3s linear infinite;
  212. animation-delay: 0.7s;
  213. }
  214. }
  215. .login-right-warp-two {
  216. &::before {
  217. filter: hue-rotate(120deg);
  218. bottom: 2px;
  219. right: -100%;
  220. width: 100%;
  221. height: 3px;
  222. background: linear-gradient(270deg, transparent, var(--el-color-primary));
  223. animation: loginRight 3s linear infinite;
  224. animation-delay: 1.4s;
  225. }
  226. &::after {
  227. filter: hue-rotate(300deg);
  228. bottom: -100%;
  229. left: 0px;
  230. width: 3px;
  231. height: 100%;
  232. background: linear-gradient(360deg, transparent, var(--el-color-primary));
  233. animation: loginBottom 3s linear infinite;
  234. animation-delay: 2.1s;
  235. }
  236. }
  237. .login-right-warp-mian {
  238. display: flex;
  239. flex-direction: column;
  240. height: 100%;
  241. .login-right-warp-main-title {
  242. height: 130px;
  243. line-height: 130px;
  244. font-size: 27px;
  245. text-align: center;
  246. letter-spacing: 3px;
  247. animation: logoAnimation 0.3s ease;
  248. animation-delay: 0.3s;
  249. color: var(--el-text-color-primary);
  250. }
  251. .login-right-warp-main-form {
  252. flex: 1;
  253. padding: 0 50px 50px;
  254. .login-content-main-sacn {
  255. position: absolute;
  256. top: 2px;
  257. right: 12px;
  258. width: 50px;
  259. height: 50px;
  260. overflow: hidden;
  261. cursor: pointer;
  262. transition: all ease 0.3s;
  263. color: var(--el-color-primary);
  264. &-delta {
  265. position: absolute;
  266. width: 35px;
  267. height: 70px;
  268. z-index: 2;
  269. top: 2px;
  270. right: 21px;
  271. background: var(--el-color-white);
  272. transform: rotate(-45deg);
  273. }
  274. &:hover {
  275. opacity: 1;
  276. transition: all ease 0.3s;
  277. color: var(--el-color-primary) !important;
  278. }
  279. i {
  280. width: 47px;
  281. height: 50px;
  282. display: inline-block;
  283. font-size: 48px;
  284. position: absolute;
  285. right: 1px;
  286. top: 0px;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. .login-authorization {
  294. position: fixed;
  295. bottom: 30px;
  296. left: 0;
  297. right: 0;
  298. text-align: center;
  299. p {
  300. font-size: 14px;
  301. color: rgba(0, 0, 0, 0.5);
  302. }
  303. a {
  304. color: var(--el-color-primary);
  305. margin: 0 5px;
  306. }
  307. }
  308. }
  309. </style>