1(function (win) { 2 var drawView = { 3 _body : $('body'), 4 _redConf_flag: true, 5 _red_serverTime : null, 6 _redConfLoginstatus : null, 7 _redConfUserinfo : null, 8 _redVoucherStatus : null, 9 _redVoucherIds : null, 10 init: function () { 11 this.serverTime(); 12 this.initdata(); 13 this.addEven(); 14 }, 15 initdata: function () { 16 var that = this; 17 //å±ç¤ºä¼æ å¸ 18 that.checkLogin(function (){ 19 if(!$("#tkRedSource").val()||$(".redPopSuspend").length>0){}else { 20 that.showCoupon($("#tkRedSource").val()); 21 } 22 if(!$("#flRedSource").val()){}else { 23 that.showCoupon($("#flRedSource").val()); 24 } 25 }); 26 }, 27 addEven: function () { 28 var that = this; 29 //ç¹å»çº¢å å ³é 30 $('body').on("click",".redMain .pm-redBox .pm-close,.redMain .pm-redBox-mask",function (){ 31 $(".pm-redBox").fadeOut(); 32 $(".pm-redBox-mask").fadeOut(); 33 $(".redMain .ylqCoupon .list").remove(); 34 }); 35 //ç¹å»å³ä¾§æµ®å¨æé®æå¼çº¢å 36 $('body').on("click",".rightFloatNav-redEnvelopes",function (){ 37 that.serverTime(); 38 that.receiveCoupon($("#flRedSource").val(),that._redVoucherStatus,that._redVoucherIds); 39 }); 40 //ç¹å»åºé¨æµ®å¨æé®æå¼çº¢å 41 $('body').on("click",".settlement-mod .redBtn",function (){ 42 that.serverTime(); 43 that.receiveCoupon($("#flRedSource").val(),that._redVoucherStatus,that._redVoucherIds); 44 }); 45 //ç¹å»çº¢å æé®æå¼çº¢å 46 $('body').on("click",".pm-redBox.wlq .pm-bot .wlqBtn",function (){ 47 that.serverTime(); 48 $(".redMain .pm-redBox.wlq").fadeOut(); 49 that.receiveCoupon($("#tkRedSource").val(),that._redVoucherStatus,that._redVoucherIds); 50 }); 51 }, 52 //伿 å¸åè®¡æ¶ 53 redCountDown : function(eleId, nowtime, dstart, dend, j){ 54 var that = this; 55 var NowTime = Number(nowtime) || new Date().getTime(); 56 var neweleId; 57 if(j == undefined || j == null){ 58 neweleId = eleId; 59 }else { 60 neweleId = eleId+j; 61 } 62 var element = document.getElementById(neweleId); 63 if (element) { 64 var dateValue = element.getAttribute('data-countDown').replace(new RegExp(/-/gm) ,"/"); 65 var EndTime = new Date(dateValue).getTime(); 66 var t = EndTime - NowTime; 67 NowTime = NowTime+1000; 68 var date = {} 69 if (t > 0) { 70 date.d = Math.floor(t / 1000 / 60 / 60 / 24), 71 date.h = Math.floor(t / 1000 / 60 / 60), 72 date.m = Math.floor(t / 1000 / 60 % 60), 73 date.s = Math.floor(t / 1000 % 60) 74 for (var i in date) date[i] < 10 ? date[i] < 10 && (date[i] = "0" + date[i]) : ''; 75 dstart && dstart(date,j); 76 setTimeout(function () { 77 that.redCountDown(eleId, NowTime, dstart, dend, j); 78 }, 1000); 79 } else { 80 dend && dend(date,j); 81 }; 82 } 83 }, 84 //æå¡å¨æ¶é´ 85 serverTime : function () { 86 var that = this; 87 $.ajax({
88 type: "POST", 89 url: "//member.med66.com/homeapi/live/getServiceTime", 90 async: false, 91 success: function (res) { 92 that._red_serverTime = res; 93 } 94 }); 95 }, 96 //读åcookie 97 getCookie : function (name) { 98 var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); 99 if (arr = document.cookie.match(reg)) { 100 return unescape(arr[2]); 101 } else { 102 return null; 103 } 104 }, 105 //设置cookie 106 //setCookie(cookieName,value,time,path) //time: 10h=10å°æ¶ 10m=10å 10=10天 107 setCookie : function (cookieName, value, time, path) { 108 var expiresDate = new Date(), 109 insertCoo = "", 110 domainPath = '.med66.com'; 111 var timeVal = !time ? '0' : time 112 if (timeVal.indexOf('h') > -1) { 113 expiresDate.setTime(expiresDate.getTime() + (parseInt(timeVal) * 3600 * 1000)); 114 } else if (timeVal.indexOf('m') > -1) { 115 expiresDate.setTime(expiresDate.getTime() + (parseInt(timeVal) * 60 * 1000)); 116 } else { 117 expiresDate.setTime(expiresDate.getTime() + (parseInt(timeVal) * 24 * 3600 * 1000)); 118 } 119 if (value != null && typeof (value) != "null" && typeof (value) != "null,") { 120 insertCoo = escape(value); 121 } 122 if (path) { 123 domainPath = path 124 } 125 var cookieStr = cookieName + "=" + insertCoo + "; expires=" + expiresDate.toGMTString() + "; path=/; domain=" + domainPath; 126 if (cookieStr != "") { 127 document.cookie = cookieStr; 128 } 129 }, 130 //æ¾ç¤ºï¼that.setLoad() å ³éï¼that.setLoad(true); 131 setLoad : function (type) { 132 if (type) { 133 $('#loadMod').remove(); 134 } else { 135 $('body').append('<div id="loadMod" style="width:118px;height:43px;line-height:24px;padding-top:75px;background:url(//www.med66.com/images/common2020/loadNew.gif) no-repeat center 15px #fff;text-align:center;color:#999;-webkit-box-shadow:0 0 12px rgba(0,0,0,.2);-moz-box-shadow:0 0 12px rgba(0,0,0,.2);box-shadow:0 0 12px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;border:1px solid #e5e5e5;position:fixed;left:50%;top:50%;margin:-60px 0 0 -60px;z-index:900;">Loading</div>') 136 } 137 }, 138 //æç¤º 139 alertTip : function (msg, time) { 140 if ($('.alertPop').length > 0) { 141 $('.alertPop').remove() 142 }; 143 $('body').append('<div class="alertPop" style="position:fixed;left:50%;top:50%;line-height:50px;font-size:16px;padding:0 20px;background:#000;opacity:.8;filter:alpha(opacity=80);color:#fff;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:5px;z-index:9999;">' + msg + '</div>'); 144 var alertPop = $('.alertPop'); 145 alertPop.css({ 146 'margin-top': -alertPop.outerHeight(true) / 2, 147 'margin-left': -alertPop.outerWidth(true) / 2 148 }); 149 setTimeout(function () { 150 alertPop.fadeOut(200, function () { 151 alertPop.remove() 152 }); 153 }, time || 4000); 154 }, 155 //ajax 156 ajax : function (param) { 157 var that = this; 158 if (param.load) { 159 that.setLoad() 160 } 161 return $.ajax({ 162 type: param.type || 'GET', 163 url: param.url, 164 data: param.data || {}, 165 dataType: 'jsonp', 166 jsonp: "jsonpCallback", 167 jsonpCallback: param.jsonpCallback || "jsonpCallback" + (new Date().getTime()) 168 }); 169 }, 170 //éªè¯ç»å½ 171 checkLogin : function (succ) { 172 var that = this; 173 var ucToken = that.getCookie("client_ucToken") 174 if (ucToken != "" && ucToken != null) { 175 that.ajax({
176 "type": "GET", 177 "url": "//member.med66.com/ucenter/loginRegister/checkUserLoginStatus/" + ucToken 178 }).then(function (json) { 179 if (json.success) { 180 if (json.result.loginFlag) { 181 //å·²ç»å½ 182 that._redConfLoginstatus = true; 183 that._redConfUserinfo = json; 184 succ && succ(json); 185 } else { 186 //æªç»å½ 187 } 188 } 189 }) 190 } else { 191 //æªç»å½ 192 } 193 }, 194 //夿ç»å½ 195 islogin : function (param) { 196 var that = this; 197 if (that._redConfLoginstatus&&that._redConfUserinfo&&that.getCookie('username')) { 198 param && param(); 199 } else { 200 loginRegister(1); 201 } 202 }, 203 //**************************************æ¥å£é¨å**************************************// 204 //å±ç¤ºä¼æ å¸å¼¹æ¡åå³ä¾§æµ®å¨ 205 showCoupon : function (source) { 206 var that = this; 207 postAesData({ 208 data : { 209 "params" : { 210 "time":new Date().getTime(), 211 "uuid":that.getCookie("bdp_uuid") || "", 212 "uid":that.getCookie('cdeluid') || "", 213 "source":source //201ï¼PCé¦é¡µç²¾åè¥éå¼¹çªï¼202ï¼PCæ ç®é¡µç²¾åè¥éå¼¹çªï¼203ï¼PCæ ç®é课ä¸å¿å表页精åè¥éå¼¹çªï¼ 204ï¼PCèµè®¯è¯¦æ 页精åè¥éå¼¹çªï¼205ï¼PCå³ä¾§å ¬ç¨å¤åè½æ ç²¾åè¥éæ¬æµ®æ¬æµ®ï¼206ï¼è´ç©è½¦é¡µåºé¨ç²¾åè¥éæ¬æµ® 214 }, 215 "domain" : "med66", 216 "resourcePath" : "+/precision/promptProbability", 217 "af":"1", //ç±»åï¼String å¿ æå段 夿³¨ï¼æ 218 "ap":"pc" //ç±»åï¼String å¿ æå段 夿³¨ï¼æ 219 }, 220 // ajaxæååè° 221 success : function (data) { 222 var result = data.result; 223 if(source == 201 || source == 202 || source == 203 || source == 204){ 224 //å¼¹åºçº¢å å¼¹æ¡ 225 if(result.type == 1){ 226 if(that.getCookie("redEnvelopes") != result.voucherIds){ 227 $(".pm-redBox.wlq .pm-top .wlqPrice .min").text(result.minDiscount); 228 $(".pm-redBox.wlq .pm-top .wlqPrice .max").text(result.maxDiscount); 229 $(".pm-redBox.wlq").css("margin-top",-($(".pm-redBox").height()/2)); 230 $(".pm-redBox.wlq").fadeIn(); 231 $(".pm-redBox-mask").fadeIn(); 232 that._redVoucherIds = result.voucherIds; 233 that._redVoucherStatus = result.voucherStatus; 234 that.setCookie("redEnvelopes",result.voucherIds,"2h"); 235 236 //诸èåç¹ 237 var zhugeObj; 238 if($(".topNav .nav-courseEdu h1").text() != ""){ 239 zhugeObj = $(".topNav .nav-courseEdu h1").text(); 240 }else if($(".nav h1").text() != ""){ 241 zhugeObj = $(".nav h1").text(); 242 } 243 zhuge.track('PC-è¿å ¥-ç²¾åè¥é',{ 244 'è¾ å¯¼åç§°': zhugeObj, 245 'æå¨é¡µé¢åç§°': $("title").text(), 246 'æå¨é¡µé¢URL': window.location.href 247 }); 248 } 249 } 250 if(source == 203){ 251 $(".pm-redBox.ylq .pm-bot .ylqBtn").addClass("close").attr({"href":"javascript:void(0)","target":"_self"}); 252 $('body').on("click",".pm-redBox.ylq .pm-bot .ylqBtn.close",function (){ 253 $(".pm-redBox").fadeOut(); 254 $(".pm-redBox-mask").fadeOut(); 255 $(".redMain .ylqCoupon .list").remove(); 256 }); 257 } 258 }else if(source == 205){ 259 //å±ç¤ºå³ä¾§æµ®å¨çº¢å æé® 260 if(result.floatType == 1){ 261 if($(".rightFloatNav").length>0){ 262 //é¦é¡µãæ ç®é¡µãåè¡¨é¡µãæ°é»é¡µå³ä¾§æµ®å¨ 263 var redBtnHtml = '<a href="javascript:void(0)" target="_self" class="rightFloatNav-redEnvelopes"><img src="'+result.floatImg+'"></a>'; 264 $(".rightFloatNav").append(redBtnHtml); 265 }else if($(".rignav").length>0){ 266 //é课å表页å³ä¾§æµ®å¨ 267 var redBtnHtml = '<a href="javascript:void(0)" target="_self" class="rightFloatNav-redEnvelopes"><img src="'+result.floatImg+'"></a>'; 268 $(".rignav").append(redBtnHtml); 269 } 270 that._redVoucherIds = result.voucherIds; 271 that._redVoucherStatus = result.voucherStatus; 272 } 273 }else if(source == 206){ 274 //å±ç¤ºè´ç©è½¦åºé¨æµ®å¨çº¢å æé® 275 if($(".settlement-mod").length>0){ 276 var redBtnHtml; 277 if(result.voucherStatus == 0){ 278 redBtnHtml = '<a href="javascript:void(0)" class="redBtn fl"><p class="redBtn-ltxt">ä¸å±ä¼æ 䏿¯æ¯ä¸ªäººé½æ<br><b>å¯ä¼æ <strong>'+result.minDiscount+'~'+result.maxDiscount+'</strong>å </b></p><span class="redBtn-rbtn">é¢å伿 </span></a>'; 279 }else if(result.voucherStatus == 1){ 280 redBtnHtml = '<a href="javascript:void(0)" class="redBtn fl" id="redBtnTime" data-countDown="'+result.couponTime+'"><p class="redBtn-ltxt">ä¸å±ä¼æ 䏿¯æ¯ä¸ªäººé½æ<br><b class="fs12"><em class="th"></em>å°æ¶å失æï¼<em class="tt"></em></b></p><span class="redBtn-rbtn">æ¥ç伿 å¸</span></a>'; 281 } 282 $(".settlement-mod").append(redBtnHtml); 283 that.redCountDown("redBtnTime",that._red_serverTime,function (obj) { 284 $("#redBtnTime").find(".th").text(obj.h >= 10 ? obj.h : obj.h.replace("0","")); 285 $("#redBtnTime").find(".tt").text(obj.h+":"+obj.m+":"+obj.s); 286 }) 287 that._redVoucherIds = result.voucherIds; 288 that._redVoucherStatus = result.voucherStatus; 289 } 290 } 291 }, 292 // ajax失败åè° 293 error : function (xhr) { 294 console.log(xhr); 295 } 296 }); 297 }, 298 //é¢å红å 伿 å¸ 299 receiveCoupon : function (source,voucherStatus,voucherIds) { 300 var that = this; 301 if (!that._redConf_flag) return false; //确认æ¯å¦æ¦æªajax 302 that._redConf_flag = false; 303 that.setLoad(); 304 postAesData({ 305 data : { 306 "params" : { 307 "time":new Date().getTime(), 308 "uuid":that.getCookie("bdp_uuid") || "", 309 "uid":that.getCookie('cdeluid') || "", 310 "source":source, //201ï¼PCé¦é¡µç²¾åè¥éå¼¹çªï¼202ï¼PCæ ç®é¡µç²¾åè¥éå¼¹çªï¼203ï¼PCæ ç®é课ä¸å¿å表页精åè¥éå¼¹çªï¼ 204ï¼PCèµè®¯è¯¦æ 页精åè¥éå¼¹çªï¼205ï¼PCå³ä¾§å ¬ç¨å¤åè½æ ç²¾åè¥éæ¬æµ®æ¬æµ®ï¼206ï¼è´ç©è½¦é¡µåºé¨ç²¾åè¥éæ¬æµ® 311 "voucherStatus":voucherStatus, //1已颿ªä½¿ç¨0æªé¢å 312 "voucherIds":voucherIds 313 }, 314 "domain" : "med66", 315 "resourcePath" : "+/precision/getLotteryResults", 316 "af":"1", //ç±»åï¼String å¿ æå段 夿³¨ï¼æ 317 "ap":"pc" //ç±»åï¼String å¿ æå段 夿³¨ï¼æ 318 }, 319 // ajaxæååè° 320 success : function (data) { 321 that.setLoad(true); 322 var result = data.result; 323 if(result.type == 1){ 324 var couponList = result.couponInfoList; 325 var couponListObj = ''; 326 for (var i = 0; i < couponList.length; i++){ 327 var voucherTypeName; 328 if(couponList[i].voucherType == 1){ 329 voucherTypeName = "å "; 330 }else if(couponList[i].voucherType == 2){
331 voucherTypeName = "æ"; 332 } 333 couponListObj += '<div class="list" data-voucherId="'+couponList[i].voucherId+'"><div class="list-price"><b>'+couponList[i].voucherDiscount+'</b>'+voucherTypeName+'</div><div class="list-right"><div class="list-right-top">伿 å¸</div><div class="list-right-cen" id="couponTime'+[i]+'" data-countDown="'+couponList[i].couponTime+'"><em class="th"></em>å°æ¶å失æï¼<em class="tt"></em></div><div class="list-right-bot">'+couponList[i].useDesc+'</div></div><i class="fdIcon"></i></div>'; 334 } 335 $(".pm-redBox .ylqCoupon").html(couponListObj); 336 //伿 å¸åè®¡æ¶ 337 for (var j = 0; j < couponList.length; j++){ 338 that.redCountDown("couponTime",that._red_serverTime,function (obj,j) { 339 $("#couponTime"+j).find(".th").text(obj.h >= 10 ? obj.h : obj.h.replace("0","")); 340 $("#couponTime"+j).find(".tt").text(obj.h+":"+obj.m+":"+obj.s); 341 },function (obj,j) { 342 $("#couponTime"+j).hide().parents(".list").addClass("no"); 343 },j) 344 } 345 $(".pm-redBox.ylq .pm-top .ylqTit b").text(result.couponNum); 346 $(".pm-redBox.ylq").css("margin-top",-($(".pm-redBox").height()/2)); 347 $(".pm-redBox.ylq").fadeIn(); 348 $(".pm-redBox-mask").fadeIn(); 349 }else{ 350 $(".rightFloatNav .rightFloatNav-redEnvelopes").remove(); 351 $(".rignav .rightFloatNav-redEnvelopes").remove(); 352 $(".settlement-mod .redBtn").remove(); 353 that.alertTip("æ¨ç伿 å¸å·²ä½¿ç¨æå·²è¿æ"); 354 } 355 }, 356 // ajax失败åè° 357 error : function (xhr) { 358 console.log(xhr); 359 that.setLoad(true); 360 } 361 }); 362 setTimeout(function (){ 363 that._redConf_flag = true; 364 },1000) 365 } 366 } 367 drawView.init(); 368 win.drawView = drawView; 369})(window)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.