Authored by 李奇

检索页新增最近检索逻辑

@@ -163,12 +163,24 @@ Page({ @@ -163,12 +163,24 @@ Page({
163 this.productList(params); 163 this.productList(params);
164 }, 164 },
165 165
166 - searchRecent: function() { 166 + searchRecent: function(e) {
  167 + const key = e.target.dataset.key;
167 168
  169 + this.confirmQuery({
  170 + detail: {
  171 + value: key
  172 + }
  173 + });
168 }, 174 },
169 175
170 deleteRecent: function() { 176 deleteRecent: function() {
171 - 177 + wx.setStorage({
  178 + key: 'search_hot_keys',
  179 + data: []
  180 + });
  181 + this.setData({
  182 + recentKeys: []
  183 + });
172 }, 184 },
173 185
174 setRecentKeys: function(key) { 186 setRecentKeys: function(key) {
@@ -10,7 +10,8 @@ @@ -10,7 +10,8 @@
10 <view class="title">最近搜索 10 <view class="title">最近搜索
11 <image class="delete" src="../../../static/images/delete.png" bindtap="deleteRecent"></image></view> 11 <image class="delete" src="../../../static/images/delete.png" bindtap="deleteRecent"></image></view>
12 <view class="keys"> 12 <view class="keys">
13 - <text wx:for="{{recentKeys}}" wx:key="{{item}}" class="key" bindtap="searchRecent">{{item}}</text> 13 + <text wx:for="{{recentKeys}}" wx:key="{{item}}"
  14 + class="key" bindtap="searchRecent" data-key="{{item}}">{{item}}</text>
14 </view> 15 </view>
15 </view> 16 </view>
16 <view hidden="{{!searched}}"> 17 <view hidden="{{!searched}}">