pans 5 сар өмнө
parent
commit
240c9cfa2b

+ 35 - 14
snowy-modules/snowy-web-app/src/main/resources/templates/loginJump.html

@@ -52,11 +52,22 @@
 </head>
 
 <body>
-<input type="hidden" th:value="${teacherUrl}" name="id"  id="teacherUrl" >
-<input type="hidden" th:value="${studentUrl}" name="id"  id="studentUrl" >
+<div class="container">
+	<div class="loading-container" id="loadingContainer">
+		<div class="spinner"></div>
+		<div class="loading-text" id="loadingText">加载中...</div>
+	</div>
+</div>
+<input type="hidden" th:value="${teacherUrl}"  id="teacherUrl" >
+<input type="hidden" th:value="${studentUrl}"   id="studentUrl" >
+<input type="hidden" th:value="${code}"  id="code" >
+<input type="hidden" th:value="${type}"  id="type" >
+<input type="hidden" th:value="${id}"  id="id" >
 <script src="/api/webapp/js/axios.min.js" type="text/javascript" th:src="@{/api/webapp/js/axios.min.js}"></script>
 <script>
-
+	let loadingContainer
+	let loadingText
+	let triggerBtn
 	let baseUrl ="http://"+window.location.host;
 	let teacherUrl = document.getElementById('teacherUrl').value;
 	let studentUrl = document.getElementById('studentUrl').value;
@@ -65,15 +76,13 @@
 	// 创建axios实例,参考request.js中的配置
 	const service = axios.create({
 		baseURL: '/api',
-		timeout: 5000
+		timeout: 10000
 	});
 
-	// 登录函数
 	const login = async () => {
-		const urlParams = new URLSearchParams(window.location.search);
-		let code = urlParams.get('code');
-		let type = urlParams.get('type');
-		let id = urlParams.get('id');
+		let code = document.getElementById('code').value;
+		let type = document.getElementById('type').value;
+		let id = document.getElementById('id').value;
 		if (code == undefined || type == undefined) {
 			alert('数据参数不对');
 			return
@@ -83,6 +92,9 @@
 			return
 		}
 		console.log('什么数值呢', code)
+		console.log('type数值', type)
+		loadingContainer.classList.remove('ready-enter');
+		loadingText.textContent = '加载中...';
 		// 这里需要替换为实际的登录接口URL
 		const loginUrl = baseUrl+'/api/webapp/disk/CollegeUser/getUser';
 
@@ -106,7 +118,16 @@
 			})
 			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,
@@ -126,6 +147,7 @@
 				});
 				const redirectUrl = `${studentUrl}${type==1?'/student/resourceDetails':'/student/resourceCenter'}?${params.toString()}`;
 				window.location.href = redirectUrl;
+
 			}
 
 		}
@@ -134,12 +156,11 @@
 	// 在<script>标签内添加
 	window.onload = function() {
 		console.log('页面加载完成');
+		loadingContainer = document.getElementById('loadingContainer');
+		loadingText = document.getElementById('loadingText');
+		triggerBtn = document.getElementById('triggerBtn');
 		login()
-		// 在这里可以执行初始化操作
-		// 比如自动登录等
-		// login(); // 如果需要自动执行登录
 	};
-
 </script>
 </body>
 </html>

+ 1 - 0
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/controller/CollegeUserController.java

@@ -172,6 +172,7 @@ public class CollegeUserController {
     @ApiOperation("根据code获取用户信息")
     @GetMapping("/disk/CollegeUser/getUser")
     public CommonResult<String> getUser(HttpServletRequest httpServletRequest){
+        log.info("==================根据code获取用户信息接口=====================");
         CommonResult<String> rs=authUtil.valid(httpServletRequest);
         //根据用户信息生成自己系统的token
         try {

+ 9 - 6
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/controller/ResourceRecordController.java

@@ -106,9 +106,6 @@ public class ResourceRecordController {
     @Value("${student.url}")
     private String studentUrl;
 
-    @Value("${base.url}")
-    private String baseUrl;
-
     @Resource
     private AuthUtil authUtil;
     /**
@@ -727,15 +724,21 @@ public class ResourceRecordController {
     @GetMapping("/disk/courseauditrecord/loginJump")
     public ModelAndView loginJump(HttpServletRequest req,Model model) { // 返回ModelAndView
         String code = req.getParameter("code");
-        String type = req.getParameter("type");
+        String state = req.getParameter("state");
+        String id = req.getParameter("id");
+        String type=state.split("=")[1];
+
         ModelAndView mav = new ModelAndView();
         mav.setViewName("loginJump"); // 设置视图名称
-        model.addAttribute("baseUrl", baseUrl); // 添加数据
         model.addAttribute("teacherUrl", teacherUrl); // 添加数据
         model.addAttribute("studentUrl", studentUrl);
         model.addAttribute("code", code); // 添加数据
         model.addAttribute("type", type);
-
+        if(ObjectUtil.isNotEmpty(id)){
+            model.addAttribute("id", id);
+        }else{
+            model.addAttribute("id", null);
+        }
         return mav;
     }
 

+ 7 - 7
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/service/impl/CollegeUserServiceImpl.java

@@ -258,14 +258,14 @@ public class CollegeUserServiceImpl extends ServiceImpl<CollegeUserMapper, Colle
 //
 //        JSONObject user=userRs.getJSONObject("data");
 //        String account=user.getString("iamUserCode");
-        String account="zhangsan10";
-//       if("teacher".equals(code)){
-//            account="zhangsan10";
-//       }
+        String account="";
+       if("teacher".equals(code)){
+            account="ww";
+       }
 
-//        if("student".equals(code)){
-//            account="zhiduoxing";
-//        }
+        if("student".equals(code)){
+            account="zhiduoxing";
+        }
 
         SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByAccount(account);