index.js
8.45 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
import resource from '../../common/resource';
//获取应用实例
let app = getApp();
Page({
data: {
resource
},
onLoad: function (e) {
// new app.WeToast;
//
// let jumpType = e.jumpType;
// if (jumpType == config.constants.JUMP_BRAND) {
//
// let brandId = e.brandId;
// let brandName = e.brandName;
// if (brandId != '' && brandName != '')
// wx.navigateTo({
// url: '../goodsList/brand?brandId=' + brandId + '&brandName=' + brandName + '&page_name=' + 'home' + '&page_param=' + ''
// });
// } else if (jumpType == config.constants.JUMP_DETAIL) {
// let productSkn = e.productSkn;
// if (productSkn != '') {
// wx.navigateTo({
// url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + 'home' + '&page_param=' + ''
// });
// }
// } else if (jumpType == config.constants.JUMP_PRODUCTPOOL) {
// let productPool = e.productPool;
// if (productPool != '') {
// wx.navigateTo({
// url: '../goodsList/productPool?productPool=' + productPool + '&page_name=' + 'home' + '&page_param=' + ''
// });
// }
// }
},
onShow: function () {
// var pages = getCurrentPages()
// var currentPage = pages[pages.length - 1]
// var url = currentPage.route
// let params = {
// PAGE_NAME: 'home',
// PAGE_PARAM: '',
// FROM_PAGE_NAME: '',
// FROM_PAGE_PARAM: '',
// PV_ID: PV_ID,
// PAGE_PATH: url
// };
// logEvent(YB_PAGE_OPEN_L, params);
//
// logEvent(YB_MAIN_TAB_C, {TAB_ID: 1});
},
onShareAppMessage: function (res) {
// let param = {
// FROM: res.from,
// SHARE_RESUIL: 0,
// TITLE: 'Yoho!Buy有货-潮流购物逛不停',
// PATH: '/pages/index/index'
// }
//
// // 用户点击右上角分享
// return {
// title: param.TITLE, // 分享标题
// desc: '精选1400+全球潮流品牌,明星潮牌和新锐原创品牌每日上新,100%正品行货。', // 分享描述
// path: param.PATH, // 分享路径
// success: function (res) {
// param.SHARE_RESUIL = 1
// logEvent(YB_SHARE_RESULT_L, param);
// },
// fail: function (res) {
// param.SHARE_RESUIL = 2
// logEvent(YB_SHARE_RESULT_L, param);
// }
// }
},
onPullDownRefresh: function () {
// wx.stopPullDownRefresh();
// this.getLastChannel();
// this.fetchNewHomeData(true);
},
onPageScroll: function (event) {
// var {scrollTop} = event;
// var isShow = scrollTop > windowHeight * 2 ? true : false;
// if (isShow != this.data.isShowIndicator) {
// this.setData({
// isShowIndicator: isShow
// });
// }
},
//回到顶部
backToTop: function () {
wx.pageScrollTo({
scrollTop: 0
})
},
jumpByRule: function (e) {
// let jumpUrl = e.currentTarget.dataset.jump_rule;
// if (!jumpUrl) {
// return;
// }
// let F_ID = e.currentTarget.dataset.f_id;//楼层id
// let I_INDEX = e.currentTarget.dataset.f_inindex + 1//楼层内index
// let F_INDEX = e.currentTarget.dataset.f_index + 1//楼层序号
// let F_NAME = e.currentTarget.dataset.f_name;//楼层名称
// let param = {
// F_ID, I_INDEX, F_INDEX, F_NAME,
// F_URL: jumpUrl
// }
//
// logEvent('YB_MAIN_EVENT', param);
// jumpByUrl(jumpUrl, 'home');
},
//获取新首页数据
fetchNewHomeData: function (force) {
// var channel = this.data.selectedChannel;
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// if (currentData && currentData.data && currentData.data.length > 0 && !force) {
// this.setHomeList();
// return;
// }
// let cotentCode = getHomeContentCode(channel);
// let gender = getGenderCode(channel);
// let yh_channel = getChannelCode(channel);
// if (!force) {
// this.setLoadingHomeData(true);
// }
// let param = {
// content_code: cotentCode,
// gender,
// yh_channel,
// page: 1,
// limit: 10,
// fromPage: 'aFP_Home'
// }
// GET(config.constants.API_HOST + '/operations/api/v5/resource/home', param)
// .then(json => {
// this.setLoadingHomeData(false);
// if (json && json.code && json.code == 200) {
// let homeList = json.data.list;
// homeList = parseHomeList(homeList, windowWidth, windowHeight, activityItemWidth, activityItemHeight);
//
// if (!homeList || homeList.length <= 0) {
// this.wetoast.toast({
// title: json.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// }
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// currentData.data = homeList;
// newChannels[channel] = currentData;
// this.setData({
// newChannels: newChannels
// })
// this.setHomeList(force);
// } else {
// this.setHomeList(force);
// this.wetoast.toast({
// title: json.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// }
// })
// .catch(error => {
// this.setLoadingHomeData(false);
// this.setHomeList(force);
// this.wetoast.toast({
// title: error.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// })
},
setLoadingHomeData: function (isLoading) {
let channel = this.data.selectedChannel;
let _newChannels = this.data.newChannels;
let currentData = _newChannels[channel];
if (currentData) {
currentData.isLoading = isLoading;
}
this.setData({
newChannels: _newChannels
})
},
setHomeList: function (force) {
// let channel = this.data.selectedChannel;
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// if (currentData && currentData.data) {
// this.setData({
// homelist: currentData.data
// })
// }
// this.fetchRecommend(force);
},
toSearch: function () {
wx.navigateTo({
url: '../search/search'
});
},
//商品点击进入商品详情
productCellTapped: function (event) {
// if (shouldDiscardTap(event.timeStamp, this.data.lastTapTimeStamp)) {
// return;
// }
// this.setData({lastTapTimeStamp: event.timeStamp});
//
// let data = event.currentTarget.dataset;
// let productSkn = data.productSkn;
// let productIndex = data.productIndex;
// let productF_index = data.productF_index;
// let f_name = productF_index == 2 ? '新品到着' : '猜你喜欢';
//
// let params = {
// F_ID: productF_index,
// F_NAME: f_name,
// F_URL: '../goodsDetail/goodsDetail?productSkn=' + productSkn,
// F_INDEX: productF_index,
// I_INDEX: productIndex + 1,
// PV_ID: PV_ID
// };
// logEvent(YB_MAIN_EVENT, params);
//
// wx.navigateTo({
// url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + 'home' + '&page_param=' + ''
// });
},
sortChange: function (e) {
console.log(e.detail);
}
});