根据ua处理下载按钮
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m39s
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m39s
This commit is contained in:
parent
67eb210ded
commit
3599d413d9
@ -72,16 +72,33 @@ const currentPlatform = ref('win')
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const ua = navigator.userAgent;
|
const ua = navigator.userAgent;
|
||||||
if (/Macintosh|Mac OS X/i.test(ua)) {
|
const platform = navigator.platform || ''; // 辅助判断
|
||||||
currentPlatform.value = 'mac'
|
|
||||||
} else if (/iPhone|iPad|iPod/i.test(ua)) {
|
// 1. 先判断 Android (通常比较稳定)
|
||||||
currentPlatform.value = 'ios'
|
if (/Android/i.test(ua)) {
|
||||||
} else if (/Android/i.test(ua)) {
|
currentPlatform.value = 'android';
|
||||||
currentPlatform.value = 'android'
|
|
||||||
} else {
|
|
||||||
currentPlatform.value = 'win'
|
|
||||||
}
|
}
|
||||||
})
|
// 2. 判断 iOS 设备 (iPhone, iPod)
|
||||||
|
else if (/iPhone|iPod/i.test(ua)) {
|
||||||
|
currentPlatform.value = 'ios';
|
||||||
|
}
|
||||||
|
// 3. 核心改进:区分 Mac 和 iPad
|
||||||
|
else if (/Macintosh|Mac OS X/i.test(ua)) {
|
||||||
|
// iPadOS 桌面模式下,支持多点触控(通常 > 1)
|
||||||
|
// 而真正的 Mac 电脑通常 maxTouchPoints 为 0 或 undefined
|
||||||
|
if (navigator.maxTouchPoints > 1) {
|
||||||
|
currentPlatform.value = 'ios'; // 归类为 iOS 端(iPad)
|
||||||
|
} else {
|
||||||
|
currentPlatform.value = 'mac';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 4. 其他情况默认为 Windows
|
||||||
|
else {
|
||||||
|
currentPlatform.value = 'win';
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Detected Platform:', currentPlatform.value);
|
||||||
|
});
|
||||||
|
|
||||||
request.get('/api/v1/common/client/download', {
|
request.get('/api/v1/common/client/download', {
|
||||||
invite_code: getAllQueryString('ic'),
|
invite_code: getAllQueryString('ic'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user