mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
fix:增加检测到手机浏览器跳转h5页面,修改h5页面图标
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 159 KiB |
@@ -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
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user