Files
x-server-mobile/frontend/src/router/index.tsx
T
root 4667590feb fix: 修复飞书免登功能,添加 H5 JSSDK 和 appId 自动获取
后端改动:
- 新增 /api/v1/auth/feishu-config 接口,根据 company 参数返回对应 appId

前端改动:
- 添加飞书 H5 JSSDK (h5-js-sdk-1.5.19.js)
- 修改登录页免登逻辑:先从后端获取 appId,再调用 tt.requestAuthCode
- 新增飞书环境检测测试页面 (/feishu-env-test)
- 移除测试页面的自动轮询逻辑

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 08:58:51 +08:00

54 lines
2.5 KiB
TypeScript

import { createBrowserRouter, Navigate } from 'react-router-dom'
import MobileLayout from '@/components/layout/MobileLayout'
import Dashboard from '@/pages/dashboard'
import Profile from '@/pages/profile'
import Settings from '@/pages/settings'
import ChangePassword from '@/pages/change-password'
import BusinessTripList from '@/pages/business-trip/list'
import BusinessTripApply from '@/pages/business-trip/apply'
import BusinessTripDetail from '@/pages/business-trip/detail'
import SelectApprover from '@/pages/business-trip/select-approver'
import SelectCc from '@/pages/business-trip/select-cc'
import ApprovalList from '@/pages/approval/list'
import ApprovalDetail from '@/pages/approval/detail'
import QuickAction from '@/pages/approval/quick-action'
import RejectPage from '@/pages/approval/reject'
import Login from '@/pages/login'
import SimpleLogin from '@/pages/login-simple'
import DebugFeishu from '@/pages/debug-feishu'
import FeishuEnvTest from '@/pages/feishu-env-test'
const router = createBrowserRouter([
{
path: '/',
element: <MobileLayout />,
children: [
{ index: true, element: <Navigate to='/dashboard' replace /> },
{ path: 'dashboard', element: <Dashboard /> },
{ path: 'profile', element: <Profile /> },
{ path: 'settings', element: <Settings /> },
{ path: 'change-password', element: <ChangePassword /> },
{ path: 'business-trip', element: <BusinessTripList /> },
{ path: 'business-trip/apply', element: <BusinessTripApply /> },
{ path: 'business-trip/apply/select-approver', element: <SelectApprover /> },
{ path: 'business-trip/apply/select-cc', element: <SelectCc /> },
{ path: 'business-trip/detail/:id', element: <BusinessTripDetail /> },
{ path: 'business-trip/:id', element: <BusinessTripDetail /> },
{ path: 'approval', element: <ApprovalList /> },
{ path: 'approval/:id', element: <ApprovalDetail /> },
],
},
// 详情页移到顶层,支持未登录访问(页面自己处理登录检查)
{ path: '/approval/detail/:id', element: <ApprovalDetail /> },
{ path: '/business-trip/detail/:id', element: <BusinessTripDetail /> },
{ path: '/login', element: <Login /> },
{ path: '/login-simple', element: <SimpleLogin /> },
{ path: '/debug-feishu', element: <DebugFeishu /> },
{ path: '/feishu-env-test', element: <FeishuEnvTest /> },
{ path: '/approval/quick-action', element: <QuickAction /> },
{ path: '/approval/reject', element: <RejectPage /> },
{ path: '*', element: <Navigate to='/login' replace /> },
])
export default router