diff --git a/pages/home/index.vue b/pages/home/index.vue index d369579..b99c3c1 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -23,7 +23,16 @@ /> - + + @@ -418,7 +427,8 @@ export default { isPlay: true, tabIconPostion: {}, messageIcon: {}, - recommendKeyword: [] + recommendKeyword: [], + keywordIndex: 0 } }, onLoad() { @@ -454,6 +464,9 @@ export default { this.scrollTop = e.scrollTop }, methods: { + changeRecommendKeyword(e) { + this.keywordIndex = e + }, getSearch() { getSearchPageConfig().then(res => { const { success, data } = res @@ -1376,7 +1389,7 @@ export default { } }, goGoodSearch() { - this.$yrouter.push('/pages/shop/GoodSearch/index') + this.$yrouter.push('/pages/shop/GoodSearch/index?keywords=' + this.recommendKeyword[this.keywordIndex] ) }, goGoodsCon(item) { if(item.isFarmerShop) { diff --git a/pages/shop/GoodSearch/index.vue b/pages/shop/GoodSearch/index.vue index 1ba30f5..0c38267 100644 --- a/pages/shop/GoodSearch/index.vue +++ b/pages/shop/GoodSearch/index.vue @@ -133,7 +133,8 @@ export default { historyKey: [], rankingArr: [], recommendKeyword: [], - CartCount: 0 + CartCount: 0, + keywords1: '' } }, computed: mapGetters(['isLogin', 'location', 'userInfo']), @@ -141,6 +142,9 @@ export default { this.getData() this.getCartCount() }, + onLoad(opts){ + this.keywords1 = opts.keywords + }, onShow() { this.getHistory() }, @@ -206,6 +210,8 @@ export default { this.rankingArr.push(data.ranking1) this.rankingArr.push(data.ranking2) this.recommendKeyword = data.recommendKeyword.split(',') + const index = this.recommendKeyword.indexOf(this.keywords1) + [this.recommendKeyword[0], this.recommendKeyword[index]] = [this.recommendKeyword[index], this.recommendKeyword[0]]; } }) },