对docker化项目的一些修正与验证
> 重命名Dockerfile,修改nginx.conf中后端指向

Change-Id: Ic3f6787e63097d2880f040016d4be1e614c7be34
diff --git a/.dockerignore b/.dockerignore
index 4ab90f9..dd63092 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,11 +1,12 @@
 # 排除构建工具生成的文件
-node_modules/  # Node.js 依赖
-target/        # Maven/Java 构建输出
-dist/          # 前端构建产物
-build/         # 通用构建目录
+node_modules  # Node.js 依赖
+target      # Maven/Java 构建输出
+dist
+build         # 通用构建目录
 
 # 排除临时文件
 *.log          # 日志文件
 *.swp          # Vim 交换文件
-.idea/         # IntelliJ IDEA 配置
-.vscode/       # VS Code 配置
\ No newline at end of file
+.idea         # IntelliJ IDEA 配置
+.vscode       # VS Code 配置
+.idea
\ No newline at end of file
diff --git a/Dokerfile b/Dockerfile
similarity index 72%
rename from Dokerfile
rename to Dockerfile
index c7ea0a4..deb81af 100644
--- a/Dokerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 # 构建阶段
-FROM FROM docker.1ms.run/node:23-alpine AS builder
+FROM node:23-alpine AS builder
 WORKDIR /src
 
 # 安装 pnpm
@@ -14,8 +14,8 @@
 RUN pnpm build
 
 # 生产环境
-FROM docker.1ms.run/nginx:1.25-alpine
-COPY --from=builder /dist /usr/share/nginx/html
+FROM nginx:1.25-alpine
+COPY --from=builder /src/dist /usr/share/nginx/html
 COPY 50x.html  /usr/share/nginx/html
 COPY nginx.conf /etc/nginx/conf.d/default.conf
 EXPOSE 80
diff --git a/nginx.conf b/nginx.conf
index 51c2b08..45a62ad 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -23,7 +23,7 @@
     
     # API 请求代理到后端
     location /api/ {
-        proxy_pass http://group1-backend:8080/;  # 后端服务地址
+        proxy_pass http://team1-backend:8080/;  # 后端服务地址
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
diff --git a/src/api/authApi.ts b/src/api/authApi.ts
index b28b04f..3a8eb17 100644
--- a/src/api/authApi.ts
+++ b/src/api/authApi.ts
@@ -1,3 +1,80 @@
+import axios from 'axios';
 
 
+ class authAPI {
+
+    // static getUserById(userId) {
+    //     // 例如 GET http://localhost:8080/123
+    //     return axios.get(`/${userId}`);
+    // }
+
+
+    // static updateUser(userId, data) {
+    //     // 例如 PUT http://localhost:8080/123  Body: { username: 'xxx', ... }
+    //     return axios.put(`/${userId}`, data);
+    // }
+    //
+    //
+    // static deleteUser(userId:string) {
+    //     // 例如 DELETE http://localhost:8080/123
+    //     return axios.delete(`/${userId}`);
+    // }
+
+
+    static sendVerificationCode(email: string) {
+        // Body: { email: 'xxx@yyy.com'}
+        return axios.post('/api/sendVerification', { email });
+    }
+
+
+    static sendResetCode(email: string) {
+        // Body: { email: 'xxx@yyy.com' }
+        return axios.post('/api/sendResetCode', { email });
+    }
+
+    //
+    // static resetPassword({ email, code, newPassword }) {
+    //     // Body: { email, code, newPassword }
+    //     return axios.post('/resetPassword', { email, code, newPassword });
+    // }
+    //
+    //
+    // static register({ username, email, verificationCode, password }) {
+    //     // Body: { username, email, verificationCode, password, identificationNumber? }
+    //     const body = {
+    //         username,
+    //         email,
+    //         verificationCode,
+    //         password,
+    //     };
+    //     return axios.post('/register', body);
+    // }
+    //
+    // /**
+    //  * 刷新 JWT Token(POST /refreshToken)
+    //  * @param {string} oldToken 旧的 JWT(放在 header: token)
+    //  * @returns {Promise<AxiosResponse>}
+    //  */
+    // static refreshToken(oldToken : string) {
+    //     // 因为后端是从 header 中读取旧 token,这里直接把 token 放进 headers
+    //     return axios.post(
+    //         '/refreshToken',
+    //         {}, // 请求体空
+    //         {
+    //             headers: {
+    //                 token: oldToken,
+    //             },
+    //         }
+    //     );
+    // }
+    //
+    //
+    // static login({ email, password } : {email: string, password:string}) {
+    //     // Body: { email, password }
+    //     return axios.post('/login', { email, password });
+    // }
+
+}
+
+export default authAPI;
 
diff --git a/src/api/interceptors.ts b/src/api/interceptors.ts
index 3b31740..f56a8d4 100644
--- a/src/api/interceptors.ts
+++ b/src/api/interceptors.ts
@@ -1,5 +1,4 @@
 import axios from "axios";
-import { useNavigate } from "react-router";
 
 // 为所有auth外请求添加token头
 axios.interceptors.request.use((config) => {
@@ -8,13 +7,11 @@
     config.url = requestUrl.replace("/auth/","/");
   } else {
     const token = localStorage.getItem('token');
-    if (!token) {
-      const navigate = useNavigate();
-      navigate("/login")
-    }
     config.headers['Authorization'] = `Bearer ${token}`;
   }
   return config;
 }, (error) => {
   return error;
-} );
\ No newline at end of file
+} );
+
+export default axios
\ No newline at end of file
diff --git a/src/feature/auth/Register.tsx b/src/feature/auth/Register.tsx
index 197d265..08edc70 100644
--- a/src/feature/auth/Register.tsx
+++ b/src/feature/auth/Register.tsx
@@ -1,7 +1,8 @@
 import { useEffect, useState } from 'react';
 import { LockOutlined, MailOutlined, NumberOutlined, UserOutlined } from '@ant-design/icons';
-import { Button, Checkbox, Form, Input, Space } from 'antd';
+import {Button, Checkbox, Form, Input, Space} from 'antd';
 import { NavLink } from 'react-router';
+import authApi from "../../api/authApi.ts";
 
 interface FormValues {
     name: string;
@@ -25,12 +26,16 @@
     }
 
     const sendVerificationCode = () => {
+        // 如果邮箱校验不通过,则触发表单校验提示,并中断
         if (!isValidEmail(emailValue)) {
-            form.validateFields(['email'])
+            form.validateFields(['email']);
             return;
         }
-        setCountdown(60)
-    }
+
+        // 发起 POST 请求到后端 /sendVerification
+        authApi.sendVerificationCode(emailValue).catch()
+        setCountdown(60);
+    };
 
     // 发送表单倒计时
     useEffect(() => {
diff --git a/src/main.tsx b/src/main.tsx
index e659723..31a6d39 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -11,6 +11,8 @@
 import { ConfigProvider } from 'antd';
 import zhCN from 'antd/locale/zh_CN';
 
+import "./api/interceptors.ts";
+
 import "./main.css"
 ReactDOM.createRoot(document.getElementById('root')!).render(
   <React.StrictMode>