浏览代码

美博会弹窗

zhengjinyi 4 年之前
父节点
当前提交
f3d66f05cc

+ 1 - 1
src/main/resources/config/dev/application-dev.yml

@@ -53,7 +53,7 @@ logging:
 # 服务域名
 caimei:
   siteEnv: 0 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
-  spiServer: http://192.168.2.68:8008
+  spiServer: https://spi-b.caimei365.com
   imageDomain: https://img-b.caimei365.com
   wwwDomain: https://www-b.caimei365.com
 

+ 17 - 11
src/main/resources/static/js/index.js

@@ -58,7 +58,8 @@ var homeData = new Vue({
         closepopup:function(){
               this.showflag=false;
               $('.Popup').slideUp(100);
-              window.localStorage.setItem('beatyPop',true);
+              localStorage.setItem('lockTime',Date.now());
+              localStorage.setItem('isActivityStatus',true);
         },
         GetBanners: function(){
             var _self = this;
@@ -264,6 +265,13 @@ var homeData = new Vue({
                     },200);
                 }
             }
+        },
+        diffTime:function(time){
+            var date = Date.now();
+            console.log('缓存时间戳',time);
+            console.log('当前时间戳',date);
+            console.log('计算时间戳',(date-time));
+            return (date -time) < 2*60*1000 ? false : true
         }
     },
     created: function() {
@@ -324,24 +332,22 @@ var homeData = new Vue({
         //关闭广告图
         $('#advertising').on('click','.close',function () {
             $(this).parents('.item').hide();
-        })
-
-        var beatyPop =  window.localStorage.getItem('beatyPop');
+        });
+        var isActivityStatus =  localStorage.getItem('isActivityStatus');
         //  window.onbeforeunload = function(e) {
         //     e = e || window.event;
         //      window.localStorage.removeItem('beatyPop');
         // };
-        //新加  优惠券弹窗
-        if(beatyPop){
-            _this.showflag = false;
+        //新加优惠券弹窗
+        if(isActivityStatus){
+            var  lockTime = localStorage.getItem('lockTime');
+            var  eTime = this.diffTime(lockTime);
+            _this.showflag = eTime;
         }else{
             setTimeout(function () {
                  _this.showflag = true;
-            },1000)
+            },1000);
         }
-        setTimeout(function () {
-             window.localStorage.removeItem('beatyPop');
-        },7200000)
     }
 });
 

+ 2 - 2
src/main/resources/templates/index.html

@@ -893,8 +893,8 @@
                 <a class="item-sideNav" href="javascript:void(0);" v-for="nav in asideNav" :data-id="nav.id" v-text="nav.value" ></a>
             </div>
         </div>
-<!--美博会弹窗-->
-        <div class="Popup" v-if="showflag" :class="showflag?'show':''">
+        <!--美博会弹窗-->
+        <div class="Popup" v-if="showflag" :class="showflag ? 'show' :'' ">
             <div class="show_popup">
                 <div class="bg_icon" @click="closepopup"><i class="icon mIcon"></i></div>
                 <div class="bg_img" @click="zhuanti"><img src="/img/Beautyfair/youhui-pc.png" v-if="isPC"><img src="/img/Beautyfair/youhui.h5.png" v-else></div>