适配最新弹屏广告插件

master
gongfuxiang 2025-01-10 14:42:23 +08:00
parent 6821b91200
commit 2476884d33
5 changed files with 180 additions and 98 deletions

42
App.vue
View File

@ -1000,17 +1000,41 @@
*/
is_tabbar_pages_handle(pages, url = null) {
var value = (url == null) ? '/'+this.current_page() : url;
if ((value || null) == null) {
return false;
if ((value || null) != null) {
if(pages.indexOf(value) != -1) {
return true;
} else {
// tabbar
if(value.indexOf('?') != -1) {
var temp = value.split('?');
if(pages.indexOf(temp[0]) != -1) {
return true;
}
}
}
}
if(pages.indexOf(value) != -1) {
return true;
} else {
// tabbar
if(value.indexOf('?') != -1) {
var temp = value.split('?');
if(pages.indexOf(temp[0]) != -1) {
return false;
},
/**
* 当前地址是否存为首页
* url url地址
*/
is_tabbar_home(url = null) {
var pages = this.app_tabbar_pages() || [];
if(pages.length > 0) {
var value = (url == null) ? '/'+this.current_page() : url;
if ((value || null) != null) {
if(pages[0] == value) {
return true;
} else {
// tabbar
if(value.indexOf('?') != -1) {
var temp = value.split('?');
if(pages[0] == temp[0]) {
return true;
}
}
}
}
}

View File

@ -37,6 +37,9 @@
<!-- 用户基础 -->
<component-user-base ref="user_base" :propIsGrayscale="propIsGrayscale"></component-user-base>
<!-- 弹屏广告 -->
<component-popupscreen ref="popupscreen" :propIsGrayscale="propIsGrayscale"></component-popupscreen>
</view>
</template>
<script>
@ -44,6 +47,7 @@
import componentDiyFooter from '@/components/diy/footer';
import componentAppAdmin from '@/components/app-admin/app-admin';
import componentUserBase from '@/components/user-base/user-base';
import componentPopupscreen from '@/components/popupscreen/popupscreen';
export default {
data() {
return {
@ -79,11 +83,17 @@
type: Boolean,
default: true,
},
// 广
propIsPopupscreen: {
type: Boolean,
default: true,
},
},
components: {
componentDiyFooter,
componentAppAdmin,
componentUserBase
componentUserBase,
componentPopupscreen
},
//
created: function () {
@ -130,6 +140,11 @@
this.$refs.user_base.init(params);
}
// 广
if (this.propIsPopupscreen && (this.$refs.popupscreen || null) != null) {
this.$refs.popupscreen.init(params);
}
// #ifdef MP-WEIXIN
//
if (app.globalData.data.is_weixin_privacy_setting == 1) {

View File

@ -0,0 +1,131 @@
<template>
<view :class="theme_view">
<view v-if="(data || null) != null && status == 1" class="plugins-popupscreen wh-auto ht-auto">
<view class="content pr">
<image class="dis-block auto" :src="data.images" mode="widthFix" :data-value="data.images_url || ''" @tap="url_event"></image>
<view class="tc margin-top-xl">
<view class="close cp round padding-sm auto" @tap.stop="close_event">
<iconfont name="icon-close-o" size="28rpx" color="#cacaca"></iconfont>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
const app = getApp();
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
data: null,
status: 0,
cache_key: 'plugins_popupscreen_cache_key',
timer: null,
};
},
props: {},
//
created: function () {
this.init_config();
},
methods: {
//
init_config(status) {
if ((status || false) == true) {
this.setData({
data: app.globalData.get_config('plugins_base.popupscreen.data') || null,
});
this.init();
} else {
app.globalData.is_config(this, 'init_config');
}
},
//
init() {
var data = this.data || null;
if (data != null && parseInt(data.is_app_enable || 0) == 1 && parseInt(data.is_valid || 0) == 1) {
//
var temp_status = true;
if(parseFloat(data.is_overall || 0) == 0) {
//
if(!app.globalData.is_tabbar_home()) {
temp_status = false;
}
}
if(temp_status) {
//
var key = this.cache_key;
var cv = parseInt(uni.getStorageSync(key)) || 0;
var pv = parseInt(data.interval_time) || 86400;
if (cv == 0 || cv + pv < app.globalData.get_timestamp()) {
//
var timer = null;
var ct = parseInt(data.close_time) || 0;
if (ct > 0) {
var self = this;
timer = setTimeout(function () {
self.setData({
status: 0,
});
uni.setStorage({
key: key,
data: app.globalData.get_timestamp(),
});
}, ct * 1000);
}
this.setData({
status: 1,
timer: timer,
});
}
}
}
},
//
close_event(e) {
this.setData({
status: 0,
});
uni.setStorage({
key: this.cache_key,
data: app.globalData.get_timestamp(),
});
clearInterval(this.timer);
},
// url
url_event(e) {
app.globalData.url_event(e);
}
}
};
</script>
<style scoped>
.plugins-popupscreen {
position: fixed;
left: 0;
top: 0;
z-index: 20;
background-color: rgb(0 0 0 / 0.3);
}
.plugins-popupscreen .close {
right: 10%;
top: 0;
z-index: 1;
width: 46rpx;
height: 46rpx;
line-height: 46rpx;
background-color: rgb(4 4 4 / 0.3);
border: solid 1px #a9a9a9;
}
.plugins-popupscreen .content {
margin-top: calc(50vh - 200rpx) !important;
}
.plugins-popupscreen .content image {
width: 600rpx;
}
</style>

View File

@ -165,31 +165,4 @@
}
.plugins-homemiddleadv .item {
flex: 1 1 calc(50% - 20rpx);
}
/**
* 广 -
*/
.plugins-popupscreen {
position: fixed;
left: 0;
top: 0;
z-index: 20;
background-color: rgb(0 0 0 / 0.3);
}
.plugins-popupscreen .close {
right: 10%;
top: 0;
z-index: 1;
width: 46rpx;
height: 46rpx;
line-height: 46rpx;
background-color: rgb(4 4 4 / 0.3);
border: solid 1px #a9a9a9;
}
.plugins-popupscreen .content {
margin-top: calc(50vh - 200rpx) !important;
}
.plugins-popupscreen .content image {
width: 600rpx;
}

View File

@ -261,16 +261,6 @@
</view>
</block>
</block>
<!-- 弹屏广告 - 插件 -->
<view v-if="(plugins_popupscreen_data || null) != null && plugins_popupscreen_status == 1" class="plugins-popupscreen wh-auto ht-auto">
<view class="content pr">
<view class="close pa cp round padding-sm tc" @tap.stop="plugins_popupscreen_close_event">
<iconfont name="icon-close-o" size="28rpx" color="#cacaca"></iconfont>
</view>
<image class="dis-block auto" :src="plugins_popupscreen_data.images" mode="widthFix" :data-value="plugins_popupscreen_data.images_url || ''" @tap="url_event"></image>
</view>
</view>
</view>
</block>
@ -392,11 +382,6 @@
plugins_label_data: null,
// 广
plugins_homemiddleadv_data: null,
// 广
plugins_popupscreen_data: null,
plugins_popupscreen_status: 0,
plugins_popupscreen_cache_key: 'plugins_popupscreen_cache_key',
plugins_popupscreen_timer: null,
//
plugins_mourning_data_is_app: app.globalData.is_app_mourning(),
//
@ -554,7 +539,6 @@
plugins_activity_data: (data.plugins_activity_data || null) == null || data.plugins_activity_data.length <= 0 ? null : data.plugins_activity_data,
plugins_label_data: (data.plugins_label_data || null) == null || (data.plugins_label_data.base || null) == null || (data.plugins_label_data.data || null) == null || data.plugins_label_data.data.length <= 0 ? null : data.plugins_label_data,
plugins_homemiddleadv_data: (data.plugins_homemiddleadv_data || null) == null || data.plugins_homemiddleadv_data.length <= 0 ? null : data.plugins_homemiddleadv_data,
plugins_popupscreen_data: data.plugins_popupscreen_data || null,
plugins_mourning_data_is_app: parseInt(data.plugins_mourning_data || 0) == 1,
plugins_blog_data: data.plugins_blog_data || null,
plugins_realstore_data: data.plugins_realstore_data || null,
@ -574,9 +558,6 @@
//
this.set_navigation_bar_color();
// 广
this.plugins_popupscreen_handle();
//
if (parseInt(data.is_result_data_cache || 0) == 1) {
this.init({ is_cache: 0 });
@ -661,48 +642,6 @@
app.globalData.url_event(e);
},
// 广
plugins_popupscreen_handle() {
if (this.plugins_popupscreen_data != null) {
//
var cv = parseInt(uni.getStorageSync(this.plugins_popupscreen_cache_key)) || 0;
var pv = parseInt(this.plugins_popupscreen_data.interval_time) || 86400;
if (cv == 0 || cv + pv < app.globalData.get_timestamp()) {
//
var timer = null;
var ct = parseInt(this.plugins_popupscreen_data.close_time) || 0;
if (ct > 0) {
var self = this;
timer = setTimeout(function () {
self.setData({
plugins_popupscreen_status: 0,
});
uni.setStorage({
key: self.plugins_popupscreen_cache_key,
data: app.globalData.get_timestamp(),
});
}, ct * 1000);
}
this.setData({
plugins_popupscreen_status: 1,
plugins_popupscreen_timer: timer,
});
}
}
},
// 广 -
plugins_popupscreen_close_event(e) {
this.setData({
plugins_popupscreen_status: 0,
});
uni.setStorage({
key: this.plugins_popupscreen_cache_key,
data: app.globalData.get_timestamp(),
});
clearInterval(this.plugins_popupscreen_timer);
},
//
change_banner(color) {
if ((color || null) == null) {