实现登录注册接口
Change-Id: I3d57cca89cac8945d562f6a39127b3454c1cd9ac
diff --git a/src/main/resources/static/home.html b/src/main/resources/static/home.html
new file mode 100644
index 0000000..635856a
--- /dev/null
+++ b/src/main/resources/static/home.html
@@ -0,0 +1,24 @@
+<!-- src/main/resources/static/home.html -->
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head><meta charset="UTF-8"><title>首页</title></head>
+<body>
+<h1>欢迎访问受保护页面</h1>
+<div id="userInfo"></div>
+<script>
+ (async ()=>{
+ const token = localStorage.getItem('token');
+ if (!token) return window.location.href='login.html';
+ const res = await fetch('/api/me', {
+ headers: { 'token': token }
+ });
+ const json = await res.json();
+ if (json.code!==0) {
+ return window.location.href='login.html';
+ }
+ document.getElementById('userInfo')
+ .innerText = '当前用户:' + json.data.username;
+ })();
+</script>
+</body>
+</html>