From 02c6ad80045c254017cc121ca29838c45b1b7980 Mon Sep 17 00:00:00 2001 From: xiaobingtech <161550081+xiaobingtech@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:40:14 +0800 Subject: [PATCH] =?UTF-8?q?mobile=E5=A2=9E=E5=8A=A0=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E9=B8=BF=E8=92=99=E7=B3=BB=E7=BB=9F=20(#2571)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于鸿蒙系统的User-Agent如下 Mozilla/5.0 (Phone; OpenHarmony5.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile 导致目前登录显示desktop --- back/config/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/back/config/util.ts b/back/config/util.ts index e5aa24c7..b5b25d5b 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -145,12 +145,14 @@ export function getPlatform(userAgent: string): 'mobile' | 'desktop' { system = 'android'; // android系统 } else if (testUa(/ios|iphone|ipad|ipod|iwatch/g)) { system = 'ios'; // ios系统 + } else if (testUa(/openharmony/g)) { + system = 'openharmony'; // openharmony系统 } let platform = 'desktop'; if (system === 'windows' || system === 'macos' || system === 'linux') { platform = 'desktop'; - } else if (system === 'android' || system === 'ios' || testUa(/mobile/g)) { + } else if (system === 'android' || system === 'ios' || system === 'openharmony' || testUa(/mobile/g)) { platform = 'mobile'; }