From 3fe0b8b6693d57f7480164f31c498f07b6a62cf0 Mon Sep 17 00:00:00 2001 From: rainv123 <2148537152@qq.com> Date: Fri, 5 Sep 2025 10:09:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E8=AE=BF=E9=97=AEweb=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E8=B7=B3=E8=BD=AC=E8=87=B3h5=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/.env.development | 6 +++++- main/manager-web/.env.production | 3 --- main/manager-web/src/App.vue | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/manager-web/.env.development b/main/manager-web/.env.development index 0a1de306..39647db6 100644 --- a/main/manager-web/.env.development +++ b/main/manager-web/.env.development @@ -1 +1,5 @@ -VUE_APP_API_BASE_URL=/xiaozhi \ No newline at end of file +VUE_APP_API_BASE_URL=/xiaozhi +#1.如需web后台适应手机浏览器,请先启动manager-api,得到服务端地址(http://局域网ip:8002/xiaozhi) +#2.在manager-mobile里的.env中,将VITE_SERVER_BASEURL修改成自己的服务端地址,然后运行pnpm dev:h5得到h5页面地址,再将其填入下方的VUE_APP_H5_URL +#3.此时手机浏览器访问web页面,即可跳转至适应手机浏览器的h5页面 +VUE_APP_H5_URL= \ No newline at end of file diff --git a/main/manager-web/.env.production b/main/manager-web/.env.production index 665ffe7f..f10c154a 100644 --- a/main/manager-web/.env.production +++ b/main/manager-web/.env.production @@ -1,7 +1,4 @@ VUE_APP_API_BASE_URL=/xiaozhi - VUE_APP_PUBLIC_PATH=/ # 是否开启CDN VUE_APP_USE_CDN=false - -VITE_H5_URL = https://2662r3426b.vicp.fun/h5/index.html \ No newline at end of file diff --git a/main/manager-web/src/App.vue b/main/manager-web/src/App.vue index 79b853c6..74ad2af8 100644 --- a/main/manager-web/src/App.vue +++ b/main/manager-web/src/App.vue @@ -60,10 +60,9 @@ export default { }; }, mounted() { - // 检测是否为移动设备,如果是则跳转到H5页面 - if (this.isMobileDevice()) { - const h5Url = process.env.VITE_H5_URL || 'https://2662r3426b.vicp.fun/h5/index.html'; - window.location.href = h5Url; + // 检测是否为移动设备且VUE_APP_H5_URL不为空,如果两个条件都满足则跳转到H5页面 + if (this.isMobileDevice() && process.env.VUE_APP_H5_URL) { + window.location.href = process.env.VUE_APP_H5_URL; return; }