QuickLogin.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="quick-login-container">
  3. <div class="loading-overlay">
  4. <div class="loading-content">
  5. <el-loading-spinner class="loading-spinner"></el-loading-spinner>
  6. <p class="loading-text">登录中...</p>
  7. </div>
  8. </div>
  9. </div>
  10. </template>
  11. <script setup>
  12. import { onMounted } from 'vue'
  13. import { useRouter } from 'vue-router'
  14. import { autoLogin } from '@/utils/loginUtils.js'
  15. const router = useRouter()
  16. // 测试账号信息
  17. const testAccount = {
  18. tenantName: import.meta.env.VITE_APP_TITLE,
  19. username: import.meta.env.VITE_APP_GUANGDIAN_LOGIN_USERNAME,
  20. password: import.meta.env.VITE_APP_GUANGDIAN_LOGIN_PASSWORD
  21. }
  22. // 组件挂载时立即执行自动登录
  23. onMounted(async () => {
  24. await autoLogin(
  25. testAccount.tenantName,
  26. testAccount.username,
  27. testAccount.password,
  28. router,
  29. '/ai-general-course'
  30. )
  31. })
  32. </script>
  33. <style scoped>
  34. .quick-login-container {
  35. position: fixed;
  36. top: 0;
  37. left: 0;
  38. right: 0;
  39. bottom: 0;
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. background: linear-gradient(to bottom, #001169, #8a78d0);
  44. }
  45. .loading-overlay {
  46. display: flex;
  47. justify-content: center;
  48. align-items: center;
  49. width: 100%;
  50. height: 100%;
  51. }
  52. .loading-content {
  53. text-align: center;
  54. color: white;
  55. }
  56. .loading-spinner {
  57. width: 60px;
  58. height: 60px;
  59. margin-bottom: 20px;
  60. }
  61. .loading-text {
  62. font-size: 18px;
  63. font-weight: 500;
  64. }
  65. </style>