fix
wzy
2021-11-11 23c3bc31f574ee9573c8045edad0233b55a0ffa6
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//index.js
//获取应用实例
const app = getApp()
var util = require('../../utils/util.js');
var api = require('../../utils/service-api.js');
 
Page({
    data: {
        banners: [
        ],
 
        iconUrls: [
        ],
 
        indexAds: [ 
        ],
 
    },
 
    
    onLoad: function () {
     
 
    util.userLogin(function () {
        console.log("登录成功");
    });
 
      this.getLbt();
      this.getNav();
      this.getIndexAds();
 
           
 
 
    },
 
  getIndexAds: function () {
    var _this = this;
    util.request({
      method: 'GET',
      api: api.ad.getByType + "indexAds",
      callback: function (data) {
        console.log(data.rows);
        _this.setData({
          indexAds: data.rows
        });
      }
    });
  },
 
  getNav: function () {
    var _this = this;
    util.request({
      method: 'GET',
      api: api.ad.getByType + "indexNav",
      callback: function (data) {
        console.log(data.rows);
        _this.setData({
          iconUrls: data.rows
        });
      }
    });
  },
 
 
  getLbt:function(){
    var _this = this;
    util.request({
      method: 'GET',
      api: api.ad.getByType + "sylbt",
      callback: function (data) {
        console.log(data.rows);
        _this.setData({
          banners: data.rows
        });
      }
    });
  },
 
    goAd(e){
 
        var title = e.currentTarget.dataset.title;
        var jumppath = e.currentTarget.dataset.jumppath;
        if (jumppath == '/pages/service/service' ||
            jumppath == '/pages/yuyue/khyuyue' ){
                wx.switchTab({
                    url: jumppath,
                    fail:function(e){
                        console.log(e);
                    },
                });
        } else{
 
            wx.navigateTo({
                url: jumppath,
            })
        }
 
 
    },
 
 
 
 
})