PromotionLogin.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_PROPAGATION_LOGIN_USERNAME,
  20. password: import.meta.env.VITE_APP_PROPAGATION_LOGIN_PASSWORD
  21. }
  22. // 组件挂载时立即执行自动登录
  23. onMounted(async () => {
  24. await autoLogin(
  25. testAccount.tenantName,
  26. testAccount.username,
  27. testAccount.password,
  28. router,
  29. {
  30. path: '/ai-develop',
  31. state: {
  32. typeId: 5,
  33. typeName: 'AI时光旅行',
  34. typeSort: '02'
  35. }
  36. }
  37. )
  38. })
  39. </script>
  40. <style scoped>
  41. .quick-login-container {
  42. position: fixed;
  43. top: 0;
  44. left: 0;
  45. right: 0;
  46. bottom: 0;
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. background: linear-gradient(to bottom, #001169, #8a78d0);
  51. }
  52. .loading-overlay {
  53. display: flex;
  54. justify-content: center;
  55. align-items: center;
  56. width: 100%;
  57. height: 100%;
  58. }
  59. .loading-content {
  60. text-align: center;
  61. color: white;
  62. }
  63. .loading-spinner {
  64. width: 60px;
  65. height: 60px;
  66. margin-bottom: 20px;
  67. }
  68. .loading-text {
  69. font-size: 18px;
  70. font-weight: 500;
  71. }
  72. </style>