diff --git a/pages/index/index.js b/pages/index/index.js index 10c4278..326369c 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,4 +1,5 @@ const product = require('../../utils/product.js') +var app = getApp() Page({ data: { @@ -31,7 +32,7 @@ Page({ var that = this product.getSlides(function(result) { - var data = getApp().store.sync(result.data) + var data = app.store.sync(result.data) that.setData({'slides': data}) wx.setStorage({ key:"indexSlides", @@ -40,7 +41,7 @@ Page({ }) product.getProducts(function(result) { - var data = getApp().store.sync(result.data) + var data = app.store.sync(result.data) that.setData({ items: data, popularity_products: data.filter(product => product.flag === '最热'), diff --git a/pages/show_product/show_product.js b/pages/show_product/show_product.js index e99561a..af1c36f 100644 --- a/pages/show_product/show_product.js +++ b/pages/show_product/show_product.js @@ -1,14 +1,30 @@ const product = require('../../utils/product.js') - +var app = getApp() Page({ data: { title: '', id: 0, quantity: 1, - product: {} + product: {}, + windowWidth: 375, + windowHeight: 667, + pixelRatio: 2 }, onLoad (params) { + try { + var res = wx.getSystemInfoSync() + this.setData({ + windowWidth: res.windowWidth, + windowHeight: res.windowHeight, + pixelRatio: res.pixelRatio + }) + app.globalData.windowWidth = res.windowWidth + app.globalData.windowHeight = res.windowHeight + app.globalData.pixelRatio = res.pixelRatio + } catch (e) { + } + var allProducts = wx.getStorageSync('products') var id = params.id var product = allProducts.filter(function(i){ diff --git a/pages/show_product/show_product.wxml b/pages/show_product/show_product.wxml index 1ab2bca..b3e5245 100644 --- a/pages/show_product/show_product.wxml +++ b/pages/show_product/show_product.wxml @@ -25,7 +25,7 @@ - + diff --git a/pages/show_product/show_product.wxss b/pages/show_product/show_product.wxss index 3d0219c..aef0c04 100644 --- a/pages/show_product/show_product.wxss +++ b/pages/show_product/show_product.wxss @@ -58,4 +58,8 @@ .desc-image { width: 100%; +} + +.desc-image-view { + margin: -10rpx; } \ No newline at end of file