From 9a11bff3d98aea29f37abc34a00a17f5c92ade9c Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 02 四月 2026 17:50:36 +0800
Subject: [PATCH] fix: 扫码路径ip修改
---
src/views/vehicle/registration/index.vue | 2 +-
vue.config.js | 4 +++-
src/views/vehicle/queuing/index.vue | 2 +-
src/utils/settingMer.js | 32 ++++++++++++++++++++++++++------
4 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/utils/settingMer.js b/src/utils/settingMer.js
index e2d59f4..730a127 100644
--- a/src/utils/settingMer.js
+++ b/src/utils/settingMer.js
@@ -8,16 +8,36 @@
// | Author: CMS Team <admin@CMS.com>
// +----------------------------------------------------------------------
-// 璇锋眰鎺ュ彛鍦板潃 濡傛灉娌℃湁閰嶇疆鑷姩鑾峰彇褰撳墠缃戝潃璺緞
-const VUE_APP_API_URL = process.env.VUE_APP_BASE_API || `${location.origin}`
-const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || (location.protocol === 'https' ? 'wss' : 'ws') + ':' + location.hostname
+// 璇锋眰鎺ュ彛鍦板潃
+// 璇存槑锛氱敓浜х幆澧冧笅涓嶅笇鏈涗娇鐢ㄢ�滃綋鍓嶅墠绔鍙b�濓紝鑰屽簲鐩存帴璧板悗绔鍙� 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: VUE_APP_API_URL + '/api/',
+ apiBaseURL,
// socket杩炴帴
- wsSocketUrl: VUE_APP_WS_URL
-}
+ wsSocketUrl: VUE_APP_WS_URL,
+};
export default SettingMer
diff --git a/src/views/vehicle/queuing/index.vue b/src/views/vehicle/queuing/index.vue
index 60eadcb..b65d01f 100644
--- a/src/views/vehicle/queuing/index.vue
+++ b/src/views/vehicle/queuing/index.vue
@@ -554,7 +554,7 @@
newEl.registerTime = res.registerTime || "-";
newEl.remark = res.remark || "-";
// newEl.url = `https://car-manager.truekey.mobi/driver/javaMobile/queryResult/${res.linkCode}`;
- newEl.url = `http://1.15.17.182:9031/driver/javaMobile/queryResult/${res.linkCode}`;
+ newEl.url = `http://1.15.17.182:9033/driver/javaMobile/queryResult/${res.linkCode}`;
newEl.visible = true;
setTimeout(() => {
diff --git a/src/views/vehicle/registration/index.vue b/src/views/vehicle/registration/index.vue
index bf40b63..fc3b67a 100644
--- a/src/views/vehicle/registration/index.vue
+++ b/src/views/vehicle/registration/index.vue
@@ -725,7 +725,7 @@
newEl.registerTime = element.registerTime || "-";
newEl.remark = element.remark || "-";
// newEl.url = `https://car-manager.truekey.mobi/driver/javaMobile/queryResult/${element.linkCode}`;
- newEl.url = `http://1.15.17.182:9031/driver/javaMobile/queryResult/${element.linkCode}`;
+ newEl.url = `http://1.15.17.182:9033/driver/javaMobile/queryResult/${element.linkCode}`;
newEl.visible = true;
printArr.push(newEl);
}
diff --git a/vue.config.js b/vue.config.js
index 5822a18..c152171 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -35,7 +35,9 @@
"@babel",
"resize-detector",
],
- publicPath: "/",
+ // 閮ㄧ讲鍒板瓙璺緞鏃堕渶瑕佹敼 publicPath锛屽惁鍒欓潤鎬佽祫婧愪細浠庡煙鍚嶆牴鐩綍 `/static/...` 鑾峰彇澶辫触
+ // 渚嬪閮ㄧ讲鍒� `http://host/car-before/`锛屽垯鎵撳寘鏃惰缃� VUE_APP_PUBLIC_PATH=/car-before/
+ publicPath: process.env.VUE_APP_PUBLIC_PATH || "/",
outputDir: "dist",
assetsDir: "static",
// 鍦ㄩ儴鍒嗙幆澧冧笅 eslint-loader 浼氬洜閰嶇疆瑙f瀽澶辫触鐩存帴瀵艰嚧鏋勫缓涓柇
--
Gitblit v1.9.3