吉安感知网项目-前端
罗广辉
2026-03-31 1b9d89101368c6e5cf7d1e0e47ed3652dff804e8
feat: 生产环境api地址
3 files modified
16 ■■■■ changed files
applications/drone-command/env/.env 4 ●●● patch | view | raw | blame | history
applications/drone-command/env/.env.development 1 ●●●● patch | view | raw | blame | history
applications/drone-command/src/axios.js 11 ●●●● patch | view | raw | blame | history
applications/drone-command/env/.env
@@ -15,6 +15,8 @@
VITE_APP_TERRAIN_URL=https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_c_uas/
#父系统
VITE_APP_PARENT_SYSTEM=http://219.146.74.42:8015/drone-web
#生产环境base api
VITE_APP_PROD_BASE_API=http://172.18.10.4:180
applications/drone-command/env/.env.development
@@ -3,7 +3,6 @@
#开发环境配置
VITE_APP_ENV='development'
#开发环境代理地址(推荐本地新建文件 .env.development.local 来进行覆盖)
# VITE_APP_URL=https://wrj.shuixiongit.com/api
VITE_APP_URL=http://192.168.1.168
applications/drone-command/src/axios.js
@@ -17,12 +17,16 @@
import { Base64 } from 'js-base64'
import { baseUrl } from '@/config/env'
import crypto from '@/utils/crypto'
const { VITE_APP_ENV,VITE_APP_PROD_BASE_API } = import.meta.env
// 全局未授权错误提示状态,只提示一次
let isErrorShown = false
let _retry = false
// 超时时间设置为10分钟,部分接口上传比较慢,如固件上传
axios.defaults.timeout = 600000
//返回其他状态码
axios.defaults.validateStatus = function (status) {
  return status >= 200 && status <= 500 // 默认的
@@ -38,8 +42,11 @@
    isErrorShown = false
    //地址为已经配置状态则不添加前缀
    if (!isURL(config.url) && !config.url.startsWith(baseUrl)) {
      config.url = baseUrl + config.url
      config.url = VITE_APP_ENV === 'development'
                ? baseUrl + config.url
                : VITE_APP_PROD_BASE_API + baseUrl + config.url
    }
    //安全请求header
    config.headers['areaCode'] = config?.params?.areaCode || store?.state?.user?.userInfo?.detail?.areaCode
    config.headers['Blade-Requested-With'] = 'BladeHttpRequest'