设备点检记录新增
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
import { merge, random } from 'lodash-es';
|
||||
import { isArray } from '/@/utils/is';
|
||||
import { FormSchema } from '/@/components/Form';
|
||||
@@ -14,11 +13,10 @@ import { useI18n } from "@/hooks/web/useI18n";
|
||||
import {$electron} from "@/electron";
|
||||
import {router} from "@/router";
|
||||
import {encryptByBase64} from "@/utils/cipher";
|
||||
import { resolveApiBaseUrl } from '/@/utils/env/apiBaseUrl';
|
||||
//存放部门路径的数组
|
||||
const departNamePath = ref<Record<string, string>>({});
|
||||
|
||||
const globSetting = useGlobSetting();
|
||||
const baseApiUrl = globSetting.domainUrl;
|
||||
/**
|
||||
* 获取文件服务访问路径
|
||||
* @param fileUrl 文件路径
|
||||
@@ -31,10 +29,10 @@ export const getFileAccessHttpUrl = (fileUrl, prefix = 'http') => {
|
||||
//判断是否是数组格式
|
||||
let isArray = fileUrl.indexOf('[') != -1;
|
||||
if (!isArray) {
|
||||
let prefix = `${baseApiUrl}/sys/common/static/`;
|
||||
const staticPrefix = `${resolveApiBaseUrl()}/sys/common/static/`;
|
||||
// 判断是否已包含前缀
|
||||
if (!fileUrl.startsWith(prefix)) {
|
||||
result = `${prefix}${fileUrl}`;
|
||||
if (!fileUrl.startsWith(staticPrefix)) {
|
||||
result = `${staticPrefix}${fileUrl}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
jeecgboot-vue3/src/utils/env/apiBaseUrl.ts
vendored
Normal file
18
jeecgboot-vue3/src/utils/env/apiBaseUrl.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
|
||||
/**
|
||||
* 后端 API 根地址(含 servlet.context-path,如 /jeecg-boot)
|
||||
* 开发环境 VITE_GLOB_DOMAIN_URL 常为 http://host:port,需与 VITE_GLOB_API_URL 拼接
|
||||
*/
|
||||
export function resolveApiBaseUrl(): string {
|
||||
const { domainUrl, apiUrl } = useGlobSetting();
|
||||
const domain = (domainUrl || '').replace(/\/$/, '');
|
||||
const api = apiUrl || '';
|
||||
if (!domain) {
|
||||
return api;
|
||||
}
|
||||
if (!api || domain.endsWith(api) || domain.includes(`${api}/`)) {
|
||||
return domain;
|
||||
}
|
||||
return `${domain}${api}`;
|
||||
}
|
||||
Reference in New Issue
Block a user