diff --git a/pages/index/index.js b/pages/index/index.js index 700d65a..5921db4 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -4,6 +4,12 @@ const product = require('../../utils/product.js') Page({ data: {items: [], slides: []}, + bindShowProduct: function (e) { + wx.navigateTo({ + url: `../show_product/show_product?id=${e.currentTarget.dataset.id}` + }) + }, + onLoad: function() { var that = this diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 561fe11..03ce318 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -11,15 +11,17 @@ - - + + - - {{item.name}} - ¥{{item.price}} + + + {{item.name}} + + ¥{{item.price}} - + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 7b5b68c..b517f4f 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1,6 +1,40 @@ -.head-img { - width: 100%; -} .slide-img { width: 100%; +} + +.item { + height: 270rpx; + padding: 15rpx; + background-color: #fff; + border-top: 1px solid #e4e4e4; + color: #787878; + display:flex; + align-items:center; +} + +.item image { + display: block; + width: 310rpx; +} + +.item-right { + display: block; + margin-left: 11px; + flex: 1; +} + +.title { + margin-bottom: 25px; +} + +.title text { + font-size: 16px; + color: #787878; + white-space: pre-wrap; + line-height: 17px; +} + +text { + font-size: 15px; + color: #444; } \ No newline at end of file diff --git a/pages/show_product/show_product.js b/pages/show_product/show_product.js index f02e7e1..68af6c4 100644 --- a/pages/show_product/show_product.js +++ b/pages/show_product/show_product.js @@ -43,7 +43,7 @@ Page({ exist.quantity = this.data.quantity } else { var model = getApp().jsonModel - var product = new model('product', this.data.id) + var product = new model('products', this.data.id) product.setAttribute('quantity', this.data.quantity) cartItems.data.push(product) }