mobile增加鸿蒙系统

由于鸿蒙系统的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

此PR修改默认desktop为mobile
This commit is contained in:
xiaobingtech 2024-11-18 16:39:23 +08:00
parent fff572869e
commit 1032339af2

View File

@ -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';
}