From 97b0bf1b50da83c33d4b94d3256053475cfdfdb2 Mon Sep 17 00:00:00 2001 From: JayChou Date: Fri, 16 May 2025 16:02:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BF=E9=97=AE=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E9=87=8D=E5=AE=9A=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +++- .env.production | 4 +++- src/main.ts | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.env.development b/.env.development index 564630e..a459376 100644 --- a/.env.development +++ b/.env.development @@ -3,4 +3,6 @@ NODE_ENV = 'development' VITE_APP_TITLE = '教学一体化平台' VITE_APP_BASE_API = http://localhost:18085/jeecg-boot # VITE_APP_BASE_API = 'http://127.0.0.1:8080' -VITE_APP_BASE_API_JEECG = '/student' \ No newline at end of file +VITE_APP_BASE_API_JEECG = '/student' +VITE_APP_PC_URL = http://localhost:18085/jeecg-boot +VITE_APP_MOBILE_URL = http://localhost:18085/jeecg-boot \ No newline at end of file diff --git a/.env.production b/.env.production index 09e06cb..d16a577 100644 --- a/.env.production +++ b/.env.production @@ -2,4 +2,6 @@ NODE_ENV = 'development' VITE_APP_TITLE = '高赛通单项目' VITE_APP_BASE_API = http://182.92.169.222:18086/jeecg-boot -# VITE_APP_BASE_API = 'http://127.0.0.1:8080' \ No newline at end of file +# VITE_APP_BASE_API = 'http://127.0.0.1:8080' +VITE_APP_PC_URL = http://localhost:18085/jeecg-boot +VITE_APP_MOBILE_URL = http://localhost:18085/jeecg-boot \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ee45777..cbd63a1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,3 +50,13 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) { // 初始化主题 const useThemeStore = themeStore() useThemeStore.initTheme() +const ua = navigator.userAgent.toLowerCase() +const isMobile = /iphone|android|ipad|mobile/.test(ua) +if (isMobile) { + console.log('手机端') + // location.href = import.meta.env.VITE_APP_MOBILE_URL +} else if (!isMobile) { + console.log('电脑端') + // location.href = import.meta.env.VITE_APP_PC_URL + +} \ No newline at end of file