feat(login): 集成飞书登录功能及其相关界面和路由支持
Some checks failed
Lint Code / Lint Code (push) Failing after 5m15s
Some checks failed
Lint Code / Lint Code (push) Failing after 5m15s
- 新增飞书登录API接口定义及请求方法 - 添加飞书登录相关的类型声明 - 本地多语言文件增加飞书登录文案(中英文) - 登录页面新增飞书登录视图和样式,支持扫码或授权登录 - 添加飞书登录状态控制、回调处理逻辑,支持token和用户信息存储 - 路由白名单增加飞书登录回调路径,避免权限拦截 - 登录页新增切换账号密码登录和飞书登录的切换按钮 - Vite配置新增本地api代理规则,便于接口联调测试
This commit is contained in:
33
src/api/feishu.ts
Normal file
33
src/api/feishu.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export type FeishuLoginResult = {
|
||||
code: number;
|
||||
message: string;
|
||||
data: {
|
||||
/** 是否登录成功 */
|
||||
isLogin: boolean;
|
||||
/** 用户ID */
|
||||
userId: string | number;
|
||||
/** 用户名 */
|
||||
username: string;
|
||||
/** 真实姓名 */
|
||||
realName: string;
|
||||
/** 头像 */
|
||||
avatar: string;
|
||||
/** 手机号 */
|
||||
phone: string;
|
||||
/** 邮箱 */
|
||||
email: string;
|
||||
/** token */
|
||||
token: string;
|
||||
/** token名称 */
|
||||
tokenName: string;
|
||||
};
|
||||
};
|
||||
|
||||
/** 飞书OAuth登录接口(前端回调后调用) */
|
||||
export const getFeishuLogin = (code: string) => {
|
||||
return http.request<FeishuLoginResult>("post", "/api/v1/auth/feishu/login", {
|
||||
params: { code }
|
||||
});
|
||||
};
|
||||
81
src/api/默认模块.openapi.json
Normal file
81
src/api/默认模块.openapi.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"openapi": "3.0.1",
|
||||
"info": {
|
||||
"title": "默认模块",
|
||||
"description": "",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"tags": [],
|
||||
"paths": {
|
||||
"/api/v1/auth/feishu/login": {
|
||||
"post": {
|
||||
"summary": "飞书OAuth登录接口(前端回调后调用)",
|
||||
"deprecated": false,
|
||||
"description": "前端从飞书回调中获取code,然后调用此接口完成登录",
|
||||
"tags": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"in": "query",
|
||||
"description": "飞书授权码",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BaseResponseMapObject",
|
||||
"description": "登录结果(包含token和用户信息)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"BaseResponseMapObject": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"description": ""
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"isLogin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"userId": {
|
||||
"$ref": "#/components/schemas/userId"
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
},
|
||||
"message": {
|
||||
"description": "",
|
||||
"type": "null"
|
||||
}
|
||||
}
|
||||
},
|
||||
"userId": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
},
|
||||
"responses": {},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"servers": [],
|
||||
"security": []
|
||||
}
|
||||
Reference in New Issue
Block a user