Browse Source

fix 修复输入关键词后搜索功能无法使用问题

tumobi 7 years ago
parent
commit
9faea79741
5 changed files with 25 additions and 9 deletions
  1. 1 4
      app.js
  2. 1 1
      config/api.js
  3. 10 0
      pages/search/search.js
  4. 2 2
      pages/search/search.wxml
  5. 11 2
      pages/search/search.wxss

+ 1 - 4
app.js

@@ -3,10 +3,7 @@ var api = require('./config/api.js');
 
 App({
   onLaunch: function () {
-    //调用API从本地缓存中获取数据
-    // var logs = wx.getStorageSync('logs') || []
-    // logs.unshift(Date.now())
-    // wx.setStorageSync('logs', logs)
+
     var that = this;
     that.login();
   

+ 1 - 1
config/api.js

@@ -1,4 +1,4 @@
-var NewApiRootUrl = 'http://192.168.31.116:8360/api/'; 
+var NewApiRootUrl = 'http://127.0.0.1:8360/api/';
 
 module.exports = {
     IndexUrl: NewApiRootUrl + 'index/index', //首页数据接口

+ 10 - 0
pages/search/search.js

@@ -162,4 +162,14 @@ Page({
     });
     this.getGoodsList();
   },
+  onKeywordConfirm(event){
+    this.setData({
+      keyword: event.detail.value,
+      page: 1,
+      categoryId: 0,
+      goodsList: []
+    });
+
+    this.getGoodsList();
+  }
 })

+ 2 - 2
pages/search/search.wxml

@@ -1,8 +1,8 @@
-<scroll-view class="container">
+<scroll-view class="container" style="height: 100%;">
   <view class="search-header">
     <view class="input-box">
       <image class="icon" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/search2-2fb94833aa.png"></image>
-      <input name="input" class="keywrod" focus="true" value="{{keyword}}" bindinput="inputChange" bindfocus="inputFocus" confirm-type="search" placeholder="{{defaultKeyword.keyword}}" />
+      <input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" confirm-type="search" placeholder="{{defaultKeyword.keyword}}" />
       <image class="del" wx:if="{{keyword}}" bindtap="clearKeyword" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/clearIpt-f71b83e3c2.png"></image>
     </view>
     <view class="right" bindtap="closeSearch">取消</view>

+ 11 - 2
pages/search/search.wxss

@@ -1,3 +1,13 @@
+page{
+  min-height: 100%;
+  background-color: #f4f4f4;
+}
+
+.container{
+  min-height: 100%;
+  background-color: #f4f4f4;
+}
+
 .search-header{
     position: fixed;
     top: 0;
@@ -306,7 +316,6 @@
 .search-result-empty{
     width: 100%;
     height: 100%;
-    background: #fff;
     padding-top: 300rpx;
 }
 
@@ -320,7 +329,7 @@
 .search-result-empty .text{
     display: block;
     width: 100%;
-    height: 30rpx;
+    height: 40rpx;
     font-size: 28rpx;
     text-align: center;
     color: #999;