diff --git a/src/main/java/uk/ac/cf/spring/demo/sports/security/SecurityConfig.java b/src/main/java/uk/ac/cf/spring/demo/sports/security/SecurityConfig.java index 1c70d5f42fa65b1f43122ae07f311cf0fa0e8cb1..10a8e80dedb69bb13ea24da5ff55cbf1fa1189ff 100644 --- a/src/main/java/uk/ac/cf/spring/demo/sports/security/SecurityConfig.java +++ b/src/main/java/uk/ac/cf/spring/demo/sports/security/SecurityConfig.java @@ -33,7 +33,8 @@ public class SecurityConfig { "/html/login.html", // login "/html/table-tennisrules.html", "/rankings", //ranking data path - "/rankings/**" + "/rankings/**", + "/html/table-tennisrules.html" }; public static final String[] ADMIN_WHITELIST = { diff --git a/src/main/resources/static/html/ranking.html b/src/main/resources/static/html/ranking.html index c9ff9753da94074d46005e75bb706310c07c6d9c..2be8d2275c1f3958708e60d74d19678f7d0b0ffb 100644 --- a/src/main/resources/static/html/ranking.html +++ b/src/main/resources/static/html/ranking.html @@ -52,6 +52,6 @@ loadFooter('footer-container'); </script> <script src="/js/rankingTable.js"></script> -<script src="/js/matchSchedule.js"></script> +<!--<script src="/js/matchSchedule.js"></script>--> </body> </html> \ No newline at end of file diff --git a/src/main/resources/static/js/UserCenter.js b/src/main/resources/static/js/UserCenter.js index 074519092d187807a6bf423989697c0389800373..5a1bef3a6200a405aa4b62f210ef7da6afedb037 100644 --- a/src/main/resources/static/js/UserCenter.js +++ b/src/main/resources/static/js/UserCenter.js @@ -1,9 +1,9 @@ // userTable.js // 动态加载用户数据 -async function loadUsers() { +async function loadUsers(id) { try { - const response = await fetch('/api/users'); // 确保后端提供了此 API + const response = await fetch('/api/users/${id}'); // 确保后端提供了此 API if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } @@ -28,10 +28,9 @@ async function loadUsers() { `; tbody.appendChild(row); }); - } catch (error) { + } + catch (error) { console.error('Error loading users:', error); - const tbody = document.querySelector('tbody'); - tbody.innerHTML = `<tr><td colspan="4">Failed to load user data.</td></tr>`; } } diff --git a/src/main/resources/templates/Usercenter/Usercenter.html b/src/main/resources/templates/Usercenter/Usercenter.html index 4f1c57ee84ce5cc4ed12c58ffdb3bb8a24636538..170d68f4ff4ddf962309b5160e6605e7cad0e770 100644 --- a/src/main/resources/templates/Usercenter/Usercenter.html +++ b/src/main/resources/templates/Usercenter/Usercenter.html @@ -3,8 +3,10 @@ <head> <meta charset="UTF-8"> <title>Title</title> + <link rel="stylesheet" href="../css/UserCenter.css"> </head> <body> + <table> <thead> <tr>