|
@@ -12,8 +12,8 @@ Page({
|
|
|
showAddCartModal: false,
|
|
showAddCartModal: false,
|
|
|
currentProduct: null,
|
|
currentProduct: null,
|
|
|
|
|
|
|
|
- isCategoryMini_1: false,
|
|
|
|
|
- isCategoryMini_2: false
|
|
|
|
|
|
|
+ isBrandMini: false,
|
|
|
|
|
+ isCategoryMini: false
|
|
|
},
|
|
},
|
|
|
// 显示商品属性模态框
|
|
// 显示商品属性模态框
|
|
|
showAddCartModal(e) {
|
|
showAddCartModal(e) {
|
|
@@ -53,56 +53,62 @@ Page({
|
|
|
console.log("onLoad");
|
|
console.log("onLoad");
|
|
|
console.log('App.globalData', App.globalData);
|
|
console.log('App.globalData', App.globalData);
|
|
|
|
|
|
|
|
- // const resBanner = await API.getBanners({});
|
|
|
|
|
- // console.log('resBanner', resBanner);
|
|
|
|
|
- // this.setData({
|
|
|
|
|
- // bannerList : resBanner.bannerList
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ const resBanner = await API.getBanners({});
|
|
|
|
|
+ console.log('resBanner', resBanner);
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ bannerList : resBanner.bannerList
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // const resBrand = await API.getIpInfos({});
|
|
|
|
|
- // console.log('resBrand', resBrand);
|
|
|
|
|
- // this.setData({
|
|
|
|
|
- // ipInfoList : resBrand.ipInfoList
|
|
|
|
|
- // });
|
|
|
|
|
- // const resCategory = await API.getProdClasses({});
|
|
|
|
|
- // console.log('resCategory', resCategory);
|
|
|
|
|
- // this.setData({
|
|
|
|
|
- // prodClassList : resCategory.prodClassList
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ const resBrand = await API.getIpInfos({});
|
|
|
|
|
+ console.log('resBrand', resBrand);
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- prodClassList: [
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '火影忍者' },
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '初音' },
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '原神' },
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '柯南' },
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '非人哉' },
|
|
|
|
|
- { classUrl: 'someprod.jpg', title: '全部' },
|
|
|
|
|
- ]
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ ipInfoList : resBrand.ipInfoList
|
|
|
|
|
+ });
|
|
|
|
|
+ const resCategory = await API.getProdClasses({});
|
|
|
|
|
+ console.log('resCategory', resCategory);
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ prodClassList : resCategory.prodClassList
|
|
|
|
|
+ });
|
|
|
|
|
+ // this.setData({
|
|
|
|
|
+ // prodClassList: [
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '火影忍者' },
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '初音' },
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '原神' },
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '柯南' },
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '非人哉' },
|
|
|
|
|
+ // { classUrl: 'someprod.jpg', title: '全部' },
|
|
|
|
|
+ // ]
|
|
|
|
|
+ // });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onPageScroll: function(e) {
|
|
onPageScroll: function(e) {
|
|
|
wx.createSelectorQuery()
|
|
wx.createSelectorQuery()
|
|
|
- .select('.brand-bar-1')
|
|
|
|
|
|
|
+ .select('.brand-bar')
|
|
|
.boundingClientRect((rect) => {
|
|
.boundingClientRect((rect) => {
|
|
|
|
|
+ console.log("brandrecttop111");
|
|
|
if (rect) {
|
|
if (rect) {
|
|
|
- const shouldBeMini = rect.top <= 40; // 在brand-bar进入顶部时,category切换为mini模式
|
|
|
|
|
- if (this.data.isCategoryMini_1 !== shouldBeMini) {
|
|
|
|
|
|
|
+ const shouldBrandBeMini = rect.top <= 40; // 在brand-bar进入顶部时,category切换为mini模式
|
|
|
|
|
+ console.log("brandrecttop:" + rect.top);
|
|
|
|
|
+ console.log("shouldBrandBeMini" + shouldBrandBeMini);
|
|
|
|
|
+ if (this.data.isBrandMini !== shouldBrandBeMini) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- isCategoryMini_1: shouldBeMini
|
|
|
|
|
|
|
+ isBrandMini: shouldBrandBeMini
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.exec();
|
|
.exec();
|
|
|
wx.createSelectorQuery()
|
|
wx.createSelectorQuery()
|
|
|
- .select('.brand-bar-2')
|
|
|
|
|
|
|
+ .select('.category')
|
|
|
.boundingClientRect((rect) => {
|
|
.boundingClientRect((rect) => {
|
|
|
|
|
+ console.log("categoryrecttop111");
|
|
|
if (rect) {
|
|
if (rect) {
|
|
|
- const shouldBeMini = rect.top <= 40; // 在brand-bar进入顶部时,category切换为mini模式
|
|
|
|
|
- if (this.data.isCategoryMini_2 !== shouldBeMini) {
|
|
|
|
|
|
|
+ const shouldCategoryBeMini = rect.top <= 40; // 在category进入顶部时,category切换为mini模式
|
|
|
|
|
+ console.log("categoryrecttop:" + rect.top);
|
|
|
|
|
+ console.log("shouldCategoryBeMini" + shouldCategoryBeMini);
|
|
|
|
|
+ if (this.data.isCategoryMini !== shouldCategoryBeMini) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- isCategoryMini_2: shouldBeMini
|
|
|
|
|
|
|
+ isCategoryMini: shouldCategoryBeMini
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|