index.js
1.76 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var app = getApp(), os = app.globalData.setting;
Component({
data:{
fontcolor:'#6e6d6b',
fontcolor_sele:'#f23030',
backgroundColor:'#ffffff',
active:-1,
list:app.def_list,
cartGoodsNum:0,
},
lifetimes: {
attached: function() {
//购物车显示商品金额
this.setData({cartGoodsNum:getApp().globalData.cartGoodsNum});
var th=this;
var is_read=getApp().globalData.is_read;
var custum_data=getApp().globalData.custum_data;
if(is_read){
if(custum_data){
this.set_list(custum_data);
}
}else{
var stoid=os.stoid
getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, {
}).then(res => {
getApp().globalData.is_read=true;
var e = res;
if(e.data.code != -1){
var itemList = e.data.data.data;
itemList = JSON.parse(itemList)
//如果是有定义自定义导航的小程序链接
if(itemList[0].weappurl && itemList[0].weappurl!=""){
getApp().globalData.custum_data=e.data.data;
var custum_data=e.data.data;
th.set_list(custum_data);
}
}
})
}
},
},
methods: {
//设置自定义页面的列表
set_list:function(data){
var itemList = data.data;
itemList = JSON.parse(itemList);
this.setData({
list:itemList,
backgroundColor: data.bkcolor,
fontcolor_sele: data.fontcolor_sele,
fontcolor:data.fontcolor,
})
},
nav_goto:function(e){
var url=e.currentTarget.dataset.url;
if(!url) return false;
if(url[0]!='/') url='/'+url;
//wx.switchTab({url:url,})
getApp().goto(url);
}
}
})