|
@@ -1,32 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="wrapper">
|
|
<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}}"
|
|
|
|
|
- class="c_ad close_ad2"
|
|
|
|
|
- if="{{adList && adList.adId}}"
|
|
|
|
|
- >
|
|
|
|
|
- <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
|
|
<ad
|
|
|
adId="{{adList.adId}}"
|
|
adId="{{adList.adId}}"
|
|
|
style="height: 100%;width: 100%;margin-top:-50px;"
|
|
style="height: 100%;width: 100%;margin-top:-50px;"
|
|
@@ -34,54 +7,15 @@
|
|
|
@adclick="adclick"
|
|
@adclick="adclick"
|
|
|
>
|
|
>
|
|
|
<div class="container" style="height: 100%;width: 100%;">
|
|
<div class="container" style="height: 100%;width: 100%;">
|
|
|
- <!-- <block> -->
|
|
|
|
|
- <div class="vertical-content big-img">
|
|
|
|
|
- <!-- 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">
|
|
|
|
|
- <ad-clickable-area type="click" if="{{ adList.desc}}">
|
|
|
|
|
- <text>{{ adList.desc }}</text>
|
|
|
|
|
- </ad-clickable-area>
|
|
|
|
|
- </div> -->
|
|
|
|
|
- </div>
|
|
|
|
|
- <!-- </block> -->
|
|
|
|
|
- <!-- <div>
|
|
|
|
|
- <ad-clickable-area type="click" class="footer-info">
|
|
|
|
|
- <text class="title">{{ adList.title }}</text>
|
|
|
|
|
- </ad-clickable-area>
|
|
|
|
|
- </div> -->
|
|
|
|
|
- </div>
|
|
|
|
|
- </ad>
|
|
|
|
|
- <!-- <ad
|
|
|
|
|
- adId="{{adList2.adId}}"
|
|
|
|
|
- style="height: 250px;width: 100%;"
|
|
|
|
|
- if="{{adList2 && adList2.adId}}"
|
|
|
|
|
- >
|
|
|
|
|
- <div class="container">
|
|
|
|
|
<block>
|
|
<block>
|
|
|
<div class="vertical-content big-img">
|
|
<div class="vertical-content big-img">
|
|
|
- <ad-clickable-area type="click" class="ad-image" if="{{ adList2.imgUrlList}}">
|
|
|
|
|
- <image src="{{adList2.imgUrlList[0]}}" style="width: 100%;height:100%;"></image>
|
|
|
|
|
|
|
+ <ad-clickable-area type="click" class="ad-image" >
|
|
|
|
|
+ <image src="{{ adList.imgUrlList&&adList.imgUrlList[0] || adImageList[roundNum] }}" style="{{ imageStyles }}"></image>
|
|
|
</ad-clickable-area>
|
|
</ad-clickable-area>
|
|
|
- <div class="ad-text">
|
|
|
|
|
- <ad-clickable-area type="click" if="{{ adList2.desc}}">
|
|
|
|
|
- <text>{{ adList2.desc }}</text>
|
|
|
|
|
- </ad-clickable-area>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</block>
|
|
</block>
|
|
|
- <div>
|
|
|
|
|
- <ad-clickable-area type="click" class="footer-info">
|
|
|
|
|
- <text class="title">{{ adList2.title }}</text>
|
|
|
|
|
- </ad-clickable-area>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</ad>
|
|
</ad>
|
|
|
- <text @click="initRewardAd" class="jl_text">打开激励视频</text>
|
|
|
|
|
- <text @click="initAd" class="jl_text">打开插屏广告</text> -->
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -95,7 +29,6 @@ export default {
|
|
|
private: {
|
|
private: {
|
|
|
adUnitId: "9bcd5671a506459c9e6ef9c642468dc9",// banner 广告
|
|
adUnitId: "9bcd5671a506459c9e6ef9c642468dc9",// banner 广告
|
|
|
adList: {},
|
|
adList: {},
|
|
|
- adList2: {},
|
|
|
|
|
adBanner: null,
|
|
adBanner: null,
|
|
|
adReward: null,
|
|
adReward: null,
|
|
|
adInsert:null,
|
|
adInsert:null,
|
|
@@ -108,56 +41,144 @@ export default {
|
|
|
screenWidth:1080,
|
|
screenWidth:1080,
|
|
|
roundNum:Math.floor(Math.random() * 3),
|
|
roundNum:Math.floor(Math.random() * 3),
|
|
|
adClickNum:0,//被点击的次数
|
|
adClickNum:0,//被点击的次数
|
|
|
|
|
+ clickEvent:"11",
|
|
|
|
|
+ onloadEvent:'14',
|
|
|
|
|
+ clickid:'',
|
|
|
|
|
+ isBlockIp:true,// 是否屏蔽iP地址
|
|
|
|
|
+ isBlockDev:true,//是否屏蔽调试器
|
|
|
},
|
|
},
|
|
|
// 广告
|
|
// 广告
|
|
|
async onInit() {
|
|
async onInit() {
|
|
|
|
|
+ // console.log('global.__env__',global)
|
|
|
|
|
+ // console.log('global.__env__',JSON.stringify(this.$page.query))
|
|
|
|
|
+ // 自归因 上报监测 clickId
|
|
|
|
|
+ // this.clickid = this.$page.query.CLICK_ID || this.$page.query.CLICKID
|
|
|
|
|
+ // 获取设备唯一标识。需要用户授权
|
|
|
|
|
+ // device.getSerial({
|
|
|
|
|
+ // success: function(data) {
|
|
|
|
|
+ // console.log(`handling success: ${data.serial}`)
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // message: `serial${ data.serial }`
|
|
|
|
|
+ // })
|
|
|
|
|
+ // },
|
|
|
|
|
+ // fail: function(data, code) {
|
|
|
|
|
+ // console.log(`handling fail, code = ${code}`)
|
|
|
|
|
+ // device.getOAID({
|
|
|
|
|
+ // success: function(data) {
|
|
|
|
|
+ // console.log(`handling success: ${data.oaid}`)
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // message: `oaid${ data.oaid }`
|
|
|
|
|
+ // })
|
|
|
|
|
+ // },
|
|
|
|
|
+ // fail: function(data, code) {
|
|
|
|
|
+ // console.log(`handling fail, code = ${code}`)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ device.getDeviceId({
|
|
|
|
|
+ success: function(data) {
|
|
|
|
|
+ console.log(`handling success: ${data.deviceId}`)
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // message: `deviceId${ data.deviceId }`
|
|
|
|
|
+ // })
|
|
|
|
|
+ //设备唯一标识。在 Android 上返回 IMEI 或 MEID; 在 Android Q 之后,除了华为手机返回 aaid(应用匿名设备标识符),
|
|
|
|
|
+ // 其他厂商手机如果支持 oaid(匿名设备标识符)则返回 oaid,否则返回空值。
|
|
|
|
|
+ $apis.common.vivoUpload({sign: data.deviceId, type: 1}).then(res=>{
|
|
|
|
|
+ console.log('res',res)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function(data, code) {
|
|
|
|
|
+ console.log(`handling fail, code = ${code}`)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
const deviceInfo = await device.getInfo()
|
|
const deviceInfo = await device.getInfo()
|
|
|
this.screenHeight = (deviceInfo.data.screenHeight * 1)
|
|
this.screenHeight = (deviceInfo.data.screenHeight * 1)
|
|
|
this.screenWidth = deviceInfo.data.screenWidth * 1
|
|
this.screenWidth = deviceInfo.data.screenWidth * 1
|
|
|
const data = await $utils.getStorage('adClickNum')
|
|
const data = await $utils.getStorage('adClickNum')
|
|
|
this.adClickNum = data * 1 || 0
|
|
this.adClickNum = data * 1 || 0
|
|
|
this.jumpMain()
|
|
this.jumpMain()
|
|
|
- // this.initNativeAd()
|
|
|
|
|
- // this.initNativeAd2()
|
|
|
|
|
- // this.initAd()
|
|
|
|
|
- // this.initBanner()
|
|
|
|
|
- fetch.fetch({
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ // 检测用户是否在特定区域中 如果在则不显示广告页内容
|
|
|
|
|
+ async areaJudge(){
|
|
|
|
|
+ var that = this
|
|
|
|
|
+ const isSpecialArea = await $utils.getStorage('isSpecialArea')
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // message: `isSpecialArea - ${ isSpecialArea } -isBlockIp ${this.isBlockIp} `
|
|
|
|
|
+ // })
|
|
|
|
|
+ // 第一次进未请求判断地区的 且 后台配置是需要屏蔽对应Ip地址
|
|
|
|
|
+ if(isSpecialArea === '' && this.isBlockIp){
|
|
|
|
|
+ fetch.fetch({
|
|
|
url: `https://ipapi.co/json/`,
|
|
url: `https://ipapi.co/json/`,
|
|
|
header:{
|
|
header:{
|
|
|
'Content-Type':'application/json',
|
|
'Content-Type':'application/json',
|
|
|
},
|
|
},
|
|
|
success: function(response) {
|
|
success: function(response) {
|
|
|
- let list = ['Xiamen','Beijing','Shanghai','Shenzhen','Guangzhou'] // 北上广深厦门 不显示广告弹窗
|
|
|
|
|
|
|
+ console.log('response',JSON.parse(response.data).city)
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // message: `${ JSON.parse(response.data).city }`
|
|
|
|
|
+ // })
|
|
|
|
|
+ let list = ['Xiamen','Beijing','Shanghai','Shenzhen','Guangzhou'] // 北上广深厦门 不显示广告弹窗
|
|
|
if(list.includes(JSON.parse(response.data).city)){
|
|
if(list.includes(JSON.parse(response.data).city)){
|
|
|
|
|
+ $utils.setStorage('isSpecialArea',true)
|
|
|
router.replace({
|
|
router.replace({
|
|
|
uri: 'pages/main'
|
|
uri: 'pages/main'
|
|
|
})
|
|
})
|
|
|
}else{
|
|
}else{
|
|
|
- this.initNativeAd()
|
|
|
|
|
- this.initNativeAd2()
|
|
|
|
|
- this.initAd()
|
|
|
|
|
- this.initBanner()
|
|
|
|
|
|
|
+ $utils.setStorage('isSpecialArea',false)
|
|
|
|
|
+ that.initNativeAd()
|
|
|
|
|
+ that.initAd()
|
|
|
|
|
+ that.initBanner()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
fail: function(data, code) {
|
|
fail: function(data, code) {
|
|
|
console.log(`handling fail, errMsg = ${data}`)
|
|
console.log(`handling fail, errMsg = ${data}`)
|
|
|
|
|
+ $utils.setStorage('isSpecialArea',true)
|
|
|
router.replace({
|
|
router.replace({
|
|
|
uri: 'pages/main'
|
|
uri: 'pages/main'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ }else if(isSpecialArea === 'false' || !this.isBlockIp){ // 不属于禁用IP地址 或者是接口中不屏蔽IP地址 展示广告
|
|
|
|
|
+ that.initNativeAd()
|
|
|
|
|
+ that.initAd()
|
|
|
|
|
+ that.initBanner()
|
|
|
|
|
+ }else{ // isSpecialArea === 'true'
|
|
|
|
|
+ router.replace({
|
|
|
|
|
+ uri: 'pages/main'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
jumpMain(){
|
|
jumpMain(){
|
|
|
- if(this.adClickNum >= 3){
|
|
|
|
|
- router.replace({
|
|
|
|
|
- uri: 'pages/main'
|
|
|
|
|
|
|
+ $apis.common.getConfig().then(res=>{
|
|
|
|
|
+ console.log('res',res)
|
|
|
|
|
+ if(res.data.status == 0){ // 屏蔽IP地址
|
|
|
|
|
+ this.isBlockIp = false
|
|
|
|
|
+ }
|
|
|
|
|
+ if(res.data.status == 0){ // 屏蔽调试器
|
|
|
|
|
+ this.isBlockDev = false
|
|
|
|
|
+ }
|
|
|
|
|
+ let devList = ['log','debug'] //
|
|
|
|
|
+ if(this.adClickNum >= 3 || (devList.includes(global.Env.logLevel) && this.isBlockDev)){ // 点击广告次数 >= 3 次 或者是调试器登录时直接跳过广告
|
|
|
|
|
+ router.replace({
|
|
|
|
|
+ uri: 'pages/main'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.areaJudge()
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
// 广告被点击
|
|
// 广告被点击
|
|
|
adclick(e){
|
|
adclick(e){
|
|
|
console.log('adclick',e)
|
|
console.log('adclick',e)
|
|
|
|
|
+ this.clickEvent = JSON.stringify(e)
|
|
|
|
|
+ // setTimeout(()=>{
|
|
|
|
|
+ // prompt.showToast({
|
|
|
|
|
+ // // message: `adclick! ${ JSON.stringify(e) }`
|
|
|
|
|
+ // message: `adclick! ${ JSON.stringify(this.$page.query) }`
|
|
|
|
|
+ // })
|
|
|
|
|
+ // },3000)
|
|
|
this.adClickNum += 1
|
|
this.adClickNum += 1
|
|
|
$utils.setStorage('adClickNum',this.adClickNum)
|
|
$utils.setStorage('adClickNum',this.adClickNum)
|
|
|
this.jumpMain()
|
|
this.jumpMain()
|
|
@@ -170,8 +191,9 @@ export default {
|
|
|
computed: {
|
|
computed: {
|
|
|
imageStyles(){
|
|
imageStyles(){
|
|
|
return{
|
|
return{
|
|
|
- height:this.screenHeight + 100 + 'px',
|
|
|
|
|
- width:this.screenWidth + 200 + 'px',
|
|
|
|
|
|
|
+ height:this.screenHeight + 'px',
|
|
|
|
|
+ width:this.screenWidth+ 'px',
|
|
|
|
|
+ objectFit:'fill'
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -186,34 +208,13 @@ export default {
|
|
|
...adParams,
|
|
...adParams,
|
|
|
success: (data) => {
|
|
success: (data) => {
|
|
|
this.adList = data.adList[0]
|
|
this.adList = data.adList[0]
|
|
|
|
|
+ this.onloadEvent = JSON.stringify(data.adList[0])
|
|
|
console.log('data',data)
|
|
console.log('data',data)
|
|
|
}, fail: (data, code) => {
|
|
}, fail: (data, code) => {
|
|
|
console.log(data, code)
|
|
console.log(data, code)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- initNativeAd2(){
|
|
|
|
|
- let adParams = {
|
|
|
|
|
- adUnitId: '6f2e50489ff74bae800ce65c992bfec0', // 原生广告2.0广告位id
|
|
|
|
|
- type: 'native', // 原生广告2.0广告类型
|
|
|
|
|
- adCount: 1, // 原生广告2.0广告预期返回广告条数
|
|
|
|
|
- }
|
|
|
|
|
- require('@service.ad').preloadAd({
|
|
|
|
|
- ...adParams,
|
|
|
|
|
- success: (data) => {
|
|
|
|
|
- this.adList2 = data.adList[0]
|
|
|
|
|
- console.log('data',data)
|
|
|
|
|
- // prompt.showToast({
|
|
|
|
|
- // message: `success! data=${JSON.stringify(data)}`
|
|
|
|
|
- // })
|
|
|
|
|
- }, fail: (data, code) => {
|
|
|
|
|
- console.log(data, code)
|
|
|
|
|
- // prompt.showToast({
|
|
|
|
|
- // message: `fail! data=${JSON.stringify(data)}, code=${code}`
|
|
|
|
|
- // })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
initBanner(){
|
|
initBanner(){
|
|
|
try {
|
|
try {
|
|
|
this.adBanner = require('@service.ad').createBannerAd({ // 使用require方式避免在不支持的广告接口的厂商运行是报错
|
|
this.adBanner = require('@service.ad').createBannerAd({ // 使用require方式避免在不支持的广告接口的厂商运行是报错
|