var colorArray = ['#9c0010','#fea262','#fbecc5','#780b06','#f8c78f']; var bannerImag = ['https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgBanner01.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgBanner02.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgBanner03.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgBanner04.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgBanner05.png']; var titleImag = ['https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/title01.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/title02.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/title03.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/title04.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/title05.png']; var bgImage = ['https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bg01.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bg02.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bg03.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bg04.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bg05.png']; var bgTopImage = ['https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgTop01.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgTop02.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgTop03.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgTop04.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/bgTop05.png']; var commodityBgImage = ['https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/conBg01.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/conBg02.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/conBg03.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/conBg04.png','https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/guoqing/conBg05.png'] var day = '';//国庆第几天 var page = 1;//页数 var qs = parseQueryString(window.location.href); $().ready(function() { if (qs.day) { day = qs.day; } getData();//获取数据 }) //页面初始化 function init () { $('body').css('background',colorArray[day-1]) $('.banner img').attr('src',bannerImag[day-1]) $('.activityList').css({'background':'url(' + bgImage[day-1] + ') no-repeat','background-size':'100% 100%'}) $('.activityList .title').css({'background':'url(' + titleImag[day-1] + ') no-repeat','background-size':'100% 100%'}) $('.activityList').eq(0).css({'background':'url(' + bgTopImage[day-1] + ') no-repeat','background-size':'100%','background-position': '0 0.5rem'}) $('.commodityListCon').css({'background':'url(' + commodityBgImage[day-1] + ') no-repeat','background-size':'100%'}) //根据天数改变样式 if(day == 1){ $('.tab li .img').css({'border-radius':'0','background':'none'}) $('.tab li .img img').css({'width':'0.55rem','height':'0.55rem'}) }else if(day == 2){ $('.title').css({'height': '0.45rem','color':'#7B1F00'}) $('.tab li .img').css({'border-radius':'0','background':'none'}) $('.tab li .img img').css({'width':'0.55rem','height':'0.55rem'}) $('.tab li span').css({'color':'#E6250D'}) $('.con').css({'width': '3.35rem','padding-top': '0.29rem'}) $('.commodityList ul li').css({'margin-left': '0.01rem'}) $('.con li p').css({'color':'#FE3967'}) $('.nowPrice').css({'color':'#FE3967'}) $('.oldPrice').css({'color':'#FF6D7E'}) }else if(day == 3){ $('.title').css({'height': '0.45rem','color':'#FFFFFF'}) $('.tab li .img').css({'border-radius':'0','background':'none'}) $('.tab li .img img').css({'width':'0.55rem','height':'0.55rem'}) $('.tab li span').css({'color':'#000000'}) $('.con li p').css({'color':'#FFF4C4'}) $('.nowPrice').css({'color':'#FFFFFF'}) $('.oldPrice').css({'color':'#FFFFFF'}) }else if(day == 4){ $('.title').css({'width': '100%','color': '#FFFFFF','line-height': '0.48rem'}) $('.con').css({'width': '3.5rem','padding-top': '0.35rem'}) }else if(day == 5){ $('.title').css({'color': '#FD5E25','line-height': '0.55rem'}) $('.con').css({'width': '3.75rem'}) $('.con .img').css({'border': '0.01rem solid #FCB502'}) } } //获取地址栏参数 function parseQueryString(url) { var urlObj = {}; var reg = /([^?=&]+)=([^?=&]+)/g; url.replace(reg, ($0, $1, $2) => { urlObj[$1] = decodeURIComponent($2); }) return urlObj; } //获取数据 function getData(){ $.ajax({ type: "POST", url: "/api/v2/goods/nationalDayActive", data:{ day : day }, success:function(res){ if(res.errno == "0" && res.rst){ var data = res.rst.data; var html = ''; html = template_Strategy (data) } } }) } //攻略模板 function template_Strategy(data) { var html = ''; var img = '' ; data.forEach(function (item, index) { var grouplist = item.grouplist; //tab列表 var goodslist = item.goodslist; //6个商品 html += '
'+ goodslist[i].title +'