Files
guilixu-admin/.workbuddy/memory/2026-07-18.md
赵忠林 2037b0699a feat(passport): 支持邮箱和用户ID登录合并账号登录
- LoginParam 接口新增 email 和 userId 字段
- 新增 loginByEmail 和 loginByUserId 接口调用,逻辑与 login 类似
- 登录页账号输入框改为 account,支持输入邮箱或用户ID
- 提交时根据账号格式(邮箱或纯数字)调用对应登录接口
- 校验规则改为校验 account 字段,格式不符时提示错误
- 手机号短信登录改用 loginBySuperAdminSms 接口替代 loginBySms
- 登录成功后保存租户ID和用户ID至 localStorage
- 优化登录页相关导入及逻辑,提升登录体验
2026-07-18 17:00:39 +08:00

41 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-07-18 工作日志
## 手机号登录改用 loginBySuperAdminSms 接口
### 改动文件
1. `src/api/passport/login/index.ts`
- 新增 `loginBySuperAdminSms()` 方法,调用 `/loginBySuperAdminSms` 接口
- 保留原有 `loginBySms()` 方法(其他页面如 register/dealer 仍在使用)
- 新方法逻辑与 `loginBySms` 一致:成功后 setToken + 存 TenantId/UserId
2. `src/views/passport/login/index.vue`
- import 替换:`loginBySms``loginBySuperAdminSms`
- `onLoginBySms()` 函数中调用替换:`loginBySms(form)``loginBySuperAdminSms(form)`
- 多租户选择逻辑(`listAdminsByPhoneAll`)保持不变
### 注意
- 仅改了管理后台登录页注册页面register/dealer仍用 `loginBySms`
## 账号登录合并邮箱/用户ID登录
### 需求
账号登录输入框同时支持「邮箱」和「用户ID」邮箱 → `https://server.websoft.top/api/loginByEmail`,纯数字 → `https://server.websoft.top/api/loginByUserId`
### 改动文件
1. `src/api/passport/login/model/index.ts`
- `LoginParam` 新增 `email?: string``userId?: string | number`
2. `src/api/passport/login/index.ts`
- 新增 `loginByEmail()` / `loginByUserId()`,逻辑同 `login()`setToken + 存 TenantId/UserId
3. `src/views/passport/login/index.vue`
- 表单字段 `userId``account`(新增 `LoginForm = User & { account?: string }` 类型)
- 输入框 placeholder 改为「邮箱 / 用户ID」form-item name 改为 `account`
- 校验规则 `userId``account`
- `submit()` 用正则判断邮箱(`/^[^\s@]+@[^\s@]+\.[^\s@]+$/`) / 纯数字(`/^\d+$/`)路由到对应接口格式不符提示「请输入正确的邮箱或用户ID」
- 移除未使用的 `login` 导入
### 注意
- 外部接口用绝对 URL`https://server.websoft.top/api/...`),未走 SERVER_API_URL 代理
- `vue-tsc` 全量检查仍有大量历史错误ByteMdEditor、shopActivity 等),本次改动无新增错误