...
|
...
|
@@ -75,8 +75,17 @@ Component({ |
|
|
result: {},
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
brandItemTapped: function(event) {
|
|
|
let that = this;
|
|
|
let brandItem = event.currentTarget.dataset.brandItem;
|
|
|
wx.navigateTo({
|
|
|
url: './brandDetail?brandId=' + brandItem.id + '&brandName=' + brandItem.name,
|
|
|
success: function(res) {
|
|
|
that.triggerEvent('dismissSearchView', {});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//搜索框获取焦点焦点
|
...
|
...
|
@@ -90,69 +99,8 @@ Component({ |
|
|
|
|
|
},
|
|
|
|
|
|
//热门搜索点击
|
|
|
hotKeywordItemTapped: function (event) {
|
|
|
let brandItem = event.currentTarget.dataset.item;
|
|
|
this.triggerEvent('dismissSearchView', {});
|
|
|
// console.log(event.currentTarget.dataset)
|
|
|
wx.navigateTo({
|
|
|
url: '../goodsList/brand?brandId=' + brandItem.brandId + '&brandName=' + brandItem.brandName + '&page_name=' + 'brands' + '&page_param=' + ''
|
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
historyKeywordItemTapped: function (event) {
|
|
|
let brandItem = event.currentTarget.dataset.item;
|
|
|
this.triggerEvent('dismissSearchView', {});
|
|
|
// console.log(event.currentTarget.dataset)
|
|
|
wx.navigateTo({
|
|
|
url: '../goodsList/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
|
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
cancelSearch: function (event) {
|
|
|
this.triggerEvent('dismissSearchView', {});
|
|
|
},
|
|
|
|
|
|
clearSearchHistory: function (e) {
|
|
|
try {
|
|
|
let searchHistory = [];
|
|
|
this.setData({
|
|
|
searchHistory,
|
|
|
});
|
|
|
wx.removeStorageSync('searchHistory');
|
|
|
} catch (e) { }
|
|
|
|
|
|
},
|
|
|
|
|
|
search_brandItemTapped: function (e) {
|
|
|
|
|
|
let brandItem = e.currentTarget.dataset.brandItem;
|
|
|
let searchHistory = this.data.searchHistory;
|
|
|
let isHistory = false;
|
|
|
for (var i = 0; i < searchHistory.length; i++) {
|
|
|
let item = searchHistory[i];
|
|
|
if (item.brand_name == brandItem.brand_name) {
|
|
|
isHistory = true;
|
|
|
}
|
|
|
}
|
|
|
if (!isHistory) {
|
|
|
searchHistory.push(brandItem);
|
|
|
this.setData({
|
|
|
searchHistory,
|
|
|
});
|
|
|
|
|
|
try {
|
|
|
wx.setStorageSync('searchHistory', searchHistory);
|
|
|
} catch (e) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
this.triggerEvent('dismissSearchView', {});
|
|
|
wx.navigateTo({
|
|
|
url: '../goodsList/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name
|
|
|
});
|
|
|
},
|
|
|
}
|
|
|
}) |
...
|
...
|
|