|
@@ -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)
|
|
|
}
|
|
|
});
|
|
|
|