diff --git a/.env.front b/.env.front index daf9d788..5a35a843 100644 --- a/.env.front +++ b/.env.front @@ -15,7 +15,7 @@ VITE_DROP_CONSOLE = false # 接口地址 # 如果没有跨域问题,直接在这里配置即可 -VITE_GLOB_API_URL = "http://localhost:48080/admin-api" +VITE_GLOB_API_URL = "http://api-dashboard.yudao.iocoder.cn/admin-api" # 文件上传接口 可选 VITE_GLOB_UPLOAD_URL = /upload diff --git a/package.json b/package.json index 694334e7..e42db59c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "bootstrap": "pnpm install", "serve": "npm run dev", "dev": "vite", + "front": "vite --mode front", "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", "build:test": "cross-env vite build --mode test && esno ./build/script/postBuild.ts", "build:no-cache": "pnpm clean:cache && npm run build", diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index 51fc4b86..cec59ae0 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -4,8 +4,15 @@ import { warn } from '@/utils/log' import { getAppEnvConfig } from '@/utils/env' export const useGlobSetting = (): Readonly => { - const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL } = - getAppEnvConfig() + const { + VITE_GLOB_APP_TITLE, + VITE_GLOB_API_URL, + VITE_GLOB_APP_SHORT_NAME, + VITE_GLOB_API_URL_PREFIX, + VITE_GLOB_UPLOAD_URL, + VITE_GLOB_APP_TENANT_ENABLE, + VITE_GLOB_APP_CAPTCHA_ENABLE + } = getAppEnvConfig() if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { warn( @@ -19,7 +26,9 @@ export const useGlobSetting = (): Readonly => { apiUrl: VITE_GLOB_API_URL, shortName: VITE_GLOB_APP_SHORT_NAME, urlPrefix: VITE_GLOB_API_URL_PREFIX, - uploadUrl: VITE_GLOB_UPLOAD_URL + uploadUrl: VITE_GLOB_UPLOAD_URL, + tenantEnable: VITE_GLOB_APP_TENANT_ENABLE, + captchaEnable: VITE_GLOB_APP_CAPTCHA_ENABLE } return glob as Readonly } diff --git a/src/utils/env.ts b/src/utils/env.ts index e74f69c1..1d816e9e 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -22,7 +22,15 @@ export function getAppEnvConfig() { (import.meta.env as unknown as GlobEnvConfig) : window[ENV_NAME as any]) as unknown as GlobEnvConfig - const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL } = ENV + const { + VITE_GLOB_APP_TITLE, + VITE_GLOB_API_URL, + VITE_GLOB_APP_SHORT_NAME, + VITE_GLOB_API_URL_PREFIX, + VITE_GLOB_UPLOAD_URL, + VITE_GLOB_APP_TENANT_ENABLE, + VITE_GLOB_APP_CAPTCHA_ENABLE + } = ENV if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) { warn( @@ -35,7 +43,9 @@ export function getAppEnvConfig() { VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, - VITE_GLOB_UPLOAD_URL + VITE_GLOB_UPLOAD_URL, + VITE_GLOB_APP_TENANT_ENABLE, + VITE_GLOB_APP_CAPTCHA_ENABLE } }