index.js
2.77 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
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
106
107
108
109
110
111
112
113
import { discoveryApi } from "~/api/index"
Page({
data: {
showCarFlag: false,
currentChannel: {
id: 6
}
},
onShow() {
// let {
// merchantId
// } = this.data
// const merchantInfo = wx.p.storage.get('merchant_info')
// let newMerchantId = merchantInfo.merchantId
// if (newMerchantId != merchantId && newMerchantId ) {
// this.setData({
// merchantId: newMerchantId
// })
// this.getDiscoverInfo(newMerchantId, 6)
// }
// this.getDiscoverInfo(merchantInfo.merchantId, 6)
this.getComponentPage().onShow && this.getComponentPage().onShow()
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
showStore:!FIRST
})
},
// getDiscoverInfo(merchantId, channel) {
// discoveryApi.getDiscoverConfig({
// merchantId
// }).then(res => {
// if (res && res.length) {
// // console.log(JSON.stringify(res), channel);
// this.handlerDiscoverSetting(JSON.stringify(res), channel)
// }
// })
// },
// 处理发现配置数据
// handlerDiscoverSetting(query, channel) {
// const list = JSON.parse(query)
// let {
// currentChannel,
// curTabIndex
// } = this.data
// if (list && list.length) {
// if (channel) {
// list.forEach((el, index) => {
// if (el.channelType == channel) {
// curTabIndex = index
// currentChannel = el
// }
// })
// } else {
// currentChannel = list[0]
// }
// // this.computeBannerHeight(list.length)
// }
// this.setData({
// currentChannel,
// })
// },
// 计算高度
// computeBannerHeight(len) {
// let query = wx.createSelectorQuery().in(this)
// query
// .select('.banner_wrapper')
// .boundingClientRect(res => {
// this.setData({
// 'heightInfo.bannerH': res.height
// })
// })
// .exec()
// query
// .select('.tab_wrapper')
// .boundingClientRect(react => {
// if (len == 1) {
// this.setData({
// 'heightInfo.tabH': 20
// })
// } else {
// this.setData({
// 'heightInfo.tabH': react.height
// })
// }
// })
// .exec()
// },
//隐藏购物车
// showShoppingCarFn(e) {
// this.setData({
// showCarFlag: e.detail != 2
// })
// },
navbarReady(e) {
let { height } = e.detail;
this.setData({
navBarHeight: height,
user_box_style: `padding-top:${height}px`,
});
},
getComponentPage() {
return this.selectComponent(`#currentChannel_6`)
},
freshMerchant(){
this.onShow()
},
onShareAppMessage(){},
onLoad(){
this.shareTitle = "甄选专区"
}
})