首页产品列表修改

wechat_user_type
Ge Hao 8 years ago
parent 3979bb7212
commit 7a21afb7a2
  1. 2
      pages/category/category.js
  2. 14
      pages/category/category.wxml
  3. 11
      pages/index/index.js
  4. 7
      pages/index/index.wxml

@ -4,7 +4,7 @@ var app = getApp()
Page({
data: {
title: '',
items: [],
items: null,
accountType: '',
categoryType: null
},

@ -1,4 +1,12 @@
<view wx:if="{{items.length > 0}}">
<view wx:if="{{!items}}">
<view class="offline-notice">正在加载中,请稍等...</view>
</view>
<view wx:elif="{{items.length === 0}}">
<view class="offline-notice">没有商品</view>
</view>
<view wx:elif="{{items.length > 0}}">
<scroll-view scroll-y="true" height="100%">
<view class="item-container">
<block wx:for="{{items}}" wx:for-item="item" wx:key="id">
@ -22,7 +30,3 @@
</view>
</scroll-view>
</view>
<view wx:else>
<view class="offline-notice">正在加载中,请稍等...</view>
</view>

@ -42,6 +42,8 @@ Page({
product.getProducts(function(result) {
var data = app.store.sync(result.data)
if (app.globalData.featureManager.enableNewFlag) {
that.setData({
items: data,
popularity_products: data.filter(product => (product.flag === '最热' && product['promotion-url'])),
@ -49,6 +51,15 @@ Page({
hot_products: data.filter(product => (product.flag === '火爆' && product['promotion-url'])),
})
wx.setStorageSync('products', data)
} else {
that.setData({
items: data,
popularity_products: data.filter(product => (product.id === "29")),
new_products: data.filter(product => (product.id === "30")),
hot_products: data.filter(product => (product.id === "32")),
})
wx.setStorageSync('products', data)
}
})
// wx.getNetworkType({

@ -20,6 +20,7 @@
<view class="separate"></view>
<view wx:if="{{hot_products[0]['promotion-url']}}">
<view class="cate-container">
<view class="category-title">
<view class="icon"><image src="../../images/hot_small.png"></image></view>
@ -31,8 +32,10 @@
</view>
</block>
</view>
</view>
<view class="separate"></view>
<view wx:if="{{new_products[0]['promotion-url']}}">
<view class="cate-container">
<view class="category-title">
<view class="icon"><image src="../../images/new_small.png"></image></view>
@ -44,8 +47,10 @@
</view>
</block>
</view>
</view>
<view class="separate"></view>
<view wx:if="{{popularity_products[0]['promotion-url']}}">
<view class="cate-container">
<view class="category-title">
<view class="icon"><image src="../../images/volume_small.png"></image></view>
@ -57,5 +62,5 @@
</view>
</block>
</view>
</view>
</scroll-view>

Loading…
Cancel
Save