queryConfig.js 2.7 KB
Newer Older
钟是志's avatar
钟是志 committed
1 2 3 4 5 6 7 8 9 10
/**
 * @param key 配置文件中 key
 * @author yyq
 * @version 0.0.1
 * @return 配置信息
 * @description
 * 当未传入key时返回config对象
 * 当key存在是且存在对应key值时返回key值 否则返回config对象
 * */
const queryConfig = (key) => {
11
	const dynamicConfig = typeof globalThis !== 'undefined' ? globalThis.CONFIG : window.CONFIG;
12 13
	if (typeof key === 'undefined') return dynamicConfig;
	return typeof dynamicConfig[key] === 'undefined' ? dynamicConfig : dynamicConfig[key];
钟是志's avatar
钟是志 committed
14 15 16 17 18
};

/**
 * @description 获取系统编码
 * */
19
export const querySysCode = () => queryConfig('SYSCODE');
钟是志's avatar
钟是志 committed
20 21 22 23

/**
 * @description 获取服务端请求路径前戳
 * */
24
export const queryOauthActionPath = () => queryConfig('OAUTH_ACTION_PATH');
钟是志's avatar
钟是志 committed
25 26 27 28

/**
 * @description 获取服务端请求路径前戳
 * */
29 30
export const queryPermActionPath = () => queryConfig('PERM_ACTION_PATH');
export const queryWsPath = () => queryConfig('WS_PATH');
钟是志's avatar
钟是志 committed
31 32 33 34

/**
 * @description 获取服务端请求路径前戳
 * */
35
export const queryApiActionPath = () => queryConfig('API_ACTION_PATH');
钟是志's avatar
钟是志 committed
36 37 38 39

/**
 * @description 获取文件上传地址
 * */
40
export const queryFileUploadActionPath = () => queryConfig('FILE_UPLOAD_ACTION_PATH');
钟是志's avatar
钟是志 committed
41 42 43 44

/**
 * @description 获取layout头部logo名称
 * */
45
export const queryLayoutHeaderLogo = () => queryConfig('LAYOUT_HEADER_LOGO');
钟是志's avatar
钟是志 committed
46 47 48 49

/**
 * @description 获取登录页面头部logo名称
 * */
50
export const queryLoginHeaderLogo = () => queryConfig('LOGIN_HEADER_LOGO');
钟是志's avatar
钟是志 committed
51 52 53 54

/**
 * @description 获取系统名称
 * */
55
export const querySystemName = () => queryConfig('SYSTEM_NAME');
钟是志's avatar
钟是志 committed
56 57 58 59

/**
 * @description 获取layout头部系统欢迎语
 * */
60
export const queryLayoutHeaderSystemWelcome = () => queryConfig('LAYOUT_HEADER_SYSTEM_WELCOME');
钟是志's avatar
钟是志 committed
61 62 63 64

/**
 * @description 获取layout类型
 * */
65
export const queryLayoutType = () => queryConfig('LAYOUT_TYPE');
钟是志's avatar
钟是志 committed
66 67 68 69

/**
 * @description 获取layout头部中间背景图片
 * */
70 71
export const queryLayoutHeaderCenterBackground = () =>
	queryConfig('LAYOUT_HEADER_CENTER_BACKGROUND');
钟是志's avatar
钟是志 committed
72 73 74 75

/**
 * @description 获取layout菜单底部背景图片
 * */
76
export const queryLayoutSiderFooterBackground = () => queryConfig('LAYOUT_SIDER_FOOTER_BACKGROUND');
钟是志's avatar
钟是志 committed
77 78 79 80

/**
 * @description 获取登录页面登录框旁背景图片
 * */
81
export const queryLoginBackground = () => queryConfig('LOGIN_BACKGROUND');
钟是志's avatar
钟是志 committed
82 83 84 85 86 87 88 89 90

/**
 * @description 获取动态图片前缀
 * */
export const queryDynamicImagePrefix = () => `${window.publicPath}images/dynamic/`;

/**
 * @description 获取配置项路由是否需要权限控制
 * */
91
export const queryCheckPath = () => queryConfig('CHECK_PATH');
钟是志's avatar
钟是志 committed
92 93 94 95

/**
 * @description 获取配置项路由是否需要权限控制
 * */
96
export const queryLoginRedirect = () => queryConfig('LOGIN_REDIRECT');
钟是志's avatar
钟是志 committed
97 98

export default queryConfig;