广告位调整

This commit is contained in:
谢宇宁
2026-09-16 16:44:01 +07:00
parent 2e8689cae0
commit 060282232c
12 changed files with 101 additions and 158 deletions
+64 -7
View File
@@ -18,8 +18,19 @@
:scene="vipContentGuideScene"
@close="closeVipContentGuide"
/>
<!-- 九宫格应用广告:启动后不管落在哪个 tab 都弹,每次启动只弹一次 -->
<NineGridPopup v-if="nineGridPopupVisible" :is-open="true" @close="nineGridPopupVisible = false" />
<!-- 启动广告弹窗链:九宫格 → 弹窗广告 → APP公告。
跟着启动落地页弹,不固定在首页;每次启动只弹一次,逐个关闭后再弹下一个 -->
<NineGridPopup v-if="launchAdPopupKey === 'nineGrid'" :is-open="true" @close="showNextLaunchAd" />
<HomePopupAdv
v-else-if="launchAdPopupKey === 'homeAdv'"
:advList="launchAdData.advList"
@close="showNextLaunchAd"
/>
<AnnouncementPopup
v-else-if="launchAdPopupKey === 'announcement'"
:announList="launchAdData.announList"
@close="showNextLaunchAd"
/>
</div>
</template>
<script lang="ts">
@@ -34,19 +45,65 @@ import { computed } from 'vue';
import { useRoute } from 'vue-router';
import PaymentGuidePopup from '@/components/PaymentGuidePopup/index.vue';
import NineGridPopup from '@/components/NineGridPopup/index.vue';
import HomePopupAdv from '@/components/HomePopupAdv/index.vue';
import AnnouncementPopup from '@/components/AnnouncementPopup/index.vue';
import { useVipContentUpdateGuideOnMainTabs } from '@/hooks/useVipContentUpdateGuideOnMainTabs';
import { AdType } from '@/enums/app';
import { getAdItem } from '@/utils/getConfig';
import { nineGridPopupVisible } from '@/utils/nineGridPopup';
import { launchAdPopupKey, type LaunchAdPopupKey } from '@/utils/launchAdPopup';
const route = useRoute();
const globalStore = useGlobalStore();
const configStore = useConfigStore();
if (!globalStore.nineGridFirst && (getAdItem(AdType.QualityApplication) || []).length > 0) {
globalStore.setNineGridFirst();
nineGridPopupVisible.value = true;
}
/** 启动广告数据:链上每个弹窗各取各的配置,没配的环节直接跳过 */
const launchAdData = {
nineGridList: <Array<Types.App.AdsInfoListItem>>[],
advList: <Array<Types.App.AdsInfoListItem>>[],
announList: <Array<Types.App.AnnounListItem>>[],
};
/**
* 弹窗顺序与安卓一致:九宫格 → 弹窗广告 → APP公告。
* markShown 用 store 里的「第一次」标记(sessionStorage),保证 MainView 重新挂载也不会重弹
*/
const launchAdChain: { key: LaunchAdPopupKey; ready: () => boolean; markShown: () => void }[] = [
{
key: 'nineGrid',
ready: () => !globalStore.nineGridFirst && launchAdData.nineGridList.length > 0,
markShown: () => globalStore.setNineGridFirst(),
},
{
key: 'homeAdv',
ready: () => !globalStore.homeAdvFirst && launchAdData.advList.length > 0,
markShown: () => globalStore.setHomeAdvFirst(),
},
{
key: 'announcement',
ready: () => !globalStore.announcementFirst && launchAdData.announList.length > 0,
markShown: () => globalStore.setAnnouncementFirst(),
},
];
/** 弹下一个:标记已弹再展示,关闭回调复用本方法,链走完置空 */
const showNextLaunchAd = () => {
const step = launchAdChain.find((item) => item.ready());
if (!step) {
launchAdPopupKey.value = '';
return;
}
step.markShown();
launchAdPopupKey.value = step.key;
};
const initLaunchAdChain = () => {
launchAdData.nineGridList = getAdItem(AdType.QualityApplication) || [];
launchAdData.advList = getAdItem(AdType.HOMEPOPUPADV) || [];
const announList = configStore.appConfig.announList;
launchAdData.announList = announList?.length ? JSON.parse(JSON.stringify(announList)) : [];
showNextLaunchAd();
};
initLaunchAdChain();
const {
visible: vipContentGuideVisible,
guide: vipContentGuide,
+12 -34
View File
@@ -12,7 +12,6 @@
<span v-show="state.countdown > 0">{{ state.countdown }}</span>
<div class="jump_over" v-show="state.countdown <= 0" @click="goApp">跳过</div>
</div>
<EnterGroupPopup v-if="state.isCheckError" />
<!-- <UpgradePopup :show="state.isUpgrade" /> -->
<div class="selectLineBox" v-if="state.loading">
<van-loading color="#1989fa" size="30" />
@@ -50,11 +49,8 @@ const state = reactive({
timer: <any>null, //广告定时器
checkTimer: <any>null, //检测图片是否加载成功定时器
checkTime: 3, //图片加载成功检测时间
isCheckError: false, //是否选线失败
checkLineErrorNum: 0, //选线失败次数
isResLock: false, // 请求结果锁
resResult: <any>[], // 响应结果
pingCheckCount: 0, // 请求的ping失败次数
lineFailCount: 0, // 已失败的线路数
loading: true, // 选线loading
isUpgrade: true, //是否升级
});
@@ -353,30 +349,14 @@ const getConfig = async (): Promise<boolean> => {
return false;
}
};
const pingErrorPop = (hosts: any) => {
// 只有最后一条域名出错时,判断响应结果不存在true的时候,说明全部不通,即弹出选线失败
state.pingCheckCount++;
if (state.pingCheckCount == hosts.length) {
state.pingCheckCount = 0;
let index = state.resResult.indexOf(true);
if (index == -1) {
if (state.checkLineErrorNum == 1) {
state.isCheckError = true;
return;
}
showDialog({
title: '温馨提示',
message: '选线失败',
confirmButtonText: '重试',
theme: 'round-button',
}).then(() => {
state.checkLineErrorNum++;
appStore.$reset();
userStore.$reset();
configStore.$reset();
init();
});
}
/**
* @description 选线失败:同安卓,失败不做处理(不弹重试/线路异常弹窗)。
* 全部线路都不通就收起「选线中...」,启动流程停在启动页
*/
const onLineCheckFail = (hosts: any) => {
state.lineFailCount++;
if (state.lineFailCount >= hosts.length && !state.isResLock) {
state.loading = false;
}
};
/**
@@ -389,8 +369,7 @@ const init = async () => {
: localStorage.setItem('isAppStore', ''); // 保存是否来自商店包,用于判断是否跳转外链
const baseUrls: string = process.env.VITE_BASE_URL || '[]';
const hosts = JSON.parse(baseUrls);
state.resResult = new Array(hosts.length);
hosts.forEach((url: any, index: number) => {
hosts.forEach((url: any) => {
axios({
method: 'GET',
url: url + '/api/app/ping/check',
@@ -400,17 +379,16 @@ const init = async () => {
if (res.data.code == 200) {
if (!state.isResLock) {
state.isResLock = true;
state.resResult[index] = true;
//选线成功
useConfigStore().saveBaseUrl(url);
await ensureAuthAndConfig();
}
} else {
pingErrorPop(hosts);
onLineCheckFail(hosts);
}
})
.catch(() => {
pingErrorPop(hosts);
onLineCheckFail(hosts);
});
});
};
@@ -52,11 +52,6 @@ const typeList = ref([
content:
'本平台有主要收益为广告赞助,且保证APP安全无毒,因平台主要展示内容为色情属于特殊行业,某些杀毒软件会误报毒提醒,如遇此类提醒请忽略继续使用。',
},
{
name: '官方联系方式?',
type: 5,
content: '商务合作:https://t1t1.com <br/> 永久下载地址:91porn01.cc',
},
// {
// name: '如何填写邀请码',
// type: 6,