123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557 |
- <template>
- <view>
- <view :class="((plugins_mourning_data || 0) == 1 ? ' grayscale' : '')+(is_single_page == 1 ? ' single-page-top' : '')">
- <!-- 顶部内容 -->
- <view v-if="load_status == 1" class="home-top-nav-content" :style="top_content_style">
- <!-- logo/标题 -->
- <!-- #ifndef MP-TOUTIAO -->
- <view class="home-top-nav-logo">
- <block v-if="is_logo_use_text == 0 && (application_logo || null) != null">
- <image :src="application_logo" mode="aspectFit" class="home-top-nav-logo-image"></image>
- </block>
- <block v-else>
- <view class="home-top-nav-logo-title cr-white single-text">{{application_title}}</view>
- </block>
- </view>
- <!-- #endif -->
- <!-- 搜索 -->
- <view v-if="search_is_fixed == 1" class="search-fixed-seat"></view>
- <view v-if="load_status == 1" :class="'pr '+(search_is_fixed == 1 ? 'search-content-fixed bg-main' : '')" :style="search_is_fixed == 1 ? top_content_style : ''">
- <view v-if="common_app_is_enable_search == 1" :style="search_style">
- <view class="margin-horizontal-main">
- <component-search propPlaceholder="输入商品名称搜索" propBgColor="#fff"></component-search>
- </view>
- </view>
- <!-- #ifdef H5 || MP-TOUTIAO || APP -->
- <!-- 右上角icon列表 -->
- <view v-if="(right_icon_list || null) != null && right_icon_list.length > 0" class="nav-top-right-icon pa">
- <block v-for="(item,index) in right_icon_list">
- <view class="item dis-inline-block cp" :data-value="item.url || ''" @tap="url_event">
- <uni-icons :type="item.icon" size="32rpx" color="#f1f1f1"></uni-icons>
- <view v-if="(item.badge || null) != null" class="badge-icon pa">
- <component-badge :propNumber="item.badge"></component-badge>
- </view>
- </view>
- </block>
- </view>
- <!-- #endif -->
- </view>
- <!-- 轮播 -->
- <view class="banner-content padding-horizontal-main" v-if="banner_list.length > 0">
- <component-banner :propData="banner_list"></component-banner>
- </view>
- </view>
- <!-- 内容 -->
- <view class="content padding-horizontal-main">
- <!-- 导航 -->
- <view v-if="navigation.length > 0">
- <component-icon-nav :propData="navigation"></component-icon-nav>
- </view>
- <!-- 商城公告 -->
- <view class="notice-content spacing-mb" v-if="load_status == 1 && (common_shop_notice || null) != null">{{common_shop_notice}}</view>
- <!-- 推荐文章 -->
- <view v-if="article_list.length > 0" class="article-list padding-main border-radius-main oh bg-white spacing-mb">
- <image :src="static_url+'new-icon.png'" mode="aspectFit" class="new-icon va-m fl cp" data-value="/pages/article-category/article-category" @tap="url_event"></image>
- <view class="right-content fr va-m">
- <swiper :vertical="true" :autoplay="true" :circular="true" display-multiple-items="1" interval="3000">
- <block v-for="(item, index) in article_list" :key="index">
- <swiper-item class="single-text">
- <text class="cr-base text-size-sm cp" :data-value="item.category_url" @tap="url_event">[{{item.article_category_name}}]</text>
- <text class="cr-base text-size-sm margin-left-xs cp" :style="(item.title_color || null) != null ? 'color:'+item.title_color+' !important;' : ''" :data-value="item.url" @tap="url_event">{{item.title}}</text>
- </swiper-item>
- </block>
- </swiper>
- </view>
- </view>
- <!-- 按照插件顺序渲染插件数据 -->
- <block v-if="plugins_sort_list.length > 0">
- <block v-for="(pv, pi) in plugins_sort_list" :key="pi">
- <!-- 首页中间广告 - 插件 -->
- <view v-if="pv.plugins == 'homemiddleadv' && (plugins_homemiddleadv_data || null) != null && plugins_homemiddleadv_data.length > 0" class="plugins-homemiddleadv oh">
- <view v-for="(item, index) in plugins_homemiddleadv_data" :key="index" class="item border-radius-main oh cp spacing-mb" :data-value="item.url || ''" @tap="url_event">
- <image class="dis-block wh-auto border-radius-main" :src="item.images" mode="widthFix"></image>
- </view>
- </view>
- <!-- 限时秒杀 - 插件 -->
- <view v-if="pv.plugins == 'seckill' && plugins_seckill_is_valid == 1 && plugins_seckill_data.goods.length > 0" class="seckill border-radius-main padding-horizontal-main spacing-mb" :style="plugins_seckill_bg">
- <view class="spacing-nav-title">
- <text class="text-wrapper va-m">限时秒杀</text>
- <view class="dis-inline-block va-m margin-left-sm">
- <component-countdown :propHour="plugins_seckill_data.time.hours" :propMinute="plugins_seckill_data.time.minutes" :propSecond="plugins_seckill_data.time.seconds"></component-countdown>
- </view>
- <navigator url="/pages/plugins/seckill/index/index" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
- </view>
- <component-goods-list :propData="{style_type: 2, goods_list: plugins_seckill_data.goods}" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-goods-list>
- </view>
- <!-- 活动配置-楼层顶部 - 插件 -->
- <block v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
- <component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="0" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-activity-list>
- </block>
- <!-- 门店 - 插件 -->
- <block v-if="pv.plugins == 'realstore' && (plugins_realstore_data || null) != null">
- <view class="spacing-nav-title">
- <text class="text-wrapper">{{plugins_realstore_data.base.home_data_list_title || '最新门店'}}</text>
- <navigator url="/pages/plugins/realstore/search/search" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
- </view>
- <component-realstore-list :propDataList="plugins_realstore_data.data" :propFavorUser="plugins_realstore_data.favor_user"></component-realstore-list>
- </block>
- <!-- 多商户 - 插件 -->
- <block v-if="pv.plugins == 'shop' && (plugins_shop_data || null) != null">
- <view class="spacing-nav-title">
- <text class="text-wrapper">{{plugins_shop_data.base.home_data_list_title || '最新商家'}}</text>
- <navigator url="/pages/plugins/shop/index/index" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
- </view>
- <component-shop-list :propConfig="plugins_shop_data.base" :propDataList="plugins_shop_data.data"></component-shop-list>
- </block>
- <!-- 博客-楼层顶部 - 插件 -->
- <block v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
- <component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="0"></component-blog-list>
- </block>
- </block>
- </block>
- <!-- 楼层数据 -->
- <block v-if="(data_list || null) != null && data_list.length > 0">
- <!-- 数据模式0,1自动+手动、2拖拽 -->
- <block v-if="home_index_floor_data_type == 2">
- <!-- 引入拖拽数据模块 -->
- <component-layout :propData="data_list"></component-layout>
- </block>
- <block v-else>
- <!-- 自动+手动 -->
- <view v-for="(floor, index) in data_list" :key="index" class="floor">
- <view class="spacing-nav-title">
- <text class="text-wrapper" :style="'color:'+(floor.bg_color || '#333')+';'">{{floor.name}}</text>
- <text v-if="(floor.describe || null) != null" class="vice-name margin-left-lg cr-gray">{{floor.describe}}</text>
- <navigator :url="'/pages/goods-search/goods-search?category_id=' + floor.id" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
- </view>
- <view class="floor-list wh-auto oh pr">
- <view v-if="floor.items.length > 0" class="word-list scroll-view-horizontal margin-bottom-lg">
- <scroll-view :scroll-x="true">
- <block v-for="(icv, icx) in floor.items" :key="icx">
- <navigator :url="'/pages/goods-search/goods-search?category_id=' + icv.id" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{icv.name}}</navigator>
- </block>
- </scroll-view>
- </view>
- <block v-if="floor.goods.length > 0">
- <component-goods-list :propData="{style_type: 1, goods_list: floor.goods}" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-goods-list>
- </block>
- </view>
- </view>
- </block>
- </block>
- <!-- 按照插件顺序渲染插件数据 -->
- <block v-if="plugins_sort_list.length > 0">
- <block v-for="(pv, pi) in plugins_sort_list" :key="pi">
- <!-- 活动配置-楼层底部 - 插件 -->
- <block v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
- <component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="1" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol"></component-activity-list>
- </block>
- <!-- 博客-楼层底部 - 插件 -->
- <block v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
- <component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="1"></component-blog-list>
- </block>
- <!--- 底部购买记录 - 插件 -->
- <view v-if="pv.plugins == 'salerecords' && (plugins_salerecords_data || null) != null && (plugins_salerecords_data.data || null) != null && plugins_salerecords_data.data.length > 0" class="spacing-mb plugins-salerecords">
- <view class="spacing-nav-title">
- <text class="text-wrapper">{{plugins_salerecords_data.base.home_bottom_title || '最新购买'}}</text>
- <text v-if="(plugins_salerecords_data.base || null) != null && (plugins_salerecords_data.base.home_bottom_desc || null) != null" class="vice-name margin-left-lg cr-gray">{{plugins_salerecords_data.base.home_bottom_desc}}</text>
- </view>
- <view class="bg-white padding-horizontal-main border-radius-main oh">
- <swiper :vertical="true" :autoplay="true" :circular="true" :display-multiple-items="plugins_salerecords_data.data.length < 6 ? plugins_salerecords_data.data.length : 6" interval="3000" :style="plugins_salerecords_data.data.length < 6 ? 'height:'+(plugins_salerecords_data.data.length*84.33)+'rpx;' : ''">
- <block v-for="(item, index) in plugins_salerecords_data.data" :key="index">
- <swiper-item>
- <view class="item oh padding-vertical-main">
- <view class="item-content single-text fl">
- <image mode="widthFix" :src="item.user.avatar" class="va-m br"></image>
- <text class="margin-left-sm">{{item.user.user_name_view}}</text>
- <text v-if="(item.user.province || null) != null"><text class="padding-left-xs padding-right-xs">-</text>{{item.user.province}}</text>
- </view>
- <view class="item-content fl">
- <navigator :url="item.goods_url" hover-class="none" class="single-text">
- <image mode="widthFix" :src="item.images" class="va-m br"></image>
- <text class="margin-left-sm single-text">{{item.title}}</text>
- </navigator>
- </view>
- <view class="item-content single-text fr tr cr-gray padding-top-xs">{{item.add_time}}</view>
- </view>
- </swiper-item>
- </block>
- </swiper>
- </view>
- </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">
- <icon type="clear" size="20" class="close pa cp" @tap.stop="plugins_popupscreen_close_event"></icon>
- <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 v-if="load_status == 1 && common_app_is_enable_answer == 1" class="bg-white border-radius-main oh spacing-mt">
- <navigator url="/pages/answer-form/answer-form" hover-class="none">
- <image mode="widthFix" :src="static_url+'answer-form.jpg'" class="wh-auto border-radius-main"></image>
- </navigator>
- </view>
- </view>
-
- <!-- 提示信息 -->
- <block v-if="load_status == 0">
- <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
- </block>
-
- <!-- 结尾 -->
- <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
-
- <!-- 版权信息 -->
- <view v-if="load_status == 1">
- <component-copyright></component-copyright>
- </view>
- </view>
- <!-- 在线客服 -->
- <component-online-service :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data || 0"></component-online-service>
-
- <!-- 快捷导航 -->
- <component-quick-nav :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data || 0"></component-quick-nav>
- </view>
- </template>
- <script>
- const app = getApp();
- import componentSearch from "../../components/search/search";
- import componentQuickNav from "../../components/quick-nav/quick-nav";
- import componentIconNav from "../../components/icon-nav/icon-nav";
- import componentBanner from "../../components/slider/slider";
- import componentCountdown from "../../components/countdown/countdown";
- import componentLayout from "../../components/layout/layout";
- import componentBadge from "../../components/badge/badge";
- import componentNoData from "../../components/no-data/no-data";
- import componentBottomLine from "../../components/bottom-line/bottom-line";
- import componentCopyright from "../../components/copyright/copyright";
- import componentOnlineService from "../../components/online-service/online-service";
- import componentActivityList from "../../components/activity-list/activity-list";
- import componentBlogList from "../../components/blog-list/blog-list";
- import componentRealstoreList from "../../components/realstore-list/realstore-list";
- import componentShopList from "../../components/shop-list/shop-list";
- import componentGoodsList from "../../components/goods-list/goods-list";
- var common_static_url = app.globalData.get_static_url('common');
- var static_url = app.globalData.get_static_url('home');
- var seckill_static_url = app.globalData.get_static_url('seckill', true);
- // 状态栏高度
- var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
- // #ifdef MP-TOUTIAO
- bar_height = 0;
- // #endif
- export default {
- data() {
- return {
- common_static_url: common_static_url,
- static_url: static_url,
- data_list_loding_status: 1,
- data_list_loding_msg: '',
- data_bottom_line_status: false,
- load_status: 0,
- currency_symbol: app.globalData.data.currency_symbol,
- data_list: [],
- banner_list: [],
- navigation: [],
- article_list: [],
- cart_total: 0,
- message_total: 0,
- right_icon_list: [],
- // 基础配置
- common_shop_notice: null,
- home_index_floor_data_type: 0,
- common_app_is_enable_search: 0,
- common_app_is_enable_answer: 0,
- common_app_is_header_nav_fixed: 0,
- common_app_is_online_service: 0,
- // 名称
- application_title: app.globalData.data.application_title,
- application_logo: app.globalData.data.application_logo,
- is_logo_use_text: app.globalData.data.is_logo_use_text || 0,
- // 顶部+搜索样式配置
- top_content_style: 'background-image: url("'+static_url+'nav-top.png");'+'padding-top:'+(bar_height+8)+'px;',
- search_style: '',
- search_is_fixed: 0,
- // 是否单页预览
- is_single_page: app.globalData.is_current_single_page() || 0,
- // 插件顺序列表
- plugins_sort_list: [],
- // 限时秒杀插件
- plugins_seckill_bg: 'background: url('+seckill_static_url+'home-bg.png) top/100% no-repeat;',
- plugins_seckill_is_valid: 0,
- plugins_seckill_data: null,
- // 购买记录插件
- plugins_salerecords_data: null,
- // 活动配置插件
- plugins_activity_data: null,
- // 标签插件
- 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: 0,
- // 标签插件
- plugins_blog_data: null,
- // 门店插件
- plugins_realstore_data: null,
- // 多商户插件
- plugins_shop_data: null
- };
- },
- components: {
- componentSearch,
- componentQuickNav,
- componentIconNav,
- componentBanner,
- componentCountdown,
- componentLayout,
- componentBadge,
- componentNoData,
- componentBottomLine,
- componentCopyright,
- componentOnlineService,
- componentActivityList,
- componentBlogList,
- componentRealstoreList,
- componentShopList,
- componentGoodsList
- },
- props: {},
- onShow() {
- // 数据加载
- this.init();
- // 初始化配置
- this.init_config();
- },
- // 下拉刷新
- onPullDownRefresh() {
- this.init();
- },
- methods: {
- // 初始化配置
- init_config(status) {
- if ((status || false) == true) {
- this.setData({
- currency_symbol: app.globalData.get_config('currency_symbol'),
- common_shop_notice: app.globalData.get_config('config.common_shop_notice'),
- home_index_floor_data_type: app.globalData.get_config('config.home_index_floor_data_type'),
- common_app_is_enable_search: app.globalData.get_config('config.common_app_is_enable_search'),
- common_app_is_enable_answer: app.globalData.get_config('config.common_app_is_enable_answer'),
- common_app_is_header_nav_fixed: app.globalData.get_config('config.common_app_is_header_nav_fixed'),
- common_app_is_online_service: app.globalData.get_config('config.common_app_is_online_service'),
- application_title: app.globalData.get_application_title(),
- application_logo: app.globalData.get_application_logo()
- });
- } else {
- app.globalData.is_config(this, 'init_config');
- }
- },
- // 获取数据
- init() {
- this.setData({
- data_list_loding_status: 1
- });
- uni.request({
- url: app.globalData.get_request_url("index", "index"),
- method: 'POST',
- data: {},
- dataType: 'json',
- success: res => {
- uni.stopPullDownRefresh();
- // 获取最新缓存
- if (this.load_status == 0) {
- this.init_config(true);
- }
- // 设置首次加载状态
- this.setData({
- load_status: 1
- });
- if (res.data.code == 0) {
- var data = res.data.data;
- this.setData({
- data_bottom_line_status: true,
- banner_list: data.banner_list || [],
- navigation: data.navigation || [],
- article_list: data.article_list || [],
- data_list: data.data_list,
- cart_total: data.cart_total.buy_number || 0,
- message_total: parseInt(data.message_total || 0),
- right_icon_list: data.right_icon_list || [],
- data_list_loding_status: data.data_list.length == 0 ? 0 : 3,
- plugins_sort_list: data.plugins_sort_list || [],
- plugins_seckill_data: data.plugins_seckill_data || null,
- plugins_seckill_is_valid: (data.plugins_seckill_data || null) != null && (data.plugins_seckill_data.is_valid || 0) == 1 ? 1 : 0,
- plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data,
- 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: data.plugins_mourning_data || 0,
- plugins_blog_data: data.plugins_blog_data || null,
- plugins_realstore_data: data.plugins_realstore_data || null,
- plugins_shop_data: data.plugins_shop_data || null
- });
- // 弹屏广告插件处理
- this.plugins_popupscreen_handle();
- // 导航购物车处理
- if (this.cart_total <= 0) {
- app.globalData.set_tab_bar_badge(2, 0);
- } else {
- app.globalData.set_tab_bar_badge(2, 1, this.cart_total);
- }
- // 搜索框宽度处理
- // #ifdef MP-TOUTIAO
- var len = (this.right_icon_list || []).length;
- var val = (len <= 0) ? 0 : 66*len;
- this.setData({
- search_style: 'width: calc(100% - '+val+'rpx);',
- });
- // #endif
- } else {
- this.setData({
- data_list_loding_status: 0,
- data_list_loding_msg: res.data.msg,
- data_bottom_line_status: true
- });
- app.globalData.showToast(res.data.msg);
- }
- // 分享菜单处理、延时执行,确保基础数据已加载完成
- setTimeout(function() {
- app.globalData.page_share_handle();
- }, 3000);
- },
- fail: () => {
- uni.stopPullDownRefresh();
- this.setData({
- data_list_loding_status: 2,
- data_list_loding_msg: '服务器请求出错',
- data_bottom_line_status: true,
- load_status: 1
- });
- app.globalData.showToast('服务器请求出错');
- }
- });
- },
-
- // 页面滚动监听
- onPageScroll(e) {
- if(this.common_app_is_header_nav_fixed == 1 && this.common_app_is_enable_search == 1) {
- var top = e.scrollTop > 35 ? 35 : e.scrollTop;
- var num = top*7;
- var base = 230;
- // #ifdef MP-ALIPAY
- base = 235
- // #endif
- // #ifdef H5 || MP-TOUTIAO || APP
- var len = (this.right_icon_list || []).length;
- base = (len <= 0) ? 0 : 66*len;
- // #endif
- // 开启哀悼插件的时候不需要浮动导航并且搜索框也不需要缩短、开启站点灰度会导致浮动失效
- if((this.plugins_mourning_data || 0) != 1) {
- var top_val = 35;
- var val = (num > base) ? base : num;
- // #ifdef MP-TOUTIAO
- top_val = 0;
- val = base
- // #endif
- this.setData({
- search_style: 'width: calc(100% - '+(val < 0 ? 0 : val)+'rpx);',
- search_is_fixed: (top >= top_val) ? 1 : 0,
- });
- }
- }
- },
-
- // url事件
- url_event(e) {
- 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);
- }
- }
- };
- </script>
- <style>
- @import './index.css';
- </style>
|