Blame view

assets/pages/scripts/otherSetting/othersetTmp.js 3.92 KB
10646c94   Andy   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  var urlarr = JSON.parse(sessionStorage.getItem("threemenulist"));
  console.log(urlarr)
  var _html = '';
  for(var i=0;i<urlarr.length;i++){
      if(i==0){
          _html  += '<li data-url="'+urlarr[i].url+'" id="button-'+urlarr[i].url+'" class="ITD-topbar-clickactive"><a href="#/'+urlarr[i].url+'"><div >'+urlarr[i].name+'</div></a></li>'
      }else{
          _html  += '<li data-url="'+urlarr[i].url+'" id="button-'+urlarr[i].url+'" ><a href="#/'+urlarr[i].url+'"><div >'+urlarr[i].name+'</div></a></li>'
      }
  }
  $('#button-btn').html(_html);
  function Router(){
      this.routes = {};
      this.curUrl = '';
  
      this.route = function(path, callback){
          this.routes[path] = callback || function(){};
      };
  
      this.refresh = function(){
          this.curUrl = location.hash.slice(1) || '/'+urlarr[0].url;
          console.log(this.curUrl)
          this.routes[this.curUrl]();
      };
  
      this.init = function(){
          window.addEventListener('load', this.refresh.bind(this), false);
          window.addEventListener('hashchange', this.refresh.bind(this), false);
      }
  }
  var R = new Router();
  R.init();
  var res = $('#main-con');
  R.route('/discountrule', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/disCount/discountrule.css');
      res.load('../../assets/pages/scripts/otherSetting/disCount/discountrule.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-discountrule').addClass('ITD-topbar-clickactive');
  });
  R.route('/whitelist', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/whiteList/whitelist.css');
      res.load('../../assets/pages/scripts/otherSetting/whiteList/whitelist.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-whitelist').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/settlerule', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/settleRule/settlerule.css');
      res.load('../../assets/pages/scripts/otherSetting/settleRule/settlerule.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-settlerule').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/apprelease', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/apprel/apprelease.css');
      res.load('../../assets/pages/scripts/otherSetting/apprel/apprelease.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-apprelease').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/couponsetting', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/couponFile/couponsetting.css');
      res.load('../../assets/pages/scripts/otherSetting/couponFile/couponsetting.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-couponsetting').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/giftrules', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/giftRule/giftrules.css');
      res.load('../../assets/pages/scripts/otherSetting/giftRule/giftrules.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-giftrules').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/undercoupon', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/xxcoupon/undercoupon.css');
      res.load('../../assets/pages/scripts/otherSetting/xxcoupon/undercoupon.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-undercoupon').addClass('ITD-topbar-clickactive');
  
  });
  R.route('/appactivity', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/otherSetting/appactive/appactivity.css');
      res.load('../../assets/pages/scripts/otherSetting/appactive/appactivity.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-appactivity').addClass('ITD-topbar-clickactive');
  
  });