feat: 2026-07-11 全量更新 - 代办集成+会议室预定+知识迭代修复+UI统一+Bug修复
== 已部署上线 (9项) == - 代办事项真实数据源集成 (企微审批API 8bug修复链) - H5/坐席端 Logo样式统一+绿色背景 - 视频引导页修复 (localStorage key v2) - 坐席端 v9 Vue版本修复 (ElMessage._context) - 截图按钮 v10 修复 (getDisplayMedia user gesture) - 扫码样式恢复+H5扫码登录跳转修复 - H5截图快捷键提示 == 代码完成待部署 (3项) == - 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查) - 会议室预定-小鱼易联终端 (40文件, 40/40测试通过) - IT资产升级审批推送 (asset_service.py) == 需求文档 (2项) == - 坐席端AI辅助消息框-PRD (4项新功能确认) - 坐席端布局优化建议 v2.0 (7天计划) == 新增文档 == - 日报-2026-07-11.md - 知识迭代Bug修复报告-20260711.md - 会议室预定-部署指南.md - CHANGELOG.md 更新 == 测试 == - test_todo_integration.py: 40/40 - test_meetingroom.py: 40/40 - test_bugfix_ki_suggestions.py: 21/21
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
// =============================================================================
|
||||
// 企微IT智能服务台 — 统一认证 API 模块
|
||||
// =============================================================================
|
||||
// 说明:三端(H5/坐席/管理)共用同一套认证API
|
||||
// API 设计文档:docs/03-技术架构/02-技术方案/技术方案-认证API设计.md
|
||||
// =============================================================================
|
||||
|
||||
import apiClient from './index'
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// 类型定义
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/** 用户信息 */
|
||||
export interface UserInfo {
|
||||
userid: string
|
||||
name: string
|
||||
role: string
|
||||
avatar?: string
|
||||
department?: string
|
||||
phone?: string
|
||||
email?: string
|
||||
corp_name?: string
|
||||
}
|
||||
|
||||
/** 二维码响应 */
|
||||
export interface QrcodeResponse {
|
||||
qrcode_url: string
|
||||
qrcode_png_base64: string
|
||||
ticket: string
|
||||
expires_in: number
|
||||
expires_at?: string
|
||||
}
|
||||
|
||||
/** 扫码状态响应 */
|
||||
export interface ScanStatusResponse {
|
||||
status: 'waiting' | 'scanned' | 'confirmed' | 'expired' | 'cancelled'
|
||||
user_info?: UserInfo
|
||||
token?: string
|
||||
is_new_user?: boolean
|
||||
}
|
||||
|
||||
/** OAuth2 回调响应 */
|
||||
export interface OAuthCallbackResponse {
|
||||
token: string
|
||||
user_info: UserInfo
|
||||
is_new_user: boolean
|
||||
}
|
||||
|
||||
/** 绑定请求 */
|
||||
export interface BindRequest {
|
||||
employee_id: string
|
||||
corp_id?: string
|
||||
bind_type?: 'existing' | 'new'
|
||||
employee_no?: string
|
||||
real_name?: string
|
||||
department?: string
|
||||
phone?: string
|
||||
}
|
||||
|
||||
/** 绑定响应 */
|
||||
export interface BindResponse {
|
||||
token: string
|
||||
user_info: UserInfo
|
||||
}
|
||||
|
||||
/** 验证 Token 响应 */
|
||||
export interface VerifyResponse {
|
||||
valid: boolean
|
||||
user_info: UserInfo
|
||||
expire_at: string
|
||||
}
|
||||
|
||||
/** 当前用户响应 */
|
||||
export interface MeResponse extends UserInfo {}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// API 函数
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 获取扫码登录二维码
|
||||
* 生成登录二维码,供企微外用户扫描
|
||||
*/
|
||||
export async function getQrcode(): Promise<QrcodeResponse> {
|
||||
return apiClient.get('/auth/qrcode')
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮询查询扫码状态
|
||||
* 客户端轮询此接口查询用户扫码结果
|
||||
* @param ticket - 扫码登录票据
|
||||
*/
|
||||
export async function getScanStatus(ticket: string): Promise<ScanStatusResponse> {
|
||||
return apiClient.get('/auth/scan/status', { params: { ticket } })
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 OAuth2 回调
|
||||
* 企微内打开页面时,通过OAuth2获取userid
|
||||
* @param code - 企微授权码
|
||||
* @param state - 随机state,防止CSRF
|
||||
*/
|
||||
export async function handleOAuthCallback(
|
||||
code: string,
|
||||
state?: string
|
||||
): Promise<OAuthCallbackResponse> {
|
||||
return apiClient.get('/auth/oauth2/callback', {
|
||||
params: { code, state },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号绑定
|
||||
* 互联企业用户扫码后无本地记录,绑定已有账号或申请新账号
|
||||
*/
|
||||
export async function bindAccount(data: BindRequest): Promise<BindResponse> {
|
||||
return apiClient.post('/auth/bind', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证 Token
|
||||
* 验证Token有效性,续期
|
||||
* @param token - 要验证的 Token 字符串
|
||||
*/
|
||||
export async function verifyToken(token: string): Promise<VerifyResponse> {
|
||||
return apiClient.post('/auth/verify', { token })
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出
|
||||
* 清除Token
|
||||
*/
|
||||
export async function logout(): Promise<void> {
|
||||
return apiClient.post('/auth/logout')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
* 获取已登录用户详情
|
||||
*/
|
||||
export async function getCurrentUser(): Promise<MeResponse> {
|
||||
return apiClient.get('/auth/me')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 OAuth2 授权 URL
|
||||
* 用于企微内自动跳转授权
|
||||
* @param redirect_uri - 授权成功后的回调地址
|
||||
*/
|
||||
export async function getOAuthAuthorizeUrl(redirect_uri: string): Promise<{ authorize_url: string }> {
|
||||
return apiClient.get('/auth/oauth2/url', { params: { redirect_uri } })
|
||||
}
|
||||
Reference in New Issue
Block a user