|
|
import resource from '../../common/resource';
|
|
|
import indexModel from '../../models/index/index';
|
|
|
|
|
|
//获取应用实例
|
|
|
let app = getApp();
|
...
|
...
|
@@ -8,51 +9,11 @@ Page({ |
|
|
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=' + ''
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
onLoad: function () {
|
|
|
this.productList();
|
|
|
},
|
|
|
|
|
|
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});
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
@@ -101,143 +62,15 @@ Page({ |
|
|
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);
|
|
|
productList: function () {
|
|
|
indexModel.productList().then(res => { console.log(res); })
|
|
|
|
|
|
},
|
|
|
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);
|
|
|
}
|
...
|
...
|
|