这是一个完整的登录注册应用,包含Web端和后端模拟服务,实现了用户登录、注册、忘记密码和用户个人中心等功能。
/workspace/ ├── frontend/ # Web端项目 │ ├── src/ │ │ ├── components/ # 公共组件 │ │ │ ├── phone-input/ # 手机号输入组件 │ │ │ ├── code-input/ # 验证码输入组件 │ │ │ └── avatar-upload/ # 头像上传组件 │ │ ├── pages/ # 页面组件 │ │ │ ├── login/ # 登录页面 │ │ │ ├── register/ # 注册页面 │ │ │ ├── forgot-password/ # 忘记密码页面 │ │ │ └── profile/ # 个人中心页面 │ │ ├── router/ # 路由配置 │ │ ├── store/ # 状态管理 │ │ ├── styles/ # 全局样式 │ │ ├── utils/ # 工具函数 │ │ ├── App.vue # 根组件 │ │ └── main.js # 入口文件 │ ├── package.json # 项目依赖配置 │ └── vite.config.js # 构建配置 ├── mock-server.js # 后端模拟服务 ├── package.json # 后端依赖配置 └── README.md # 项目说明文档
# 安装前端依赖
cd frontend
npm install
# 安装后端模拟服务依赖
cd ..
npm install express cors
# 启动后端模拟服务(端口3001)
node mock-server.js
# 启动前端开发服务器(端口3000)
cd frontend
npm run dev
打开浏览器访问: http://localhost:3000
后端模拟服务提供了以下API接口:
POST /auth/send-code - 发送验证码POST /auth/login - 手机号验证码登录POST /auth/register - 用户注册POST /auth/reset-password - 重置密码GET /user/profile - 获取用户信息PUT /user/profile - 更新用户信息