# node.js前端 **Repository Path**: shou21/node.js-frontend ## Basic Information - **Project Name**: node.js前端 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-06-17 - **Last Updated**: 2026-06-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SmartTodo 前端使用文档 本仓库是 SmartTodo 的前端项目,基于 Vue 3、Vite、Vue Router、Axios 实现登录注册、任务管理、个人信息和头像上传。 配套后端仓库: ```txt https://gitee.com/shou21/node.js-5.git ``` ## 环境要求 - Node.js 18 或以上 - npm - 已启动 SmartTodo 后端服务 后端默认地址: ```txt http://localhost:3000/api ``` ## 1. 克隆项目 ```bash git clone https://gitee.com/shou21/node.js-frontend.git cd node.js-frontend ``` ## 2. 安装依赖 ```bash npm install ``` ## 3. 启动后端 前端依赖后端接口,请先启动后端项目: ```bash git clone https://gitee.com/shou21/node.js-5.git cd node.js-5 npm install npm start ``` 后端启动成功后应能访问: ```txt http://localhost:3000 ``` ## 4. 启动前端 回到前端目录: ```bash cd node.js-frontend npm run dev ``` 浏览器打开: ```txt http://localhost:5173 ``` ## 使用流程 1. 打开 `http://localhost:5173` 2. 注册一个新账号 3. 登录账号 4. 在任务页新增、编辑、删除、完成 Todo 5. 进入个人信息页修改昵称或上传头像 ## 页面路由 ```txt /login 登录页 /register 注册页 /todos 任务主页 /profile 个人信息页 ``` ## 接口配置 前端请求配置在: ```txt src/api/request.js ``` 默认接口地址: ```js baseURL: 'http://localhost:3000/api' ``` 如果后端端口改变,需要同步修改这里的地址。 ## 常见问题 页面打不开 确认前端是否已经启动,并访问 Vite 输出的地址,默认是 `http://localhost:5173`。 登录或注册失败 确认后端是否已经启动,并能访问 `http://localhost:3000`。 接口请求失败或跨域报错 确认后端项目正在运行。后端已经配置 `cors`,正常情况下不需要额外配置代理。 头像上传失败 确认后端的 `uploads` 目录存在,并且后端服务有写入权限。