1.9 KiB
1.9 KiB
| name | description |
|---|---|
| jjb-base-system-info | 定义 JJB 底座 systemInfo、themeConfig 系统信息对象。在获取租户ID、主题配置时查阅。 |
底座平台API调用规范
系统信息对象
base.systemInfo
获取系统信息对象(同步获取)。
类型定义:
interface systemInfo {
baseTenantId: string; // 租户ID
clientId: string; // 终端ID
orgId: string; // 机构/组织ID
redirect: string; // 退出登录重定向地址
}
使用示例:
if (typeof window.__IN_BASE__ !== 'undefined') {
const systemInfo = base.systemInfo;
console.log('租户ID:', systemInfo.baseTenantId);
console.log('终端ID:', systemInfo.clientId);
console.log('机构ID:', systemInfo.orgId);
console.log('退出登录重定向地址:', systemInfo.redirect);
}
base.themeConfig
获取系统主题配置对象(同步获取)。
类型定义:
interface themeConfig {
algorithm: string; // 主题算法,参考 https://ant-design.antgroup.com/docs/react/customize-theme-cn#基本算法algorithm
borderRadius: string; // 圆角
colorPrimary: string; // 品牌色
}
使用示例:
if (typeof window.__IN_BASE__ !== 'undefined') {
const themeConfig = base.themeConfig;
console.log('主题算法:', themeConfig.algorithm);
console.log('圆角:', themeConfig.borderRadius);
console.log('品牌色:', themeConfig.colorPrimary);
// 使用主题配置
import { ConfigProvider } from 'antd';
import { theme } from 'antd';
const algorithm = themeConfig.algorithm === 'darkAlgorithm'
? theme.darkAlgorithm
: theme.defaultAlgorithm;
<ConfigProvider
theme={{
algorithm,
token: {
borderRadius: parseInt(themeConfig.borderRadius),
colorPrimary: themeConfig.colorPrimary,
},
}}
>
{/* 应用内容 */}
</ConfigProvider>
}