|
|
|
@ -42,3 +42,17 @@ import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
|
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
|
|
|
|
app.component(key, component) |
|
|
|
|
} |
|
|
|
|
const ua = navigator.userAgent.toLowerCase() |
|
|
|
|
const isMobile = /iphone|android|ipad|mobile/.test(ua) |
|
|
|
|
|
|
|
|
|
const currentHost = location.host |
|
|
|
|
const mobileHost = new URL(import.meta.env.VITE_APP_MOBILE_URL).host |
|
|
|
|
const pcHost = new URL(import.meta.env.VITE_APP_PC_URL).host |
|
|
|
|
|
|
|
|
|
if (isMobile && currentHost !== mobileHost) { |
|
|
|
|
console.log('手机端,跳转到移动站') |
|
|
|
|
location.href = import.meta.env.VITE_APP_MOBILE_URL |
|
|
|
|
} else if (!isMobile && currentHost !== pcHost) { |
|
|
|
|
console.log('电脑端,跳转到 PC 站') |
|
|
|
|
location.href = import.meta.env.VITE_APP_PC_URL |
|
|
|
|
} |
|
|
|
|