|
|
@@ -10,7 +10,8 @@ Page({
|
|
|
ipInfoList: [],
|
|
|
prodClassList: [],
|
|
|
showAddCartModal: false,
|
|
|
- currentProduct: null
|
|
|
+ currentProduct: null,
|
|
|
+ isCategoryMini: false
|
|
|
},
|
|
|
// 显示商品属性模态框
|
|
|
showAddCartModal(e) {
|
|
|
@@ -50,22 +51,47 @@ Page({
|
|
|
console.log("onLoad");
|
|
|
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);
|
|
|
+ // 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
|
|
|
+ // });
|
|
|
this.setData({
|
|
|
- prodClassList : resCategory.prodClassList
|
|
|
- });
|
|
|
-
|
|
|
+ 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) {
|
|
|
+ wx.createSelectorQuery()
|
|
|
+ .select('.category')
|
|
|
+ .boundingClientRect((rect) => {
|
|
|
+ if (rect) {
|
|
|
+ const shouldBeMini = rect.top <= 120; // 在高度小于120时,切换为 mini 模式
|
|
|
+ if (this.data.isCategoryMini !== shouldBeMini) {
|
|
|
+ this.setData({
|
|
|
+ isCategoryMini: shouldBeMini
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ }
|
|
|
})
|