diff --git a/locales/en.yaml b/locales/en.yaml index 651ff31..7ff11b5 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -220,6 +220,7 @@ login: pureAlipayLogin: Alipay Login pureQQLogin: QQ Login pureWeiBoLogin: Weibo Login + pureFeishuLogin: Feishu Login purePhone: Phone pureSmsVerifyCode: SMS VerifyCode pureBack: Back diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index f89dcf8..c6b318b 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -220,6 +220,7 @@ login: pureAlipayLogin: 支付宝登录 pureQQLogin: QQ登录 pureWeiBoLogin: 微博登录 + pureFeishuLogin: 飞书登录 purePhone: 手机号码 pureSmsVerifyCode: 短信验证码 pureBack: 返回 diff --git a/src/api/feishu.ts b/src/api/feishu.ts new file mode 100644 index 0000000..2456620 --- /dev/null +++ b/src/api/feishu.ts @@ -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("post", "/api/v1/auth/feishu/login", { + params: { code } + }); +}; diff --git a/src/api/默认模块.openapi.json b/src/api/默认模块.openapi.json new file mode 100644 index 0000000..2084c28 --- /dev/null +++ b/src/api/默认模块.openapi.json @@ -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": [] +} diff --git a/src/router/index.ts b/src/router/index.ts index b92a529..290d74d 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -116,7 +116,7 @@ export function resetRouter() { } /** 路由白名单 */ -const whiteList = ["/login"]; +const whiteList = ["/login", "/auth/callback"]; const { VITE_HIDE_HOME } = import.meta.env; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index f6c0d64..8fc7575 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,7 +1,7 @@