新增 API 调试工具页面,支持填写 AppKey/Secret 测试开放接口
- 仅开发模式下管理员可见,菜单入口通过 import.meta.env.DEV 控制 - 浏览器端 Web Crypto API 计算 HMAC-SHA256 签名,与后端 BuildOpenV1Sign 一致 - 接口选择采用卡片式 Radio 列表,路径/查询/请求体参数动态生成 - AppKey/Secret 自动持久化到 localStorage,支持一键清除 - 展示签名详情(签名串/X-Sign)和完整响应
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
MenuUnfoldOutlined,
|
||||
ApiOutlined,
|
||||
ShopOutlined,
|
||||
BugOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { useAuth } from '../store/auth'
|
||||
import type { MenuProps } from 'antd'
|
||||
@@ -42,6 +43,11 @@ export default function MainLayout() {
|
||||
{ key: '/platform-merchants', icon: <ShopOutlined />, label: '商户管理' },
|
||||
{ key: '/open-api', icon: <ApiOutlined />, label: '开放接口' },
|
||||
)
|
||||
if (import.meta.env.DEV) {
|
||||
items.push(
|
||||
{ key: '/api-debug', icon: <BugOutlined />, label: 'API 调试' },
|
||||
)
|
||||
}
|
||||
}
|
||||
return items
|
||||
}, [isAdmin])
|
||||
|
||||
Reference in New Issue
Block a user