// import * as env from "./env.js" $(function () { ncode = false; fes = getUrlParam("fes"); sou = getUrlParam("sou"); $("#useraccount_tt").attr("value", getUrlParam("freeflow_token")); }); function goto404() { if (window.location.href == "https://800.wo.cn/orderchannel/hd/Dy/order202005.html?fes=jh7") { window.location.href = "https://800.wo.cn/orderchannel/hd/Dy/order.html?fes=9on&sou=12"; return; } if (window.location.href == "https://optest.bol.wo.cn/orderchannel/orderchannel-s1h5/douyin/5G618/index.html?fes=jme&sou=vt") return; if (window.location.href.indexOf('jiangtao') >= 0) { alert(window.location.href) } // return var url = getRootPath() + "/404.html"; $(location).attr('href', url); } $('.circular').click(function () { $('.circular').toggleClass("active") }); $('.iphone').focus(function () { $(this).css('border', '1px solid #FF14CB'); $(this).css('opacity', '1'); }) $('.iphone').blur(function () { $(this).css('border', '1px solid #fff'); if ($(this).val() == '') { $(this).css('opacity', '0.49'); } else { $(this).css('opacity', '1'); } }) $('.yanzhenma').focus(function () { $(this).css('border', '1px solid #FF14CB'); $(this).css('opacity', '1'); }) $('.yanzhenma').blur(function () { $(this).css('border', '1px solid #fff') if ($(this).val() == '') { $(this).css('opacity', '0.49'); } else { $(this).css('opacity', '1'); } }) $('.btn').mousedown(function () { $(this).css('opacity', '0.8') }); $('.btn').mouseup(function () { $(this).css('opacity', '1') }) $('.yuyue').click(function () { $('.maskArea').show(); $('.tc').show(); $('.close').show(); }) $('.close').click(function () { $('.maskArea').hide(); $('.tc').hide(); $('.close').hide(); }) var derice = ""; var pattern = /^1[345678]\d{9}$/; var ncode = false; var countdown = 60; function settime(mode) { if (countdown == 0) { $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')"); $(".yanzhenma_btn").css('background-color', '#FF14CB') $(".yanzhenma_btn").attr("disabled", false); $(".yanzhenma_btn").text("获取验证码"); countdown = 60; } else { $(".yanzhenma_btn").attr("disabled", true); $(".yanzhenma_btn").text(countdown + 's'); countdown--; setTimeout(function () { settime(mode) }, 1000) } } function pro_bounced(headmg, textmg, buttonmg, state) { if (state) { $('.maskArea').show(); $('.tc').show(); $("#ts").attr('src', 'img/wancheng.png'); $("#co").text(textmg); } else { $('.maskArea').show(); $('.tc').show(); $('.close').show(); $("#ts").attr('src', 'img/wan.png'); $("#co").text(textmg); } } function closeSe() { $(".maskArea").attr("style", "display:none;"); } function emptyM() { $(".coupon").empty(); } function getMemoValbyId(product, type) { var val = ""; switch (type) { case "phone": val = $("#input_100_" + product).val(); break; case "code": val = $("#input_50_" + product).val(); break; case "fog": val = $("#fog_" + product).val(); break; case "useraccount": val = $("#useraccount_" + product).val(); break; case "sendsmsorder": val = $("#sendsms_order_" + product).val(); break; case "sendsmscancel": val = $("#sendsms_cancel_" + product).val(); break; case "sendsmsyuyue": val = $("#sendsms_yuyue_" + product).val(); break; case "sendsmsacti": val = $("#sendsms_acti_" + product).val(); break; } if (val == null) { return ""; } else { return val; } } function getRootPath() { var curWwwPath = window.document.location.href; var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); var localhostPath = curWwwPath.substring(0, pos); var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); // return (localhostPath + projectName); // return 'https://operation1.bol.wo.cn/orderchannel' if (window.location.href.indexOf('https://optest.bol.wo.cn') >= 0) { return 'https://optest.bol.wo.cn/orderchannel' } else { return 'https://operation1.bol.wo.cn/orderchannel' } // return 'https://optest.bol.wo.cn/orderchannel' } function getHref() { var curWwwPath = window.document.location.href; var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); var localhostPath = curWwwPath.substring(0, pos); var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); return (localhostPath + pathName); } function sendSmsDate(product, mode) { var data = { "fog": getMemoValbyId(product, "fog"), "usermob": getMemoValbyId(product, "phone"), "smstype": getMemoValbyId(product, "sendsms" + mode), "sou": getUrlParam("sou"), }; return data; } function getUrlParam(urlprm) { var reg = new RegExp("(^|&)" + urlprm + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) { return r[2]; } else { switch (urlprm) { case "con": return "1"; break; case "freeflow_token": return ""; break; default: goto404(); break; } } } function theme(title, icon) { $("title").text(title); var sou = getUrlParam("sou"); var fes = getUrlParam("fes"); if (fes == "9om" && sou == "2e") { $("title").text("免流量看皮皮虾"); } if (fes == "jh3" || sou == "jh4") { $("title").text("抗击疫情,温暖同行"); } } function postini() { $.ajax({ url: getRootPath() + "-s1api" + '/ini/getstyle', type: "POST", contentType: "application/json; charset=utf-8", dataType: "Json", data: JSON.stringify(postiniDate()), success: function (msg) { var resCode = msg["resultCode"]; if (resCode == "0000") { var festival = msg["festival"]; theme(festival["title"], festival["icon"]); var productlist = msg["product"]; for (var i = 0, l = productlist.length; i < l; i++) { $("#fog_" + productlist[i].url).attr("value", productlist[i].fog); var smslist = productlist[i].icon.split(","); for (var int = 0; int < smslist.length; int++) { if (int == 0) { $("#sendsms_order_" + productlist[i].url).attr("value", smslist[int]); } if (int == 1) { $("#sendsms_cancel_" + productlist[i].url).attr("value", smslist[int]); } if (int == 2) { $("#sendsms_yuyue_" + productlist[i].url).attr("value", smslist[int]); } } } if (location.href.indexOf('order_imme.html') >= 0) { $('#major').trigger('click'); } } else { goto404(); } if (location.href.indexOf('/cancel') >= 0) { burypointLogId('110002'); } else if (location.href.indexOf('/draw') >= 0) { burypointLogId('110003'); } else if (location.href.indexOf('/flow') >= 0) { burypointLogId('110004'); } else if (location.href.indexOf('/active') >= 0) { burypointLogId('110005'); } else { burypointLogId('110001'); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { goto404(); }, }); } function gotorder() { var url = getRootPath() + "/Tou/Dy/order.html" + "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&con=0"; $(location).attr('href', url); } function gotosucc() { var url = getRootPath() + "/Tou/Dy/orderSucc.html" + "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&phone=" + getMemoValbyId('tt', 'phone') + "&fog=" + getMemoValbyId('tt', 'fog') + "&fog=" + getMemoValbyId('tt', 'fog') + "&use=" + getMemoValbyId('tt', 'useraccount'); $(location).attr('href', url); } function sendSms(product, mode) { $("#yzm").removeAttr("onclick"); if (getMemoValbyId("tt", "phone") != "") { if (pattern.test(getMemoValbyId("tt", "phone"))) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "Json", url: getRootPath() + "-s1api" + '/smsc', data: JSON.stringify(sendSmsDate(product, mode)), success: function (msg) { var resCode = eval(msg["resultCode"]); if (resCode == "0000") { ncode = true; settime(mode); } else { sleep(mode); pro_bounced("温馨提示", msg["errorInfo"], "", false); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { sleep(mode); pro_bounced("温馨提示", "短信验证码发送失败", "", false); }, }); } else { $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')"); pro_bounced("温馨提示", "请输入正确的中国联通手机号码", "", false); } } else { $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')"); pro_bounced("温馨提示", "手机号码未输入", "", false); } if ('acti' == mode) { WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'active_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) }) } else { WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) }) } } function sleep(mode) { var start = new Date().getTime(); while (true) { if (new Date().getTime() - start > 10000) { $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')"); break; } } } function gotoUrl(html) { var url = getRootPath() + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount'); $(location).attr('href', url); } function gotoUrlC(html) { var url = getRootPath().replace(/https/ig, "http") + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount'); $(location).attr('href', url); } function postiniDate() { var data = { fes: getUrlParam("fes"), sou: getUrlParam("sou"), }; return data; } function GetFlowJsonData(product) { var data = { "fog": fog, "usermob": phone, }; return data; } function GetMasData(product) { var data = { "code": getMemoValbyId(product, "code"), "fog": getMemoValbyId(product, "fog"), "usermob": getMemoValbyId(product, "phone"), "useraccount": getMemoValbyId(product, "useraccount"), "fes": getUrlParam("fes"), "sou": getUrlParam("sou"), }; return data; } var se = 0; function seuid() { se = se + 1; if (se == 5) { se = 0; alert("sou:" + sou); } } (function () { Date.prototype.from = function (dateString) { var pattern2 = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ var str = dateString.replace(/-/g, '/'); str = str.replace(pattern2, '$1/$2/$3 $4:$5:$6') return new Date(str) } Date.prototype.format = function (fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } })(); function getTodaySurplusMillis() { var time1 = new Date(); var time2 = time1.from(time1.getFullYear() + '-' + (time1.getMonth() + 1) + '-' + time1.getDate() + ' 23:59:59'); console.log(time2.getTime() - time1) return time2.getTime() - time1.getTime(); } function burypointLogId(operid, remark, url) { var uuid = getCookie('uuid'); var vvid = getCookie('vvid'); if (uuid == null || uuid.trim() == '') { uuid = guid(); setCookie('uuid', uuid, getTodaySurplusMillis()); } if (vvid == null || vvid.trim() == '') { vvid = guid(); setCookie('vvid', vvid, -1); } if (operid == null || operid == '') { return; } var param = { operid: operid, uuid: uuid, vvid: vvid, fog: getMemoValbyId('tt', 'fog'), userid: '', fes: getUrlParam("fes"), sou: getUrlParam("sou"), url: encodeURIComponent(url || window.location.href), remark: encodeURIComponent(remark || '') } $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "Json", url: getRootPath() + "-s1api" + '/burypoint/logid', data: JSON.stringify(param), success: function () { }, error: function () { }, }); } function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(arr[2]); else return null; } function setCookie(name, value, millis) { millis = (millis == undefined ? 0 : millis); var exp = new Date(); if (millis < 0) { document.cookie = name + "=" + escape(value); } else { exp.setTime(exp.getTime() + millis); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); } } function guid() { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }