tuil-nongetstyle.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. // import * as env from "./env.js"
  2. $(function () {
  3. ncode = false;
  4. fes = getUrlParam("fes");
  5. sou = getUrlParam("sou");
  6. $("#useraccount_tt").attr("value", getUrlParam("freeflow_token"));
  7. });
  8. function goto404() {
  9. if (window.location.href == "https://800.wo.cn/orderchannel/hd/Dy/order202005.html?fes=jh7") {
  10. window.location.href = "https://800.wo.cn/orderchannel/hd/Dy/order.html?fes=9on&sou=12";
  11. return;
  12. }
  13. if (window.location.href == "https://optest.bol.wo.cn/orderchannel/orderchannel-s1h5/douyin/5G618/index.html?fes=jme&sou=vt") return;
  14. if (window.location.href.indexOf('jiangtao') >= 0) {
  15. alert(window.location.href)
  16. }
  17. // return
  18. var url = getRootPath() + "/404.html";
  19. $(location).attr('href', url);
  20. }
  21. $('.circular').click(function () {
  22. $('.circular').toggleClass("active")
  23. });
  24. $('.iphone').focus(function () {
  25. $(this).css('border', '1px solid #FF14CB');
  26. $(this).css('opacity', '1');
  27. })
  28. $('.iphone').blur(function () {
  29. $(this).css('border', '1px solid #fff');
  30. if ($(this).val() == '') {
  31. $(this).css('opacity', '0.49');
  32. } else {
  33. $(this).css('opacity', '1');
  34. }
  35. })
  36. $('.yanzhenma').focus(function () {
  37. $(this).css('border', '1px solid #FF14CB');
  38. $(this).css('opacity', '1');
  39. })
  40. $('.yanzhenma').blur(function () {
  41. $(this).css('border', '1px solid #fff')
  42. if ($(this).val() == '') {
  43. $(this).css('opacity', '0.49');
  44. } else {
  45. $(this).css('opacity', '1');
  46. }
  47. })
  48. $('.btn').mousedown(function () {
  49. $(this).css('opacity', '0.8')
  50. });
  51. $('.btn').mouseup(function () {
  52. $(this).css('opacity', '1')
  53. })
  54. $('.yuyue').click(function () {
  55. $('.maskArea').show();
  56. $('.tc').show();
  57. $('.close').show();
  58. })
  59. $('.close').click(function () {
  60. $('.maskArea').hide();
  61. $('.tc').hide();
  62. $('.close').hide();
  63. })
  64. var derice = "";
  65. var pattern = /^1[345678]\d{9}$/;
  66. var ncode = false;
  67. var countdown = 60;
  68. function settime(mode) {
  69. if (countdown == 0) {
  70. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  71. $(".yanzhenma_btn").css('background-color', '#FF14CB')
  72. $(".yanzhenma_btn").attr("disabled", false);
  73. $(".yanzhenma_btn").text("获取验证码");
  74. countdown = 60;
  75. } else {
  76. $(".yanzhenma_btn").attr("disabled", true);
  77. $(".yanzhenma_btn").text(countdown + 's');
  78. countdown--;
  79. setTimeout(function () {
  80. settime(mode)
  81. }, 1000)
  82. }
  83. }
  84. function pro_bounced(headmg, textmg, buttonmg, state) {
  85. if (state) {
  86. $('.maskArea').show();
  87. $('.tc').show();
  88. $("#ts").attr('src', 'img/wancheng.png');
  89. $("#co").text(textmg);
  90. } else {
  91. $('.maskArea').show();
  92. $('.tc').show();
  93. $('.close').show();
  94. $("#ts").attr('src', 'img/wan.png');
  95. $("#co").text(textmg);
  96. }
  97. }
  98. function closeSe() {
  99. $(".maskArea").attr("style", "display:none;");
  100. }
  101. function emptyM() {
  102. $(".coupon").empty();
  103. }
  104. function getMemoValbyId(product, type) {
  105. var val = "";
  106. switch (type) {
  107. case "phone":
  108. val = $("#input_100_" + product).val();
  109. break;
  110. case "code":
  111. val = $("#input_50_" + product).val();
  112. break;
  113. case "fog":
  114. val = $("#fog_" + product).val();
  115. break;
  116. case "useraccount":
  117. val = $("#useraccount_" + product).val();
  118. break;
  119. case "sendsmsorder":
  120. val = $("#sendsms_order_" + product).val();
  121. break;
  122. case "sendsmscancel":
  123. val = $("#sendsms_cancel_" + product).val();
  124. break;
  125. case "sendsmsyuyue":
  126. val = $("#sendsms_yuyue_" + product).val();
  127. break;
  128. case "sendsmsacti":
  129. val = $("#sendsms_acti_" + product).val();
  130. break;
  131. }
  132. if (val == null) {
  133. return "";
  134. } else {
  135. return val;
  136. }
  137. }
  138. function getRootPath() {
  139. var curWwwPath = window.document.location.href;
  140. var pathName = window.document.location.pathname;
  141. var pos = curWwwPath.indexOf(pathName);
  142. var localhostPath = curWwwPath.substring(0, pos);
  143. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  144. // return (localhostPath + projectName);
  145. // return 'https://operation1.bol.wo.cn/orderchannel'
  146. if (window.location.href.indexOf('https://optest.bol.wo.cn') >= 0) {
  147. return 'https://optest.bol.wo.cn/orderchannel'
  148. } else {
  149. return 'https://operation1.bol.wo.cn/orderchannel'
  150. }
  151. // return 'https://optest.bol.wo.cn/orderchannel'
  152. }
  153. function getHref() {
  154. var curWwwPath = window.document.location.href;
  155. var pathName = window.document.location.pathname;
  156. var pos = curWwwPath.indexOf(pathName);
  157. var localhostPath = curWwwPath.substring(0, pos);
  158. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  159. return (localhostPath + pathName);
  160. }
  161. function sendSmsDate(product, mode) {
  162. var data = {
  163. "fog": getMemoValbyId(product, "fog"),
  164. "usermob": getMemoValbyId(product, "phone"),
  165. "smstype": getMemoValbyId(product, "sendsms" + mode),
  166. "sou": getUrlParam("sou"),
  167. };
  168. return data;
  169. }
  170. function getUrlParam(urlprm) {
  171. var reg = new RegExp("(^|&)" + urlprm + "=([^&]*)(&|$)");
  172. var r = window.location.search.substr(1).match(reg);
  173. if (r != null) {
  174. return r[2];
  175. } else {
  176. switch (urlprm) {
  177. case "con":
  178. return "1";
  179. break;
  180. case "freeflow_token":
  181. return "";
  182. break;
  183. default:
  184. goto404();
  185. break;
  186. }
  187. }
  188. }
  189. function theme(title, icon) {
  190. $("title").text(title);
  191. var sou = getUrlParam("sou");
  192. var fes = getUrlParam("fes");
  193. if (fes == "9om" && sou == "2e") {
  194. $("title").text("免流量看皮皮虾");
  195. }
  196. if (fes == "jh3" || sou == "jh4") {
  197. $("title").text("抗击疫情,温暖同行");
  198. }
  199. }
  200. function postini() {
  201. $.ajax({
  202. url: getRootPath() + "-s1api" + '/ini/getstyle',
  203. type: "POST",
  204. contentType: "application/json; charset=utf-8",
  205. dataType: "Json",
  206. data: JSON.stringify(postiniDate()),
  207. success:
  208. function (msg) {
  209. var resCode = msg["resultCode"];
  210. if (resCode == "0000") {
  211. var festival = msg["festival"];
  212. theme(festival["title"], festival["icon"]);
  213. var productlist = msg["product"];
  214. for (var i = 0, l = productlist.length; i < l; i++) {
  215. $("#fog_" + productlist[i].url).attr("value", productlist[i].fog);
  216. var smslist = productlist[i].icon.split(",");
  217. for (var int = 0; int < smslist.length; int++) {
  218. if (int == 0) {
  219. $("#sendsms_order_" + productlist[i].url).attr("value", smslist[int]);
  220. }
  221. if (int == 1) {
  222. $("#sendsms_cancel_" + productlist[i].url).attr("value", smslist[int]);
  223. }
  224. if (int == 2) {
  225. $("#sendsms_yuyue_" + productlist[i].url).attr("value", smslist[int]);
  226. }
  227. }
  228. }
  229. if (location.href.indexOf('order_imme.html') >= 0) {
  230. $('#major').trigger('click');
  231. }
  232. } else {
  233. goto404();
  234. }
  235. if (location.href.indexOf('/cancel') >= 0) {
  236. burypointLogId('110002');
  237. } else if (location.href.indexOf('/draw') >= 0) {
  238. burypointLogId('110003');
  239. } else if (location.href.indexOf('/flow') >= 0) {
  240. burypointLogId('110004');
  241. } else if (location.href.indexOf('/active') >= 0) {
  242. burypointLogId('110005');
  243. } else {
  244. burypointLogId('110001');
  245. }
  246. },
  247. error:
  248. function (XMLHttpRequest, textStatus, errorThrown) {
  249. goto404();
  250. },
  251. });
  252. }
  253. function gotorder() {
  254. var url = getRootPath() + "/Tou/Dy/order.html" +
  255. "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") +
  256. "&con=0";
  257. $(location).attr('href', url);
  258. }
  259. function gotosucc() {
  260. var url = getRootPath() + "/Tou/Dy/orderSucc.html" +
  261. "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") +
  262. "&phone=" + getMemoValbyId('tt', 'phone') + "&fog=" + getMemoValbyId('tt', 'fog') + "&fog=" + getMemoValbyId('tt', 'fog') + "&use=" + getMemoValbyId('tt', 'useraccount');
  263. $(location).attr('href', url);
  264. }
  265. function sendSms(product, mode) {
  266. $("#yzm").removeAttr("onclick");
  267. if (getMemoValbyId("tt", "phone") != "") {
  268. if (pattern.test(getMemoValbyId("tt", "phone"))) {
  269. $.ajax({
  270. type: "POST",
  271. contentType: "application/json; charset=utf-8",
  272. dataType: "Json",
  273. url: getRootPath() + "-s1api" + '/smsc',
  274. data: JSON.stringify(sendSmsDate(product, mode)),
  275. success: function (msg) {
  276. var resCode = eval(msg["resultCode"]);
  277. if (resCode == "0000") {
  278. ncode = true;
  279. settime(mode);
  280. } else {
  281. sleep(mode);
  282. pro_bounced("温馨提示", msg["errorInfo"], "", false);
  283. }
  284. },
  285. error: function (XMLHttpRequest, textStatus, errorThrown) {
  286. sleep(mode);
  287. pro_bounced("温馨提示", "短信验证码发送失败", "", false);
  288. },
  289. });
  290. } else {
  291. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  292. pro_bounced("温馨提示", "请输入正确的中国联通手机号码", "", false);
  293. }
  294. } else {
  295. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  296. pro_bounced("温馨提示", "手机号码未输入", "", false);
  297. }
  298. if ('acti' == mode) {
  299. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'active_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  300. } else {
  301. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  302. }
  303. }
  304. function sleep(mode) {
  305. var start = new Date().getTime();
  306. while (true) {
  307. if (new Date().getTime() - start > 10000) {
  308. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  309. break;
  310. }
  311. }
  312. }
  313. function gotoUrl(html) {
  314. var url = getRootPath() + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount');
  315. $(location).attr('href', url);
  316. }
  317. function gotoUrlC(html) {
  318. var url = getRootPath().replace(/https/ig, "http") + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount');
  319. $(location).attr('href', url);
  320. }
  321. function postiniDate() {
  322. var data = {
  323. fes: getUrlParam("fes"),
  324. sou: getUrlParam("sou"),
  325. };
  326. return data;
  327. }
  328. function GetFlowJsonData(product) {
  329. var data = {
  330. "fog": fog,
  331. "usermob": phone,
  332. };
  333. return data;
  334. }
  335. function GetMasData(product) {
  336. var data = {
  337. "code": getMemoValbyId(product, "code"),
  338. "fog": getMemoValbyId(product, "fog"),
  339. "usermob": getMemoValbyId(product, "phone"),
  340. "useraccount": getMemoValbyId(product, "useraccount"),
  341. "fes": getUrlParam("fes"),
  342. "sou": getUrlParam("sou"),
  343. };
  344. return data;
  345. }
  346. var se = 0;
  347. function seuid() {
  348. se = se + 1;
  349. if (se == 5) {
  350. se = 0;
  351. alert("sou:" + sou);
  352. }
  353. }
  354. (function () {
  355. Date.prototype.from = function (dateString) {
  356. var pattern2 = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/
  357. var str = dateString.replace(/-/g, '/');
  358. str = str.replace(pattern2, '$1/$2/$3 $4:$5:$6')
  359. return new Date(str)
  360. }
  361. Date.prototype.format = function (fmt) {
  362. var o = {
  363. "M+": this.getMonth() + 1,
  364. "d+": this.getDate(),
  365. "h+": this.getHours(),
  366. "m+": this.getMinutes(),
  367. "s+": this.getSeconds(),
  368. "q+": Math.floor((this.getMonth() + 3) / 3),
  369. "S": this.getMilliseconds()
  370. };
  371. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  372. for (var k in o)
  373. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  374. return fmt;
  375. }
  376. })();
  377. function getTodaySurplusMillis() {
  378. var time1 = new Date();
  379. var time2 = time1.from(time1.getFullYear() + '-' + (time1.getMonth() + 1) + '-' + time1.getDate() + ' 23:59:59');
  380. console.log(time2.getTime() - time1)
  381. return time2.getTime() - time1.getTime();
  382. }
  383. function burypointLogId(operid, remark, url) {
  384. var uuid = getCookie('uuid');
  385. var vvid = getCookie('vvid');
  386. if (uuid == null || uuid.trim() == '') {
  387. uuid = guid();
  388. setCookie('uuid', uuid, getTodaySurplusMillis());
  389. }
  390. if (vvid == null || vvid.trim() == '') {
  391. vvid = guid();
  392. setCookie('vvid', vvid, -1);
  393. }
  394. if (operid == null || operid == '') {
  395. return;
  396. }
  397. var param = {
  398. operid: operid,
  399. uuid: uuid,
  400. vvid: vvid,
  401. fog: getMemoValbyId('tt', 'fog'),
  402. userid: '',
  403. fes: getUrlParam("fes"),
  404. sou: getUrlParam("sou"),
  405. url: encodeURIComponent(url || window.location.href),
  406. remark: encodeURIComponent(remark || '')
  407. }
  408. $.ajax({
  409. type: "POST",
  410. contentType: "application/json; charset=utf-8",
  411. dataType: "Json",
  412. url: getRootPath() + "-s1api" + '/burypoint/logid',
  413. data: JSON.stringify(param),
  414. success: function () { },
  415. error: function () { },
  416. });
  417. }
  418. function getCookie(name) {
  419. var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  420. if (arr = document.cookie.match(reg))
  421. return unescape(arr[2]);
  422. else
  423. return null;
  424. }
  425. function setCookie(name, value, millis) {
  426. millis = (millis == undefined ? 0 : millis);
  427. var exp = new Date();
  428. if (millis < 0) {
  429. document.cookie = name + "=" + escape(value);
  430. } else {
  431. exp.setTime(exp.getTime() + millis);
  432. document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
  433. }
  434. }
  435. function guid() {
  436. return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  437. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  438. return v.toString(16);
  439. });
  440. }