com_top_nav.js
1.46 KB
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
var t = getApp(),os = t.globalData.setting;
Component({
  properties: {
      title:{
          type: String,value: '你好'
      },
      bcolor:{
          type: String,value: '#fff'
      },
      color:{
          type: String,value: '#313131'
      },
      need_cover:{
          type: Number,value: 0
      }
  },
  data: {
    iurl: os.imghost,
    height:0,
    h1:0,
    h2:0,
    user_id:0,
    is_pc:0
  },
  ready: function() {
      let height= getApp().globalData.navBarHeight;
      let menuInfo = getApp().globalData.menuInfo || {height:0};
      let user_no='';
      if(getApp().globalData.userInfo){
          user_no=getApp().globalData.userInfo.erpvipno
      }
      //-- 胶囊的高度 --
      this.setData({height,h1:menuInfo.top,h2:menuInfo.height,user_no});
      if(getApp().globalData.is_pc){
          this.setData({is_pc:1})
      }
  },
  pageLifetimes: {
        //要处理一下,游客登录后的界面的变化,主要还该是改变会员
        show: function () {
            let user_no='';
            if(getApp().globalData.userInfo){
                user_no=getApp().globalData.userInfo.erpvipno
            }
            //-- 胶囊的高度 --
            this.setData({user_no});
        }
  },
  methods: {
      go_back(){
          let pages = getCurrentPages();
          if (pages[pages.length - 2]) {
              wx.navigateBack();
          } else {
              getApp().goto('/pages/index/index/index')
          }
      }
  }
})