fix:增加检测到手机浏览器跳转h5页面,修改h5页面图标

This commit is contained in:
rainv123
2025-09-04 09:32:53 +08:00
committed by ruoyemuzimi
parent 64c841d00a
commit b3a6ae2441
3 changed files with 16 additions and 1 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 159 KiB

+4 -1
View File
@@ -1,4 +1,7 @@
VUE_APP_API_BASE_URL=/xiaozhi
VUE_APP_PUBLIC_PATH=/
# 是否开启CDN
VUE_APP_USE_CDN=false
VUE_APP_USE_CDN=false
VITE_H5_URL = https://2662r3426b.vicp.fun/h5/index.html
+12
View File
@@ -60,6 +60,13 @@ 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;
return;
}
// 只有在启用CDN时才添加相关事件和功能
if (this.isCDNEnabled) {
// 添加全局快捷键Alt+C用于显示缓存查看器
@@ -101,6 +108,11 @@ export default {
this.showCacheViewer = true;
}
},
isMobileDevice() {
// 检测是否为移动设备的函数
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
},
async checkServiceWorkerStatus() {
// 检查Service Worker是否已注册
if ('serviceWorker' in navigator) {