UNPKG

@jdlinker/linker

Version:

jdLinker 系统模块

60 lines (51 loc) 1.5 kB
import { defHttp, useGlobSetting } from '@jdlinker/func'; const glob = useGlobSetting(); export const FILE_UPLOAD = `${glob.uploadUrl}/accessory/uploadFile2`; /** * 获取文件服务访问路径 * @param avatar * @param subStr * @returns {*} */ export const getFileAccessHttpUrl = (avatar, subStr) => { if (!subStr) subStr = 'http'; if (avatar && avatar.startsWith(subStr)) { return avatar; } else { if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) { // return window._CONFIG['staticDomainURL'] + '/' + avatar return window.location.origin + '/' + avatar; } } }; /** * 保存查询记录 * @param data * @param target */ export const saveSearchHistory = (data: any, target: string) => defHttp.post({ url: `/user/settings/${target}`, data }); /** * 获取查询记录 * @param target */ export const getSearchHistory = (target: string) => defHttp.get<any[]>({ url: `/user/settings/${target}` }); /** * 删除指定查询记录 * @param id * @param target */ export const deleteSearchHistory = (target: string, id: string) => defHttp.delete<any[]>({ url: `/user/settings/${target}/${id}` }); /** * 获取当前系统版本 */ export const systemVersion = () => defHttp.get<{ edition?: string }>({ url: '/system/version' }); /** * 聚合查询 * @param data * @returns */ export const queryDashboard = (data: Record<string, any>) => defHttp.post({ url: `/dashboard/_multi`, data }, { isTransformResponse: false });