ソースを参照

小程序首页增加搜索 (#135)

* 小程序首页增加搜索
jason233 6 年 前
コミット
98e6190cfa

+ 7 - 1
litemall-wx/pages/index/index.js

@@ -15,7 +15,8 @@ Page({
     floorGoods: [],
     banner: [],
     channel: [],
-    coupon: []
+    coupon: [],
+    goodsCount: 0
   },
 
   onShareAppMessage: function() {
@@ -50,6 +51,11 @@ Page({
         });
       }
     });
+    util.request(api.GoodsCount).then(function (res) {
+      that.setData({
+        goodsCount: res.data.goodsCount
+      });
+    });
   },
   onLoad: function(options) {
 

+ 6 - 0
litemall-wx/pages/index/index.wxml

@@ -1,5 +1,11 @@
 <!--index.wxml-->
 <view class="container">
+<view class="search">
+    <navigator url="/pages/search/search" class="input">
+      <image class="icon"></image>
+      <text class="txt">商品搜索, 共{{goodsCount}}款好物</text>
+    </navigator>
+  </view>
   <swiper class="banner" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
     <swiper-item wx:for="{{banner}}" wx:key="id">
       <!-- <navigator url="{{item.link}}"> -->

+ 33 - 0
litemall-wx/pages/index/index.wxss

@@ -514,3 +514,36 @@
   align-items: center;
   justify-content: center;
 }
+.search {
+  height: 88rpx;
+  width: 100%;
+  padding: 0 30rpx;
+  background: #fff;
+  display: flex;
+  align-items: center;
+}
+
+.search .input {
+  width: 690rpx;
+  height: 56rpx;
+  background: #ededed;
+  border-radius: 8rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.search .icon {
+  background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png) center no-repeat;
+  background-size: 100%;
+  width: 28rpx;
+  height: 28rpx;
+}
+
+.search .txt {
+  height: 42rpx;
+  line-height: 42rpx;
+  color: #666;
+  padding-left: 10rpx;
+  font-size: 30rpx;
+}

+ 1 - 1
litemall-wx/project.config.json

@@ -262,4 +262,4 @@
 			]
 		}
 	}
-}
+}