| | |
| | | |
| | | // 不同的环境变量配置 |
| | | // 如果是打包app,需要改这里,h5不需要改这里 |
| | | const development = { |
| | | VITE_APP_ENV:'development', |
| | | // 开发环境这里改为自己的 |
| | |
| | | VITE_API_BASE_URL: 'https://wrj.shuixiongit.com/api', |
| | | } |
| | | |
| | | // app打包要改这里 |
| | | const production = { |
| | | VITE_APP_ENV:'production', |
| | | VITE_APP_WEBVIEW_URL: 'https://wrj.shuixiongit.com/drone-app-web-view/#/webViewWrapper', |
| | | VITE_API_BASE_URL: 'https://wrj.shuixiongit.com/api', |
| | | VITE_APP_WEBVIEW_URL: 'https://aisky.org.cn/drone-app-web-view/#/webViewWrapper', |
| | | VITE_API_BASE_URL: 'https://aisky.org.cn/api', |
| | | } |
| | | |
| | | export default { |
| | |
| | | } |
| | | } |
| | | export function getEnvObj() { |
| | | const envName = JSON.parse(__APP_ENV__?.UNI_CUSTOM_DEFINE||null)?.ENV_NAME |
| | | return configEnv[envName || import.meta.env.VITE_APP_ENV] || {} |
| | | return configEnv[__APP_ENV__?.ENV_NAME] || {} |
| | | } |
| | | export function getWebViewUrl (targetUrl, otherParams) { |
| | | const userStore = useUserStore() |
| | |
| | | |
| | | const { UNI_PLATFORM,UNI_CUSTOM_DEFINE } = process.env |
| | | const ENV_NAME = UNI_CUSTOM_DEFINE && JSON.parse(UNI_CUSTOM_DEFINE)?.ENV_NAME |
| | | console.log("平台 -> ", UNI_PLATFORM) // 得到 mp-weixin, h5, app 等 |
| | | console.log("环境 -> ", ENV_NAME || 'development') // 得到 development,test 等 |
| | | const __APP_ENV__ = { |
| | | UNI_PLATFORM: UNI_PLATFORM, |
| | | ENV_NAME: ENV_NAME || 'development' |
| | | } |
| | | console.log("平台 -> ", __APP_ENV__.UNI_PLATFORM) // 得到 mp-weixin, h5, app 等 |
| | | console.log("环境 -> ", __APP_ENV__.ENV_NAME) // 得到 development,test 等 |
| | | |
| | | const env = loadEnv(mode, fileURLToPath(new URL("./env", import.meta.url))) |
| | | // console.log("环境变量 env -> ", env) |
| | | const isBuild = process.env.NODE_ENV === "production" |
| | | return { |
| | | define: { |
| | | __APP_ENV__: process.env, |
| | | __APP_ENV__, |
| | | }, |
| | | // 自定义env目录 |
| | | envDir: "./env", |
| | |
| | | hmr: true, |
| | | host: true, |
| | | open: true, |
| | | proxy: createViteProxy(env,ENV_NAME) |
| | | proxy: createViteProxy(env,__APP_ENV__.ENV_NAME) |
| | | }, |
| | | // 设置scss的api类型为modern-compiler |
| | | css: { |