| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>教育平台登录</title>
- <script src="./axios.min.js"></script>
- <style>
- body {
- font-family: Arial, sans-serif;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- margin: 0;
- background-color: #f0f2f5;
- }
- .login-container {
- text-align: center;
- background: white;
- padding: 2rem;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
- }
- .login-btn {
- display: block;
- width: 200px;
- padding: 12px;
- margin: 20px auto;
- border: none;
- border-radius: 4px;
- color: white;
- font-size: 16px;
- cursor: pointer;
- transition: background-color 0.3s;
- }
- .student-btn {
- background-color: #1890ff;
- }
- .teacher-btn {
- background-color: #52c41a;
- }
- .login-btn:hover {
- opacity: 0.9;
- }
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Arial', sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .container {
- text-align: center;
- }
- .loading-container {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 20px;
- padding: 40px;
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
- backdrop-filter: blur(10px);
- margin-bottom: 30px;
- transition: all 0.3s ease;
- }
- .spinner {
- width: 50px;
- height: 50px;
- border: 5px solid #f3f3f3;
- border-top: 5px solid #667eea;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- margin: 0 auto 20px;
- }
- @keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- .loading-text {
- font-size: 18px;
- color: #333;
- font-weight: 500;
- }
- /* 准备进入状态样式 */
- .ready-enter {
- animation: pulse 2s infinite;
- }
- @keyframes pulse {
- 0% {
- transform: scale(1);
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
- }
- 50% {
- transform: scale(1.05);
- box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
- }
- 100% {
- transform: scale(1);
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
- }
- }
- .trigger-btn {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- border: none;
- padding: 15px 30px;
- font-size: 16px;
- border-radius: 50px;
- cursor: pointer;
- transition: all 0.3s ease;
- box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
- }
- .trigger-btn:hover {
- transform: translateY(-3px);
- box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
- }
- .trigger-btn:active {
- transform: translateY(0);
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="loading-container" id="loadingContainer">
- <div class="spinner"></div>
- <div class="loading-text" id="loadingText">加载中...</div>
- </div>
- <!-- <button class="trigger-btn" id="triggerBtn">发起网络请求</button>-->
- </div>
- <!--<div class="login-container">-->
- <!-- <h1>在线教育平台</h1>-->
- <!-- <button class="login-btn student-btn" onclick="login()">登录</button>-->
- <!--</div>-->
- <!--http://localhost:63342/onlineEducation-front/public/html/loginJump.html?_ijt=eqdbr9d1k5uh8if53et5u8j8su&_ij_reload=RELOAD_ON_SAVE&code=teacher&state=type=1&id=1958766027408039938-->
- <script>
- let loadingContainer
- let loadingText
- let triggerBtn
- let baseUrl = 'http://192.168.1.213:9003'
- let baseUrlt = 'http://192.168.1.202:9000'
- let baseUrls = 'http://192.168.1.202:9000'
- // 创建axios实例,参考request.js中的配置
- const service = axios.create({
- baseURL: '/api',
- timeout: 10000
- });
- // 登录函数
- const login = async () => {
- const urlParams = new URLSearchParams(window.location.search);
- let code = urlParams.get('code');
- let type = urlParams.get('state').split('=')[1];
- let id = urlParams.get('id');
- if (code == undefined || type == undefined) {
- alert('数据参数不对');
- return
- }
- if (type == 1 && id == undefined) {
- alert('数据参数不对 没有id');
- return
- }
- console.log('什么数值呢', code)
- loadingContainer.classList.remove('ready-enter');
- loadingText.textContent = '加载中...';
- // 这里需要替换为实际的登录接口URL
- const loginUrl = baseUrl+'/api/webapp/disk/CollegeUser/getUser';
- let res = await service.get(loginUrl, {
- params: {
- code
- },
- headers: {
- 'account': 'admin',
- }
- })
- console.log('登录状况:', res.data);
- if (res.data.code === 200) {
- let url = baseUrl+'/api/webapp/auth/b/getLoginUser'
- let ress = await service.get(url, {
- headers: {
- 'token': res.data.data,
- }
- })
- console.log('获取人员信息:', ress);
- if(ress.data.code == 200 && ress.data.data.eduIdentity == 1){
- // 请求完成后切换到准备进入状态
- loadingText.textContent = '准备进入';
- loadingContainer.classList.add('ready-enter');
- // 可选:移除spinner,只显示文字
- const spinner = document.querySelector('.spinner');
- if (spinner) {
- spinner.style.display = 'none';
- }
- //去教师段
- // 构建带参数的URL
- const params = new URLSearchParams({
- userId: ress.data.data.id,
- type,
- id
- });
- const redirectUrl = `${baseUrlt}/jump?${params.toString()}`;
- window.location.href = redirectUrl;
- }
- }
- // .then(response => {
- //
- // // alert('登录成功');
- // // // 保存token等操作
- // // console.log('登录成功:', response.data);
- // // } else {
- // // alert(`登录失败: ${response.data.msg}`);
- // // }
- // })
- // .catch(error => {
- // console.error('登录请求失败:', error);
- // alert('登录请求失败,请检查网络连接');
- // });
- // // 发送登录请求
- // service.post(loginUrl, loginData)
- // .then(response => {
- // if (response.data.code === 200) {
- // alert(`${userType === 'student' ? '学生' : '教师'}端登录成功`);
- // // 保存token等操作
- // console.log('登录成功:', response.data);
- // } else {
- // alert(`登录失败: ${response.data.msg}`);
- // }
- // })
- // .catch(error => {
- // console.error('登录请求失败:', error);
- // alert('登录请求失败,请检查网络连接');
- // });
- }
- // 在<script>标签内添加
- window.onload = function() {
- console.log('页面加载完成');
- loadingContainer = document.getElementById('loadingContainer');
- loadingText = document.getElementById('loadingText');
- triggerBtn = document.getElementById('triggerBtn');
- login()
- // 在这里可以执行初始化操作
- // 比如自动登录等
- // login(); // 如果需要自动执行登录
- };
- </script>
- </body>
- </html>
|