处理为openinstall
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m25s

This commit is contained in:
speakeloudest 2026-04-07 04:06:59 +03:00
parent 5a0f82704d
commit 1e26abf1d8

View File

@ -8,7 +8,6 @@
target="_blank"
:aria-label="mainButton.label"
class="flex h-full w-full items-center justify-center transition-transform hover:brightness-110 active:scale-95"
@click.prevent="handleDownload(mainButton)"
>
<component :is="mainButton.mainIcon" class="h-auto w-full text-black transition-transform" />
</a>
@ -16,8 +15,8 @@
v-else
:id="mainButton?.id"
:aria-label="mainButton?.label"
@click="handleDownload(mainButton.key)"
class="flex h-full w-full cursor-pointer items-center justify-center transition-transform hover:brightness-110 active:scale-95"
@click="handleDownload(mainButton)"
>
<component :is="mainButton?.mainIcon" class="h-auto w-full text-black transition-transform" />
</div>
@ -37,7 +36,6 @@
target="_blank"
:aria-label="item.label"
class="transition-transform hover:brightness-110 active:scale-95"
@click.prevent="handleDownload(item)"
>
<component :is="item.secondaryIcon" class="h-[24px] md:h-[34px] text-white" />
</a>
@ -45,8 +43,8 @@
v-else
:id="item.id"
:aria-label="item.label"
@click="handleDownload(item.key)"
class="cursor-pointer transition-transform hover:brightness-110 active:scale-95"
@click="handleDownload(item)"
>
<component :is="item.secondaryIcon" class="h-[24px] md:h-[34px] text-white" />
</div>
@ -68,9 +66,9 @@ import AndroidIcon from './AndroidIcon.svg?component'
import request from '@/utils/request'
import {computed, ref, onMounted} from "vue";
import {getAllQueryString} from "../../../utils/url-utils";
import AdjustUtil from "../../../utils/adjust";
import {getAllQueryString} from "@/utils/url-utils.ts";
const downLoadWin = ref('')
const currentPlatform = ref('win')
onMounted(() => {
@ -103,41 +101,44 @@ onMounted(() => {
console.log('Detected Platform:', currentPlatform.value);
});
const handleDownload = (item: any) => {
console.log('Downloading:', item.label, item.link);
// key
AdjustUtil.trackEvent(item.key);
// request.get('/api/v1/common/client/download', {
// invite_code: getAllQueryString('ic'),
// platform: 'windows',
// }).then((res: any) => {
// downLoadWin.value = res.url
// })
if (item.key === 'win') {
// Windows
request.get('/api/v1/common/client/download', {
invite_code: getAllQueryString('ic'),
platform: 'windows',
}).then((res: any) => {
if (res.url) {
window.open(res.url, '_blank');
}
}).catch((err: any) => {
console.error('Failed to fetch windows download link:', err);
});
} else if (item.link) {
//
window.open(item.link, '_blank');
const handleDownload = async (key: string) => {
const platformMap: Record<string, string> = {
win: 'windows',
mac: 'mac',
android: 'android',
ios: 'ios',
}
};
const platform = platformMap[key] || 'windows'
const allDownloadOptions = computed(() => {
const androidLink = currentPlatform.value === 'android'
? AdjustUtil.getDecoratedLink()
: 'https://api.hifast.biz/v1/common/client/download/file/Hi%E5%BF%ABVPN-android-1.0.0.apk'
try {
const res: any = await request.get('/api/v1/common/client/download', {
invite_code: getAllQueryString('ic'),
platform: platform,
})
if (res.url) {
if (key === 'win') {
downLoadWin.value = res.url
}
window.open(res.url, '_blank')
}
} catch (error) {
console.error('Download fetch failed', error)
}
}
return [
{ key: 'win', mainIcon: Icon1, secondaryIcon: WinIcon, link: '', label: 'Windows', id: 'downloadButton_win' },
{ key: 'mac', mainIcon: Icon3, secondaryIcon: MacIcon, label: 'macOS', link: AdjustUtil.getDecoratedLink() },
{ key: 'ios', mainIcon: Icon2, secondaryIcon: AppleIcon, label: 'iOS', link: AdjustUtil.getDecoratedLink() },
{ key: 'android', mainIcon: Icon4, secondaryIcon: AndroidIcon, label: 'Android', link: androidLink },
]
})
const allDownloadOptions = computed(() => [
{ key: 'win', mainIcon: Icon1, secondaryIcon: WinIcon, link: downLoadWin.value, label: 'Windows', id: 'downloadButton_win' },
{ key: 'mac', mainIcon: Icon3, secondaryIcon: MacIcon, label: 'macOS', id: 'downloadButton_mac' },
{ key: 'ios', mainIcon: Icon2, secondaryIcon: AppleIcon, label: 'iOS', id: 'downloadButton_apple' },
{ key: 'android', mainIcon: Icon4, secondaryIcon: AndroidIcon, label: 'Android', id: 'downloadButton_android' },
])
const mainButton = computed(() => {
return allDownloadOptions.value.find(opt => opt.key === currentPlatform.value) || allDownloadOptions.value[0]
@ -147,3 +148,4 @@ const otherButtons = computed(() => {
return allDownloadOptions.value.filter(opt => opt.key !== currentPlatform.value)
})
</script>