You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/antdv-demo/components/top_ad.vue

62 lines
1.6 KiB

<template>
<div>
<template v-if="ads.length">
<a-carousel autoplay>
<template v-for="ad in ads">
<a :key="ad.href" :href="ad.href" target="_blank">
3 years ago
<img style="width: 100%; max-width: 1200px" :alt="ad.alt || ''" :src="ad.img" />
</a>
</template>
</a-carousel>
</template>
<template v-else-if="showGoogleAd">
3 years ago
<template v-if="isCN">
<WWAds :key="`WWAds_${$route.path}`" />
</template>
<GoogleAdsTop v-else :key="`GoogleAdsTop_${$route.path}`" />
</template>
</div>
</template>
<script>
import moment from 'moment';
import GoogleAdsTop from './GoogleAdsTop';
3 years ago
import WWAds from './WWAds.vue';
const isEffective = (start, end) => {
return moment().isBetween(start, end);
};
export default {
components: {
GoogleAdsTop,
3 years ago
WWAds,
},
props: ['isCN', 'isMobile'],
data() {
return {
showGoogleAd: location.host.indexOf('antdv.com') > -1,
cnAds: [
{
img: `https://yidengfe.com/launches/01/yd.png?v=${Date.now()}`,
href: 'https://yidengfe.com/launches/01/yd.html',
visible: isEffective('2020-09-11 17:00:00', '2021-03-11 17:00:00'),
},
].filter(ad => ad.visible),
enAds: [
{
img: 'https://qn.antdv.com/TheBigRichGroup.png',
href: 'https://thebigrichgroup.com/',
3 years ago
visible: isEffective('2020-09-18 17:00:00', '2021-07-11 17:00:00'),
},
].filter(ad => ad.visible),
};
},
computed: {
ads() {
return this.isCN ? this.cnAds : this.enAds;
},
},
};
</script>
<style lang="less" scoped></style>