|
|
@ -6,13 +6,13 @@ |
|
|
|
* @create: 2022/4/8 |
|
|
|
* @create: 2022/4/8 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
import type { RouteLocationNormalized, RouteRecordNormalized } from 'vue-router'; |
|
|
|
import type {RouteLocationNormalized, RouteRecordNormalized} from 'vue-router'; |
|
|
|
import type { App, Component } from 'vue'; |
|
|
|
import type {App, Component} from 'vue'; |
|
|
|
import { unref } from 'vue'; |
|
|
|
import {unref} from 'vue'; |
|
|
|
import {isObject, isUrl} from '/@/utils/is'; |
|
|
|
import {isObject, isUrl} from '/@/utils/is'; |
|
|
|
import { isEmpty, cloneDeep } from 'lodash-es'; |
|
|
|
import {cloneDeep, isEmpty} from 'lodash-es'; |
|
|
|
import { isDevMode } from '/@/utils/env'; |
|
|
|
import {isDevMode} from '/@/utils/env'; |
|
|
|
import { useGlobSetting } from '/@/hooks/setting'; |
|
|
|
import {useGlobSetting} from '/@/hooks/setting'; |
|
|
|
|
|
|
|
|
|
|
|
const { apiUrl } = useGlobSetting(); |
|
|
|
const { apiUrl } = useGlobSetting(); |
|
|
|
export const noop = () => {}; |
|
|
|
export const noop = () => {}; |
|
|
@ -134,11 +134,11 @@ export const findListNameById = (id: string, list: any[], options: Partial<{ idF |
|
|
|
return ''; |
|
|
|
return ''; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取后端微服务代理地址 */ |
|
|
|
/** 获取后端微服务代理地址 */ |
|
|
|
export function getCloudProxyUrl(): string { |
|
|
|
export function getCloudProxyUrl(): string { |
|
|
|
let baseUrl = `${window.location.origin}${apiUrl}`; |
|
|
|
let baseUrl = `${window.location.origin}${apiUrl}`; |
|
|
|
if (isDevMode()) { |
|
|
|
if (isDevMode()) { |
|
|
|
|
|
|
|
// 开发环境支持公网地址,确保开发环境下支持多人共享文件预览
|
|
|
|
const proxy: [string[]] = JSON.parse(import.meta.env.VITE_PROXY); |
|
|
|
const proxy: [string[]] = JSON.parse(import.meta.env.VITE_PROXY); |
|
|
|
const api = proxy.find(item => item[0] == apiUrl) || []; |
|
|
|
const api = proxy.find(item => item[0] == apiUrl) || []; |
|
|
|
baseUrl = api[1]; |
|
|
|
baseUrl = api[1]; |
|
|
@ -148,3 +148,9 @@ export function getCloudProxyUrl(): string { |
|
|
|
|
|
|
|
|
|
|
|
/** 获取OSS代理地址 */ |
|
|
|
/** 获取OSS代理地址 */ |
|
|
|
export const getOSSProxyUrl = (url: string) => isUrl(url) ? url : `${apiUrl}${url}`; |
|
|
|
export const getOSSProxyUrl = (url: string) => isUrl(url) ? url : `${apiUrl}${url}`; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取授权客户端 */ |
|
|
|
|
|
|
|
export function getAuthClient(clientId: string): string[] { |
|
|
|
|
|
|
|
const authClient: [string[]] = JSON.parse(import.meta.env['VITE_AUTH_CLIENT']); |
|
|
|
|
|
|
|
return authClient.find(item => item[0] == clientId) || []; |
|
|
|
|
|
|
|
} |
|
|
|