main.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import * as unicom from "../../../public/js/unicom.js";
  2. import * as douyin from "../../../public/js/douyin.js";
  3. import * as compnt from "../../../public/js/compnt.js";
  4. $(document).ready(function() {
  5. var newVisitor = isNewVisitor(); // 如果是新访客
  6. if (newVisitor === true) {
  7. // 动画弹出消息框
  8. compnt.showAlertlt('活动期间成功订购产品,可返5元话费。快来参与吧!');
  9. // 标记:已经向该访客弹出过消息。2个月之内不要再弹
  10. setCookie("gznotes-visited9", "true", 93);
  11. }
  12. });
  13. function isNewVisitor() {
  14. // 从cookie读取“已经向访客提示过消息”的标志位
  15. var flg = getCookie("gznotes-visited9");
  16. if (flg === "") {
  17. return true;
  18. } else {
  19. return false;
  20. }
  21. }
  22. // 写cookie
  23. function setCookie(cname, cvalue, exdays) {
  24. var d = new Date();
  25. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  26. var expires = "expires=" + d.toUTCString();
  27. document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
  28. }
  29. // 读cookie
  30. function getCookie(cname) {
  31. var name = cname + "=";
  32. var ca = document.cookie.split(';');
  33. for (var i = 0; i < ca.length; i++) {
  34. var c = ca[i];
  35. while (c.charAt(0) == ' ') c = c.substring(1);
  36. if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
  37. }
  38. return "";
  39. }
  40. unicom.query.fes = unicom.getUrlParam('fes');
  41. unicom.query.sou = unicom.getUrlParam('sou');
  42. //unicom.query.activityid = unicom.getUrlParam('activityid');
  43. unicom.getRootPath();
  44. var prouctName = '';
  45. var fes = unicom.getUrlParam("fes");
  46. var sou = unicom.getUrlParam("sou");
  47. var activityid = window.activityid || '';
  48. // 2020春节活动页面
  49. if (unicom.getNowFormatDate() < 20200220) {
  50. if (window.location.href.indexOf("hd/Dy/order.html") > 0) {
  51. /* 春节活动
  52. if (fes == "9uq" &&
  53. (sou == "2h" || sou == "1g" || sou == "1h" || sou == "15" || sou == "47"
  54. || sou == "2k" || sou == "18" || sou == "4a" || sou == "12")) {
  55. window.location.href = 'https://800.wo.cn/orderchannel/hd/Dy/spring.html?fes=9uq&sou=' + sou;
  56. }*/
  57. /* 为武汉助力活动 */
  58. //if (fes == '9on' && (sou=='1m' || sou == '4d' || sou == '2l' || sou == '4g')) {//短彩
  59. // window.location.href = 'https://800.wo.cn/orderchannel/hd/Dy/order20200131.html?fes=9on&sou=' + sou;
  60. //}
  61. }
  62. }
  63. // 抗击疫情,温暖同行,2020-02-12
  64. // 根据fes 判断应该显示 9元9G,一版是9元10G
  65. if (unicom.getNowFormatDate() < 20200630) {
  66. if ((window.location.href.indexOf("hd/Dy/order.html") > 0) && (fes == "jh3" || fes == "jh4")) {
  67. window.location.href = 'https://800.wo.cn/orderchannel/hd/Dy/order20200212.html?fes=' + fes + '&sou=' + sou;
  68. } else if (window.location.href.indexOf("hd/Dy/order20200212.html") > 0) {
  69. if (fes == "jh3") {
  70. $('.banner img').attr('src', '../../hd/Dy/images/wntx-9g.png');
  71. prouctName = '9元9G今日头条国内定向流量';
  72. } else {
  73. $('.banner img').attr('src', '../../hd/Dy/images/wntx-10g.png');
  74. prouctName = '9元10G今日头条国内定向流量';
  75. }
  76. }
  77. }
  78. if (window.location.href.indexOf("order.html") && unicom.getUrlParam("fes") == '9on') {
  79. if (unicom.getUrlParam("sou") == '3k' || unicom.getUrlParam("sou") == '3l') {
  80. window.location.href = 'https://800.wo.cn/orderchannel/hd/Dy/ordersfty.html?fes=9p3&sou=' + unicom.getUrlParam("sou");
  81. }
  82. }
  83. if (window.location.href.indexOf("order.html") && unicom.getUrlParam("fes") == '9p4') {
  84. if (unicom.getUrlParam("sou") == '2l') {
  85. window.location.href = 'https://800.wo.cn/orderchannel/hd/Dy/orderqh.html?fes=9p4&sou=2l'
  86. }
  87. }
  88. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'order_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.getUrlParam("sou"), 32) })
  89. $('#major').unbind('click').on('click', function() {
  90. var fog = $('#fog_tt').val();
  91. unicom.showCapPage(fog, prouctName).then(function(user) {
  92. if (unicom.getNowFormatDate() < 20200128) {
  93. $('#sendsms_order_tt').val('910');
  94. }
  95. user.usermob = "17601768237";
  96. douyin.order(user, 'tt', activityid);
  97. }).fail(function(response) {
  98. $('iframe').remove();
  99. $("body").css("overflow", "auto");
  100. })
  101. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.getUrlParam("sou"), 32) })
  102. })