车辆管理系统-后台管理系统web
spring
3 天以前 9a11bff3d98aea29f37abc34a00a17f5c92ade9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// +----------------------------------------------------------------------
// | CMS [ CMS赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.CMS.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CMS并不是自由软件,未经许可不能去掉CMS相关版权
// +----------------------------------------------------------------------
// | Author: CMS Team <admin@CMS.com>
// +----------------------------------------------------------------------
 
// 请求接口地址
// 说明:生产环境下不希望使用“当前前端端口”,而应直接走后端端口 9031。
const DEFAULT_API_PORT = process.env.VUE_APP_API_PORT || 9031;
 
const VUE_APP_API_URL =
  process.env.VUE_APP_BASE_API ||
  (typeof location !== "undefined"
    ? `${location.protocol}//${location.hostname}:${DEFAULT_API_PORT}`
    : `http://127.0.0.1:${DEFAULT_API_PORT}`);
 
// 支持用户传入的 VUE_APP_BASE_API 已经包含 /api 的情况,避免拼成双 /api
const apiBaseURL = VUE_APP_API_URL.includes("/api")
  ? VUE_APP_API_URL.endsWith("/") ? VUE_APP_API_URL : `${VUE_APP_API_URL}/`
  : `${VUE_APP_API_URL.replace(/\/+$/, "")}/api/`;
 
const VUE_APP_WS_URL =
  process.env.VUE_APP_WS_URL ||
  (typeof location !== "undefined"
    ? `${
        location.protocol === "https" ? "wss" : "ws"
      }://${location.hostname}:${DEFAULT_API_PORT}`
    : `ws://127.0.0.1:${DEFAULT_API_PORT}`);
 
const SettingMer = {
  // 服务器地址
  httpUrl: VUE_APP_API_URL,
  // 接口请求地址
  apiBaseURL,
  // socket连接
  wsSocketUrl: VUE_APP_WS_URL,
};
 
export default SettingMer