init
This commit is contained in:
2025-06-27 17:42:38 +08:00
commit bd6402478b
5317 changed files with 785994 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
export function getEnvInfo(): ViteEnv {
const res: any = {};
const envInfo: Recordable = import.meta.env;
for (const envName of Object.keys(envInfo)) {
let realName = typeof envInfo[envName] == 'string' ? envInfo[envName].replace(/\\n/g, '\n') : envInfo[envName];
realName = realName === 'true' ? true : realName === 'false' ? false : realName;
if (envName === 'VITE_PORT') {
realName = Number(realName);
}
if (envName === 'VITE_PROXY' && realName) {
try {
realName = JSON.parse(realName.replace(/'/g, '"'));
} catch (error) {
realName = '';
}
}
res[envName] = realName;
}
return res;
}
// 判断是否显示身份证相关信息(JD项目不显示)返回true 则不为交大项目
export function isShowIdCard() {
const res = getEnvInfo();
return (res.VITE_PLATFORM !== 'JD') as boolean;
}
// 判断是否为青海
export function isQH() {
const res = getEnvInfo();
return (res.VITE_PLATFORM === 'QH') as boolean;
}
// 判断是否为油田
export function isYT() {
const res = getEnvInfo();
return (res.VITE_PLATFORM === 'YT') as boolean;
}
export function isShowNewLayout(v) {
if (getEnvInfo().VITE_PLATFORM !== 'YT') return false;
// const code: string = '/intervene24/index,/information,/archives/index';
const code: string = '*';
return code === '*' || (code.split(',').includes(v) && v);
}
export function isShowNewLayoutSpecial(v) {
if (getEnvInfo().VITE_PLATFORM !== 'YT') return false;
// const code: string = '/intervene24/index,/information,/archives/index';
// return !code.split(',').includes(v) && v;
return false;
}
// 判断是否为空,需过滤0
export function isNull(v) {
if (v != 0 && !v) return '-';
return v;
}