Commit 181c3e52 authored by Allen Bai's avatar Allen Bai

feat: 内置环境判断

parent dbd2e16b
...@@ -115,6 +115,13 @@ const defaultBoardStyles: Optional<CSSStyleDeclaration> = { ...@@ -115,6 +115,13 @@ const defaultBoardStyles: Optional<CSSStyleDeclaration> = {
let currentTaskId = null let currentTaskId = null
function getEnv() {
let isTest = window.location.host.indexOf('test.') != -1
let isPre = window.location.host.indexOf('pre.') != -1
let env = isTest ? 'test' : isPre ? 'pre' : undefined
return env
}
/** /**
* 挂载 * 挂载
* @param {IPCFooterOptions} opts * @param {IPCFooterOptions} opts
...@@ -128,14 +135,14 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) { ...@@ -128,14 +135,14 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
let IPCNumberString = '' let IPCNumberString = ''
try { try {
IPCNumberString = (await getIPCByDomain(opts.domain || location.host, opts.env)) as string IPCNumberString = (await getIPCByDomain(opts.domain || location.host, opts.env || getEnv())) as string
} catch (err) { } catch (err) {
console.log('备案号获取失败') console.log('备案号获取失败')
} }
// 预发环境的接口取不到ipc备案信息 // 预发环境的接口取不到ipc备案信息
// 所以,预发的备案信息写死 // 所以,预发的备案信息写死
if (opts.env == 'pre') { if ((opts.env || getEnv()) == 'pre') {
IPCNumberString = '预发IPC备案号-写死' IPCNumberString = '预发IPC备案号-写死'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment