去除前端硬编码域名,改为动态获取当前站点域名

This commit is contained in:
yml2213
2026-08-05 15:20:39 +08:00
parent 0256bfd276
commit c779fa0dca
2 changed files with 8 additions and 14 deletions
@@ -45,16 +45,16 @@ const lakalaGateways: Record<string, string> = {
} }
const defaultNotifyURLs: Record<string, string> = { const defaultNotifyURLs: Record<string, string> = {
leshua: 'https://hao858.com/api/payments/leshua/notify', leshua: `${window.location.origin}/api/payments/leshua/notify`,
lakala: 'https://hao858.com/api/payments/lakala/notify', lakala: `${window.location.origin}/api/payments/lakala/notify`,
shuncheng: 'https://hao858.com/api/payments/shuncheng/notify', shuncheng: `${window.location.origin}/api/payments/shuncheng/notify`,
mock: '', mock: '',
} }
const defaultJumpURLs: Record<string, string> = { const defaultJumpURLs: Record<string, string> = {
leshua: 'https://hao858.com/orders', leshua: `${window.location.origin}/orders`,
lakala: 'https://hao858.com/orders', lakala: `${window.location.origin}/orders`,
shuncheng: 'https://hao858.com/orders', shuncheng: `${window.location.origin}/orders`,
mock: '', mock: '',
} }
@@ -6,15 +6,9 @@ import shareMenuIcon from '@/assets/share-menu-icon.png'
const router = useRouter() const router = useRouter()
const homeUrl = computed(() => { const homeUrl = computed(() => `${window.location.origin}/m`)
if (typeof window === 'undefined') return 'https://hao858.com/m'
return `${window.location.origin}/m`
})
const displayHost = computed(() => { const displayHost = computed(() => window.location.host)
if (typeof window === 'undefined') return 'hao858.com'
return window.location.host || 'hao858.com'
})
async function copyHomeUrl() { async function copyHomeUrl() {
try { try {