|
@@ -1,4 +1,9 @@
|
|
|
// components/product-list/product-list.js
|
|
// components/product-list/product-list.js
|
|
|
|
|
+
|
|
|
|
|
+// 获取应用实例
|
|
|
|
|
+const {API} = require('../../service/api.js');
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Component({
|
|
Component({
|
|
|
properties: {
|
|
properties: {
|
|
|
// header嵌入的位置,index:首页
|
|
// header嵌入的位置,index:首页
|
|
@@ -52,9 +57,28 @@ Component({
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
-
|
|
|
|
|
|
|
+ // 获取今日热门商品列表
|
|
|
|
|
+ getHotCommodity(){
|
|
|
|
|
+ API.getLeftProds().then(res=>{
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取上新商品列表
|
|
|
|
|
+ getNewCommodity(){
|
|
|
|
|
+ API.getMiddleProds().then(res=>{
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取预售商品列表
|
|
|
|
|
+ getPresaleCommodity(){
|
|
|
|
|
+ API.getRightProds().then(res=>{
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
ready: function(){
|
|
ready: function(){
|
|
|
- console.log(this.data.position);
|
|
|
|
|
|
|
+ if(this.data.position === 'hot') this.getHotCommodity();
|
|
|
|
|
+ if(this.data.position === 'new') this.getNewCommodity();
|
|
|
|
|
+ if(this.data.position === 'presale') this.getPresaleCommodity();
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|