douyin.sidemenu.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. (function($) {
  2. 'use strict';
  3. var SideMenu = function(element, options) {
  4. this.options = $.extend({}, SideMenu.DEFAULTS, options);
  5. }
  6. SideMenu.DEFAULTS = {
  7. path: '../../public/libs/douyinsidemenu/',
  8. name: '', // 当前页面的名称,菜单中不需要再显示自己的链接
  9. data: [
  10. // {name: '彩铃融合包', icon: 'images/dy-list-rbt.png', url: '../../douyin/rbt15/index.html?fes=jiq&type=poly&sou='},
  11. { name: '抖音彩铃包', icon: 'images/dy-list-rbt.png', url: '../../douyin/rbt15/index.html?fes=jiq&type=poly&sou=' },
  12. { name: '头条流量包', icon: 'images/dy-list-tt.png', url: '../../douyin/poly/index9.html?fes=jh9&type=poly&sou=' },
  13. // { name: '头条流量包', icon: 'images/dy-list-tt.png', url: '../../Tou/Dy/order20220131.html?fes=9om&type=poly&sou=' },
  14. // { name: '头条流量包', icon: 'images/dy-list-tt.png', url: '../../Tou/Dy/order202109.html?fes=9om&type=poly&sou=' },
  15. // { name: '抖音权益包', icon: 'images/dy-list-doubi.png', url: '../../douyin/poly/index20220424.html?fes=jh9&type=poly&sou=' },
  16. { name: '抖音加油包', icon: 'images/icon20g1x.png', url: '../../douyin/30/index20220704.html?fes=jk8&type=poly&sou=' }
  17. ]
  18. }
  19. if (window.location.href.indexOf("Provincnawe") > 0) {
  20. SideMenu.DEFAULTS = {
  21. path: '../../public/libs/douyinsidemenu/',
  22. name: '', // 当前页面的名称,菜单中不需要再显示自己的链接
  23. data: [
  24. { name: '抖音彩铃包', icon: 'images/dy-list-rbt.png', url: 'https://800.wo.cn/orderchannel/douyin/rbt15/channel.html?fes=jj7&type=poly&sou=ub&Provincnawe' },
  25. { name: '头条流量包', icon: 'images/dy-list-tt.png', url: 'https://800.wo.cn/orderchannel/douyin/poly/index9.html?fes=jh9&type=poly&sou=26&Provincnawe' },
  26. { name: '抖音加油包', icon: 'images/icon20g1x.png', url: 'https://800.wo.cn/orderchannel/douyin/30/index20220704.html?fes=jk8&type=poly&sou=26&Provincnawe' }
  27. ]
  28. }
  29. }
  30. if (window.location.href.indexOf("ProvincesThree") > 0) {
  31. SideMenu.DEFAULTS = {
  32. path: '../../public/libs/douyinsidemenu/',
  33. name: '', // 当前页面的名称,菜单中不需要再显示自己的链接
  34. data: [
  35. { name: '头条流量包', icon: 'images/dy-list-tt.png', url: 'https://800.wo.cn/orderchannel/douyin/poly/index9cd.html?fes=jkk&sou=n2&type=poly&ProvincesThree' },
  36. { name: '抖音权益包', icon: 'images/dy-list-doubi.png', url: 'https://800.wo.cn/orderchannel/douyin/poly/index15cd.html?fes=jkj&sou=n2&type=poly&ProvincesThree' },
  37. // {name: '头条流量包', icon: 'images/dy-list-tt.png', url: '../../douyin/poly/index9.html?fes=jh9&sou='},
  38. { name: '彩铃融合包', icon: 'images/dy-list-rbt.png', url: 'https://800.wo.cn/orderchannel/douyin/rbt/indexcd.html?fes=jki&sou=n2&type=poly&ProvincesThreey' }
  39. ]
  40. }
  41. }
  42. if (window.location.href.indexOf("ProvincesTwo") > 0) {
  43. SideMenu.DEFAULTS = {
  44. path: '../../public/libs/douyinsidemenu/',
  45. name: '', // 当前页面的名称,菜单中不需要再显示自己的链接
  46. data: [
  47. { name: '头条流量包', icon: 'images/dy-list-tt.png', url: 'https://800.wo.cn/orderchannel/douyin/poly/index9cd.html?fes=jkk&sou=n3&type=poly&ProvincesTwo' },
  48. { name: '抖音彩铃包', icon: 'images/dy-list-rbt.png', url: 'https://800.wo.cn/orderchannel/douyin/rbt15/channelcd.html?fes=jkl&sou=n3&type=poly&ProvincesTwo' },
  49. // { name: '头条流量包', icon: 'images/dy-list-tt.png', url: '../../Tou/Dy/order202107.html?fes=9om&type=poly&sou=' },
  50. // { name: '抖音权益包', icon: 'images/dy-list-doubi.png', url: '../../douyin/poly/index15.html?fes=jh9&type=poly&sou=' }
  51. ]
  52. }
  53. }
  54. SideMenu.prototype = {
  55. init: function() {
  56. var $container = $('<div class="sideMenu moreProduct"></div>');
  57. var $head = $('<div class="head"><div class="icon"></div></div>');
  58. var $body = $('<div class="body"></div>');
  59. for (var i = 0; i < this.options.data.length; i++) {
  60. var data = this.options.data;
  61. var $row = null;
  62. if (this.options.name == data[i].name) {
  63. $row = $('<div class="row row-select" data-i="' + i + '"><div class="current"></div><div class="icon"><img src="' +
  64. this.options.path + data[i].icon + '" alt=""></div>' + data[i].name + '</div>')
  65. } else {
  66. $row = $('<div class="row" data-i="' + i + '"><div class="icon"><img src="' +
  67. this.options.path + data[i].icon + '" alt=""></div>' + data[i].name + '</div>')
  68. }
  69. $row.on('click', function(event) {
  70. var sou = getQueryString('sou')
  71. window.location.replace(data[$(event.target).data('i')].url + sou + '&t=' + new Date().getTime())
  72. })
  73. $body.append($row);
  74. }
  75. $container.find('.icon').on('click', function(event) {
  76. if (!$container.hasClass('showSelector')) {
  77. $container.addClass('showSelector');
  78. }
  79. event.stopPropagation();
  80. })
  81. $container.on('click', function(event) {
  82. if ($container.hasClass('showSelector')) {
  83. if (window.location.href.indexOf("ProvincesTwo") > 0) {
  84. $(".showSelector").css("height", "1.67rem");
  85. }
  86. $container.removeClass('showSelector');
  87. } else {
  88. $container.addClass('showSelector');
  89. if (window.location.href.indexOf("ProvincesTwo") > 0) {
  90. $(".showSelector").css("height", "2.76rem");
  91. }
  92. }
  93. event.stopPropagation();
  94. });
  95. $container.append($head).append($body).appendTo('body');
  96. },
  97. }
  98. $.fn.sideMenu = function(options) {
  99. return this.each(function() {
  100. var sideMenu = new SideMenu(this, options);
  101. sideMenu.init();
  102. })
  103. };
  104. function getQueryString(name) {
  105. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  106. var r = window.location.search.substr(1).match(reg);
  107. if (r != null) return unescape(r[2]);
  108. return null;
  109. }
  110. })(jQuery)