improve mobile ad

This commit is contained in:
liangping 2024-03-23 12:12:23 +08:00
parent fc20f3e460
commit b74ab21bc8
2 changed files with 10 additions and 7 deletions

View File

@ -25,7 +25,7 @@ onMounted(() => {
</script>
<template>
<div v-show="show" class="grid justify-items-center">
<div :id="id" :style="{ width, height }" class="mt-6"></div>
<div v-show="show" class="grid justify-items-center overflow-auto">
<div :id="id" class="mt-6"></div>
</div>
</template>

View File

@ -6,10 +6,10 @@ interface ADConfig {
}
export const confs: Record<string, ADConfig> = {
// "localhost": {
// apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us.
// environment: 'staging', // use value 'production' when going live
// },
"localhost": {
apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us.
environment: 'staging', // use value 'production' when going live
},
"ping.pub": {
apiKey: 'persona-pub-0x6ca028de83d9bc438bb3fd7f9620f36b',
environment: 'production',
@ -24,12 +24,15 @@ export const confs: Record<string, ADConfig> = {
export const UNITS: Record<string, Record<string, string>> = {
"localhost": {
"banner": "3a094192-4c7b-4761-a50c-bd9b6a67e987",
"banner_mobile": "e6b82a11-6a94-46c0-a9d2-cf730159a5e6",
},
"ping.pub": {
"banner": "6883877a-ccae-4a08-b457-7e30b3465a8c",
"banner_mobile": "a95c6b55-5e2a-49eb-8993-a488513b2d10",
},
"testnet.ping.pub": {
"banner": "1644951b-5022-4544-8a85-11aef8a8f645",
"banner_mobile": "81e0527f-475a-42a4-bb9a-ed9967c5d06f",
},
}
@ -44,6 +47,6 @@ export function getClient() {
export function getUnit(ad: string): string | undefined {
const ads = UNITS[location.hostname]
if(ads) {
return ads[ad]
return window.innerWidth > 600 ? ads[ad] : ads[`${ad}_mobile`]
}
}