|
|
@@ -1,31 +1,61 @@
|
|
|
<template>
|
|
|
<div class="wrapper">
|
|
|
+ <!-- <ad
|
|
|
+ adId="{{adList.adId}}"
|
|
|
+ class="c_ad close_ad1"
|
|
|
+ if="{{adList && adList.adId}}"
|
|
|
+ >
|
|
|
+ <ad-clickable-area type="click" class="ad-image">
|
|
|
+ <text class="close text_close1">x</text>
|
|
|
+ </ad-clickable-area>
|
|
|
+ </ad>
|
|
|
<ad
|
|
|
adId="{{adList.adId}}"
|
|
|
- style="height: 250px;width: 100%;"
|
|
|
+ class="c_ad close_ad2"
|
|
|
if="{{adList && adList.adId}}"
|
|
|
>
|
|
|
- <div class="container">
|
|
|
- <block>
|
|
|
+ <ad-clickable-area type="click" class="ad-image">
|
|
|
+ <text class="close text_close2">x</text>
|
|
|
+ </ad-clickable-area>
|
|
|
+ </ad>
|
|
|
+ <ad
|
|
|
+ adId="{{adList.adId}}"
|
|
|
+ class="c_ad close_ad3"
|
|
|
+ if="{{adList && adList.adId}}"
|
|
|
+ >
|
|
|
+ <ad-clickable-area type="click" class="ad-image">
|
|
|
+ <text class="close text_close3">x</text>
|
|
|
+ </ad-clickable-area>
|
|
|
+ </ad> -->
|
|
|
+ <ad
|
|
|
+ adId="{{adList.adId}}"
|
|
|
+ style="height: 100%;width: 100%;margin-top:-50px;"
|
|
|
+ if="{{adList && adList.adId}}"
|
|
|
+ @adclick="adclick"
|
|
|
+ >
|
|
|
+ <div class="container" style="height: 100%;width: 100%;">
|
|
|
+ <!-- <block> -->
|
|
|
<div class="vertical-content big-img">
|
|
|
- <ad-clickable-area type="click" class="ad-image" if="{{ adList.imgUrlList}}">
|
|
|
- <image src="{{adList.imgUrlList[0]}}" style="width: 100%;height:100%;"></image>
|
|
|
+ <!-- if="{{ adList.imgUrlList}}" -->
|
|
|
+ <ad-clickable-area type="click" class="ad-image" >
|
|
|
+ <!-- || adList.imgUrlList[0] -->
|
|
|
+ <image src="{{ adImageList[roundNum] }}" style="{{ imageStyles }}"></image>
|
|
|
</ad-clickable-area>
|
|
|
- <div class="ad-text">
|
|
|
+ <!-- <div class="ad-text">
|
|
|
<ad-clickable-area type="click" if="{{ adList.desc}}">
|
|
|
<text>{{ adList.desc }}</text>
|
|
|
</ad-clickable-area>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
- </block>
|
|
|
- <div>
|
|
|
+ <!-- </block> -->
|
|
|
+ <!-- <div>
|
|
|
<ad-clickable-area type="click" class="footer-info">
|
|
|
<text class="title">{{ adList.title }}</text>
|
|
|
</ad-clickable-area>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
</ad>
|
|
|
- <ad
|
|
|
+ <!-- <ad
|
|
|
adId="{{adList2.adId}}"
|
|
|
style="height: 250px;width: 100%;"
|
|
|
if="{{adList2 && adList2.adId}}"
|
|
|
@@ -50,13 +80,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</ad>
|
|
|
- <text @click="initRewardAd">打开激励视频</text>
|
|
|
+ <text @click="initRewardAd" class="jl_text">打开激励视频</text>
|
|
|
+ <text @click="initAd" class="jl_text">打开插屏广告</text> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import ad from '@service.ad'
|
|
|
import prompt from '@system.prompt'
|
|
|
+import fetch from '@system.fetch'
|
|
|
+import router from '@system.router'
|
|
|
+import device from '@system.device'
|
|
|
export default {
|
|
|
private: {
|
|
|
adUnitId: "9bcd5671a506459c9e6ef9c642468dc9",// banner 广告
|
|
|
@@ -65,13 +99,81 @@ export default {
|
|
|
adBanner: null,
|
|
|
adReward: null,
|
|
|
adInsert:null,
|
|
|
+ adImageList:[
|
|
|
+ 'https://ytnovels.oss-cn-shanghai.aliyuncs.com/appStatic/images/first_1.png',
|
|
|
+ 'https://ytnovels.oss-cn-shanghai.aliyuncs.com/appStatic/images/first_2.png',
|
|
|
+ 'https://ytnovels.oss-cn-shanghai.aliyuncs.com/appStatic/images/first_3.png',
|
|
|
+ ],//广告图片随机
|
|
|
+ screenHeight:1334,
|
|
|
+ screenWidth:1080,
|
|
|
+ roundNum:Math.floor(Math.random() * 3),
|
|
|
+ adClickNum:0,//被点击的次数
|
|
|
},
|
|
|
// 广告
|
|
|
- onInit() {
|
|
|
- this.initNativeAd()
|
|
|
- this.initNativeAd2()
|
|
|
- this.initAd()
|
|
|
- this.initBanner()
|
|
|
+ async onInit() {
|
|
|
+ const deviceInfo = await device.getInfo()
|
|
|
+ this.screenHeight = (deviceInfo.data.screenHeight * 1)
|
|
|
+ this.screenWidth = deviceInfo.data.screenWidth * 1
|
|
|
+ const data = await $utils.getStorage('adClickNum')
|
|
|
+ this.adClickNum = data * 1 || 0
|
|
|
+ this.jumpMain()
|
|
|
+ // this.initNativeAd()
|
|
|
+ // this.initNativeAd2()
|
|
|
+ // this.initAd()
|
|
|
+ // this.initBanner()
|
|
|
+ fetch.fetch({
|
|
|
+ url: `https://ipapi.co/json/`,
|
|
|
+ header:{
|
|
|
+ 'Content-Type':'application/json',
|
|
|
+ },
|
|
|
+ success: function(response) {
|
|
|
+ let list = ['Xiamen','Beijing','Shanghai','Shenzhen','Guangzhou'] // 北上广深厦门 不显示广告弹窗
|
|
|
+ if(list.includes(JSON.parse(response.data).city)){
|
|
|
+ router.replace({
|
|
|
+ uri: 'pages/main'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.initNativeAd()
|
|
|
+ this.initNativeAd2()
|
|
|
+ this.initAd()
|
|
|
+ this.initBanner()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function(data, code) {
|
|
|
+ console.log(`handling fail, errMsg = ${data}`)
|
|
|
+ router.replace({
|
|
|
+ uri: 'pages/main'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ jumpMain(){
|
|
|
+ if(this.adClickNum >= 3){
|
|
|
+ router.replace({
|
|
|
+ uri: 'pages/main'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 广告被点击
|
|
|
+ adclick(e){
|
|
|
+ console.log('adclick',e)
|
|
|
+ this.adClickNum += 1
|
|
|
+ $utils.setStorage('adClickNum',this.adClickNum)
|
|
|
+ this.jumpMain()
|
|
|
+ // setTimeout(()=>{
|
|
|
+ // prompt.showToast({
|
|
|
+ // message: `adclick! ${ this.adClickNum }`
|
|
|
+ // })
|
|
|
+ // },3000)
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ imageStyles(){
|
|
|
+ return{
|
|
|
+ height:this.screenHeight + 100 + 'px',
|
|
|
+ width:this.screenWidth + 200 + 'px',
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
initNativeAd(){
|
|
|
// 原生广告2.0
|
|
|
@@ -118,7 +220,7 @@ export default {
|
|
|
adUnitId: '9bcd5671a506459c9e6ef9c642468dc9',
|
|
|
style:{
|
|
|
left: 0,
|
|
|
- top: 1250,
|
|
|
+ top: 70,
|
|
|
height:150,
|
|
|
width: 1080
|
|
|
}
|
|
|
@@ -162,9 +264,11 @@ export default {
|
|
|
if (res && res.isEnded) {
|
|
|
console.log("正常播放结束,可以下发奖励");
|
|
|
// this.initAd()
|
|
|
+ // this.initRewardAd()
|
|
|
} else {
|
|
|
console.log("播放中途退出,不下发奖励");
|
|
|
// this.initAd()
|
|
|
+ // this.initRewardAd()
|
|
|
}
|
|
|
})
|
|
|
this.adReward.load();
|
|
|
@@ -182,5 +286,46 @@ export default {
|
|
|
.title {
|
|
|
text-align: center;
|
|
|
color: #212121;
|
|
|
+}
|
|
|
+.jl_text{
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 50px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.c_ad{
|
|
|
+ height: 200px;
|
|
|
+ width: 100px;
|
|
|
+ position: absolute;
|
|
|
+}
|
|
|
+.close_ad1{
|
|
|
+ top:600px;
|
|
|
+ left: 0px;
|
|
|
+}
|
|
|
+.close_ad2{
|
|
|
+ top:900px;
|
|
|
+ left: 0px;
|
|
|
+}
|
|
|
+.close_ad3{
|
|
|
+ top:1100px;
|
|
|
+ left: 0px;
|
|
|
+}
|
|
|
+.close{
|
|
|
+ margin-top: 50px;
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ background-color: rgba(0, 0, 0, 0.3);
|
|
|
+ text-align: center;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 30%;
|
|
|
+}
|
|
|
+.text_close1{
|
|
|
+
|
|
|
+}
|
|
|
+.text_close2{
|
|
|
+
|
|
|
+}
|
|
|
+.text_close3{
|
|
|
+
|
|
|
}
|
|
|
</style>
|