var drawCode = getParameter('drawCode'); var prizeType = null; var prizeCode = null; function rtn() { let rtnBtn = getParameter('rtn'); if (rtnBtn) { location.href = decodeURIComponent(rtnBtn); } else { history.back(); } } function drawrule() { console.log('rule'); $.ajax({ type: "POST", url: contextRootPath+"/draw/describe", data: {actCode: drawCode}, dataType: "json", success: function(data){ var desc = removeHTMLTag(data.drawRule.drawdescribe); var desc1 = escape2Html(desc); console.log(desc1); $(".contBox").append(desc1); }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('网络异常', textStatus, errorThrown); } }); $('.rule').show(); } //转义替换 /*移除HTML标签代码*/ function removeHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白 //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行 //str=str.replace(/ /ig,'');//去掉 return str; } function escape2Html(str) { var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'}; return str.replace(/&(|lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];}); } function tip(msg) { $('.tip_copy>p').text(msg); $('.tip_copy').show(); setTimeout(function(){ $('.tip_copy').hide(); },1500); } function myprizes() { $('.popList').html(''); $('.myPrize').show(); $.ajax({ type: "POST", url: contextRootPath+"/draw/prizes.action", data: {drawCode: drawCode}, dataType: "json", success: function(data){ if (!data.prizes) { return; } console.log(data.prizes); $.each(data.prizes, function (i, n) { var ptype = n.prizeType; var status = n.status; var iscenter = 0; var prize = $('.prize_li').clone(); $(prize).css('display', 'inherit'); prize.removeClass('prize_li'); prize.find('.pname').html(n.prizeName); prize.find('.time').html(n.drawTime); $(prize).attr('val', n.prizeCode); $(prize).attr('flow', n.gatewayFlow); $(prize).attr('ptype', ptype); $('.popList').append(prize); }); }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('网络异常', textStatus, errorThrown); } }); } $('.pop_height').css({ 'max-height': $(window).height() * 0.45 + 'px' }); $(window).resize(function () { $('.pop_height').css({ 'max-height': $(window).height() * 0.45 + 'px' }) }); function readtext(obj) { var pcode = $(obj).parent().parent('li').attr('val'); var text = prizeTexts.get(pcode); $(obj).parent().next('.read_text').html(text); $(obj).parent().next('i').toggle(); } function readinfo(obj) { var ptype = $(obj).parent().parent('li').attr('ptype'); var pcode = $(obj).parent().parent('li').attr('val'); var flow = $(obj).parent().parent('li').attr('flow'); var pname = $(obj).parent().parent('li').find('.pname').text(); setPrizeInfo(ptype, pcode, pname, flow); $('.smak_prize').hide(); $('.material').show(); } function setPrizeInfo(ptype, pcode, cue, flow) { prizeCode = pcode; prizeType = ptype; $('.flow').val(flow); let src = $('img[pcode="'+pcode+'"]').attr('src'); if (ptype == 'materialObject') { $('.goods').find('.cue').text(cue); $('.goods').find('.pimg').attr('src', src); } else if (ptype == 'pcoupon') { $('.winPrize').find('.cue').text(cue); $('.winPrize').find('.remark').text('电子码将以短信的形式发送到您的手机号上,请注意查收'); $('.winPrize').find('.pimg').attr('src', src); } else { $('.winPrize').find('.cue').text(cue); $('.winPrize').find('.remark').text('将在2小时内发放至您的一账通绑定银行卡中,请注意查收'); $('.winPrize').find('.pimg').attr('src', src); } } function prizes() { $.ajax({ type: "POST", url: contextRootPath+"/draw/prizes.action", data: {drawCode: drawCode, isAll: 1}, dataType: "json", success: function(data){ var content = ''; if (data.prizes) { $.each(data.prizes, function (i, n) { if (n.mobile) { content = content + ('