添加默认邀请人,website@hifast.biz 'uSSfg1Y1vt'
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m25s
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m25s
This commit is contained in:
parent
aeeea4c5d2
commit
4dc5cb4dd9
@ -2,6 +2,7 @@ import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './styles/index.css'
|
||||
import '@/utils/openinstall'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
|
||||
@ -71,9 +71,12 @@
|
||||
<ChatIcon class="h-[60px] w-[50px]" />登录海外 Apple ID 后再点击下方下载按钮
|
||||
</div>
|
||||
<div class="mx-auto h-[101px] w-[247px] md:h-[202px] md:w-[494px]">
|
||||
<a :href="downLoadIos" target="_blank" class="block h-full w-full">
|
||||
<div
|
||||
@click="handleDownload('ios')"
|
||||
class="block h-full w-full cursor-pointer transition-transform active:scale-95"
|
||||
>
|
||||
<img src="./Group%20100.png" class="h-full w-full" alt="下载" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
@ -103,12 +106,15 @@
|
||||
其他客户端下载
|
||||
</div>
|
||||
<div class="flex justify-center gap-4">
|
||||
<template v-for="client in otherClients" :key="client.link">
|
||||
<a :href="client.link" target="_blank">
|
||||
<template v-for="client in otherClients" :key="client.type">
|
||||
<div
|
||||
@click="handleDownload(client.type)"
|
||||
class="cursor-pointer transition-transform hover:brightness-110 active:scale-95"
|
||||
>
|
||||
<MacosIcon v-if="client.type === 'mac'" />
|
||||
<WindowsIcon v-if="client.type === 'window'" />
|
||||
<AndroidIcon v-if="client.type === 'android'" />
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@ -131,63 +137,43 @@ import DownloadMethodList from './DownloadMethodList/DownloadMethodList.vue'
|
||||
import FAQAccordion from './FAQAccordion/index.vue'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
const ic = getAllQueryString('ic') || sessionStorage.getItem('ic')
|
||||
const ADJ_GO_LINK =
|
||||
ic && typeof ic === 'string'
|
||||
? `https://hifastvpn.go.link?adj_t=1xf6e7ru&inviteCode=${ic}`
|
||||
: 'https://hifastvpn.go.link/?adj_t=1xf6e7ru'
|
||||
const handleDownload = async (key: string) => {
|
||||
const platformMap: Record<string, string> = {
|
||||
window: 'windows',
|
||||
mac: 'mac',
|
||||
android: 'android',
|
||||
ios: 'ios',
|
||||
}
|
||||
const platform = platformMap[key] || 'windows'
|
||||
const ic = getAllQueryString('ic') || sessionStorage.getItem('ic') || 'uSSfg1Y1vt'
|
||||
|
||||
const getTrackedUrl = (url: string) => {
|
||||
if (!url) return ''
|
||||
return `${ADJ_GO_LINK}&adj_redirect=${encodeURIComponent(url)}`
|
||||
if (platform === 'ios') {
|
||||
if (window.OI_SDK && window.OI_SDK.OI) {
|
||||
window.OI_SDK.OI.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const downLoadWin = ref(
|
||||
getTrackedUrl(
|
||||
'https://api.hifast.biz/v1/common/client/download/file/Hi快VPN-windows-1.0.0.exe',
|
||||
),
|
||||
)
|
||||
const downLoadMac = ref(ADJ_GO_LINK)
|
||||
const downLoadIos = ref(ADJ_GO_LINK)
|
||||
const downLoadAndroid = ref(
|
||||
ic && typeof ic === 'string'
|
||||
? `https://hifastvpn.go.link?adj_t=1xf6e7ru&inviteCode=${ic}`
|
||||
: 'https://api.hifast.biz/v1/common/client/download/file/Hi%E5%BF%ABVPN-android-1.0.0.apk',
|
||||
)
|
||||
// request
|
||||
// .get('/api/v1/common/client/download', {
|
||||
// // invite_code: getAllQueryString('ic'),
|
||||
// platform: 'mac',
|
||||
// })
|
||||
// .then((res) => {
|
||||
// downLoadMac.value = res.url
|
||||
// })
|
||||
//
|
||||
// request
|
||||
// .get('/api/v1/common/client/download', {
|
||||
// // invite_code: getAllQueryString('ic'),
|
||||
// platform: 'windows',
|
||||
// })
|
||||
// .then((res) => {
|
||||
// downLoadWin.value = res.url
|
||||
// })
|
||||
//
|
||||
// request
|
||||
// .get('/api/v1/common/client/download', {
|
||||
// // invite_code: getAllQueryString('ic'),
|
||||
// platform: 'android',
|
||||
// })
|
||||
// .then((res) => {
|
||||
// downLoadAndroid.value = res.url
|
||||
// })
|
||||
try {
|
||||
const res: any = await request.get('/api/v1/common/client/download', {
|
||||
invite_code: ic,
|
||||
platform: platform,
|
||||
})
|
||||
if (res.url) {
|
||||
window.open(res.url, '_blank')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Download fetch failed', error)
|
||||
}
|
||||
}
|
||||
|
||||
const activeIndex = ref(0)
|
||||
|
||||
const otherClients = computed(() => {
|
||||
return [
|
||||
{ icon: WindowsIcon, link: downLoadWin.value, type: 'window' },
|
||||
{ icon: MacosIcon, link: downLoadMac.value, type: 'mac' },
|
||||
{ icon: AndroidIcon, link: downLoadAndroid.value, type: 'android' },
|
||||
{ icon: WindowsIcon, type: 'window' },
|
||||
{ icon: MacosIcon, type: 'mac' },
|
||||
{ icon: AndroidIcon, type: 'android' },
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@ -4,8 +4,18 @@
|
||||
<div
|
||||
class="relative mx-auto flex h-[60px] w-[210px] items-center justify-center overflow-hidden rounded-full bg-[#ADFF5B] px-[16px] md:mb-4 md:ml-0 md:h-[83px] md:w-[300px] md:px-[24px]"
|
||||
>
|
||||
<router-link
|
||||
v-if="mainButton?.link && !mainButton.link.startsWith('http')"
|
||||
:to="mainButton.link"
|
||||
class="flex h-full w-full items-center justify-center transition-transform hover:brightness-110 active:scale-95"
|
||||
>
|
||||
<component
|
||||
:is="mainButton.mainIcon"
|
||||
class="h-auto w-full text-black transition-transform"
|
||||
/>
|
||||
</router-link>
|
||||
<a
|
||||
v-if="mainButton?.link"
|
||||
v-else-if="mainButton?.link"
|
||||
:href="mainButton.link"
|
||||
target="_blank"
|
||||
:aria-label="mainButton.label"
|
||||
@ -20,6 +30,7 @@
|
||||
v-else
|
||||
:id="mainButton?.id"
|
||||
:aria-label="mainButton?.label"
|
||||
@click="mainButton.key === 'win' ? handleDownload(mainButton.key) : null"
|
||||
class="flex h-full w-full cursor-pointer items-center justify-center transition-transform hover:brightness-110 active:scale-95"
|
||||
>
|
||||
<component
|
||||
@ -57,6 +68,7 @@
|
||||
v-else
|
||||
:id="item.id"
|
||||
:aria-label="item.label"
|
||||
@click="item.key === 'win' ? handleDownload(item.key) : null"
|
||||
class="cursor-pointer transition-transform hover:brightness-110 active:scale-95"
|
||||
>
|
||||
<component :is="item.secondaryIcon" class="h-[24px] text-white md:h-[34px]" />
|
||||
@ -120,15 +132,31 @@ onMounted(() => {
|
||||
// downLoadMac.value = res.url
|
||||
// })
|
||||
|
||||
const ic = getAllQueryString('ic') || sessionStorage.getItem('ic')
|
||||
const ADJ_GO_LINK =
|
||||
ic && typeof ic === 'string'
|
||||
? `https://hifastvpn.go.link?adj_t=1xf6e7ru&inviteCode=${ic}`
|
||||
: 'https://hifastvpn.go.link/?adj_t=1xf6e7ru'
|
||||
const downLoadWin = ref('')
|
||||
|
||||
const getTrackedUrl = (target: string) => {
|
||||
if (!target) return ''
|
||||
return `${ADJ_GO_LINK}&adj_redirect=${encodeURIComponent(target)}`
|
||||
const handleDownload = async (key: string) => {
|
||||
const platformMap: Record<string, string> = {
|
||||
win: 'windows',
|
||||
mac: 'mac',
|
||||
android: 'android',
|
||||
ios: 'ios',
|
||||
}
|
||||
const platform = platformMap[key] || 'windows'
|
||||
|
||||
try {
|
||||
const res: any = await request.get('/api/v1/common/client/download', {
|
||||
invite_code: getAllQueryString('ic') || sessionStorage.getItem('ic') || 'uSSfg1Y1vt',
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
const allDownloadOptions = computed(() => [
|
||||
@ -136,9 +164,7 @@ const allDownloadOptions = computed(() => [
|
||||
key: 'win',
|
||||
mainIcon: Icon1,
|
||||
secondaryIcon: WinIcon,
|
||||
link: getTrackedUrl(
|
||||
'https://api.hifast.biz/v1/common/client/download/file/Hi快VPN-windows-1.0.0.exe',
|
||||
),
|
||||
link: downLoadWin.value,
|
||||
label: 'Windows',
|
||||
id: 'downloadButton_win',
|
||||
},
|
||||
@ -146,26 +172,20 @@ const allDownloadOptions = computed(() => [
|
||||
key: 'mac',
|
||||
mainIcon: Icon3,
|
||||
secondaryIcon: MacIcon,
|
||||
link: ADJ_GO_LINK,
|
||||
link: '/help',
|
||||
label: 'macOS',
|
||||
id: 'downloadButton_mac',
|
||||
},
|
||||
{
|
||||
key: 'ios',
|
||||
mainIcon: Icon2,
|
||||
secondaryIcon: AppleIcon,
|
||||
link: ADJ_GO_LINK,
|
||||
link: '/help',
|
||||
label: 'iOS',
|
||||
id: 'downloadButton_apple',
|
||||
},
|
||||
{
|
||||
key: 'android',
|
||||
mainIcon: Icon4,
|
||||
secondaryIcon: AndroidIcon,
|
||||
link:
|
||||
ic && typeof ic === 'string'
|
||||
? `https://hifastvpn.go.link?adj_t=1xf6e7ru&inviteCode=${ic}`
|
||||
: 'https://api.hifast.biz/v1/common/client/download/file/Hi%E5%BF%ABVPN-android-1.0.0.apk',
|
||||
label: 'Android',
|
||||
id: 'downloadButton_android',
|
||||
},
|
||||
@ -173,20 +193,7 @@ const allDownloadOptions = computed(() => [
|
||||
|
||||
const mainButton = computed(() => {
|
||||
const platform = currentPlatform.value
|
||||
const opt =
|
||||
allDownloadOptions.value.find((opt) => opt.key === platform) || allDownloadOptions.value[0]
|
||||
|
||||
if (['mac', 'android', 'ios'].includes(platform)) {
|
||||
// Android 无邀请码时使用直传链接(即 opt.link)
|
||||
if (platform === 'android' && !(ic && typeof ic === 'string')) {
|
||||
return opt
|
||||
}
|
||||
return {
|
||||
...opt,
|
||||
link: ADJ_GO_LINK,
|
||||
}
|
||||
}
|
||||
return opt
|
||||
return allDownloadOptions.value.find((opt) => opt.key === platform) || allDownloadOptions.value[0]
|
||||
})
|
||||
|
||||
const otherButtons = computed(() => {
|
||||
|
||||
87
src/utils/openinstall.ts
Normal file
87
src/utils/openinstall.ts
Normal file
@ -0,0 +1,87 @@
|
||||
import { getAllQueryString } from '@/utils/url-utils.ts'
|
||||
|
||||
/**
|
||||
* OpenInstall sdk 用于上报h5邀请参数
|
||||
* 自动注册openinstall sdk 挂在到window对象上 通过window.OI_SDK访问
|
||||
* sdk初始化时会自动检索url上的参数并作为拉起下载或唤醒app时的参数
|
||||
*/
|
||||
const script = document.createElement('script')
|
||||
script.type = 'text/javascript'
|
||||
script.charset = 'UTF-8'
|
||||
script.src = 'https://web.cdn.openinstall.io/openinstall.js'
|
||||
document.head.appendChild(script)
|
||||
|
||||
script.addEventListener('load', () => {
|
||||
window.OI_SDK = new OpenInstallSdk()
|
||||
})
|
||||
|
||||
class OpenInstallSdk {
|
||||
public urlQuery: any // openinstall.js中提供的api,解析当前网页url中的查询参数并对data进行赋值
|
||||
|
||||
public OI: Record<string, any> // openinstall 实例
|
||||
|
||||
constructor() {
|
||||
this.OI = {}
|
||||
this.urlQuery = window.OpenInstall.parseUrlParams()
|
||||
const id = getAllQueryString('id')
|
||||
if (id) {
|
||||
this.urlQuery = {
|
||||
platform: 'merchant',
|
||||
code: id,
|
||||
}
|
||||
}
|
||||
this.init()
|
||||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
this.OI = new window.OpenInstall(
|
||||
{
|
||||
appKey: 'alf57p',
|
||||
onready: function () {
|
||||
// 初始化成功回调方法。当初始化完成后,会自动进入
|
||||
this.schemeWakeup() // 尝试使用scheme打开App(主要用于Android以及iOS的QQ环境中)
|
||||
const m = this
|
||||
const button = document.getElementById('downloadButton_apple')
|
||||
const button_mac = document.getElementById('downloadButton_mac')
|
||||
const button1 = document.getElementById('downloadButton_android')
|
||||
const ic = getAllQueryString('ic') || 'uSSfg1Y1vt'
|
||||
if (button) {
|
||||
button.onclick = function () {
|
||||
if (ic) {
|
||||
m.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
} else {
|
||||
m.wakeupOrInstall() // 此方法为scheme、Universal Link唤醒以及引导下载的作用(必须调用且不可额外自行跳转下载)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (button_mac) {
|
||||
button_mac.onclick = function () {
|
||||
if (ic) {
|
||||
m.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
} else {
|
||||
m.wakeupOrInstall() // 此方法为scheme、Universal Link唤醒以及引导下载的作用(必须调用且不可额外自行跳转下载)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (button1) {
|
||||
button1.onclick = function () {
|
||||
if (ic) {
|
||||
m.wakeupOrInstall({ data: { platform: 'download', inviteCode: ic } })
|
||||
} else {
|
||||
m.wakeupOrInstall() // 此方法为scheme、Universal Link唤醒以及引导下载的作用(必须调用且不可额外自行跳转下载)
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
this.urlQuery,
|
||||
) // 初始化时传入data,作为一键拉起/App传参安装时候的参数
|
||||
} catch (e) {
|
||||
console.log(e, 'OpenInstall——sdk初始化失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user