广告位调整
This commit is contained in:
+64
-7
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user